summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelobject.cpp')
-rw-r--r--indra/newview/llpanelobject.cpp90
1 files changed, 48 insertions, 42 deletions
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 73a8fbe3aa..8fa6beb474 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -135,23 +135,24 @@ BOOL LLPanelObject::postBuild()
// PhysicsShapeType combobox
mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl");
- childSetCommitCallback("Physics Shape Type Combo Ctrl", onCommitPhysicsParam, this);
-
+ mComboPhysicsShapeType->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsShapeType, this, _1, mComboPhysicsShapeType));
+
// PhysicsGravity
mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity");
- childSetCommitCallback("Physics Gravity", onCommitPhysicsParam, this);
+ mSpinPhysicsGravity->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsGravity, this, _1, mSpinPhysicsGravity));
// PhysicsFriction
mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction");
- childSetCommitCallback("Physics Friction", onCommitPhysicsParam, this);
-
+ mSpinPhysicsFriction->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsFriction, this, _1, mSpinPhysicsFriction));
+
// PhysicsDensity
mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density");
- childSetCommitCallback("Physics Density", onCommitPhysicsParam, this);
+ mSpinPhysicsDensity->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsDensity, this, _1, mSpinPhysicsDensity));
// PhysicsRestitution
mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution");
- childSetCommitCallback("Physics Restitution", onCommitPhysicsParam, this);
+ mSpinPhysicsRestitution->setCommitCallback(boost::bind(&LLPanelObject::sendPhysicsRestitution, this, _1, mSpinPhysicsRestitution));
+
// Position
mLabelPosition = getChild<LLTextBox>("label position");
@@ -1281,35 +1282,46 @@ void LLPanelObject::sendIsPhantom()
}
}
-#include "llsdutil.h"
-class CostResponder : public LLHTTPClient::Responder
+void LLPanelObject::sendPhysicsShapeType(LLUICtrl* ctrl, void* userdata)
{
-public:
- CostResponder(U32 id) { mID = id; }
- virtual void result(const LLSD& content) { llinfos << ll_pretty_print_sd(content) << llendl; }
+ U8 type = ctrl->getValue().asInteger();
+ LLSelectMgr::getInstance()->selectionSetPhysicsType(type);
- U32 mID;
-};
+ refreshCost();
+}
-void LLPanelObject::sendPhysicsParam()
+void LLPanelObject::sendPhysicsGravity(LLUICtrl* ctrl, void* userdata)
{
- LLSD physicsType = mComboPhysicsShapeType->getValue();
-
- U8 type = physicsType.asInteger();
- F32 gravity = mSpinPhysicsGravity->get();
- F32 friction = mSpinPhysicsFriction->get();
- F32 density = mSpinPhysicsDensity->get();
- F32 restitution = mSpinPhysicsRestitution->get();
-
- LLSelectMgr::getInstance()->selectionUpdatePhysicsParam(type, gravity, friction,
- density, restitution);
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetGravity(val);
+}
- std::string url = gAgent.getRegion()->getCapability("GetObjectCost");
- LLSD body = LLSD::emptyArray();
-
- body.append(LLSelectMgr::getInstance()->getSelection()->getFirstObject()->getID());
+void LLPanelObject::sendPhysicsFriction(LLUICtrl* ctrl, void* userdata)
+{
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetFriction(val);
+}
+
+void LLPanelObject::sendPhysicsRestitution(LLUICtrl* ctrl, void* userdata)
+{
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetRestitution(val);
+}
+
+void LLPanelObject::sendPhysicsDensity(LLUICtrl* ctrl, void* userdata)
+{
+ F32 val = ctrl->getValue().asReal();
+ LLSelectMgr::getInstance()->selectionSetDensity(val);
+}
+
+void LLPanelObject::refreshCost()
+{
+ LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getFirstObject();
- LLHTTPClient::post( url, body, new CostResponder(body[0].asInteger()) );
+ if (obj)
+ {
+ obj->getObjectCost();
+ }
}
void LLPanelObject::sendCastShadows()
@@ -1911,7 +1923,8 @@ void LLPanelObject::refresh()
mRootObject = NULL;
}
- bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled");
+ bool enable_mesh = gSavedSettings.getBOOL("MeshEnabled") &&
+ !gAgent.getRegion()->getCapability("GetMesh").empty();
getChildView("label physicsshapetype")->setVisible(enable_mesh);
getChildView("Physics Shape Type Combo Ctrl")->setVisible(enable_mesh);
@@ -1921,10 +1934,10 @@ void LLPanelObject::refresh()
getChildView("Physics Density")->setVisible(enable_mesh);
getChildView("Physics Restitution")->setVisible(enable_mesh);
- // if mesh isn't enabled we want to the scale max to be 10
- getChild<LLSpinCtrl>("Scale X")->setMaxValue(enable_mesh ? 64 : 10);
- getChild<LLSpinCtrl>("Scale Y")->setMaxValue(enable_mesh ? 64 : 10);
- getChild<LLSpinCtrl>("Scale Z")->setMaxValue(enable_mesh ? 64 : 10);
+ F32 max_scale = DEFAULT_MAX_PRIM_SCALE_NO_MESH;
+ getChild<LLSpinCtrl>("Scale X")->setMaxValue(max_scale);
+ getChild<LLSpinCtrl>("Scale Y")->setMaxValue(max_scale);
+ getChild<LLSpinCtrl>("Scale Z")->setMaxValue(max_scale);
LLComboBox* sculpt_combo = getChild<LLComboBox>("sculpt type control");
BOOL found = sculpt_combo->itemExists("Mesh");
@@ -2121,13 +2134,6 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata )
}
// static
-void LLPanelObject::onCommitPhysicsParam(LLUICtrl* ctrl, void* userdata )
-{
- LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendPhysicsParam();
-}
-
-// static
void LLPanelObject::onCommitCastShadows( LLUICtrl* ctrl, void* userdata )
{
LLPanelObject* self = (LLPanelObject*) userdata;