Merge viewer-bear

meow-7.2.2
Ansariel 2015-11-11 19:40:43 +01:00
commit 9401c93c7a
18 changed files with 98 additions and 44 deletions

View File

@ -328,9 +328,9 @@ S32 LLPrimitive::setTEMaterialID(const U8 index, const LLMaterialID& pMaterialID
return mTextureList.setMaterialID(index, pMaterialID);
}
S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
S32 LLPrimitive::setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams)
{
return mTextureList.setMaterialParams(index, pMaterialParams, isInitFromServer);
return mTextureList.setMaterialParams(index, pMaterialParams);
}
LLMaterialPtr LLPrimitive::getTEMaterialParams(const U8 index)

View File

@ -392,7 +392,7 @@ public:
virtual S32 setTEMediaFlags(const U8 te, const U8 flags);
virtual S32 setTEGlow(const U8 te, const F32 glow);
virtual S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
virtual S32 setTEMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
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);

View File

@ -368,18 +368,11 @@ S32 LLPrimTextureList::setMaterialID(const U8 index, const LLMaterialID& pMateri
return TEM_CHANGE_NONE;
}
S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
S32 LLPrimTextureList::setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams)
{
if (index < mEntryList.size())
{
if (!isInitFromServer && mEntryList[index]->isMatParamsInitFromServer())
{
return TEM_CHANGE_NONE;
}
else
{
return mEntryList[index]->setMaterialParams(pMaterialParams);
}
return mEntryList[index]->setMaterialParams(pMaterialParams);
}
return TEM_CHANGE_NONE;
}

View File

@ -105,7 +105,7 @@ public:
S32 setMediaFlags(const U8 index, const U8 media_flags);
S32 setGlow(const U8 index, const F32 glow);
S32 setMaterialID(const U8 index, const LLMaterialID& pMaterialID);
S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
S32 setMaterialParams(const U8 index, const LLMaterialPtr pMaterialParams);
LLMaterialPtr getMaterialParams(const U8 index);

View File

@ -63,7 +63,6 @@ LLTextureEntry::LLTextureEntry()
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
, mInitMatParamsFromServer(false)
{
init(LLUUID::null,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
@ -72,7 +71,6 @@ LLTextureEntry::LLTextureEntry(const LLUUID& tex_id)
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
, mInitMatParamsFromServer(false)
{
init(tex_id,1.f,1.f,0.f,0.f,0.f,DEFAULT_BUMP_CODE);
}
@ -81,7 +79,6 @@ LLTextureEntry::LLTextureEntry(const LLTextureEntry &rhs)
: mMediaEntry(NULL)
, mSelected(false)
, mMaterialUpdatePending(false)
, mInitMatParamsFromServer(false)
{
mID = rhs.mID;
mScaleS = rhs.mScaleS;
@ -565,7 +562,6 @@ S32 LLTextureEntry::setMaterialParams(const LLMaterialPtr pMaterialParams)
mMaterialUpdatePending = true;
}
mMaterial = pMaterialParams;
this->mInitMatParamsFromServer = TRUE;
return TEM_CHANGE_TEXTURE;
}

View File

@ -160,8 +160,6 @@ public:
const LLMaterialID& getMaterialID() const { return mMaterialID; };
const LLMaterialPtr getMaterialParams() const { return mMaterial; };
bool isMatParamsInitFromServer() const { return mInitMatParamsFromServer; };
// *NOTE: it is possible for hasMedia() to return true, but getMediaData() to return NULL.
// CONVERSELY, it is also possible for hasMedia() to return false, but getMediaData()
// to NOT return NULL.
@ -219,8 +217,6 @@ protected:
bool mMaterialUpdatePending;
LLMaterialID mMaterialID;
LLMaterialPtr mMaterial;
bool mInitMatParamsFromServer; // Flag to identification when material paramas initialized from
// Note the media data is not sent via the same message structure as the rest of the TE
LLMediaEntry* mMediaEntry; // The media data for the face

View File

@ -117,12 +117,20 @@ LLExperienceHandler gExperienceHandler;
LLFloaterExperienceProfile::LLFloaterExperienceProfile(const LLSD& data)
: LLFloater(data)
, mExperienceId(data.asUUID())
, mSaveCompleteAction(NOTHING)
, mDirty(false)
, mForceClose(false)
{
if (data.has("experience_id"))
{
mExperienceId = data["experience_id"].asUUID();
mPostEdit = data.has("edit_experience") && data["edit_experience"].asBoolean();
}
else
{
mExperienceId = data.asUUID();
mPostEdit = false;
}
}
@ -356,9 +364,7 @@ bool LLFloaterExperienceProfile::experiencePermission( LLHandle<LLFloaterExperie
void LLFloaterExperienceProfile::onClickEdit()
{
LLTabContainer* tabs = getChild<LLTabContainer>("tab_container");
tabs->selectTabByName("edit_panel_experience_info");
changeToEdit();
}
@ -618,6 +624,12 @@ void LLFloaterExperienceProfile::refreshExperience( const LLSD& experience )
mDirty=false;
mForceClose = false;
getChild<LLButton>(BTN_SAVE)->setEnabled(mDirty);
if (mPostEdit)
{
mPostEdit = false;
changeToEdit();
}
}
void LLFloaterExperienceProfile::setPreferences( const LLSD& content )
@ -832,6 +844,13 @@ void LLFloaterExperienceProfile::changeToView()
}
}
void LLFloaterExperienceProfile::changeToEdit()
{
LLTabContainer* tabs = getChild<LLTabContainer>("tab_container");
tabs->selectTabByName("edit_panel_experience_info");
}
void LLFloaterExperienceProfile::onClickLocation()
{
LLViewerRegion* region = gAgent.getRegion();

View File

@ -76,6 +76,7 @@ protected:
void setEditGroup(LLUUID group_id);
void changeToView();
void changeToEdit();
void experienceForgotten();
void experienceBlocked();
@ -99,6 +100,7 @@ protected:
int mSaveCompleteAction;
bool mDirty;
bool mForceClose;
bool mPostEdit; // edit experience after opening and updating it
};
#endif // LL_LLFLOATEREXPERIENCEPROFILE_H

