diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/newview/llfloaterobjectweights.cpp | 115 | ||||
| -rw-r--r-- | indra/newview/llfloaterobjectweights.h | 36 | ||||
| -rw-r--r-- | indra/newview/llfloatertools.cpp | 113 | ||||
| -rw-r--r-- | indra/newview/llfloatertools.h | 4 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_tools.xml | 10 | 
5 files changed, 139 insertions, 139 deletions
| diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 7ad34431fb..7bfa8454b6 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -33,68 +33,36 @@  #include "lltextbox.h"  #include "llagent.h" -#include "llselectmgr.h"  #include "llviewerparcelmgr.h"  #include "llviewerregion.h" -/** - * struct LLCrossParcelFunctor - * - * A functor that checks whether a bounding box for all - * selected objects crosses a region or parcel bounds. - */ -struct LLCrossParcelFunctor : public LLSelectedObjectFunctor +// virtual +bool LLCrossParcelFunctor::apply(LLViewerObject* obj)  { -	/*virtual*/ bool apply(LLViewerObject* obj) -	{ -		// Add the root object box. -		mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned()); +	// Add the root object box. +	mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned()); -		// Extend the bounding box across all the children. -		LLViewerObject::const_child_list_t children = obj->getChildren(); -		for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); -			 iter != children.end(); iter++) -		{ -			LLViewerObject* child = *iter; -			mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); -		} - -		bool result = false; - -		LLViewerRegion* region = obj->getRegion(); -		if (region) -		{ -			std::vector<LLBBox> boxes; -			boxes.push_back(mBoundingBox); -			result = region->objectsCrossParcel(boxes); -		} - -		return result; +	// Extend the bounding box across all the children. +	LLViewerObject::const_child_list_t children = obj->getChildren(); +	for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); +		 iter != children.end(); iter++) +	{ +		LLViewerObject* child = *iter; +		mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned());  	} -private: -	LLBBox	mBoundingBox; -}; +	bool result = false; -/** - * Class LLLandImpactsObserver - * - * An observer class to monitor parcel selection and update - * the land impacts data from a parcel containing the selected object. - */ -class LLLandImpactsObserver : public LLParcelObserver -{ -public: -	virtual void changed() +	LLViewerRegion* region = obj->getRegion(); +	if (region)  	{ -		LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights"); -		if(object_weights_floater) -		{ -			object_weights_floater->updateLandImpacts(); -		} +		std::vector<LLBBox> boxes; +		boxes.push_back(mBoundingBox); +		result = region->objectsCrossParcel(boxes);  	} -}; +	return result; +}  LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key)  :	LLFloater(key), @@ -107,22 +75,12 @@ LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key)  	mSelectedOnLand(NULL),  	mRezzedOnLand(NULL),  	mRemainingCapacity(NULL), -	mTotalCapacity(NULL), -	mLandImpactsObserver(NULL) +	mTotalCapacity(NULL)  { -	mLandImpactsObserver = new LLLandImpactsObserver(); -	LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver);  }  LLFloaterObjectWeights::~LLFloaterObjectWeights()  { -	mObjectSelection = NULL; -	mParcelSelection = NULL; - -	mSelectMgrConnection.disconnect(); - -	LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver); -	delete mLandImpactsObserver;  }  // virtual @@ -147,21 +105,8 @@ BOOL LLFloaterObjectWeights::postBuild()  // virtual  void LLFloaterObjectWeights::onOpen(const LLSD& key)  { -	mSelectMgrConnection = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLFloaterObjectWeights::refresh, this)); - -	mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); -	mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); -  	refresh(); -} - -// virtual -void LLFloaterObjectWeights::onClose(bool app_quitting) -{ -	mSelectMgrConnection.disconnect(); - -	mObjectSelection = NULL; -	mParcelSelection = NULL; +	updateLandImpacts(LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel());  }  // virtual @@ -190,9 +135,8 @@ void LLFloaterObjectWeights::setErrorStatus(U32 status, const std::string& reaso  	toggleWeightsLoadingIndicators(false);  } -void LLFloaterObjectWeights::updateLandImpacts() +void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel)  { -	LLParcel *parcel = mParcelSelection->getParcel();  	if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty())  	{  		updateIfNothingSelected(); @@ -241,21 +185,6 @@ void LLFloaterObjectWeights::refresh()  			toggleLandImpactsLoadingIndicators(false);  		} -		else -		{ -			LLViewerObject* selected_object = mObjectSelection->getFirstObject(); -			if (selected_object) -			{ -				// Select a parcel at the currently selected object's position. -				LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); - -				toggleLandImpactsLoadingIndicators(true); -			} -			else -			{ -				llwarns << "Failed to get selected object" << llendl; -			} -		}  		LLViewerRegion* region = gAgent.getRegion();  		if (region && region->capabilitiesReceived()) diff --git a/indra/newview/llfloaterobjectweights.h b/indra/newview/llfloaterobjectweights.h index 50d028909e..64aa2f2bbe 100644 --- a/indra/newview/llfloaterobjectweights.h +++ b/indra/newview/llfloaterobjectweights.h @@ -30,36 +30,45 @@  #include "llfloater.h"  #include "llaccountingcostmanager.h" +#include "llselectmgr.h" -class LLLandImpactsObserver; -class LLObjectSelection; -class LLParcelSelection; +class LLParcel;  class LLTextBox; +/** + * struct LLCrossParcelFunctor + * + * A functor that checks whether a bounding box for all + * selected objects crosses a region or parcel bounds. + */ +struct LLCrossParcelFunctor : public LLSelectedObjectFunctor +{ +	/*virtual*/ bool apply(LLViewerObject* obj); + +private: +	LLBBox	mBoundingBox; +}; + +  class LLFloaterObjectWeights : public LLFloater, LLAccountingCostObserver  {  public:  	LOG_CLASS(LLFloaterObjectWeights); -	typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; -	typedef LLSafeHandle<LLParcelSelection> LLParcelSelectionHandle; -  	LLFloaterObjectWeights(const LLSD& key);  	~LLFloaterObjectWeights();  	/*virtual*/ BOOL postBuild();  	/*virtual*/ void onOpen(const LLSD& key); -	/*virtual*/ void onClose(bool app_quitting);  	/*virtual*/ void onWeightsUpdate(const SelectionCost& selection_cost);  	/*virtual*/ void setErrorStatus(U32 status, const std::string& reason); -	void updateLandImpacts(); - -private: +	void updateLandImpacts(const LLParcel* parcel);  	void refresh(); +private:  	void toggleWeightsLoadingIndicators(bool visible);  	void toggleLandImpactsLoadingIndicators(bool visible); @@ -77,13 +86,6 @@ private:  	LLTextBox		*mRezzedOnLand;  	LLTextBox		*mRemainingCapacity;  	LLTextBox		*mTotalCapacity; - -	LLLandImpactsObserver		*mLandImpactsObserver; - -	LLObjectSelectionHandle		mObjectSelection; -	LLParcelSelectionHandle		mParcelSelection; - -	boost::signals2::connection	mSelectMgrConnection;  };  #endif //LL_LLFLOATEROBJECTWEIGHTS_H diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index 48aeeafcfd..1008b4a6e4 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -41,6 +41,7 @@  #include "llfloaterbuildoptions.h"  #include "llfloatermediasettings.h"  #include "llfloateropenobject.h" +#include "llfloaterobjectweights.h"  #include "llfloaterreg.h"  #include "llfocusmgr.h"  #include "llmediaentry.h" @@ -54,6 +55,7 @@  #include "llpanelobject.h"  #include "llpanelvolume.h"  #include "llpanelpermissions.h" +#include "llparcel.h"  #include "llradiogroup.h"  #include "llresmgr.h"  #include "llselectmgr.h" @@ -117,6 +119,24 @@ void commit_radio_group_edit(LLUICtrl* ctrl);  void commit_radio_group_land(LLUICtrl* ctrl);  void commit_slider_zoom(LLUICtrl *ctrl); +/** + * Class LLLandImpactsObserver + * + * An observer class to monitor parcel selection and update + * the land impacts data from a parcel containing the selected object. + */ +class LLLandImpactsObserver : public LLParcelObserver +{ +public: +	virtual void changed() +	{ +		LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build"); +		if(tools_floater) +		{ +			tools_floater->updateLandImpacts(); +		} +	} +};  //static  void*	LLFloaterTools::createPanelPermissions(void* data) @@ -344,6 +364,9 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)  	mCostTextBorder(NULL),  	mTabLand(NULL), + +	mLandImpactsObserver(NULL), +  	mDirty(TRUE),  	mNeedMediaTitle(TRUE)  { @@ -375,12 +398,17 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)  	mCommitCallbackRegistrar.add("BuildTool.LinkObjects",		boost::bind(&LLSelectMgr::linkObjects, LLSelectMgr::getInstance()));  	mCommitCallbackRegistrar.add("BuildTool.UnlinkObjects",		boost::bind(&LLSelectMgr::unlinkObjects, LLSelectMgr::getInstance())); +	mLandImpactsObserver = new LLLandImpactsObserver(); +	LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver);  }  LLFloaterTools::~LLFloaterTools()  {  	// children automatically deleted  	gFloaterTools = NULL; + +	LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver); +	delete mLandImpactsObserver;  }  void LLFloaterTools::setStatusText(const std::string& text) @@ -449,45 +477,44 @@ void LLFloaterTools::refresh()  	else  #endif  	{ -		F32 link_phys_cost  = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetPhysicsCost();  		F32 link_cost  = LLSelectMgr::getInstance()->getSelection()->getSelectedLinksetCost(); -		S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount();  		S32 link_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); -		LLStringUtil::format_map_t selection_args; -		selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); -		selection_args["PRIM_COUNT"] = llformat("%.1d", prim_count); - -		std::ostringstream selection_info; - -		bool show_mesh_cost = gMeshRepo.meshRezEnabled(); - -		if (show_mesh_cost) +		LLCrossParcelFunctor func; +		if (LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, true))  		{ -			LLStringUtil::format_map_t prim_equiv_args; -			prim_equiv_args["SEL_WEIGHT"] = llformat("%.1d", (S32)link_cost); -			selection_args["PE_STRING"] = getString("status_selectprimequiv", prim_equiv_args); +			// Selection crosses parcel bounds. +			// We don't display remaining land capacity in this case. +			const LLStringExplicit empty_str(""); +			childSetTextArg("remaining_capacity", "[CAPACITY_STRING]", empty_str);  		}  		else  		{ -			selection_args["PE_STRING"] = ""; +			LLViewerObject* selected_object = mObjectSelection->getFirstObject(); +			if (selected_object) +			{ +				// Select a parcel at the currently selected object's position. +				LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); +			} +			else +			{ +				llwarns << "Failed to get selected object" << llendl; +			}  		} -		selection_info << getString("status_selectcount", selection_args); - - -		selection_info << ","; +		LLStringUtil::format_map_t selection_args; +		selection_args["OBJ_COUNT"] = llformat("%.1d", link_count); +		selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); -		S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); +		std::ostringstream selection_info; -		childSetTextArg("selection_weight", "[PHYS_WEIGHT]", llformat("%.1f", link_phys_cost)); -		childSetTextArg("selection_weight", "[DISP_WEIGHT]", llformat("%.1d", render_cost)); +		selection_info << getString("status_selectcount", selection_args);  		getChild<LLTextBox>("selection_count")->setText(selection_info.str());  		bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty();  		childSetVisible("selection_count",  have_selection); -		childSetVisible("selection_weight", have_selection); +		childSetVisible("remaining_capacity", have_selection);  		childSetVisible("selection_empty", !have_selection);  	} @@ -500,6 +527,13 @@ void LLFloaterTools::refresh()  	refreshMedia();  	mPanelContents->refresh();  	mPanelLandInfo->refresh(); + +	// Refresh the advanced weights floater +	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights"); +	if(object_weights_floater && object_weights_floater->getVisible()) +	{ +		object_weights_floater->refresh(); +	}  }  void LLFloaterTools::draw() @@ -758,7 +792,7 @@ void LLFloaterTools::updatePopup(LLCoordGL center, MASK mask)  	bool have_selection = !LLSelectMgr::getInstance()->getSelection()->isEmpty();  	getChildView("selection_count")->setVisible(!land_visible && have_selection); -	getChildView("selection_weight")->setVisible(!land_visible && have_selection); +	getChildView("remaining_capacity")->setVisible(!land_visible && have_selection);  	getChildView("selection_empty")->setVisible(!land_visible && !have_selection);  	mTab->setVisible(!land_visible); @@ -1086,6 +1120,37 @@ bool LLFloaterTools::selectedMediaEditable()  	return selected_Media_editable;  } +void LLFloaterTools::updateLandImpacts() +{ +	LLParcel *parcel = mParcelSelection->getParcel(); +	if (!parcel) +	{ +		return; +	} + +	S32 rezzed_prims = parcel->getSimWidePrimCount(); +	S32 total_capacity = parcel->getSimWideMaxPrimCapacity(); + +	std::string remaining_capacity_str = ""; + +	bool show_mesh_cost = gMeshRepo.meshRezEnabled(); +	if (show_mesh_cost) +	{ +		LLStringUtil::format_map_t remaining_capacity_args; +		remaining_capacity_args["LAND_CAPACITY"] = llformat("%d", total_capacity - rezzed_prims); +		remaining_capacity_str = getString("status_remaining_capacity", remaining_capacity_args); +	} + +	childSetTextArg("remaining_capacity", "[CAPACITY_STRING]", remaining_capacity_str); + +	// Update land impacts info in the weights floater +	LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance<LLFloaterObjectWeights>("object_weights"); +	if(object_weights_floater) +	{ +		object_weights_floater->updateLandImpacts(parcel); +	} +} +  void LLFloaterTools::getMediaState()  {  	LLObjectSelectionHandle selected_objects =LLSelectMgr::getInstance()->getSelection(); diff --git a/indra/newview/llfloatertools.h b/indra/newview/llfloatertools.h index 8c4cb721d3..63ed9dc82b 100644 --- a/indra/newview/llfloatertools.h +++ b/indra/newview/llfloatertools.h @@ -47,6 +47,7 @@ class LLMediaCtrl;  class LLTool;  class LLParcelSelection;  class LLObjectSelection; +class LLLandImpactsObserver;  typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle; @@ -103,6 +104,7 @@ public:  	void updateMediaTitle();  	void navigateToTitleMedia( const std::string url );  	bool selectedMediaEditable(); +	void updateLandImpacts();  private:  	void refresh(); @@ -180,6 +182,8 @@ public:  	LLTabContainer*			mTabLand; +	LLLandImpactsObserver*  mLandImpactsObserver; +  	LLParcelSelectionHandle	mParcelSelection;  	LLObjectSelectionHandle	mObjectSelection; diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index 03d6c84266..9b02f7d273 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -48,11 +48,11 @@      </floater.string>      <floater.string       name="status_selectcount"> -        [OBJ_COUNT] objects ( [PRIM_COUNT] prims[PE_STRING] ) selected +        [OBJ_COUNT] objects selected, land impact [LAND_IMPACT]      </floater.string>      <floater.string -     name="status_selectprimequiv"> -        , [SEL_WEIGHT] prim equivs +     name="status_remaining_capacity"> +        Remaining capacity [LAND_CAPACITY].      </floater.string>      <button       follows="left|top" @@ -738,11 +738,11 @@  	  font="SansSerifSmall"  	  layout="topleft"  	  left="10" -	  name="selection_weight" +	  name="remaining_capacity"  	  top_pad="0"  	  visible="false"  	  width="280"> -	  Physics weight [PHYS_WEIGHT], Render Cost [DISP_WEIGHT]. [secondlife:///app/openfloater/object_weights More info] +	  [CAPACITY_STRING] [secondlife:///app/openfloater/object_weights More info]  	</text>      <!-- <text -->      <!-- text_color="LtGray_50" --> | 
