diff options
author | Dave Parks <davep@lindenlab.com> | 2022-09-26 17:41:52 -0500 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2022-09-26 17:41:52 -0500 |
commit | d53c077315418e95bcb23d720e86d3d50d7b47b1 (patch) | |
tree | 49bc6a399992f9149e25107ebf50092428ecf11e | |
parent | 23ad6e930b6b4a163c2bb83905ca38ceb04e780e (diff) | |
parent | 30b6d29b042f6f9a5054d80cad26960b83d8472b (diff) |
Merge branch 'DRTVWR-559' of ssh://bitbucket.org/lindenlab/viewer into DRTVWR-559
-rw-r--r-- | indra/newview/llmaterialeditor.cpp | 43 | ||||
-rw-r--r-- | indra/newview/llmaterialeditor.h | 5 |
2 files changed, 42 insertions, 6 deletions
diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 12d21cf284..a0ab771c7b 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -149,6 +149,8 @@ BOOL LLMaterialEditor::postBuild() childSetVisible("unsaved_changes", mHasUnsavedChanges); + getChild<LLUICtrl>("total_upload_fee")->setTextArg("[FEE]", llformat("%d", 0)); + // Todo: // Disable/enable setCanApplyImmediately() based on // working from inventory, upload or editing inworld @@ -391,16 +393,43 @@ void LLMaterialEditor::setHasUnsavedChanges(bool value) getChild<LLUICtrl>("total_upload_fee")->setTextArg("[FEE]", llformat("%d", mExpectedUploadCost)); } -void LLMaterialEditor::setCanSaveAs(BOOL value) +void LLMaterialEditor::setCanSaveAs(bool value) { childSetEnabled("save_as", value); } -void LLMaterialEditor::setCanSave(BOOL value) +void LLMaterialEditor::setCanSave(bool value) { childSetEnabled("save", value); } +void LLMaterialEditor::setEnableEditing(bool can_modify) +{ + childSetEnabled("double sided", can_modify); + + // BaseColor + childSetEnabled("base color", can_modify); + childSetEnabled("transparency", can_modify); + childSetEnabled("alpha mode", can_modify); + childSetEnabled("alpha cutoff", can_modify); + + // Metallic-Roughness + childSetEnabled("metalness factor", can_modify); + childSetEnabled("roughness factor", can_modify); + + // Metallic-Roughness + childSetEnabled("metalness factor", can_modify); + childSetEnabled("roughness factor", can_modify); + + // Emissive + childSetEnabled("emissive color", can_modify); + + mBaseColorTextureCtrl->setEnabled(can_modify); + mMetallicTextureCtrl->setEnabled(can_modify); + mEmissiveTextureCtrl->setEnabled(can_modify); + mNormalTextureCtrl->setEnabled(can_modify); +} + void LLMaterialEditor::onCommitBaseColorTexture(LLUICtrl * ctrl, const LLSD & data) { // might be better to use arrays, to have a single callback @@ -1624,6 +1653,7 @@ void LLMaterialEditor::loadAsset() mAssetStatus = PREVIEW_ASSET_LOADED; loadDefaults(); setHasUnsavedChanges(false); + setEnableEditing(allow_modify && !source_library); } else { @@ -1644,6 +1674,7 @@ void LLMaterialEditor::loadAsset() mAssetID.setNull(); mAssetStatus = PREVIEW_ASSET_LOADED; setHasUnsavedChanges(false); + setEnableEditing(allow_modify && !source_library); return; } user_data->with("taskid", mObjectUUID).with("itemid", mItemUUID); @@ -1653,6 +1684,8 @@ void LLMaterialEditor::loadAsset() user_data = new LLSD(mItemUUID); } + setEnableEditing(false); // wait for it to load + gAssetStorage->getInvItemAsset(source_sim, gAgent.getID(), gAgent.getSessionID(), @@ -1724,8 +1757,9 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid, editor->decodeAsset(buffer); - BOOL modifiable = editor->canModify(editor->mObjectID, editor->getItem()); - editor->setEnabled(modifiable); + BOOL allow_modify = editor->canModify(editor->mObjectID, editor->getItem()); + BOOL source_library = editor->mObjectID.isNull() && gInventory.isObjectDescendentOf(editor->mItemUUID, gInventory.getLibraryRootFolderID()); + editor->setEnableEditing(allow_modify && !source_library); editor->setHasUnsavedChanges(false); editor->mAssetStatus = PREVIEW_ASSET_LOADED; } @@ -1744,6 +1778,7 @@ void LLMaterialEditor::onLoadComplete(const LLUUID& asset_uuid, { LLNotificationsUtil::add("UnableToLoadMaterial"); } + editor->setEnableEditing(false); LL_WARNS() << "Problem loading material: " << status << LL_ENDL; editor->mAssetStatus = PREVIEW_ASSET_ERROR; diff --git a/indra/newview/llmaterialeditor.h b/indra/newview/llmaterialeditor.h index 0d741614b8..8a67c3c348 100644 --- a/indra/newview/llmaterialeditor.h +++ b/indra/newview/llmaterialeditor.h @@ -153,8 +153,9 @@ public: void setDoubleSided(bool double_sided); void setHasUnsavedChanges(bool value); - void setCanSaveAs(BOOL value); - void setCanSave(BOOL value); + void setCanSaveAs(bool value); + void setCanSave(bool value); + void setEnableEditing(bool can_modify); void onCommitBaseColorTexture(LLUICtrl* ctrl, const LLSD& data); void onCommitMetallicTexture(LLUICtrl* ctrl, const LLSD& data); |