Subject: Gravity, Friction, Restitution, Density now work with simulator.

From: "Matthew Breindel (Falcon)" <[email-masked]>
Date: Fri, 9 Jul 2010 17:47:58 -0700

---
 indra/newview/llpanelobject.cpp       | 13 ++-----------
 indra/newview/llpanelobject.h         |  1 -
 indra/newview/llselectmgr.cpp         | 13 +++++--------
 indra/newview/llselectmgr.h           |  4 ++--
 indra/newview/llviewerobject.cpp      | 25 ++++++++-----------------
 indra/newview/llviewerobject.h        |  3 ---
 scripts/messages/message_template.msg | 10 +++++-----
 7 files changed, 22 insertions(+), 47 deletions(-)

(limited to 'scripts/messages/message_template.msg')

diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index e972e17894..55e73731c1 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -146,10 +146,6 @@ BOOL	LLPanelObject::postBuild()
 	mSpinPhysicsGravity = getChild<LLSpinCtrl>("Physics Gravity");
 	childSetCommitCallback("Physics Gravity", onCommitPhysicsParam, this);
 
-	// PhysicsMaterialOverride
-	mCheckPhysicsMaterialOverride = getChild<LLCheckBoxCtrl>("Physics Material Override");
-	childSetCommitCallback("Physics Material Override", onCommitPhysicsParam, this);
-
 	// PhysicsFriction
 	mSpinPhysicsFriction = getChild<LLSpinCtrl>("Physics Friction");
 	childSetCommitCallback("Physics Friction", onCommitPhysicsParam, this);
@@ -558,9 +554,6 @@ void LLPanelObject::getState( )
 	mSpinPhysicsGravity->set(objectp->getPhysicsGravity());
 	mSpinPhysicsGravity->setEnabled(editable);
 
-	mCheckPhysicsMaterialOverride->set(objectp->getPhysicsMaterialOverride());
-	mCheckPhysicsMaterialOverride->setEnabled(editable);
-	
 	mSpinPhysicsFriction->set(objectp->getPhysicsFriction());
 	mSpinPhysicsFriction->setEnabled(editable);
 	
