diff options
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r-- | indra/newview/llviewerobject.cpp | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 03e524268d..82147dd339 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -201,6 +201,11 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mbCanSelect(TRUE), mFlags(0), mPhysicsShapeType(0), + mPhysicsGravity(0), + mPhysicsMaterialOverride(FALSE), + mPhysicsFriction(0), + mPhysicsDensity(0), + mPhysicsRestitution(0), mDrawable(), mCreateSelected(FALSE), mRenderMedia(FALSE), @@ -5022,6 +5027,11 @@ 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->sendReliable( regionp->getHost() ); if (getPhysicsShapeType() != 0) @@ -5062,7 +5072,31 @@ BOOL LLViewerObject::setFlags(U32 flags, BOOL state) void LLViewerObject::setPhysicsShapeType(U8 type) { mPhysicsShapeType = type; - updateFlags(); +} + +void LLViewerObject::setPhysicsGravity(F32 gravity) +{ + mPhysicsGravity = gravity; +} + +void LLViewerObject::setPhysicsMaterialOverride(BOOL material_override) +{ + mPhysicsMaterialOverride = material_override; +} + +void LLViewerObject::setPhysicsFriction(F32 friction) +{ + mPhysicsFriction = friction; +} + +void LLViewerObject::setPhysicsDensity(F32 density) +{ + mPhysicsDensity = density; +} + +void LLViewerObject::setPhysicsRestitution(F32 restitution) +{ + mPhysicsRestitution = restitution; } void LLViewerObject::applyAngularVelocity(F32 dt) @@ -5303,13 +5337,13 @@ public: const LLSD& context, const LLSD& input) const { - LLSD objectData = input["body"]["ObjectData"]; - S32 numEntries = objectData.size(); + LLSD object_data = input["body"]["ObjectData"]; + S32 num_entries = object_data.size(); - for ( S32 i = 0; i < numEntries; i++ ) + for ( S32 i = 0; i < num_entries; i++ ) { - LLSD& currObjectData = objectData[i]; - U32 localID = currObjectData["LocalID"].asInteger(); + LLSD& curr_object_data = object_data[i]; + U32 local_id = curr_object_data["LocalID"].asInteger(); // Iterate through nodes at end, since it can be on both the regular AND hover list struct f : public LLSelectedNodeFunctor @@ -5320,16 +5354,26 @@ public: { return (node->getObject() && node->getObject()->mLocalID == mID ); } - } func(localID); + } func(local_id); LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func); if (node) { // The LLSD message builder doesn't know how to handle U8, so we need to send as S8 and cast - U8 physicsShapeType = (U8)currObjectData["PhysicsShapeType"].asInteger(); - - node->getObject()->setPhysicsShapeType(physicsShapeType); + 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(); + + 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); } } |