SL-20553: Clean up dead code
parent
2d69611c47
commit
ee8b96f3ef
|
|
@ -2123,65 +2123,11 @@ void LLMaterialEditor::saveObjectsMaterialAs(const LLGLTFMaterial* render_materi
|
|||
}
|
||||
else
|
||||
{
|
||||
if (item_id.notNull() && object_id.notNull())
|
||||
{
|
||||
llassert(false); // *TODO: Remove this code path if unused
|
||||
// Copy existing item from object inventory, and create new composite asset on top of it
|
||||
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback, _1, _2, permissions, object_id, item_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions));
|
||||
}
|
||||
llassert(object_id.isNull()); // Case for copying item from object inventory is no longer implemented
|
||||
LLNotificationsUtil::add("SaveMaterialAs", args, payload, boost::bind(&LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback, _1, _2, permissions));
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMaterialEditor::onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id)
|
||||
{
|
||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||
if (0 != option)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
LLSD asset;
|
||||
asset["version"] = LLGLTFMaterial::ASSET_VERSION;
|
||||
asset["type"] = LLGLTFMaterial::ASSET_TYPE;
|
||||
// This is the string serialized from LLGLTFMaterial::asJSON
|
||||
asset["data"] = notification["payload"]["data"];
|
||||
|
||||
std::ostringstream str;
|
||||
LLSDSerialize::serialize(asset, str, LLSDSerialize::LLSD_BINARY);
|
||||
|
||||
LLViewerObject* object = gObjectList.findObject(object_id);
|
||||
if (!object)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const LLInventoryItem* item = object->getInventoryItem(item_id);
|
||||
if (!item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::string new_name = response["message"].asString();
|
||||
LLInventoryObject::correctInventoryName(new_name);
|
||||
if (new_name.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const LLUUID destination_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MATERIAL);
|
||||
|
||||
LLPointer<LLInventoryCallback> cb = new LLObjectsMaterialItemCallback(permissions, str.str(), new_name);
|
||||
// NOTE: This should be an item copy. Saving a material to an inventory should be disabled when the associated material is no-copy.
|
||||
move_or_copy_inventory_from_object(destination_id,
|
||||
object_id,
|
||||
item_id,
|
||||
cb);
|
||||
}
|
||||
|
||||
// static
|
||||
void LLMaterialEditor::onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,7 +116,6 @@ class LLMaterialEditor : public LLPreview, public LLVOInventoryListener
|
|||
static bool canSaveObjectsMaterial();
|
||||
static bool canClipboardObjectsMaterial();
|
||||
static void saveObjectsMaterialAs();
|
||||
static void onCopyObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions, const LLUUID& object_id, const LLUUID& item_id);
|
||||
static void onSaveObjectsMaterialAsMsgCallback(const LLSD& notification, const LLSD& response, const LLPermissions& permissions);
|
||||
|
||||
static void onLoadComplete(const LLUUID& asset_uuid, LLAssetType::EType type, void* user_data, S32 status, LLExtStat ext_status);
|
||||
|
|
|
|||
|
|
@ -1658,67 +1658,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
|
|||
}
|
||||
}
|
||||
|
||||
void move_or_copy_inventory_from_object(const LLUUID& destination_id,
|
||||
const LLUUID& object_id,
|
||||
const LLUUID& item_id,
|
||||
LLPointer<LLInventoryCallback> cb)
|
||||
{
|
||||
LLViewerObject* object = gObjectList.findObject(object_id);
|
||||
if (!object)
|
||||
{
|
||||
return;
|
||||
}
|
||||
const LLInventoryItem* item = object->getInventoryItem(item_id);
|
||||
if (!item)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
class LLItemAddedObserver : public LLInventoryObserver
|
||||
{
|
||||
public:
|
||||
LLItemAddedObserver(const LLUUID& copied_asset_id, LLPointer<LLInventoryCallback> cb)
|
||||
: LLInventoryObserver(),
|
||||
mAssetId(copied_asset_id),
|
||||
mCallback(cb)
|
||||
{
|
||||
}
|
||||
|
||||
void changed(U32 mask) override
|
||||
{
|
||||
if((mask & (LLInventoryObserver::ADD)) == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (const LLUUID& changed_id : gInventory.getChangedIDs())
|
||||
{
|
||||
LLViewerInventoryItem* changed_item = gInventory.getItem(changed_id);
|
||||
if (changed_item->getAssetUUID() == mAssetId)
|
||||
{
|
||||
changeComplete(changed_item->getUUID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void changeComplete(const LLUUID& item_id)
|
||||
{
|
||||
mCallback->fire(item_id);
|
||||
gInventory.removeObserver(this);
|
||||
delete this;
|
||||
}
|
||||
|
||||
LLUUID mAssetId;
|
||||
LLPointer<LLInventoryCallback> mCallback;
|
||||
};
|
||||
|
||||
const LLUUID& asset_id = item->getAssetUUID();
|
||||
LLItemAddedObserver* observer = new LLItemAddedObserver(asset_id, cb);
|
||||
gInventory.addObserver(observer);
|
||||
object->moveInventory(destination_id, item_id);
|
||||
}
|
||||
|
||||
void create_new_item(const std::string& name,
|
||||
const LLUUID& parent_id,
|
||||
LLAssetType::EType asset_type,
|
||||
|
|
|
|||
|
|
@ -463,11 +463,6 @@ void copy_inventory_from_notecard(const LLUUID& destination_id,
|
|||
const LLInventoryItem *src,
|
||||
U32 callback_id = 0);
|
||||
|
||||
void move_or_copy_inventory_from_object(const LLUUID& destination_id,
|
||||
const LLUUID& object_id,
|
||||
const LLUUID& item_id,
|
||||
LLPointer<LLInventoryCallback> cb);
|
||||
|
||||
void menu_create_inventory_item(LLInventoryPanel* root,
|
||||
LLFolderBridge* bridge,
|
||||
const LLSD& userdata,
|
||||
|
|
|
|||
Loading…
Reference in New Issue