@@ -1289,13 +1282,12 @@ void LLPanelObject::sendPhysicsParam()
 {
 	U8 type = (U8)mComboPhysicsShapeType->getCurrentIndex();
 	F32 gravity = mSpinPhysicsGravity->get();
-	BOOL material_override = mCheckPhysicsMaterialOverride->get();
 	F32 friction = mSpinPhysicsFriction->get();
 	F32 density = mSpinPhysicsDensity->get();
 	F32 restitution = mSpinPhysicsRestitution->get();
 	
-	LLSelectMgr::getInstance()->selectionUpdatePhysicsParam(type, gravity, material_override,
-															friction, density, restitution);
+	LLSelectMgr::getInstance()->selectionUpdatePhysicsParam(type, gravity, friction, 
+																density, restitution);
 
 	std::string url = gAgent.getRegion()->getCapability("GetObjectCost");
 	LLSD body = LLSD::emptyArray();
@@ -1982,7 +1974,6 @@ void LLPanelObject::clearCtrls()
 	mComboPhysicsShapeType->setCurrentByIndex(0);
 	mComboPhysicsShapeType->setEnabled(FALSE);
 	mSpinPhysicsGravity->setEnabled(FALSE);
-	mCheckPhysicsMaterialOverride->setEnabled(FALSE);
 	mSpinPhysicsFriction->setEnabled(FALSE);
 	mSpinPhysicsDensity->setEnabled(FALSE);
 	mSpinPhysicsRestitution->setEnabled(FALSE);
diff --git a/indra/newview/llpanelobject.h b/indra/newview/llpanelobject.h
index 2c62002ac6..ca6316f54e 100644
--- a/indra/newview/llpanelobject.h
+++ b/indra/newview/llpanelobject.h
@@ -171,7 +171,6 @@ protected:
 
 	LLComboBox*     mComboPhysicsShapeType;
 	LLSpinCtrl*     mSpinPhysicsGravity;
-	LLCheckBoxCtrl* mCheckPhysicsMaterialOverride;
 	LLSpinCtrl*     mSpinPhysicsFriction;
 	LLSpinCtrl*     mSpinPhysicsDensity;
 	LLSpinCtrl*     mSpinPhysicsRestitution;
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 8ab9910f67..c11a6f289b 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -3939,18 +3939,16 @@ void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows)
 
 struct LLSelectMgrApplyPhysicsParam : public LLSelectedObjectFunctor
 {
-	LLSelectMgrApplyPhysicsParam(U8 type, F32 gravity, BOOL material_override,
-								 F32 friction, F32 density, F32 restitution) :
+	LLSelectMgrApplyPhysicsParam(U8 type, F32 gravity, F32 friction, 
+									F32 density, F32 restitution) :
 		mType(type),
 		mGravity(gravity),
-		mMaterialOverride(material_override),
 		mFriction(friction),
 		mDensity(density),
 		mRestitution(restitution)
 	{}
 	U8 mType;
 	F32 mGravity;
-	BOOL mMaterialOverride;
 	F32 mFriction;
 	F32 mDensity;
 	F32 mRestitution;
@@ -3960,7 +3958,6 @@ struct LLSelectMgrApplyPhysicsParam : public LLSelectedObjectFunctor
 		{
 			object->setPhysicsShapeType( mType );
 			object->setPhysicsGravity(mGravity);
-			object->setPhysicsMaterialOverride(mMaterialOverride);
 			object->setPhysicsFriction(mFriction);
 			object->setPhysicsDensity(mDensity);
 			object->setPhysicsRestitution(mRestitution);
@@ -3971,11 +3968,11 @@ struct LLSelectMgrApplyPhysicsParam : public LLSelectedObjectFunctor
 };

-void LLSelectMgr::selectionUpdatePhysicsParam(U8 type, F32 gravity, BOOL material_override,
-											  F32 friction, F32 density, F32 restitution)
+void LLSelectMgr::selectionUpdatePhysicsParam(U8 type, F32 gravity, F32 friction, 
+											  F32 density, F32 restitution)
 {
 	llwarns << "physics shape type ->" << (U32)type << llendl;
-	LLSelectMgrApplyPhysicsParam func(type, gravity, material_override, friction, density, restitution);
+	LLSelectMgrApplyPhysicsParam func(type, gravity, friction, density, restitution);
 	getSelection()->applyToObjects(&func);	
 }
 
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index e5db0b6df1..54b9b39a8e 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -485,8 +485,8 @@ public:
 	void saveSelectedObjectTextures();
 
 	void selectionUpdatePhysics(BOOL use_physics);
-	void selectionUpdatePhysicsParam(U8 type, F32 gravity, BOOL material_override,
-									 F32 friction, F32 density, F32 restitution);
+	void selectionUpdatePhysicsParam(U8 type, F32 gravity, F32 friction, 
+										F32 density, F32 restitution);
 	void selectionUpdateTemporary(BOOL is_temporary);
 	void selectionUpdatePhantom(BOOL is_ghost);
 	void selectionUpdateCastShadows(BOOL cast_shadows);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 82147dd339..80d645ca80 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -202,7 +202,6 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mFlags(0),
 	mPhysicsShapeType(0),
 	mPhysicsGravity(0),
-	mPhysicsMaterialOverride(FALSE),
 	mPhysicsFriction(0),
 	mPhysicsDensity(0),
 	mPhysicsRestitution(0),
@@ -5027,11 +5026,10 @@ void LLViewerObject::updateFlags()
 	gMessageSystem->addBOOL("CastsShadows", flagCastShadows() );
 	gMessageSystem->nextBlock("ExtraPhysics");
 	gMessageSystem->addU8("PhysicsShapeType", getPhysicsShapeType() );
-	gMessageSystem->addF32("PhysicsGravity", getPhysicsGravity() );
-	gMessageSystem->addBOOL("PhysicsMaterialOverride", getPhysicsMaterialOverride() );
-	gMessageSystem->addF32("PhysicsFriction", getPhysicsFriction() );
-	gMessageSystem->addF32("PhysicsDensity", getPhysicsDensity() );
-	gMessageSystem->addF32("PhysicsRestitution", getPhysicsRestitution() );
+	gMessageSystem->addF32("Density", getPhysicsDensity() );
+	gMessageSystem->addF32("Friction", getPhysicsFriction() );
+	gMessageSystem->addF32("Restitution", getPhysicsRestitution() );
+	gMessageSystem->addF32("GravityMultiplier", getPhysicsGravity() );
 	gMessageSystem->sendReliable( regionp->getHost() );
 
 	if (getPhysicsShapeType() != 0)
@@ -5079,11 +5077,6 @@ void LLViewerObject::setPhysicsGravity(F32 gravity)
 	mPhysicsGravity = gravity;
 }
 
