summaryrefslogtreecommitdiff
path: root/indra/newview/lltexturectrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltexturectrl.cpp')
-rw-r--r--indra/newview/lltexturectrl.cpp164
1 files changed, 150 insertions, 14 deletions
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index c7adaa908f..0aeea15b97 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -32,6 +32,7 @@
#include "llrender.h"
#include "llagent.h"
#include "llviewertexturelist.h"
+#include "llselectmgr.h"
#include "llcheckboxctrl.h"
#include "llcombobox.h"
#include "llbutton.h"
@@ -404,6 +405,10 @@ BOOL LLFloaterTexturePicker::postBuild()
LLToolPipette::getInstance()->setToolSelectCallback(boost::bind(&LLFloaterTexturePicker::onTextureSelect, this, _1));
+ getChild<LLComboBox>("l_bake_use_texture_combo_box")->setCommitCallback(onBakeTextureSelect, this);
+ getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setCommitCallback(onHideBaseMeshRegionCheck, this);
+
+ setBakeTextureEnabled(FALSE);
return TRUE;
}
@@ -478,7 +483,24 @@ void LLFloaterTexturePicker::draw()
mTexturep = NULL;
if(mImageAssetID.notNull())
{
- mTexturep = LLViewerTextureManager::getFetchedTexture(mImageAssetID);
+ LLPointer<LLViewerFetchedTexture> texture = NULL;
+
+ if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER))
+ {
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)
+ {
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID);
+ texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL;
+ }
+ }
+
+ if (texture.isNull())
+ {
+ texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID);
+ }
+
+ mTexturep = texture;
mTexturep->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
}
@@ -760,22 +782,58 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
void LLFloaterTexturePicker::onModeSelect(LLUICtrl* ctrl, void *userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
- bool mode = (self->mModeSelector->getSelectedIndex() == 0);
+ int mode = self->mModeSelector->getSelectedIndex();
- self->getChild<LLButton>("Default")->setVisible(mode);
- self->getChild<LLButton>("Blank")->setVisible(mode);
- self->getChild<LLButton>("None")->setVisible(mode);
- self->getChild<LLButton>("Pipette")->setVisible(mode);
- self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode);
- self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode);
+ self->getChild<LLButton>("Default")->setVisible(mode == 0);
+ self->getChild<LLButton>("Blank")->setVisible(mode == 0);
+ self->getChild<LLButton>("None")->setVisible(mode == 0);
+ self->getChild<LLButton>("Pipette")->setVisible(mode == 0);
+ self->getChild<LLFilterEditor>("inventory search editor")->setVisible(mode == 0);
+ self->getChild<LLInventoryPanel>("inventory panel")->setVisible(mode == 0);
/*self->getChild<LLCheckBox>("show_folders_check")->setVisible(mode);
no idea under which conditions the above is even shown, needs testing. */
- self->getChild<LLButton>("l_add_btn")->setVisible(!mode);
- self->getChild<LLButton>("l_rem_btn")->setVisible(!mode);
- self->getChild<LLButton>("l_upl_btn")->setVisible(!mode);
- self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(!mode);
+ self->getChild<LLButton>("l_add_btn")->setVisible(mode == 1);
+ self->getChild<LLButton>("l_rem_btn")->setVisible(mode == 1);
+ self->getChild<LLButton>("l_upl_btn")->setVisible(mode == 1);
+ self->getChild<LLScrollListCtrl>("l_name_list")->setVisible(mode == 1);
+
+ self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setVisible(mode == 2);
+ self->getChild<LLCheckBoxCtrl>("hide_base_mesh_region")->setVisible(false);// mode == 2);
+
+ if (mode == 2)
+ {
+ S8 val = -1;
+
+ LLUUID imageID = self->mImageAssetID;
+ if (imageID == IMG_USE_BAKED_HEAD)
+ {
+ val = 0;
+ }
+ else if (imageID == IMG_USE_BAKED_UPPER)
+ {
+ val = 1;
+ }
+ else if (imageID == IMG_USE_BAKED_LOWER)
+ {
+ val = 2;
+ }
+ else if (imageID == IMG_USE_BAKED_EYES)
+ {
+ val = 3;
+ }
+ else if (imageID == IMG_USE_BAKED_SKIRT)
+ {
+ val = 4;
+ }
+ else if (imageID == IMG_USE_BAKED_HAIR)
+ {
+ val = 5;
+ }
+
+ self->getChild<LLComboBox>("l_bake_use_texture_combo_box")->setSelectedByValue(val, TRUE);
+ }
}
// static
@@ -896,6 +954,61 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da
picker->commitIfImmediateSet();
}
+//static
+void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data)
+{
+ LLFloaterTexturePicker* self = (LLFloaterTexturePicker*)user_data;
+ LLComboBox* combo_box = (LLComboBox*)ctrl;
+
+ S8 type = combo_box->getValue().asInteger();
+
+ LLUUID imageID = LLUUID::null;
+ if (type == 0)
+ {
+ imageID = IMG_USE_BAKED_HEAD;
+ }
+ else if (type == 1)
+ {
+ imageID = IMG_USE_BAKED_UPPER;
+ }
+ else if (type == 2)
+ {
+ imageID = IMG_USE_BAKED_LOWER;
+ }
+ else if (type == 3)
+ {
+ imageID = IMG_USE_BAKED_EYES;
+ }
+ else if (type == 4)
+ {
+ imageID = IMG_USE_BAKED_SKIRT;
+ }
+ else if (type == 5)
+ {
+ imageID = IMG_USE_BAKED_HAIR;
+ }
+
+ if (imageID.notNull())
+ {
+ self->setCanApply(true, true);
+ self->setImageID(imageID);
+ self->commitIfImmediateSet();
+ }
+ else
+ {
+ self->setCanApply(true, true);
+ self->setImageID(self->mOriginalImageAssetID);
+ self->commitIfImmediateSet();
+ }
+}
+
+//static
+void LLFloaterTexturePicker::onHideBaseMeshRegionCheck(LLUICtrl* ctrl, void *user_data)
+{
+ //LLFloaterTexturePicker* picker = (LLFloaterTexturePicker*)user_data;
+ //LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
+}
+
void LLFloaterTexturePicker::updateFilterPermMask()
{
//mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss.
@@ -951,6 +1064,11 @@ void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled)
mModeSelector->setIndexEnabled(1,enabled);
}
+void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled)
+{
+ mModeSelector->setIndexEnabled(2, enabled);
+}
+
void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
{
LLUUID inventory_item_id = findItemID(te.getID(), TRUE);
@@ -999,7 +1117,8 @@ LLTextureCtrl::LLTextureCtrl(const LLTextureCtrl::Params& p)
mImageAssetID(p.image_id),
mDefaultImageAssetID(p.default_image_id),
mDefaultImageName(p.default_image_name),
- mFallbackImage(p.fallback_image)
+ mFallbackImage(p.fallback_image),
+ mBakeTextureEnabled(FALSE)
{
// Default of defaults is white image for diff tex
@@ -1196,6 +1315,8 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
if (root_floater)
root_floater->addDependentFloater(floaterp);
floaterp->openFloater();
+
+ texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled);
}
if (take_focus)
@@ -1413,7 +1534,22 @@ void LLTextureCtrl::draw()
}
else if (!mImageAssetID.isNull())
{
- LLPointer<LLViewerFetchedTexture> texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES,LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ LLPointer<LLViewerFetchedTexture> texture = NULL;
+
+ if ((mImageAssetID == IMG_USE_BAKED_EYES) || (mImageAssetID == IMG_USE_BAKED_HAIR) || (mImageAssetID == IMG_USE_BAKED_HEAD) || (mImageAssetID == IMG_USE_BAKED_LOWER) || (mImageAssetID == IMG_USE_BAKED_SKIRT) || (mImageAssetID == IMG_USE_BAKED_UPPER))
+ {
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1)
+ {
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
+ LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID);
+ texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL;
+ }
+ }
+
+ if (texture.isNull())
+ {
+ texture = LLViewerTextureManager::getFetchedTexture(mImageAssetID, FTT_DEFAULT, MIPMAP_YES, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
+ }
texture->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
texture->forceToSaveRawImage(0) ;