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.cpp152
1 files changed, 94 insertions, 58 deletions
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 669ff3ffd6..6b687846ae 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -137,11 +137,27 @@ BOOL LLPanelObject::postBuild()
// Phantom checkbox
mCheckPhantom = getChild<LLCheckBoxCtrl>("Phantom Checkbox Ctrl");
childSetCommitCallback("Phantom Checkbox Ctrl",onCommitPhantom,this);
-
+
// PhysicsShapeType combobox
mComboPhysicsShapeType = getChild<LLComboBox>("Physics Shape Type Combo Ctrl");
- childSetCommitCallback("Physics Shape Type Combo Ctrl", onCommitPhysicsShapeType,this);
+ childSetCommitCallback("Physics Shape Type Combo Ctrl", onCommitPhysicsParam, this);
+
+ // PhysicsGravity
+ mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity");
+ childSetCommitCallback("Physics Gravity", onCommitPhysicsParam, this);
+
+ // PhysicsFriction
+ mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction");
+ childSetCommitCallback("Physics Friction", onCommitPhysicsParam, this);
+ // PhysicsDensity
+ mSpinPhysicsDensity = getChild<LLSpinCtrl>("Physics Density");
+ childSetCommitCallback("Physics Density", onCommitPhysicsParam, this);
+
+ // PhysicsRestitution
+ mSpinPhysicsRestitution = getChild<LLSpinCtrl>("Physics Restitution");
+ childSetCommitCallback("Physics Restitution", onCommitPhysicsParam, this);
+
// Position
mLabelPosition = getChild<LLTextBox>("label position");
mCtrlPosX = getChild<LLSpinCtrl>("Pos X");
@@ -176,7 +192,6 @@ BOOL LLPanelObject::postBuild()
//--------------------------------------------------------
// material type popup
- mLabelMaterial = getChild<LLTextBox>("label material");
mComboMaterial = getChild<LLComboBox>("material");
childSetCommitCallback("material",onCommitMaterial,this);
mComboMaterial->removeall();
@@ -193,7 +208,6 @@ BOOL LLPanelObject::postBuild()
mComboMaterialItemCount = mComboMaterial->getItemCount();
// Base Type
- mLabelBaseType = getChild<LLTextBox>("label basetype");
mComboBaseType = getChild<LLComboBox>("comboBaseType");
childSetCommitCallback("comboBaseType",onCommitParametric,this);
@@ -324,7 +338,6 @@ LLPanelObject::LLPanelObject()
mIsPhysical(FALSE),
mIsTemporary(FALSE),
mIsPhantom(FALSE),
- mPhysicsShapeType(0),
mCastShadows(TRUE),
mSelectedType(MI_BOX),
mSculptTextureRevert(LLUUID::null),
@@ -471,17 +484,17 @@ void LLPanelObject::getState( )
BOOL editable = root_objectp->permModify();
// Select Single Message
- childSetVisible("select_single", FALSE);
- childSetVisible("edit_object", FALSE);
+ getChildView("select_single")->setVisible( FALSE);
+ getChildView("edit_object")->setVisible( FALSE);
if (!editable || single_volume || selected_count <= 1)
{
- childSetVisible("edit_object", TRUE);
- childSetEnabled("edit_object", TRUE);
+ getChildView("edit_object")->setVisible( TRUE);
+ getChildView("edit_object")->setEnabled(TRUE);
}
else
{
- childSetVisible("select_single", TRUE);
- childSetEnabled("select_single", TRUE);
+ getChildView("select_single")->setVisible( TRUE);
+ getChildView("select_single")->setEnabled(TRUE);
}
// Lock checkbox - only modifiable if you own the object.
BOOL self_owned = (gAgent.getID() == owner_id);
@@ -532,9 +545,20 @@ void LLPanelObject::getState( )
mCheckPhantom->set( mIsPhantom );
mCheckPhantom->setEnabled( roots_selected>0 && editable && !is_flexible );
- mPhysicsShapeType = objectp->getPhysicsShapeType();
- mComboPhysicsShapeType->setCurrentByIndex(mPhysicsShapeType);
+ mComboPhysicsShapeType->setCurrentByIndex(objectp->getPhysicsShapeType());
mComboPhysicsShapeType->setEnabled(editable);
+
+ mSpinPhysicsGravity->set(objectp->getPhysicsGravity());
+ mSpinPhysicsGravity->setEnabled(editable);
+
+ mSpinPhysicsFriction->set(objectp->getPhysicsFriction());
+ mSpinPhysicsFriction->setEnabled(editable);
+
+ mSpinPhysicsDensity->set(objectp->getPhysicsDensity());
+ mSpinPhysicsDensity->setEnabled(editable);
+
+ mSpinPhysicsRestitution->set(objectp->getPhysicsRestitution());
+ mSpinPhysicsRestitution->setEnabled(editable);
#if 0 // 1.9.2
mCastShadows = root_objectp->flagCastShadows();
@@ -557,7 +581,6 @@ void LLPanelObject::getState( )
if (editable && single_volume && material_same)
{
mComboMaterial->setEnabled( TRUE );
- mLabelMaterial->setEnabled( TRUE );
if (material_code == LL_MCODE_LIGHT)
{
if (mComboMaterial->getItemCount() == mComboMaterialItemCount)
@@ -579,7 +602,6 @@ void LLPanelObject::getState( )
else
{
mComboMaterial->setEnabled( FALSE );
- mLabelMaterial->setEnabled( FALSE );
}
//----------------------------------------------------------------------------
@@ -988,7 +1010,6 @@ void LLPanelObject::getState( )
}
// Update field enablement
- mLabelBaseType ->setEnabled( enabled );
mComboBaseType ->setEnabled( enabled );
mLabelCut ->setEnabled( enabled );
@@ -1007,19 +1028,19 @@ void LLPanelObject::getState( )
mLabelSkew ->setEnabled( enabled );
mSpinSkew ->setEnabled( enabled );
- childSetVisible("scale_hole", FALSE);
- childSetVisible("scale_taper", FALSE);
+ getChildView("scale_hole")->setVisible( FALSE);
+ getChildView("scale_taper")->setVisible( FALSE);
if (top_size_x_visible || top_size_y_visible)
{
if (size_is_hole)
{
- childSetVisible("scale_hole", TRUE);
- childSetEnabled("scale_hole", enabled);
+ getChildView("scale_hole")->setVisible( TRUE);
+ getChildView("scale_hole")->setEnabled(enabled);
}
else
{
- childSetVisible("scale_taper", TRUE);
- childSetEnabled("scale_taper", enabled);
+ getChildView("scale_taper")->setVisible( TRUE);
+ getChildView("scale_taper")->setEnabled(enabled);
}
}
@@ -1030,27 +1051,27 @@ void LLPanelObject::getState( )
mSpinShearX ->setEnabled( enabled );
mSpinShearY ->setEnabled( enabled );
- childSetVisible("advanced_cut", FALSE);
- childSetVisible("advanced_dimple", FALSE);
- childSetVisible("advanced_slice", FALSE);
+ getChildView("advanced_cut")->setVisible( FALSE);
+ getChildView("advanced_dimple")->setVisible( FALSE);
+ getChildView("advanced_slice")->setVisible( FALSE);
if (advanced_cut_visible)
{
if (advanced_is_dimple)
{
- childSetVisible("advanced_dimple", TRUE);
- childSetEnabled("advanced_dimple", enabled);
+ getChildView("advanced_dimple")->setVisible( TRUE);
+ getChildView("advanced_dimple")->setEnabled(enabled);
}
else if (advanced_is_slice)
{
- childSetVisible("advanced_slice", TRUE);
- childSetEnabled("advanced_slice", enabled);
+ getChildView("advanced_slice")->setVisible( TRUE);
+ getChildView("advanced_slice")->setEnabled(enabled);
}
else
{
- childSetVisible("advanced_cut", TRUE);
- childSetEnabled("advanced_cut", enabled);
+ getChildView("advanced_cut")->setVisible( TRUE);
+ getChildView("advanced_cut")->setEnabled(enabled);
}
}
@@ -1241,20 +1262,33 @@ void LLPanelObject::sendIsPhantom()
}
}
-void LLPanelObject::sendPhysicsShapeType()
+#include "llsdutil.h"
+class CostResponder : public LLHTTPClient::Responder
{
- U8 value = (U8)mComboPhysicsShapeType->getCurrentIndex();
- if (mPhysicsShapeType != value)
- {
- LLSelectMgr::getInstance()->selectionUpdatePhysicsShapeType(value);
- mPhysicsShapeType = value;
-
- llinfos << "update physics shape type sent" << llendl;
- }
- else
- {
- llinfos << "update physics shape type not changed" << llendl;
- }
+public:
+ CostResponder(U32 id) { mID = id; }
+ virtual void result(const LLSD& content) { llinfos << ll_pretty_print_sd(content) << llendl; }
+
+ U32 mID;
+};
+
+void LLPanelObject::sendPhysicsParam()
+{
+ U8 type = (U8)mComboPhysicsShapeType->getCurrentIndex();
+ F32 gravity = mSpinPhysicsGravity->get();
+ F32 friction = mSpinPhysicsFriction->get();
+ F32 density = mSpinPhysicsDensity->get();
+ F32 restitution = mSpinPhysicsRestitution->get();
+
+ LLSelectMgr::getInstance()->selectionUpdatePhysicsParam(type, gravity, friction,
+ density, restitution);
+
+ std::string url = gAgent.getRegion()->getCapability("GetObjectCost");
+ LLSD body = LLSD::emptyArray();
+
+ body.append(LLSelectMgr::getInstance()->getSelection()->getFirstObject()->getID());
+
+ LLHTTPClient::post( url, body, new CostResponder(body[0].asInteger()) );
}
void LLPanelObject::sendCastShadows()
@@ -1930,19 +1964,21 @@ void LLPanelObject::clearCtrls()
mCheckTemporary ->setEnabled( FALSE );
mCheckPhantom ->set(FALSE);
mCheckPhantom ->setEnabled( FALSE );
- mComboPhysicsShapeType->setCurrentByIndex(0);
- mComboPhysicsShapeType->setEnabled(FALSE);
+
+ mSpinPhysicsGravity->setEnabled(FALSE);
+ mSpinPhysicsFriction->setEnabled(FALSE);
+ mSpinPhysicsDensity->setEnabled(FALSE);
+ mSpinPhysicsRestitution->setEnabled(FALSE);
+
#if 0 // 1.9.2
mCheckCastShadows->set(FALSE);
mCheckCastShadows->setEnabled( FALSE );
#endif
mComboMaterial ->setEnabled( FALSE );
- mLabelMaterial ->setEnabled( FALSE );
// Disable text labels
mLabelPosition ->setEnabled( FALSE );
mLabelSize ->setEnabled( FALSE );
mLabelRotation ->setEnabled( FALSE );
- mLabelBaseType ->setEnabled( FALSE );
mLabelCut ->setEnabled( FALSE );
mLabelHollow ->setEnabled( FALSE );
mLabelHoleType ->setEnabled( FALSE );
@@ -1953,15 +1989,15 @@ void LLPanelObject::clearCtrls()
mLabelRadiusOffset->setEnabled( FALSE );
mLabelRevolutions->setEnabled( FALSE );
- childSetVisible("select_single", FALSE);
- childSetVisible("edit_object", TRUE);
- childSetEnabled("edit_object", FALSE);
+ getChildView("select_single")->setVisible( FALSE);
+ getChildView("edit_object")->setVisible( TRUE);
+ getChildView("edit_object")->setEnabled(FALSE);
- childSetEnabled("scale_hole", FALSE);
- childSetEnabled("scale_taper", FALSE);
- childSetEnabled("advanced_cut", FALSE);
- childSetEnabled("advanced_dimple", FALSE);
- childSetVisible("advanced_slice", FALSE);
+ getChildView("scale_hole")->setEnabled(FALSE);
+ getChildView("scale_taper")->setEnabled(FALSE);
+ getChildView("advanced_cut")->setEnabled(FALSE);
+ getChildView("advanced_dimple")->setEnabled(FALSE);
+ getChildView("advanced_slice")->setVisible( FALSE);
}
//
@@ -2027,10 +2063,10 @@ void LLPanelObject::onCommitPhantom( LLUICtrl* ctrl, void* userdata )
}
// static
-void LLPanelObject::onCommitPhysicsShapeType(LLUICtrl* ctrl, void* userdata )
+void LLPanelObject::onCommitPhysicsParam(LLUICtrl* ctrl, void* userdata )
{
LLPanelObject* self = (LLPanelObject*) userdata;
- self->sendPhysicsShapeType();
+ self->sendPhysicsParam();
}
// static