SL-18125 Separate GLTF permissions from normal uploads

master
Andrey Kleshchev 2022-10-13 21:01:35 +03:00
parent 0e3f8db632
commit 3d170fae5d
5 changed files with 149 additions and 7 deletions

View File

@ -16136,6 +16136,61 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>MaterialsNextOwnerCopy</key>
<map>
<key>Comment</key>
<string>Newly created GLTF material can be copied by next owner</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MaterialsNextOwnerModify</key>
<map>
<key>Comment</key>
<string>Newly created GLTF material can be modified by next owner</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MaterialsNextOwnerTransfer</key>
<map>
<key>Comment</key>
<string>Newly created GLTF material can be resold or given away by next owner</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>MaterialsEveryoneCopy</key>
<map>
<key>Comment</key>
<string>Everyone can copy the newly created GLTF material</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>MaterialsShareWithGroup</key>
<map>
<key>Comment</key>
<string>Newly created GLTF materials are shared with the currently active group</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>DefaultUploadPermissionsConverted</key>
<map>
<key>Comment</key>

View File

@ -123,6 +123,7 @@ const std::string LLFloaterPermsDefault::sCategoryNames[CAT_LAST] =
"Gestures",
"Wearables",
"Settings"
"Materials"
};
BOOL LLFloaterPermsDefault::postBuild()

View File

@ -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);

View File

@ -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;
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
height="250"
height="266"
layout="topleft"
name="perms default"
help_topic="perms_default"
@ -10,7 +10,7 @@
width="700">
<panel
follows="left|top|right|bottom"
height="200"
height="216"
label="Default Permissions"
layout="topleft"
left="10"
@ -549,6 +549,70 @@
left_pad="0"
top_delta="0"
width="100" />
<text
name="label_14"
type="string"
length="1"
follows="left|top"
height="16"
layout="topleft"
left="0"
tool_tip="Set default permissions for when GLTF Materials are created"
width="100">
Materials
</text>
<icon
follows="left|top"
height="16"
image_name="Inv_Material"
layout="topleft"
left_pad="2"
width="18"/>
<check_box
control_name="MaterialsNextOwnerCopy"
height="16"
layout="topleft"
name="env_material_c"
left_pad="45"
top_delta="0"
width="100">
<check_box.commit_callback
function="PermsDefault.Copy"
parameter="Materials" />
</check_box>
<check_box
control_name="MaterialsNextOwnerModify"
height="16"
layout="topleft"
name="env_materials_m"
left_pad="0"
top_delta="0"
width="100" />
<check_box
enabled_control="MaterialsNextOwnerCopy"
control_name="MaterialsNextOwnerTransfer"
height="16"
layout="topleft"
name="env_materials_t"
left_pad="0"
top_delta="0"
width="100" />
<check_box
control_name="MaterialsShareWithGroup"
height="16"
layout="topleft"
name="env_materials_s"
left_pad="0"
top_delta="0"
width="120" />
<check_box
control_name="MaterialsEveryoneCopy"
height="16"
layout="topleft"
name="env_materials_e"
left_pad="0"
top_delta="0"
width="100" />
</panel>
<button
height="20"