NORSPEC-102 Rapid materials updates are not smooth to viewer which is editing the object
parent
d8f2ecd5b3
commit
269b8b7de5
|
|
@ -373,6 +373,24 @@ S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMateri
|
|||
return mTextureList.setMaterialParams(index, pMaterialParams);
|
||||
}
|
||||
|
||||
void LLPrimitive::setAllTESelected(bool sel)
|
||||
{
|
||||
for (int i = 0, cnt = getNumTEs(); i < cnt; i++)
|
||||
{
|
||||
setTESelected(i, sel);
|
||||
}
|
||||
}
|
||||
|
||||
void LLPrimitive::setTESelected(const U8 te, bool sel)
|
||||
{
|
||||
LLTextureEntry* tep = getTE(te);
|
||||
if ( (tep) && (tep->setSelected(sel)) && (!sel) && (tep->hasPendingMaterialUpdate()) )
|
||||
{
|
||||
LLMaterialID material_id = tep->getMaterialID();
|
||||
setTEMaterialID(te, material_id);
|
||||
}
|
||||
}
|
||||
|
||||
LLPCode LLPrimitive::legacyToPCode(const U8 legacy)
|
||||
{
|
||||
// TODO: Should this default to something valid?
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@ public:
|
|||
LLTextureEntry* getTE(const U8 te_num) const;
|
||||
|
||||
virtual void setNumTEs(const U8 num_tes);
|
||||
virtual void setAllTESelected(bool sel);
|
||||
virtual void setAllTETextures(const LLUUID &tex_id);
|
||||
virtual void setTE(const U8 index, const LLTextureEntry& te);
|
||||
virtual S32 setTEColor(const U8 te, const LLColor4 &color);
|
||||
|
|
@ -357,6 +358,7 @@ public:
|
|||
virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
|
||||
virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
|
||||
virtual BOOL setMaterial(const U8 material); // returns TRUE if material changed
|
||||
virtual void setTESelected(const U8 te, bool sel);
|
||||
|
||||
void copyTEs(const LLPrimitive *primitive);
|
||||
S32 packTEField(U8 *cur_ptr, U8 *data_ptr, U8 data_size, U8 last_face_index, EMsgVariableType type) const;
|
||||
|
|
|
|||
|
|
@ -61,18 +61,24 @@ LLTextureEntry* LLTextureEntry::newTextureEntry()
|
|||
//===============================================================
|
||||
LLTextureEntry::LLTextureEntry()
|
||||
: mMediaEntry(NULL)
|
||||
, mSelected(false)
|
||||
, mMaterialUpdatePending(false)
|
||||
{
|
||||
init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
|
||||
}
|
||||
|
||||
LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
|
||||
: mMediaEntry(NULL)
|
||||
, mSelected(false)
|
||||
, mMaterialUpdatePending(false)
|
||||
{
|
||||
init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
|
||||
}
|
||||
|
||||
LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
|
||||
: mMediaEntry(NULL)
|
||||
, mSelected(false)
|
||||
, mMaterialUpdatePending(false)
|
||||
{
|
||||
mID = rhs.mID;
|
||||
mScaleS = rhs.mScaleS;
|
||||
|
|
@ -532,8 +538,16 @@ S32 LLTextureEntry::setGlow(F32 glow)
|
|||
|
||||
S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID)
|
||||
{
|
||||
if (mMaterialID != pMaterialID)
|
||||
if ( (mMaterialID != pMaterialID) || (mMaterialUpdatePending && !mSelected) )
|
||||
{
|
||||
if (mSelected)
|
||||
{
|
||||
mMaterialUpdatePending = true;
|
||||
mMaterialID = pMaterialID;
|
||||
return TEM_CHANGE_NONE;
|
||||
}
|
||||
|
||||
mMaterialUpdatePending = false;
|
||||
mMaterialID = pMaterialID;
|
||||
if (mMaterialID.isNull())
|
||||
{
|
||||
|
|
@ -548,6 +562,10 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
|
|||
{
|
||||
if (mMaterial != pMaterialParams)
|
||||
{
|
||||
if (mSelected)
|
||||
{
|
||||
mMaterialUpdatePending = true;
|
||||
}
|
||||
mMaterial = pMaterialParams;
|
||||
return TEM_CHANGE_TEXTURE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ public:
|
|||
virtual LLTextureEntry* newCopy() const;
|
||||
|
||||
void init(const LLUUID& tex_id, F32 scale_s, F32 scale_t, F32 offset_s, F32 offset_t, F32 rotation, U8 bump);
|
||||
|
||||
bool hasPendingMaterialUpdate() const { return mMaterialUpdatePending; }
|
||||
bool isSelected() const { return mSelected; }
|
||||
bool setSelected(bool sel) { bool prev_sel = mSelected; mSelected = sel; return prev_sel; }
|
||||
|
||||
// These return a TEM_ flag from above to indicate if something changed.
|
||||
S32 setID (const LLUUID &tex_id);
|
||||
|
|
@ -194,11 +198,13 @@ public:
|
|||
static const char* TEXTURE_MEDIA_DATA_KEY;
|
||||
|
||||
protected:
|
||||
bool mSelected;
|
||||
LLUUID mID; // Texture GUID
|
||||
LLColor4 mColor;
|
||||
U8 mBump; // Bump map, shiny, and fullbright
|
||||
U8 mMediaFlags; // replace with web page, movie, etc.
|
||||
F32 mGlow;
|
||||
bool mMaterialUpdatePending;
|
||||
LLMaterialID mMaterialID;
|
||||
LLMaterialPtr mMaterial;
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Reference in New Issue