MAINT-6959 Ability to set custom folders for uploading items

master
andreykproductengine 2017-01-17 20:11:00 +02:00
parent ba6974eb37
commit b94aa751c9
13 changed files with 369 additions and 10 deletions

View File

@ -348,5 +348,49 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>ModelUploadFolder</key>
<map>
<key>Comment</key>
<string>All model uploads will be stored in this directory (UUID)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string></string>
</map>
<key>TextureUploadFolder</key>
<map>
<key>Comment</key>
<string>All image(texture) uploads will be stored in this directory (UUID)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string></string>
</map>
<key>SoundUploadFolder</key>
<map>
<key>Comment</key>
<string>All sound uploads will be stored in this directory (UUID)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string></string>
</map>
<key>AnimationUploadFolder</key>
<map>
<key>Comment</key>
<string>All animation uploads will be stored in this directory (UUID)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string></string>
</map>
</map>
</llsd>

View File

@ -467,6 +467,11 @@ BOOL LLFloaterPreference::postBuild()
gSavedSettings.getControl("PreferredMaturity")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeMaturity, this));
gSavedPerAccountSettings.getControl("ModelUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeModelFolder, this));
gSavedPerAccountSettings.getControl("TextureUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeTextureFolder, this));
gSavedPerAccountSettings.getControl("SoundUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeSoundFolder, this));
gSavedPerAccountSettings.getControl("AnimationUploadFolder")->getSignal()->connect(boost::bind(&LLFloaterPreference::onChangeAnimationFolder, this));
LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
tabcontainer->selectFirstTab();
@ -501,6 +506,7 @@ BOOL LLFloaterPreference::postBuild()
fov_slider->setMinValue(LLViewerCamera::getInstance()->getMinView());
fov_slider->setMaxValue(LLViewerCamera::getInstance()->getMaxView());
return TRUE;
}
@ -742,7 +748,12 @@ void LLFloaterPreference::onOpen(const LLSD& key)
// Display selected maturity icons.
onChangeMaturity();
onChangeModelFolder();
onChangeTextureFolder();
onChangeSoundFolder();
onChangeAnimationFolder();
// Load (double-)click to walk/teleport settings.
updateClickActionControls();
@ -1979,6 +1990,57 @@ void LLFloaterPreference::onChangeMaturity()
getChild<LLIconCtrl>("rating_icon_adult")->setVisible(sim_access == SIM_ACCESS_ADULT);
}
std::string get_category_path(LLUUID cat_id)
{
LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
if (cat->getParentUUID().notNull())
{
return get_category_path(cat->getParentUUID()) + " > " + cat->getName();
}
else
{
return cat->getName();
}
}
std::string get_category_path(LLFolderType::EType cat_type)
{
LLUUID cat_id = gInventory.findUserDefinedCategoryUUIDForType(cat_type);
return get_category_path(cat_id);
}
void LLFloaterPreference::onChangeModelFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLLineEditor>("upload_models")->setText(get_category_path(LLFolderType::FT_OBJECT));
}
}
void LLFloaterPreference::onChangeTextureFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLLineEditor>("upload_textures")->setText(get_category_path(LLFolderType::FT_TEXTURE));
}
}
void LLFloaterPreference::onChangeSoundFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLLineEditor>("upload_sounds")->setText(get_category_path(LLFolderType::FT_SOUND));
}
}
void LLFloaterPreference::onChangeAnimationFolder()
{
if (gInventory.isInventoryUsable())
{
getChild<LLLineEditor>("upload_animation")->setText(get_category_path(LLFolderType::FT_ANIMATION));
}
}
// FIXME: this will stop you from spawning the sidetray from preferences dialog on login screen
// but the UI for this will still be enabled
void LLFloaterPreference::onClickBlockList()

View File

@ -161,6 +161,10 @@ public:
void onCommitMusicEnabled();
void applyResolution();
void onChangeMaturity();
void onChangeModelFolder();
void onChangeTextureFolder();
void onChangeSoundFolder();
void onChangeAnimationFolder();
void onClickBlockList();
void onClickProxySettings();
void onClickTranslationSettings();

View File

