diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelface.cpp | 44 | ||||
-rw-r--r-- | indra/newview/llpanelface.h | 3 | ||||
-rw-r--r-- | indra/newview/llselectmgr.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llviewerobject.h | 2 |
5 files changed, 39 insertions, 36 deletions
diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index a0f2fb702e..032d066c48 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -262,7 +262,6 @@ BOOL LLPanelFace::postBuild() LLPanelFace::LLPanelFace() : LLPanel(), - mMaterialID(LLMaterialID::null), mMaterial(LLMaterialPtr()), mIsAlpha(false) { @@ -1575,26 +1574,23 @@ void LLPanelFace::getState() // Materials { - mMaterialID = LLMaterialID::null; - mMaterial = NULL; - - struct f1 : public LLSelectedTEGetFunctor<LLMaterialID> + struct f1 : public LLSelectedTEGetFunctor<LLMaterialPtr> { - LLMaterialID get(LLViewerObject* object, S32 te_index) + LLMaterialPtr get(LLViewerObject* object, S32 te_index) { LLMaterialID material_id; - return object->getTE(te_index)->getMaterialID(); + return object->getTE(te_index)->getMaterialParams(); } } func; - identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, mMaterialID ); - llinfos << "Material ID returned: '" - << mMaterialID.asString() << "', isNull? " - << (mMaterialID.isNull()?"TRUE":"FALSE") << llendl; - if (!mMaterialID.isNull() && editable) + + LLMaterialPtr material; + identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func, material ); + + mMaterial = (material) ? new LLMaterial(*material) : NULL; + if (mMaterial && editable) { - llinfos << "Requesting material ID " << mMaterialID.asString() << llendl; - LLMaterialMgr::getInstance()->get(objectp->getRegion()->getRegionID(),mMaterialID,boost::bind(&LLPanelFace::onMaterialLoaded, this, _1, _2)); + onMaterialLoaded(mMaterial); } } @@ -1659,15 +1655,8 @@ void LLPanelFace::refresh() getState(); } -void LLPanelFace::onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material) +void LLPanelFace::onMaterialLoaded(const LLMaterialPtr material) { //laying out UI based on material parameters (calls setVisible on various components) - LL_DEBUGS("Materials") << "Loaded material " << material_id.asString() << material->asLLSD() << LL_ENDL; - - //make a local copy of the material for editing - // (prevents local edits from overwriting client state on shared materials) - mMaterial = new LLMaterial(*material); - mMaterialID = material_id; - // Alpha LLCtrlSelectionInterface* combobox_alphamode = childGetSelectionInterface("combobox alphamode"); @@ -1780,13 +1769,9 @@ void LLPanelFace::updateMaterial() || (shininess == SHINY_TEXTURE)) { // The user's specified something that needs a material. - bool new_material = false; - if (!mMaterial) - { - new_material = true; - mMaterial = LLMaterialPtr(new LLMaterial()); - } + bool new_material = !mMaterial; + mMaterial = LLMaterialPtr(new LLMaterial()); mMaterial->setDiffuseAlphaMode(getChild<LLComboBox>("combobox alphamode")->getCurrentIndex()); mMaterial->setAlphaMaskCutoff((U8)(getChild<LLUICtrl>("maskcutoff")->getValue().asInteger())); @@ -1866,11 +1851,10 @@ void LLPanelFace::updateMaterial() else { // The user has specified settings that don't need a material. - if (mMaterial || !mMaterialID.isNull()) + if (mMaterial) { LL_DEBUGS("Materials") << "Resetting material entry" << LL_ENDL; mMaterial = NULL; - mMaterialID = LLMaterialID::null; // Delete existing material entry... LLSelectMgr::getInstance()->selectionRemoveMaterial(); } diff --git a/indra/newview/llpanelface.h b/indra/newview/llpanelface.h index 2138319365..470da10bee 100644 --- a/indra/newview/llpanelface.h +++ b/indra/newview/llpanelface.h @@ -84,7 +84,7 @@ protected: void onCommitAlpha(const LLSD& data); void onCancelColor(const LLSD& data); void onSelectColor(const LLSD& data); - void onMaterialLoaded(const LLMaterialID& material_id, const LLMaterialPtr material); + void onMaterialLoaded(const LLMaterialPtr material); void updateMaterial(); static void onCommitTextureInfo( LLUICtrl* ctrl, void* userdata); @@ -115,7 +115,6 @@ private: */ void onTextureSelectionChanged(LLInventoryItem* itemp); - LLMaterialID mMaterialID; LLMaterialPtr mMaterial; bool mIsAlpha; diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 5089570319..8ef56af379 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -816,6 +816,7 @@ void LLSelectMgr::addAsFamily(std::vector<LLViewerObject*>& objects, BOOL add_to if (objectp->getNumTEs() > 0) { nodep->selectAllTEs(TRUE); + objectp->setAllTESelected(true); } else { @@ -873,10 +874,12 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab else if (face == SELECT_ALL_TES) { nodep->selectAllTEs(TRUE); + objectp->setAllTESelected(true); } else if (0 <= face && face < SELECT_MAX_TES) { nodep->selectTE(face, TRUE); + objectp->setTESelected(face, true); } else { @@ -1096,6 +1099,7 @@ LLObjectSelectionHandle LLSelectMgr::selectHighlightedObjects() // flag this object as selected objectp->setSelected(TRUE); + objectp->setAllTESelected(true); mSelectedObjects->mSelectType = getSelectTypeForObject(objectp); @@ -1321,6 +1325,7 @@ void LLSelectMgr::remove(LLViewerObject *objectp, S32 te, BOOL undoable) if (nodep->isTESelected(te)) { nodep->selectTE(te, FALSE); + objectp->setTESelected(te, false); } else { @@ -5751,6 +5756,7 @@ void LLSelectNode::selectTE(S32 te_index, BOOL selected) { return; } + S32 mask = 0x1 << te_index; if(selected) { diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 286604e367..4a112d3ab3 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -531,6 +531,17 @@ void LLViewerObject::setNameValueList(const std::string& name_value_list) } } +void LLViewerObject::setSelected(BOOL sel) +{ + mUserSelected = sel; + resetRot(); + + if (!sel) + { + setAllTESelected(false); + } +} + // This method returns true if the object is over land owned by the // agent. bool LLViewerObject::isReturnable() @@ -4354,10 +4365,13 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID << ", material " << pMaterialID << LL_ENDL; retval = LLPrimitive::setTEMaterialID(te, pMaterialID); - setChanged(TEXTURE); - if (mDrawable.notNull() && retval) + if (retval) { - gPipeline.markTextured(mDrawable); + setChanged(TEXTURE); + if (mDrawable.notNull() && retval) + { + gPipeline.markTextured(mDrawable); + } } } return retval; diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index a6569740bb..05b2e0361b 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -200,7 +200,7 @@ public: LLViewerRegion* getRegion() const { return mRegionp; } BOOL isSelected() const { return mUserSelected; } - virtual void setSelected(BOOL sel) { mUserSelected = sel; resetRot();} + virtual void setSelected(BOOL sel); const LLUUID &getID() const { return mID; } U32 getLocalID() const { return mLocalID; } |