From 3d170fae5d528dfbecacc913fb68c870abbf9ce2 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 13 Oct 2022 21:01:35 +0300 Subject: SL-18125 Separate GLTF permissions from normal uploads --- indra/newview/app_settings/settings.xml | 55 +++++++++++++++++ indra/newview/llfloaterperms.cpp | 1 + indra/newview/llmaterialeditor.cpp | 10 ++-- indra/newview/llviewerinventory.cpp | 22 +++++++ .../skins/default/xui/en/floater_perms_default.xml | 68 +++++++++++++++++++++- 5 files changed, 149 insertions(+), 7 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 2eee9f2f25..4171b52938 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -16136,6 +16136,61 @@ Value 1 + MaterialsNextOwnerCopy + + Comment + Newly created GLTF material can be copied by next owner + Persist + 1 + Type + Boolean + Value + 0 + + MaterialsNextOwnerModify + + Comment + Newly created GLTF material can be modified by next owner + Persist + 1 + Type + Boolean + Value + 1 + + MaterialsNextOwnerTransfer + + Comment + Newly created GLTF material can be resold or given away by next owner + Persist + 1 + Type + Boolean + Value + 1 + + MaterialsEveryoneCopy + + Comment + Everyone can copy the newly created GLTF material + Persist + 1 + Type + Boolean + Value + 0 + + MaterialsShareWithGroup + + Comment + Newly created GLTF materials are shared with the currently active group + Persist + 1 + Type + Boolean + Value + 0 + DefaultUploadPermissionsConverted Comment diff --git a/indra/newview/llfloaterperms.cpp b/indra/newview/llfloaterperms.cpp index 649a107d74..fb55c6c6c4 100644 --- a/indra/newview/llfloaterperms.cpp +++ b/indra/newview/llfloaterperms.cpp @@ -123,6 +123,7 @@ const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] = "Gestures", "Wearables", "Settings" + "Materials" }; BOOL LLFloaterPermsDefault::postBuild() diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index dfb43dfe0d..4a75426265 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -935,7 +935,7 @@ bool LLMaterialEditor::saveIfNeeded() tid.generate(); // timestamp-based randomization + uniquification LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID()); std::string res_desc = buildMaterialDescription(); - U32 next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Uploads"); + U32 next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Materials"); LLUUID parent = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_MATERIAL); const U8 subtype = NO_INV_SUBTYPE; // TODO maybe use AT_SETTINGS and LLSettingsType::ST_MATERIAL ? @@ -948,11 +948,11 @@ bool LLMaterialEditor::saveIfNeeded() { // create_inventory_item doesn't allow presetting some permissions, fix it now LLPermissions perm = item->getPermissions(); - if (perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms("Uploads") - || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms("Uploads")) + if (perm.getMaskEveryone() != LLFloaterPerms::getEveryonePerms("Materials") + || perm.getMaskGroup() != LLFloaterPerms::getGroupPerms("Materials")) { - perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Uploads")); - perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Uploads")); + perm.setMaskEveryone(LLFloaterPerms::getEveryonePerms("Materials")); + perm.setMaskGroup(LLFloaterPerms::getGroupPerms("Materials")); item->setPermissions(perm); diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp index 2265379ce4..b4feafb7ff 100644 --- a/indra/newview/llviewerinventory.cpp +++ b/indra/newview/llviewerinventory.cpp @@ -999,6 +999,21 @@ void create_notecard_cb(const LLUUID& inv_item) } } +void create_gltf_material_cb(const LLUUID& inv_item) +{ + if (!inv_item.isNull()) + { + LLViewerInventoryItem* item = gInventory.getItem(inv_item); + if (item) + { + set_default_permissions(item, "Materials"); + + gInventory.updateItem(item); + gInventory.notifyObservers(); + } + } +} + LLInventoryCallbackManager gInventoryCallbacks; void create_inventory_item(const LLUUID& agent_id, const LLUUID& session_id, @@ -1623,6 +1638,13 @@ void create_new_item(const std::string& name, next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Notecards"); break; } + + case LLInventoryType::IT_MATERIAL: + { + cb = new LLBoostFuncInventoryCallback(create_gltf_material_cb); + next_owner_perm = LLFloaterPerms::getNextOwnerPerms("Materials"); + break; + } default: break; } diff --git a/indra/newview/skins/default/xui/en/floater_perms_default.xml b/indra/newview/skins/default/xui/en/floater_perms_default.xml index 49dc719a24..9ca61671e1 100644 --- a/indra/newview/skins/default/xui/en/floater_perms_default.xml +++ b/indra/newview/skins/default/xui/en/floater_perms_default.xml @@ -1,7 +1,7 @@ + + Materials + + + + + + + + +