QmlDesigner: Ensure unique content lib user item icon names

Also update user materials model to have the improvements
done to the 3D model. Also trying to make the 2 mdoels
as similar as possible to make it easy for further
future refactoring.

Change-Id: I5a32e1dcd7919bdf3cb638b068b0cdb5d4afecd9
Fixes: QDS-12736
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2024-05-13 16:29:27 +03:00
parent e86814c491
commit 54879113f1
4 changed files with 120 additions and 129 deletions

View File

@@ -186,42 +186,48 @@ void ContentLibraryUserModel::removeFromContentLib(QObject *item)
remove3DFromContentLib(itm); remove3DFromContentLib(itm);
} }
void ContentLibraryUserModel::removeMaterialFromContentLib(ContentLibraryMaterial *mat) void ContentLibraryUserModel::removeMaterialFromContentLib(ContentLibraryMaterial *item)
{ {
auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/materials/"); auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/materials/");
QJsonObject matsObj = m_bundleObjMaterial.value("materials").toObject(); QJsonArray itemsArr = m_bundleObjMaterial.value("items").toArray();
// remove qml and icon files // remove qml and icon files
Utils::FilePath::fromString(mat->qmlFilePath()).removeFile(); Utils::FilePath::fromString(item->qmlFilePath()).removeFile();
Utils::FilePath::fromUrl(mat->icon()).removeFile(); Utils::FilePath::fromUrl(item->icon()).removeFile();
// remove from the bundle json file // remove from the bundle json file
matsObj.remove(mat->name()); for (int i = 0; i < itemsArr.size(); ++i) {
m_bundleObjMaterial.insert("materials", matsObj); if (itemsArr.at(i).toObject().value("qml") == item->qml()) {
auto result = bundlePath.pathAppended("user_materials_bundle.json") itemsArr.removeAt(i);
break;
}
}
m_bundleObjMaterial.insert("items", itemsArr);
auto result = bundlePath.pathAppended("user_material_bundle.json")
.writeFileContents(QJsonDocument(m_bundleObjMaterial).toJson()); .writeFileContents(QJsonDocument(m_bundleObjMaterial).toJson());
if (!result) if (!result)
qWarning() << __FUNCTION__ << result.error(); qWarning() << __FUNCTION__ << result.error();
// delete dependency files if they are only used by the deleted material // delete dependency files if they are only used by the deleted material
QStringList allFiles; QStringList allFiles;
for (const QJsonValueConstRef &mat : std::as_const(matsObj)) for (const QJsonValueConstRef &itemRef : std::as_const(itemsArr))
allFiles.append(mat.toObject().value("files").toVariant().toStringList()); allFiles.append(itemRef.toObject().value("files").toVariant().toStringList());
const QStringList matFiles = mat->files(); const QStringList itemFiles = item->files();
for (const QString &matFile : matFiles) { for (const QString &file : itemFiles) {
if (allFiles.count(matFile) == 0) // only used by the deleted material if (allFiles.count(file) == 0) // only used by the deleted item
bundlePath.pathAppended(matFile).removeFile(); bundlePath.pathAppended(file).removeFile();
} }
// remove from model // remove from model
m_userMaterials.removeOne(mat); m_userMaterials.removeOne(item);
mat->deleteLater(); item->deleteLater();
// update model // update model
int matSectionIdx = 0; int sectionIdx = 0;
emit dataChanged(index(matSectionIdx), index(matSectionIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
} }
void ContentLibraryUserModel::remove3DFromContentLib(ContentLibraryItem *item) void ContentLibraryUserModel::remove3DFromContentLib(ContentLibraryItem *item)
@@ -266,51 +272,41 @@ void ContentLibraryUserModel::remove3DFromContentLib(ContentLibraryItem *item)
emit dataChanged(index(sectionIdx), index(sectionIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
} }
// returns unique library material's name and qml component /**
QPair<QString, QString> ContentLibraryUserModel::getUniqueLibMaterialNameAndQml(const QString &defaultName) const * @brief Gets unique Qml component and icon file material names from a given name
* @param defaultName input name
* @return <Qml, icon> file names
*/
QPair<QString, QString> ContentLibraryUserModel::getUniqueLibMaterialNames(const QString &defaultName) const
{ {
QTC_ASSERT(!m_bundleObjMaterial.isEmpty(), return {}); return getUniqueLibItemNames(defaultName, m_bundleObjMaterial);
const QJsonObject matsObj = m_bundleObjMaterial.value("materials").toObject();
const QStringList matNames = matsObj.keys();
QStringList matQmls;
for (const QString &matName : matNames)
matQmls.append(matsObj.value(matName).toObject().value("qml").toString().chopped(4)); // remove .qml
QString retName = defaultName.isEmpty() ? "Material" : defaultName.trimmed();
QString retQml = retName;
retQml.remove(' ');
if (retQml.at(0).isLower())
retQml[0] = retQml.at(0).toUpper();
retQml.prepend("My");
int num = 1;
if (matNames.contains(retName) || matQmls.contains(retQml)) {
while (matNames.contains(retName + QString::number(num))
|| matQmls.contains(retQml + QString::number(num))) {
++num;
} }
retName += QString::number(num); /**
retQml += QString::number(num); * @brief Gets unique Qml component and icon file 3d item names from a given name
} * @param defaultName input name
* @return <Qml, icon> file names
return {retName, retQml + ".qml"}; */
} QPair<QString, QString> ContentLibraryUserModel::getUniqueLib3DNames(const QString &defaultName) const
QString ContentLibraryUserModel::getUniqueLib3DQmlName(const QString &defaultName) const
{ {
QTC_ASSERT(!m_bundleObj3D.isEmpty(), return {}); return getUniqueLibItemNames(defaultName, m_bundleObj3D);
}
const QJsonArray itemsArr = m_bundleObj3D.value("items").toArray(); QPair<QString, QString> ContentLibraryUserModel::getUniqueLibItemNames(const QString &defaultName,
const QJsonObject &bundleObj) const
{
QTC_ASSERT(!bundleObj.isEmpty(), return {});
QStringList itemQmls; const QJsonArray itemsArr = bundleObj.value("items").toArray();
for (const QJsonValueConstRef &itemRef : itemsArr)
itemQmls.append(itemRef.toObject().value("qml").toString().chopped(4)); // remove .qml
QString baseQml = defaultName.isEmpty() ? "Item" : defaultName.trimmed(); QStringList itemQmls, itemIcons;
for (const QJsonValueConstRef &itemRef : itemsArr) {
const QJsonObject &obj = itemRef.toObject();
itemQmls.append(obj.value("qml").toString().chopped(4)); // remove .qml
itemIcons.append(QFileInfo(obj.value("icon").toString()).baseName());
}
QString baseQml = defaultName.trimmed();
baseQml.remove(' '); baseQml.remove(' ');
baseQml[0] = baseQml.at(0).toUpper(); baseQml[0] = baseQml.at(0).toUpper();
baseQml.prepend("My"); baseQml.prepend("My");
@@ -319,7 +315,11 @@ QString ContentLibraryUserModel::getUniqueLib3DQmlName(const QString &defaultNam
return !itemQmls.contains(name); return !itemQmls.contains(name);
}); });
return uniqueQml + ".qml"; QString uniqueIcon = UniqueName::get(defaultName, [&] (const QString &name) {
return !itemIcons.contains(name);
});
return {uniqueQml + ".qml", uniqueIcon + ".png"};
} }
QHash<int, QByteArray> ContentLibraryUserModel::roleNames() const QHash<int, QByteArray> ContentLibraryUserModel::roleNames() const
@@ -364,59 +364,61 @@ void ContentLibraryUserModel::loadMaterialBundle()
m_bundleObjMaterial = {}; m_bundleObjMaterial = {};
m_bundleIdMaterial.clear(); m_bundleIdMaterial.clear();
int matSectionIdx = 0; int sectionIdx = 0;
QDir bundleDir{Paths::bundlesPathSetting() + "/User/materials"}; m_bundlePathMaterial = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/materials");
bundleDir.mkpath("."); m_bundlePathMaterial.ensureWritableDir();
m_bundlePathMaterial.pathAppended("icons").ensureWritableDir();
auto jsonFilePath = Utils::FilePath::fromString(bundleDir.filePath("user_materials_bundle.json")); auto jsonFilePath = m_bundlePathMaterial.pathAppended("user_materials_bundle.json");
if (!jsonFilePath.exists()) { if (!jsonFilePath.exists()) {
QString jsonContent = "{\n"; QString jsonContent = "{\n";
jsonContent += " \"id\": \"UserMaterials\",\n"; jsonContent += " \"id\": \"UserMaterials\",\n";
jsonContent += " \"materials\": {\n"; jsonContent += " \"items\": []\n";
jsonContent += " }\n";
jsonContent += "}"; jsonContent += "}";
jsonFilePath.writeFileContents(jsonContent.toLatin1()); Utils::expected_str<qint64> res = jsonFilePath.writeFileContents(jsonContent.toLatin1());
if (!res.has_value()) {
qWarning() << __FUNCTION__ << res.error();
emit dataChanged(index(sectionIdx), index(sectionIdx));
return;
}
} }
QFile jsonFile(jsonFilePath.path()); Utils::expected_str<QByteArray> jsonContents = jsonFilePath.fileContents();
if (!jsonFile.open(QIODevice::ReadOnly)) { if (!jsonContents.has_value()) {
qWarning() << __FUNCTION__ << "Couldn't open user_materials_bundle.json"; qWarning() << __FUNCTION__ << jsonContents.error();
emit dataChanged(index(matSectionIdx), index(matSectionIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
return; return;
} }
QJsonDocument matBundleJsonDoc = QJsonDocument::fromJson(jsonFile.readAll()); QJsonDocument bundleJsonDoc = QJsonDocument::fromJson(jsonContents.value());
if (matBundleJsonDoc.isNull()) { if (bundleJsonDoc.isNull()) {
qWarning() << __FUNCTION__ << "Invalid user_materials_bundle.json file"; qWarning() << __FUNCTION__ << "Invalid user_materials_bundle.json file";
emit dataChanged(index(matSectionIdx), index(matSectionIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
return; return;
} }
m_bundleObjMaterial = matBundleJsonDoc.object();
m_bundleObjMaterial["id"] = compUtils.userMaterialsBundleId();
m_bundleIdMaterial = compUtils.userMaterialsBundleId(); m_bundleIdMaterial = compUtils.userMaterialsBundleId();
m_bundleObjMaterial = bundleJsonDoc.object();
m_bundleObjMaterial["id"] = m_bundleIdMaterial;
// parse materials // parse items
const QJsonObject matsObj = m_bundleObjMaterial.value("materials").toObject();
const QStringList materialNames = matsObj.keys();
QString typePrefix = compUtils.userMaterialsBundleType(); QString typePrefix = compUtils.userMaterialsBundleType();
for (const QString &matName : materialNames) { const QJsonArray itemsArr = m_bundleObj3D.value("items").toArray();
const QJsonObject matObj = matsObj.value(matName).toObject(); for (const QJsonValueConstRef &itemRef : itemsArr) {
const QJsonObject itemObj = itemRef.toObject();
QString name = itemObj.value("name").toString();
QString qml = itemObj.value("qml").toString();
TypeName type = QLatin1String("%1.%2").arg(typePrefix, qml.chopped(4)).toLatin1();
QUrl icon = m_bundlePathMaterial.pathAppended(itemObj.value("icon").toString()).toUrl();
QStringList files; QStringList files;
const QJsonArray assetsArr = matObj.value("files").toArray(); const QJsonArray assetsArr = itemObj.value("files").toArray();
for (const QJsonValueConstRef &asset : assetsArr) for (const QJsonValueConstRef &asset : assetsArr)
files.append(asset.toString()); files.append(asset.toString());
QUrl icon = QUrl::fromLocalFile(bundleDir.filePath(matObj.value("icon").toString())); m_userMaterials.append(new ContentLibraryMaterial(this, name, qml, type, icon, files,
QString qml = matObj.value("qml").toString(); m_bundlePathMaterial.path(), ""));
TypeName type = QLatin1String("%1.%2").arg(typePrefix, qml.chopped(4)).toLatin1();
auto userMat = new ContentLibraryMaterial(this, matName, qml, type, icon, files,
bundleDir.path(), "");
m_userMaterials.append(userMat);
} }
m_bundleMaterialSharedFiles.clear(); m_bundleMaterialSharedFiles.clear();
@@ -424,13 +426,9 @@ void ContentLibraryUserModel::loadMaterialBundle()
for (const QJsonValueConstRef &file : sharedFilesArr) for (const QJsonValueConstRef &file : sharedFilesArr)
m_bundleMaterialSharedFiles.append(file.toString()); m_bundleMaterialSharedFiles.append(file.toString());
m_matBundleExists = true;
emit matBundleExistsChanged();
emit dataChanged(index(matSectionIdx), index(matSectionIdx));
m_matBundleExists = true; m_matBundleExists = true;
updateIsEmptyMaterials(); updateIsEmptyMaterials();
resetModel(); emit dataChanged(index(sectionIdx), index(sectionIdx));
} }
void ContentLibraryUserModel::load3DBundle() void ContentLibraryUserModel::load3DBundle()
@@ -448,14 +446,13 @@ void ContentLibraryUserModel::load3DBundle()
m_bundleObj3D = {}; m_bundleObj3D = {};
m_bundleId3D.clear(); m_bundleId3D.clear();
int section3DIdx = 2; int sectionIdx = 2;
m_bundlePath3D = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/3d"); m_bundlePath3D = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/3d");
m_bundlePath3D.ensureWritableDir(); m_bundlePath3D.ensureWritableDir();
m_bundlePath3D.pathAppended("icons").ensureWritableDir(); m_bundlePath3D.pathAppended("icons").ensureWritableDir();
auto jsonFilePath = m_bundlePath3D.pathAppended("user_3d_bundle.json"); auto jsonFilePath = m_bundlePath3D.pathAppended("user_3d_bundle.json");
if (!jsonFilePath.exists()) { if (!jsonFilePath.exists()) {
QByteArray jsonContent = "{\n"; QByteArray jsonContent = "{\n";
jsonContent += " \"id\": \"User3D\",\n"; jsonContent += " \"id\": \"User3D\",\n";
@@ -464,7 +461,7 @@ void ContentLibraryUserModel::load3DBundle()
Utils::expected_str<qint64> res = jsonFilePath.writeFileContents(jsonContent); Utils::expected_str<qint64> res = jsonFilePath.writeFileContents(jsonContent);
if (!res.has_value()) { if (!res.has_value()) {
qWarning() << __FUNCTION__ << res.error(); qWarning() << __FUNCTION__ << res.error();
emit dataChanged(index(section3DIdx), index(section3DIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
return; return;
} }
} }
@@ -472,14 +469,14 @@ void ContentLibraryUserModel::load3DBundle()
Utils::expected_str<QByteArray> jsonContents = jsonFilePath.fileContents(); Utils::expected_str<QByteArray> jsonContents = jsonFilePath.fileContents();
if (!jsonContents.has_value()) { if (!jsonContents.has_value()) {
qWarning() << __FUNCTION__ << jsonContents.error(); qWarning() << __FUNCTION__ << jsonContents.error();
emit dataChanged(index(section3DIdx), index(section3DIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
return; return;
} }
QJsonDocument bundleJsonDoc = QJsonDocument::fromJson(jsonContents.value()); QJsonDocument bundleJsonDoc = QJsonDocument::fromJson(jsonContents.value());
if (bundleJsonDoc.isNull()) { if (bundleJsonDoc.isNull()) {
qWarning() << __FUNCTION__ << "Invalid user_3d_bundle.json file"; qWarning() << __FUNCTION__ << "Invalid user_3d_bundle.json file";
emit dataChanged(index(section3DIdx), index(section3DIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
return; return;
} }
@@ -487,7 +484,7 @@ void ContentLibraryUserModel::load3DBundle()
m_bundleObj3D = bundleJsonDoc.object(); m_bundleObj3D = bundleJsonDoc.object();
m_bundleObj3D["id"] = m_bundleId3D; m_bundleObj3D["id"] = m_bundleId3D;
// parse 3d items // parse items
QString typePrefix = compUtils.user3DBundleType(); QString typePrefix = compUtils.user3DBundleType();
const QJsonArray itemsArr = m_bundleObj3D.value("items").toArray(); const QJsonArray itemsArr = m_bundleObj3D.value("items").toArray();
for (const QJsonValueConstRef &itemRef : itemsArr) { for (const QJsonValueConstRef &itemRef : itemsArr) {
@@ -512,7 +509,7 @@ void ContentLibraryUserModel::load3DBundle()
m_bundle3DExists = true; m_bundle3DExists = true;
updateIsEmpty3D(); updateIsEmpty3D();
emit dataChanged(index(section3DIdx), index(section3DIdx)); emit dataChanged(index(sectionIdx), index(sectionIdx));
} }
void ContentLibraryUserModel::loadTextureBundle() void ContentLibraryUserModel::loadTextureBundle()

View File

@@ -43,8 +43,8 @@ public:
void updateMaterialsImportedState(const QStringList &importedItems); void updateMaterialsImportedState(const QStringList &importedItems);
void update3DImportedState(const QStringList &importedItems); void update3DImportedState(const QStringList &importedItems);
QPair<QString, QString> getUniqueLibMaterialNameAndQml(const QString &defaultName = {}) const; QPair<QString, QString> getUniqueLibMaterialNames(const QString &defaultName = "Material") const;
QString getUniqueLib3DQmlName(const QString &defaultName = {}) const; QPair<QString, QString> getUniqueLib3DNames(const QString &defaultName = "Item") const;
void setQuick3DImportVersion(int major, int minor); void setQuick3DImportVersion(int major, int minor);
@@ -94,6 +94,8 @@ private:
bool isValidIndex(int idx) const; bool isValidIndex(int idx) const;
void removeMaterialFromContentLib(ContentLibraryMaterial *mat); void removeMaterialFromContentLib(ContentLibraryMaterial *mat);
void remove3DFromContentLib(ContentLibraryItem *item); void remove3DFromContentLib(ContentLibraryItem *item);
QPair<QString, QString> getUniqueLibItemNames(const QString &defaultName,
const QJsonObject &bundleObj) const;
ContentLibraryWidget *m_widget = nullptr; ContentLibraryWidget *m_widget = nullptr;
QString m_searchText; QString m_searchText;
@@ -101,6 +103,7 @@ private:
QString m_bundleId3D; QString m_bundleId3D;
QStringList m_bundleMaterialSharedFiles; QStringList m_bundleMaterialSharedFiles;
QStringList m_bundle3DSharedFiles; QStringList m_bundle3DSharedFiles;
Utils::FilePath m_bundlePathMaterial;
Utils::FilePath m_bundlePath3D; Utils::FilePath m_bundlePath3D;
QList<ContentLibraryMaterial *> m_userMaterials; QList<ContentLibraryMaterial *> m_userMaterials;

View File

@@ -496,41 +496,39 @@ void ContentLibraryView::applyBundleMaterialToDropTarget(const ModelNode &bundle
#endif #endif
// Add a project material to Content Library's user tab // Add a project material to Content Library's user tab
void ContentLibraryView::addLibMaterial(const ModelNode &mat, const QPixmap &icon) void ContentLibraryView::addLibMaterial(const ModelNode &node, const QPixmap &iconPixmap)
{ {
auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/materials/"); auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/materials/");
auto [name, qml] = m_widget->userModel()->getUniqueLibMaterialNameAndQml( QString name = node.variantProperty("objectName").value().toString();
mat.variantProperty("objectName").value().toString()); auto [qml, icon] = m_widget->userModel()->getUniqueLibMaterialNames(node.id());
bundlePath.pathAppended("icons").createDir(); QString iconPath = QLatin1String("icons/%1").arg(icon);
bundlePath.pathAppended("images").createDir();
bundlePath.pathAppended("shaders").createDir();
QString iconPath = QLatin1String("icons/%1.png").arg(mat.id());
QString fullIconPath = bundlePath.pathAppended(iconPath).toString(); QString fullIconPath = bundlePath.pathAppended(iconPath).toString();
// save icon // save icon
bool iconSaved = icon.save(fullIconPath); bool iconSaved = iconPixmap.save(fullIconPath);
if (!iconSaved) if (!iconSaved)
qWarning() << __FUNCTION__ << "icon save failed"; qWarning() << __FUNCTION__ << "icon save failed";
// generate and save material Qml file // generate and save material Qml file
const QStringList depAssets = writeLibItemQml(mat, qml); const QStringList depAssets = writeLibItemQml(node, qml);
// add the material to the bundle json // add the material to the bundle json
QJsonObject &jsonRef = m_widget->userModel()->bundleJsonMaterialObjectRef(); QJsonObject &jsonRef = m_widget->userModel()->bundleJsonMaterialObjectRef();
QJsonObject matsObj = jsonRef.value("materials").toObject(); QJsonArray itemsArr = jsonRef.value("items").toArray();
QJsonObject matObj; QJsonObject itemObj;
matObj.insert("qml", qml); itemObj.insert("name", name);
matObj.insert("icon", iconPath); itemObj.insert("qml", qml);
itemObj.insert("icon", iconPath);
QJsonArray filesArr; QJsonArray filesArr;
for (const QString &assetPath : depAssets) for (const QString &assetPath : depAssets)
filesArr.append(assetPath); filesArr.append(assetPath);
matObj.insert("files", filesArr); itemObj.insert("files", filesArr);
itemsArr.append(itemObj);
jsonRef["items"] = itemsArr;
matsObj.insert(name, matObj);
jsonRef.insert("materials", matsObj);
auto result = bundlePath.pathAppended("user_materials_bundle.json") auto result = bundlePath.pathAppended("user_materials_bundle.json")
.writeFileContents(QJsonDocument(jsonRef).toJson()); .writeFileContents(QJsonDocument(jsonRef).toJson());
if (!result) if (!result)
@@ -538,16 +536,9 @@ void ContentLibraryView::addLibMaterial(const ModelNode &mat, const QPixmap &ico
// copy material assets to bundle folder // copy material assets to bundle folder
for (const QString &assetPath : depAssets) { for (const QString &assetPath : depAssets) {
Asset asset(assetPath);
QString subDir;
if (asset.isImage())
subDir = "images";
else if (asset.isShader())
subDir = "shaders";
Utils::FilePath assetPathSource = DocumentManager::currentResourcePath().pathAppended(assetPath); Utils::FilePath assetPathSource = DocumentManager::currentResourcePath().pathAppended(assetPath);
Utils::FilePath assetPathTarget = bundlePath.pathAppended(QString("%1/%2") Utils::FilePath assetPathTarget = bundlePath.pathAppended(assetPath);
.arg(subDir, "/" + asset.fileName())); assetPathTarget.parentDir().ensureWritableDir();
auto result = assetPathSource.copyFile(assetPathTarget); auto result = assetPathSource.copyFile(assetPathTarget);
if (!result) if (!result)
@@ -667,8 +658,8 @@ void ContentLibraryView::addLib3DItem(const ModelNode &node)
auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/3d/"); auto bundlePath = Utils::FilePath::fromString(Paths::bundlesPathSetting() + "/User/3d/");
QString name = node.variantProperty("objectName").value().toString(); QString name = node.variantProperty("objectName").value().toString();
QString qml = m_widget->userModel()->getUniqueLib3DQmlName(node.id()); auto [qml, icon] = m_widget->userModel()->getUniqueLib3DNames(node.id());
QString iconPath = QLatin1String("icons/%1.png").arg(node.id()); // TODO: make sure path is unique QString iconPath = QLatin1String("icons/%1").arg(icon);
// generate and save item Qml file // generate and save item Qml file
const QStringList depAssets = writeLibItemQml(node, qml); const QStringList depAssets = writeLibItemQml(node, qml);

View File

@@ -55,7 +55,7 @@ private:
bool isItemBundle(const QString &bundleId) const; bool isItemBundle(const QString &bundleId) const;
void active3DSceneChanged(qint32 sceneId); void active3DSceneChanged(qint32 sceneId);
void updateBundlesQuick3DVersion(); void updateBundlesQuick3DVersion();
void addLibMaterial(const ModelNode &mat, const QPixmap &icon); void addLibMaterial(const ModelNode &node, const QPixmap &iconPixmap);
void addLibAssets(const QStringList &paths); void addLibAssets(const QStringList &paths);
void addLib3DItem(const ModelNode &node); void addLib3DItem(const ModelNode &node);
void genAndSaveIcon(const QString &qmlPath, const QString &iconPath); void genAndSaveIcon(const QString &qmlPath, const QString &iconPath);