diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelface.cpp | 31 | ||||
-rw-r--r-- | indra/newview/lltexturectrl.cpp | 46 | ||||
-rw-r--r-- | indra/newview/lltexturectrl.h | 2 |
3 files changed, 66 insertions, 13 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 363fe3da04..5689c44e21 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -880,10 +880,21 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); - if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + bool allAttachments = true; + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end();iter++) { - texture_ctrl->setBakeTextureEnabled(objectp->isAttachment()); + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if (!object->isAttachment()) + { + allAttachments = false; + break; + } } + + texture_ctrl->setBakeTextureEnabled(allAttachments); + } else if (id.isNull()) { @@ -895,6 +906,8 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("label alphamode")->setEnabled(FALSE); getChildView("maskcutoff")->setEnabled(FALSE); getChildView("label maskcutoff")->setEnabled(FALSE); + + texture_ctrl->setBakeTextureEnabled(false); } else { @@ -907,10 +920,20 @@ void LLPanelFace::updateUI(bool force_set_values /*false*/) getChildView("maskcutoff")->setEnabled(editable && mIsAlpha); getChildView("label maskcutoff")->setEnabled(editable && mIsAlpha); - if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() == 1) + bool allAttachments = true; + for (LLObjectSelection::iterator iter = LLSelectMgr::getInstance()->getSelection()->begin(); + iter != LLSelectMgr::getInstance()->getSelection()->end();iter++) { - texture_ctrl->setBakeTextureEnabled(objectp->isAttachment()); + LLSelectNode* node = *iter; + LLViewerObject* object = node->getObject(); + if (!object->isAttachment()) + { + allAttachments = false; + break; + } } + + texture_ctrl->setBakeTextureEnabled(allAttachments); } } diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp index 0aeea15b97..d9170dd832 100644 --- a/indra/newview/lltexturectrl.cpp +++ b/indra/newview/lltexturectrl.cpp @@ -487,9 +487,9 @@ void LLFloaterTexturePicker::draw() 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(); + if (obj) { - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID); texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL; } @@ -990,9 +990,23 @@ void LLFloaterTexturePicker::onBakeTextureSelect(LLUICtrl* ctrl, void *user_data if (imageID.notNull()) { - self->setCanApply(true, true); self->setImageID(imageID); - self->commitIfImmediateSet(); + self->mViewModel->setDirty(); // *TODO: shouldn't we be using setValue() here? + + if (!self->mPreviewSettingChanged) + { + self->mCanPreview = gSavedSettings.getBOOL("TextureLivePreview"); + } + else + { + self->mPreviewSettingChanged = false; + } + + if (self->mCanPreview) + { + // only commit intentional selections, not implicit ones + self->commitIfImmediateSet(); + } } else { @@ -1067,6 +1081,8 @@ void LLFloaterTexturePicker::setLocalTextureEnabled(BOOL enabled) void LLFloaterTexturePicker::setBakeTextureEnabled(BOOL enabled) { mModeSelector->setIndexEnabled(2, enabled); + mModeSelector->setSelectedIndex(mModeSelector->getSelectedIndex(), 0); + onModeSelect(0, this); } void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te ) @@ -1310,13 +1326,15 @@ void LLTextureCtrl::showPicker(BOOL take_focus) { texture_floaterp->setSetImageAssetIDCallback(boost::bind(&LLTextureCtrl::setImageAssetID, this, _1)); } + if (texture_floaterp) + { + texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled); + } LLFloater* root_floater = gFloaterView->getParentFloater(this); if (root_floater) root_floater->addDependentFloater(floaterp); floaterp->openFloater(); - - texture_floaterp->setBakeTextureEnabled(mBakeTextureEnabled); } if (take_focus) @@ -1480,6 +1498,17 @@ void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id ) } } +void LLTextureCtrl::setBakeTextureEnabled(BOOL enabled) +{ + mBakeTextureEnabled = enabled; + LLFloaterTexturePicker* floaterp = (LLFloaterTexturePicker*)mFloaterHandle.get(); + if (floaterp) + { + floaterp->setBakeTextureEnabled(enabled); + floaterp->resetDirty(); + } +} + BOOL LLTextureCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, @@ -1538,12 +1567,13 @@ void LLTextureCtrl::draw() 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(); + if (obj) { - LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject(); LLViewerTexture* viewerTexture = obj->getBakedTextureForMagicId(mImageAssetID); texture = viewerTexture ? dynamic_cast<LLViewerFetchedTexture*>(viewerTexture) : NULL; } + } if (texture.isNull()) diff --git a/indra/newview/lltexturectrl.h b/indra/newview/lltexturectrl.h index ee43fdfb9e..b43ad69687 100644 --- a/indra/newview/lltexturectrl.h +++ b/indra/newview/lltexturectrl.h @@ -198,7 +198,7 @@ public: LLViewerFetchedTexture* getTexture() { return mTexturep; } - void setBakeTextureEnabled(BOOL enabled) { mBakeTextureEnabled = enabled; } + void setBakeTextureEnabled(BOOL enabled); private: BOOL allowDrop(LLInventoryItem* item); |