diff options
Diffstat (limited to 'indra/newview/llmaterialeditor.cpp')
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 4f51030fc0..3245c6629a 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -180,6 +180,16 @@ LLMaterialEditor::LLMaterialEditor(const LLSD& key) } } +void LLMaterialEditor::setObjectID(const LLUUID& object_id) +{ + LLPreview::setObjectID(object_id); + const LLInventoryItem* item = getItem(); + if (item) + { + mAssetID = item->getAssetUUID(); + } +} + BOOL LLMaterialEditor::postBuild() { mBaseColorTextureCtrl = getChild<LLTextureCtrl>("base_color_texture"); @@ -751,7 +761,8 @@ bool LLMaterialEditor::decodeAsset(const std::vector<char>& buffer) if (loader.LoadASCIIFromString(&model_in, &error_msg, &warn_msg, data.c_str(), data.length(), "")) { - return setFromGltfModel(model_in, true); + // assets are only supposed to have one item + return setFromGltfModel(model_in, 0, true); } else { @@ -996,11 +1007,15 @@ void LLMaterialEditor::finishInventoryUpload(LLUUID itemId, LLUUID newAssetId, L void LLMaterialEditor::finishTaskUpload(LLUUID itemId, LLUUID newAssetId, LLUUID taskId) { - LLMaterialEditor* me = LLFloaterReg::findTypedInstance<LLMaterialEditor>("material_editor", LLSD(itemId)); + LLSD floater_key; + floater_key["taskid"] = taskId; + floater_key["itemid"] = itemId; + LLMaterialEditor* me = LLFloaterReg::findTypedInstance<LLMaterialEditor>("material_editor", floater_key); if (me) { me->setAssetId(newAssetId); me->refreshFromInventory(); + me->setEnabled(true); } } @@ -1037,7 +1052,17 @@ void LLMaterialEditor::refreshFromInventory(const LLUUID& new_item_id) if (new_item_id.notNull()) { mItemUUID = new_item_id; - setKey(LLSD(new_item_id)); + if (mObjectUUID.isNull()) + { + setKey(LLSD(new_item_id)); + } + else + { + LLSD floater_key; + floater_key["taskid"] = new_item_id; + floater_key["itemid"] = mObjectUUID; + setKey(floater_key); + } } LL_DEBUGS() << "LLPreviewNotecard::refreshFromInventory()" << LL_ENDL; loadAsset(); @@ -1878,8 +1903,8 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid, editor->decodeAsset(buffer); - BOOL allow_modify = editor->canModify(editor->mObjectID, editor->getItem()); - BOOL source_library = editor->mObjectID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); + BOOL allow_modify = editor->canModify(editor->mObjectUUID, editor->getItem()); + BOOL source_library = editor->mObjectUUID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); editor->setEnableEditing(allow_modify && !source_library); editor->setHasUnsavedChanges(false); editor->mAssetStatus = PREVIEW_ASSET_LOADED; @@ -2083,5 +2108,5 @@ void LLMaterialEditor::loadDefaults() { tinygltf::Model model_in; model_in.materials.resize(1); - setFromGltfModel(model_in, true); + setFromGltfModel(model_in, 0, true); } |