@ -3789,6 +3789,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("New Gesture"));
disabled_items.push_back(std::string("New Clothes"));
disabled_items.push_back(std::string("New Body Parts"));
disabled_items.push_back(std::string("upload_def"));
}
if (favorites == mUUID)
{
@ -3815,6 +3816,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
disabled_items.push_back(std::string("New Gesture"));
disabled_items.push_back(std::string("New Clothes"));
disabled_items.push_back(std::string("New Body Parts"));
disabled_items.push_back(std::string("upload_def"));
}
if (marketplace_listings_id == mUUID)
{
@ -3864,6 +3866,7 @@ void LLFolderBridge::buildContextMenuOptions(U32 flags, menuentry_vec_t& items
items.push_back(std::string("New Gesture"));
items.push_back(std::string("New Clothes"));
items.push_back(std::string("New Body Parts"));
items.push_back(std::string("upload_def"));
}
}
getClipboardEntries(false, items, disabled_items, flags);

View File

@ -515,6 +515,42 @@ const LLUUID LLInventoryModel::findCategoryUUIDForType(LLFolderType::EType prefe
return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getRootFolderID());
}
const LLUUID LLInventoryModel::findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type)
{
LLUUID cat_id;
switch (preferred_type)
{
case LLFolderType::FT_OBJECT:
{
cat_id = LLUUID(gSavedPerAccountSettings.getString("ModelUploadFolder"));
break;
}
case LLFolderType::FT_TEXTURE:
{
cat_id = LLUUID(gSavedPerAccountSettings.getString("TextureUploadFolder"));
break;
}
case LLFolderType::FT_SOUND:
{
cat_id = LLUUID(gSavedPerAccountSettings.getString("SoundUploadFolder"));
break;
}
case LLFolderType::FT_ANIMATION:
{
cat_id = LLUUID(gSavedPerAccountSettings.getString("AnimationUploadFolder"));
break;
}
default:
break;
}
if (cat_id.isNull() || !getCategory(cat_id))
{
cat_id = findCategoryUUIDForTypeInRoot(preferred_type, true, getRootFolderID());
}
return cat_id;
}
const LLUUID LLInventoryModel::findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type, bool create_folder)
{
return findCategoryUUIDForTypeInRoot(preferred_type, create_folder, gInventory.getLibraryRootFolderID());

View File

@ -287,6 +287,9 @@ public:
// will search in the user's library folder instead of "My Inventory"
const LLUUID findLibraryCategoryUUIDForType(LLFolderType::EType preferred_type,
bool create_folder = true);
// Returns user specified category for uploads, returns default id if there are no
// user specified one or it does not exist, creates default category if it is missing.
const LLUUID findUserDefinedCategoryUUIDForType(LLFolderType::EType preferred_type);
// Get whatever special folder this object is a child of, if any.
const LLViewerInventoryCategory *getFirstNondefaultParent(const LLUUID& obj_id) const;

View File

@ -167,7 +167,7 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2));
mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
mCommitCallbackRegistrar.add("Inventory.Share", boost::bind(&LLAvatarActions::shareWithAvatars, this));
mCommitCallbackRegistrar.add("Inventory.FileUploadLocation", boost::bind(&LLInventoryPanel::fileUploadLocation, this, _2));
}
LLFolderView * LLInventoryPanel::createFolderRoot(LLUUID root_id )
@ -1190,6 +1190,27 @@ bool LLInventoryPanel::beginIMSession()
return true;
}
void LLInventoryPanel::fileUploadLocation(const LLSD& userdata)
{
const std::string param = userdata.asString();
if (param == "model")
{
gSavedPerAccountSettings.setString("ModelUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString());
}
else if (param == "texture")
{
gSavedPerAccountSettings.setString("TextureUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString());
}
else if (param == "sound")
{
gSavedPerAccountSettings.setString("SoundUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString());
}
else if (param == "animation")
{
gSavedPerAccountSettings.setString("AnimationUploadFolder", LLFolderBridge::sSelf.get()->getUUID().asString());
}
}
bool LLInventoryPanel::attachObject(const LLSD& userdata)
{
// Copy selected item UUIDs to a vector.

View File

@ -201,6 +201,7 @@ public:
void doToSelected(const LLSD& userdata);
void doCreate(const LLSD& userdata);
bool beginIMSession();
void fileUploadLocation(const LLSD& userdata);
bool attachObject(const LLSD& userdata);
static void idle(void* user_data);

View File

@ -2030,8 +2030,8 @@ void LLMeshUploadThread::wholeModelToLLSD(LLSD& dest, bool include_textures)
LLSD result;
LLSD res;
result["folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT);
result["texture_folder_id"] = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE);
result["folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_OBJECT);
result["texture_folder_id"] = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
result["asset_type"] = "mesh";
result["inventory_type"] = "object";
result["description"] = "(No Description)";
@ -3536,11 +3536,11 @@ void LLMeshRepository::notifyLoadedMeshes()
// Handle addition of texture, if any.
if ( data.mResponse.has("new_texture_folder_id") )
{
const LLUUID& folder_id = data.mResponse["new_texture_folder_id"].asUUID();
const LLUUID& new_folder_id = data.mResponse["new_texture_folder_id"].asUUID();
if ( folder_id.notNull() )
if ( new_folder_id.notNull() )
{
LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE);
LLUUID parent_id = gInventory.findUserDefinedCategoryUUIDForType(LLFolderType::FT_TEXTURE);
std::string name;
// Check if the server built a different name for the texture folder
@ -3555,7 +3555,7 @@ void LLMeshRepository::notifyLoadedMeshes()
// Add the category to the internal representation
LLPointer<LLViewerInventoryCategory> cat =
new LLViewerInventoryCategory(folder_id, parent_id,
new LLViewerInventoryCategory(new_folder_id, parent_id,
LLFolderType::FT_NONE, name, gAgent.getID());
cat->setVersion(LLViewerInventoryCategory::VERSION_UNKNOWN);

View File

@ -307,10 +307,9 @@ void LLResourceUploadInfo::assignDefaults()
mDescription = "(No Description)";
}
mFolderId = gInventory.findCategoryUUIDForType(
mFolderId = gInventory.findUserDefinedCategoryUUIDForType(
(mDestinationFolderType == LLFolderType::FT_NONE) ?
(LLFolderType::EType)mAssetType : mDestinationFolderType);
}
std::string LLResourceUploadInfo::getDisplayName() const

View File

@ -120,6 +120,13 @@
layout="topleft"
help_topic="preferences_advanced1_tab"
name="advanced1" />
<panel
class="panel_preference"
filename="panel_preferences_uploads.xml"
label="Uploads"
layout="topleft"
help_topic="preferences_uploads_tab"
name="uploads" />
</tab_container>
</floater>

View File

@ -321,6 +321,43 @@
parameter="eyes" />
</menu_item_call>
</menu>
<menu
label="Use as default for"
layout="topleft"
name="upload_def">
<menu_item_call
label="Image uploads"
layout="topleft"
name="Image uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="texture" />
</menu_item_call>
<menu_item_call
label="Sound uploads"
layout="topleft"
name="Sound uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="sound" />
</menu_item_call>
<menu_item_call
label="Animation uploads"
layout="topleft"
name="Animation uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="animation" />
</menu_item_call>
<menu_item_call
label="Model uploads"
layout="topleft"
name="Model uploads">
<menu_item_call.on_click
function="Inventory.FileUploadLocation"
parameter="model" />
</menu_item_call>
</menu>
<menu
label="Change Type"
layout="topleft"

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<panel
border="true"
follows="all"
height="408"
label="Uploads"
layout="topleft"
left="102"
name="uploads"
top="1"
width="517">
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="33"
name="title"
top_pad="10"
width="250">
Current destination folders for uploads
</text>
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="37"
name="title_models"
top_pad="20"
width="100">
Images
</text>
<line_editor
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerif"
height="23"
layout="topleft"
left="40"
max_length="4096"
name="upload_textures"
enabled="false"
top_pad="5"
width="350" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="37"
name="title_sounds"
top_pad="10"
width="100">
Sounds
</text>
<line_editor
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerif"
height="23"
layout="topleft"
left="40"
max_length="4096"
name="upload_sounds"
enabled="false"
top_pad="5"
width="350" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="37"
name="title_animation"
top_pad="10"
width="100">
Animations
</text>
<line_editor
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerif"
height="23"
layout="topleft"
left="40"
max_length="4096"
name="upload_animation"
enabled="false"
top_pad="5"
width="350" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="37"
name="title_animation"
top_pad="10"
width="100">
Models
</text>
<line_editor
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerif"
height="23"
layout="topleft"
left="40"
max_length="4096"
name="upload_models"
enabled="false"
top_pad="5"
width="350" />
<text
type="string"
length="1"
follows="left|top"
height="30"
layout="topleft"
left="33"
name="upload_help"
top_pad="10"
width="387">
To change a destination folder, right click on it in inventory and choose
"Use as default for"
</text>
</panel>