FIRE-14230: Allow applying a texture via UUID to the current selection in the texture picker. Patch from Chaser Zaks.

Tonya Souther 2019-06-22 15:14:41 -05:00
parent 395406232d
commit f45c19cdb3
4 changed files with 114 additions and 9 deletions

View File

@ -157,11 +157,32 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id, bool set_selecti
else
{
LLInventoryItem* itemp = gInventory.getItem(image_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
//<FS:Chaser> Texture UUID picker
//if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
if (itemp)
{
// no copy texture
getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
mNoCopyTextureSelected = TRUE;
BOOL copy = itemp->getPermissions().allowCopyBy(gAgent.getID());
BOOL mod = itemp->getPermissions().allowModifyBy(gAgent.getID());
BOOL xfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
if(!copy)
{
// no copy texture
getChild<LLUICtrl>("apply_immediate_check")->setValue(FALSE);
mNoCopyTextureSelected = TRUE;
}
//Verify permissions before revealing UUID.
//Replicates behaviour of "Copy UUID" on inventory. If you can't copy it there, you can't copy it here.
if(copy&&mod&&xfer)
{
getChild<LLLineEditor>("TextureKey")->setText(image_id.asString());
}
else
{
getChild<LLLineEditor>("TextureKey")->setText(LLUUID::null.asString());
}
//</FS:Chaser>
}
}
@ -420,6 +441,9 @@ BOOL LLFloaterTexturePicker::postBuild()
}
getChild<LLUICtrl>("Pipette")->setCommitCallback( boost::bind(&LLFloaterTexturePicker::onBtnPipette, this));
//<FS:Chaser> UUID picker
childSetAction("TextureKeyApply", LLFloaterTexturePicker::onBtnApplyTexture,this);
//</FS:Chaser>
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
@ -736,6 +760,17 @@ void LLFloaterTexturePicker::onBtnRevert(void* userdata)
self->mViewModel->resetDirty();
}*/
//<FS:Chaser> UUID texture picker
// static
void LLFloaterTexturePicker::onBtnApplyTexture(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID(LLUUID(self->getChild<LLLineEditor>("TextureKey")->getText()));
self->commitIfImmediateSet();
}
//</FS:Chaser>
// static
void LLFloaterTexturePicker::onBtnCancel(void* userdata)
{
@ -796,16 +831,39 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
{
mTextureSelectedCallback(itemp);
}
if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
// <FS:Chaser> UUID texture picker uses extra permissions, so we do all the fancy stuff here
BOOL copy = itemp->getPermissions().allowCopyBy(gAgent.getID());
BOOL mod = itemp->getPermissions().allowModifyBy(gAgent.getID());
BOOL xfer = itemp->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
//if (!itemp->getPermissions().allowCopyBy(gAgent.getID()))
if (!copy)
{
mNoCopyTextureSelected = TRUE;
}
// </FS:Chaser>
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
setCanApply(true, true);
// </FS:Ansariel>
setImageID(itemp->getAssetUUID(),false);
// <FS:Chaser> UUID texture picker permissions continued
//We also have to set this here because above passes the asset ID, not the inventory ID.
//Verify permissions before revealing UUID.
//Replicates behaviour of "Copy UUID" on inventory. If you can't copy it there, you can't copy it here.
if(copy&&mod&&xfer)
{
getChild<LLLineEditor>("TextureKey")->setText(itemp->getAssetUUID().asString());
}
else
{
getChild<LLLineEditor>("TextureKey")->setText(LLUUID::null.asString());
}
// </FS:Chaser>
mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here?
if(!mPreviewSettingChanged)
{
mCanPreview = gSavedSettings.getBOOL("TextureLivePreview");

View File

@ -319,6 +319,9 @@ public:
const LLUUID& getBlankImageAssetID() { return mBlankImageAssetID; }
static void onBtnSetToDefault(void* userdata);
//<FS:Chaser> UUID texture picker
static void onBtnApplyTexture(void* userdata);
//</FS:Chaser>
static void onBtnSelect(void* userdata);
static void onBtnCancel(void* userdata);
void onBtnPipette();

View File

@ -3,7 +3,7 @@
legacy_header_height="18"
can_minimize="false"
can_resize="true"
height="330"
height="360"
layout="topleft"
min_height="330"
min_width="410"
@ -239,6 +239,28 @@
</scroll_list>
<!-- bottom static -->
<line_editor
follows="bottom"
height="20"
left="7"
top="-55"
max_length_chars="256"
name="TextureKey"
layout="topleft"
label="00000000-0000-0000-0000-000000000000"
control_name="TextureKey"
tool_tip="Texture Key"
width="290"/>
<button
follows="left|top"
name="TextureKeyApply"
height="20"
label="Apply UUID"
layout="topleft"
left_pad="5"
width="100"
sound_flags="0"
tool_tip="Apply this UUID"/>
<button
follows="bottom"
height="20"
@ -265,7 +287,7 @@
initial_value="true"
label="Apply now"
layout="topleft"
left="4"
left="5"
name="apply_immediate_check"
top_delta="0"
width="120" />

View File

@ -3,7 +3,7 @@
legacy_header_height="18"
can_minimize="false"
can_resize="true"
height="330"
height="360"
layout="topleft"
min_height="330"
min_width="410"
@ -248,6 +248,28 @@
</scroll_list>
<!-- bottom static -->
<line_editor
follows="bottom"
height="20"
left="7"
top="-55"
max_length_chars="256"
name="TextureKey"
layout="topleft"
label="00000000-0000-0000-0000-000000000000"
control_name="TextureKey"
tool_tip="Texture Key"
width="290"/>
<button
follows="left|top"
name="TextureKeyApply"
height="20"
label="Apply UUID"
layout="topleft"
left_pad="5"
width="100"
sound_flags="0"
tool_tip="Apply this UUID"/>
<button
follows="bottom"
height="20"