View File

@ -303,6 +303,32 @@ void LLFloaterExperiences::checkPurchaseInfo(LLPanelExperiences* panel, const LL
LLFloaterExperiences::findInstance()->updateInfo("GetCreatorExperiences","Contrib_Experiences_Tab");
}
void LLFloaterExperiences::checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const
{
checkPurchaseInfo(panel, content);
// determine new item
const LLSD& response_ids = content["experience_ids"];
if (mPrepurchaseIds.size() + 1 == response_ids.size())
{
// we have a new element
for (LLSD::array_const_iterator it = response_ids.beginArray(); it != response_ids.endArray(); ++it)
{
LLUUID experience_id = it->asUUID();
if (std::find(mPrepurchaseIds.begin(), mPrepurchaseIds.end(), experience_id) == mPrepurchaseIds.end())
{
// new element found, open it
LLSD args;
args["experience_id"] = experience_id;
args["edit_experience"] = true;
LLFloaterReg::showInstance("experience_profile", args, true);
break;
}
}
}
}
void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab)
{
LLViewerRegion* region = gAgent.getRegion();
@ -318,18 +344,28 @@ void LLFloaterExperiences::updateInfo(std::string experiences, std::string tab)
}
}
void LLFloaterExperiences::sendPurchaseRequest() const
void LLFloaterExperiences::sendPurchaseRequest()
{
LLViewerRegion* region = gAgent.getRegion();
std::string url = region->getCapability("AgentExperiences");
if(!url.empty())
{
LLSD content;
const std::string tab_owned_name = "Owned_Experiences_Tab";
// extract ids for experiences that we already have
LLTabContainer* tabs = getChild<LLTabContainer>("xp_tabs");
LLPanelExperiences* tab_owned = (LLPanelExperiences*)tabs->getPanelByName(tab_owned_name);
mPrepurchaseIds.clear();
if (tab_owned)
{
tab_owned->getExperienceIdsList(mPrepurchaseIds);
}
LLExperienceListResponder::NameMap nameMap;
nameMap["experience_ids"]="Owned_Experiences_Tab";
nameMap["experience_ids"] = tab_owned_name;
LLExperienceListResponder* responder = new LLExperienceListResponder(getDerivedHandle<LLFloaterExperiences>(), nameMap, "ExperienceAcquireFailed");
responder->mCallback = boost::bind(&LLFloaterExperiences::checkPurchaseInfo, this, _1, _2);
responder->mCallback = boost::bind(&LLFloaterExperiences::checkAndOpen, this, _1, _2);
LLHTTPClient::post(url, content, responder);
}
}

View File

@ -49,12 +49,14 @@ protected:
LLPanelExperiences* addTab(const std::string& name, bool select);
bool updatePermissions(const LLSD& permission);
void sendPurchaseRequest() const;
void sendPurchaseRequest();
void checkPurchaseInfo(LLPanelExperiences* panel, const LLSD& content)const;
void checkAndOpen(LLPanelExperiences* panel, const LLSD& content) const;
void updateInfo(std::string experiences, std::string tab);
private:
std::vector<LLUUID> mPrepurchaseIds;
};
#endif //LL_LLFLOATEREXPERIENCES_H

