quick hax to get inputting texture UUIDs working in the texture picker

This commit is contained in:
Hazim Gazov
2010-05-16 04:05:23 -03:00
parent 01dd55579a
commit 31568240fd
2 changed files with 56 additions and 13 deletions

View File

@@ -67,6 +67,10 @@
#include "llglheaders.h" #include "llglheaders.h"
#include "lluictrlfactory.h" #include "lluictrlfactory.h"
#include "lltrans.h" #include "lltrans.h"
// <edit>
#include "llmenugl.h"
#include "lllocalinventory.h"
// </edit>
static const S32 CLOSE_BTN_WIDTH = 100; static const S32 CLOSE_BTN_WIDTH = 100;
@@ -152,6 +156,7 @@ public:
static void onBtnSelect( void* userdata ); static void onBtnSelect( void* userdata );
static void onBtnCancel( void* userdata ); static void onBtnCancel( void* userdata );
static void onBtnPipette( void* userdata ); static void onBtnPipette( void* userdata );
static void onBtnUUID( void* userdata );
//static void onBtnRevert( void* userdata ); //static void onBtnRevert( void* userdata );
static void onBtnWhite( void* userdata ); static void onBtnWhite( void* userdata );
static void onBtnInvisible( void* userdata ); static void onBtnInvisible( void* userdata );
@@ -281,6 +286,7 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
} }
childSetAction("Pipette", LLFloaterTexturePicker::onBtnPipette,this); childSetAction("Pipette", LLFloaterTexturePicker::onBtnPipette,this);
childSetAction("ApplyUUID", LLFloaterTexturePicker::onBtnUUID,this);
childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this); childSetAction("Cancel", LLFloaterTexturePicker::onBtnCancel,this);
childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this); childSetAction("Select", LLFloaterTexturePicker::onBtnSelect,this);
@@ -303,6 +309,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id)
mNoCopyTextureSelected = FALSE; mNoCopyTextureSelected = FALSE;
mIsDirty = TRUE; mIsDirty = TRUE;
mImageAssetID = image_id; mImageAssetID = image_id;
/* I'm good, thanks
LLUUID item_id = findItemID(mImageAssetID, FALSE); LLUUID item_id = findItemID(mImageAssetID, FALSE);
if (item_id.isNull()) if (item_id.isNull())
{ {
@@ -310,6 +317,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id)
} }
else else
{ {
LLInventoryItem* itemp = gInventory.getItem(image_id); LLInventoryItem* itemp = gInventory.getItem(image_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
{ {
@@ -319,6 +327,7 @@ void LLFloaterTexturePicker::setImageID(const LLUUID& image_id)
} }
mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO); mInventoryPanel->setSelection(item_id, TAKE_FOCUS_NO);
} }
*/
} }
} }
@@ -390,9 +399,11 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
if (mod) item_perm_mask |= PERM_MODIFY; if (mod) item_perm_mask |= PERM_MODIFY;
if (xfer) item_perm_mask |= PERM_TRANSFER; if (xfer) item_perm_mask |= PERM_TRANSFER;
//PermissionMask filter_perm_mask = getFilterPermMask(); Commented out due to no-copy texture loss. // <edit>
PermissionMask filter_perm_mask = mImmediateFilterPermMask; //PermissionMask filter_perm_mask = mImmediateFilterPermMask;
if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) //if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
if(1)
// </edit>
{ {
if (drop) if (drop)
{ {
@@ -546,6 +557,7 @@ void LLFloaterTexturePicker::draw()
childSetEnabled("Select", mActive); childSetEnabled("Select", mActive);
childSetEnabled("Pipette", mActive); childSetEnabled("Pipette", mActive);
childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance()); childSetValue("Pipette", LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
childSetValue("texture_uuid", mImageAssetID);
//RN: reset search bar to reflect actual search query (all caps, for example) //RN: reset search bar to reflect actual search query (all caps, for example)
mSearchEdit->setText(mInventoryPanel->getFilterSubString()); mSearchEdit->setText(mInventoryPanel->getFilterSubString());
@@ -782,6 +794,23 @@ void LLFloaterTexturePicker::onBtnPipette( void* userdata )
} }
// static
void LLFloaterTexturePicker::onBtnUUID( void* userdata )
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
if ( self)
{
std::string texture_uuid = self->childGetValue("texture_uuid").asString();
if (texture_uuid.length() == 36)
{
self->setImageID( LLUUID(texture_uuid) );
self->mIsDirty = TRUE;
self->commitIfImmediateSet();
}
}
}
// static // static
void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data) void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
{ {
@@ -882,13 +911,18 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da
{ {
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data; LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)data;
LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE); //<edit>
if (self && inventory_item_id.notNull()) //LLUUID inventory_item_id = self->findItemID(te.getID(), TRUE);
//if (self && inventory_item_id.notNull())
if(self)
//</edit>
{ {
LLToolPipette::getInstance()->setResult(TRUE, ""); LLToolPipette::getInstance()->setResult(TRUE, "");
self->setImageID(te.getID()); self->setImageID(te.getID());
self->mNoCopyTextureSelected = FALSE; self->mNoCopyTextureSelected = FALSE;
//<edit>
/*
LLInventoryItem* itemp = gInventory.getItem(inventory_item_id); LLInventoryItem* itemp = gInventory.getItem(inventory_item_id);
if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID())) if (itemp && !itemp->getPermissions().allowCopyBy(gAgent.getID()))
@@ -896,6 +930,8 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te, void *da
// no copy texture // no copy texture
self->mNoCopyTextureSelected = TRUE; self->mNoCopyTextureSelected = TRUE;
} }
*/
//</edit>
self->commitIfImmediateSet(); self->commitIfImmediateSet();
} }
@@ -1412,8 +1448,11 @@ BOOL LLTextureCtrl::allowDrop(LLInventoryItem* item)
// PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss. // PermissionMask filter_perm_mask = mCanApplyImmediately ? commented out due to no-copy texture loss.
// mImmediateFilterPermMask : mNonImmediateFilterPermMask; // mImmediateFilterPermMask : mNonImmediateFilterPermMask;
PermissionMask filter_perm_mask = mImmediateFilterPermMask; // <edit>
if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask ) //PermissionMask filter_perm_mask = mImmediateFilterPermMask;
//if ( (item_perm_mask & filter_perm_mask) == filter_perm_mask )
if(1)
// </edit>
{ {
if(mDragCallback) if(mDragCallback)
{ {

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?> <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater bottom="-516" can_close="true" can_drag_on_left="false" can_minimize="false" <floater bottom="-516" can_close="true" can_drag_on_left="false" can_minimize="false"
can_resize="true" can_tear_off="true" enabled="true" height="310" can_resize="true" can_tear_off="true" enabled="true" height="320"
left="478" min_height="310" min_width="410" mouse_opaque="true" left="478" min_height="320" min_width="410" mouse_opaque="true"
name="texture picker" title="Pick: Texture" width="410"> name="texture picker" title="Pick: Texture" width="410">
<string name="choose_picture"> <string name="choose_picture">
Click to choose a picture Click to choose a picture
@@ -54,10 +54,14 @@
<button bottom="-282" enabled="true" follows="right|bottom" font="SansSerif" <button bottom="-282" enabled="true" follows="right|bottom" font="SansSerif"
halign="center" height="20" label="Select" label_selected="Select" halign="center" height="20" label="Select" label_selected="Select"
left="290" mouse_opaque="true" name="Select" scale_image="true" width="100" /> left="290" mouse_opaque="true" name="Select" scale_image="true" width="100" />
<line_editor bevel_style="in" border_style="line" border_thickness="1" bottom_delta="-10" <line_editor bevel_style="in" border_style="line" border_thickness="1" bottom="10"
follows="left|bottom" font="SansSerif" handle_edit_keys_directly="true" left="8" follows="bottom" font="SansSerif" handle_edit_keys_directly="true"
height="20" max_length="36" mouse_opaque="true" height="20" max_length="36" mouse_opaque="true" name="texture_uuid"
name="texture_uuid" select_all_on_focus_received="false" width="230" /> select_all_on_focus_received="false" width="230" />
<button enabled="true" follows="top|right" font="SansSerif"
height="20" label="Apply UUID" label_selected="Apply UUID"
right="340" bottom_delta="0" mouse_opaque="true"
name="ApplyUUID" scale_image="true" width="100" />
<string name="pick title"> <string name="pick title">
Pick: Pick:
</string> </string>