-void LLViewerObject::setPhysicsMaterialOverride(BOOL material_override)
-{
-	mPhysicsMaterialOverride = material_override;
-}
-
 void LLViewerObject::setPhysicsFriction(F32 friction)
 {
 	mPhysicsFriction = friction;
@@ -5362,15 +5355,13 @@ public:
 			{
 				// The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast
 				U8 type = (U8)curr_object_data["PhysicsShapeType"].asInteger();
-				F32 gravity = (F32)curr_object_data["PhysicsGravity"].asReal();
-				BOOL material_override = curr_object_data["PhysicsMaterialOverride"].asBoolean();
-				F32 friction = (F32)curr_object_data["PhysicsFriction"].asReal();
-				F32 density = (F32)curr_object_data["PhysicsDensity"].asReal();
-				F32 restitution = (F32)curr_object_data["PhysicsRestitution"].asReal();
+				F32 density = (F32)curr_object_data["Density"].asReal();
+				F32 friction = (F32)curr_object_data["Friction"].asReal();
+				F32 restitution = (F32)curr_object_data["Restitution"].asReal();
+				F32 gravity = (F32)curr_object_data["GravityMultiplier"].asReal();
 
 				node->getObject()->setPhysicsShapeType(type);
 				node->getObject()->setPhysicsGravity(gravity);
-				node->getObject()->setPhysicsMaterialOverride(material_override);
 				node->getObject()->setPhysicsFriction(friction);
 				node->getObject()->setPhysicsDensity(density);
 				node->getObject()->setPhysicsRestitution(restitution);
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 90c9ba0f7a..70bc916acb 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -469,7 +469,6 @@ public:
 
 	inline U8       getPhysicsShapeType() const     { return mPhysicsShapeType; }
 	inline F32      getPhysicsGravity() const       { return mPhysicsGravity; }
-	inline BOOL     getPhysicsMaterialOverride() const { return mPhysicsMaterialOverride; }
 	inline F32      getPhysicsFriction() const      { return mPhysicsFriction; }
 	inline F32      getPhysicsDensity() const       { return mPhysicsDensity; }
 	inline F32      getPhysicsRestitution() const   { return mPhysicsRestitution; }
@@ -491,7 +490,6 @@ public:
 	BOOL setFlags(U32 flag, BOOL state);
 	void setPhysicsShapeType(U8 type);
 	void setPhysicsGravity(F32 gravity);
-	void setPhysicsMaterialOverride(BOOL material_override);
 	void setPhysicsFriction(F32 friction);
 	void setPhysicsDensity(F32 density);
 	void setPhysicsRestitution(F32 restitution);
@@ -577,7 +575,6 @@ public:
 	// Sent to sim in UPDATE_FLAGS, received in ObjectPhysicsProperties
 	U8              mPhysicsShapeType;
 	F32             mPhysicsGravity;
-	BOOL            mPhysicsMaterialOverride;
 	F32             mPhysicsFriction;
 	F32             mPhysicsDensity;
 	F32             mPhysicsRestitution;
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index 8cfd3c5ce6..1dd9b5c2b2 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -2064,11 +2064,11 @@ version 2.0
     {
 		ExtraPhysics        Variable
 		{   PhysicsShapeType U8     }
-		{   PhysicsGravity   F32    }
-		{   PhysicsMaterialOverride BOOL }
-		{   PhysicsFriction  F32    }
-		{   PhysicsDensity   F32    }
-		{   PhysicsRestitution F32  }
+        {   Density          F32    }
+        {   Friction         F32    }
+        {   Restitution      F32    }
+        {   GravityMultiplier    F32    }
+
 	}
 }
 
-- 
cgit v1.3