View File

@ -98,6 +98,16 @@ void LLPanelExperiences::setExperienceList( const LLSD& experiences )
mExperiencesList->sort();
}
void LLPanelExperiences::getExperienceIdsList(std::vector<LLUUID>& result)
{
std::vector<LLSD> ids;
mExperiencesList->getValues(ids);
for (LLSD::array_const_iterator it = ids.begin(); it != ids.end(); ++it)
{
result.push_back(it->asUUID());
}
}
LLPanelExperiences* LLPanelExperiences::create(const std::string& name)
{
LLPanelExperiences* panel= new LLPanelExperiences();

View File

@ -58,6 +58,7 @@ public:
/*virtual*/ void onClosePanel();
void setExperienceList(const LLSD& experiences);
void getExperienceIdsList(std::vector<LLUUID>& result);
LLExperienceItem* getSelectedExperienceItem();
void removeExperiences( const LLSD& ids );

View File

@ -362,7 +362,7 @@ private:
LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material);
}
object->setTEMaterialParams(face, new_material, TRUE);
object->setTEMaterialParams(face, new_material);
return new_material;
}
return NULL;

View File

@ -2212,7 +2212,7 @@ void LLSelectMgr::selectionRemoveMaterial()
{
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
LLMaterialMgr::getInstance()->remove(object->getID(),face);
object->setTEMaterialParams(face, NULL, FALSE);
object->setTEMaterialParams(face, NULL);
}
return true;
}

View File

@ -4754,7 +4754,7 @@ S32 LLViewerObject::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID
return retval;
}
S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
S32 retval = 0;
const LLTextureEntry *tep = getTE(te);
@ -4764,14 +4764,13 @@ S32 LLViewerObject::setTEMaterialParams(const U8 te, const LLMaterialPtr pMateri
return 0;
}
setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams, isInitFromServer);
retval = LLPrimitive::setTEMaterialParams(te, pMaterialParams);
LL_DEBUGS("Material") << "Changing material params for te " << (S32)te
<< ", object " << mID
<< " (" << retval << ")"
<< LL_ENDL;
setTENormalMap(te, (pMaterialParams) ? pMaterialParams->getNormalID() : LLUUID::null);
setTESpecularMap(te, (pMaterialParams) ? pMaterialParams->getSpecularID() : LLUUID::null);
refreshMaterials();
return retval;

View File

@ -335,7 +335,7 @@ public:
/*virtual*/ S32 setTEMediaFlags(const U8 te, const U8 media_flags );
/*virtual*/ S32 setTEGlow(const U8 te, const F32 glow);
/*virtual*/ S32 setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
// Used by Materials update functions to properly kick off rebuilds
// of VBs etc when materials updates require changes.

View File

@ -2084,7 +2084,7 @@ void LLVOVolume::setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLM
LLTextureEntry* texture_entry = pVol->getTE(te);
if (texture_entry && (texture_entry->getMaterialID() == pMaterialID))
{
pVol->setTEMaterialParams(te, pMaterialParams, FALSE);
pVol->setTEMaterialParams(te, pMaterialParams);
}
}
}
@ -2155,7 +2155,7 @@ bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture)
for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
{
LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
LLViewerObject::setTEMaterialParams(it->first, it->second, FALSE);
LLViewerObject::setTEMaterialParams(it->first, it->second);
}
//clear wait-list
@ -2237,7 +2237,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it)
{
LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second);
LLViewerObject::setTEMaterialParams(it->first, it->second, FALSE);
LLViewerObject::setTEMaterialParams(it->first, it->second);
}
//clear wait-list
@ -2246,7 +2246,7 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture)
return 0 != new_material.size();
}
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams, bool isInitFromServer)
S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams)
{
LLMaterialPtr pMaterial = const_cast<LLMaterialPtr&>(pMaterialParams);
@ -2343,7 +2343,7 @@ S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialPa
}
}
S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial, isInitFromServer);
S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial);
LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res
<< ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )

View File

@ -194,7 +194,7 @@ public:
static void setTEMaterialParamsCallbackTE(const LLUUID& objectID, const LLMaterialID& pMaterialID, const LLMaterialPtr pMaterialParams, U32 te);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams, bool isInitFromServer);
/*virtual*/ S32 setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams);
/*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t);
/*virtual*/ S32 setTEScaleS(const U8 te, const F32 s);
/*virtual*/ S32 setTEScaleT(const U8 te, const F32 t);