summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-01-20 15:50:03 -0600
committerDave Parks <davep@lindenlab.com>2011-01-20 15:50:03 -0600
commitc1db849c418d2cef8c321199ad1421b183aff9bf (patch)
tree42c1ff2409c692bf82c0d570d0171f3e740644d3 /indra/newview/llselectmgr.cpp
parent1b2c082feb91b4837a0cb5652d1668f6582e9bc9 (diff)
SH-635 Fix for changing one physics parameter changing all physics parameters.
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp136
1 files changed, 97 insertions, 39 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 305b629cf7..44ccbe22f7 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1889,6 +1889,103 @@ BOOL LLSelectMgr::selectionGetGlow(F32 *glow)
return identical;
}
+
+void LLSelectMgr::selectionSetPhysicsType(U8 type)
+{
+ struct f : public LLSelectedObjectFunctor
+ {
+ U8 mType;
+ f(const U8& t) : mType(t) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsShapeType(mType);
+ object->updateFlags();
+ }
+ return true;
+ }
+ } sendfunc(type);
+ getSelection()->applyToObjects(&sendfunc);
+}
+
+void LLSelectMgr::selectionSetFriction(F32 friction)
+{
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mFriction;
+ f(const F32& friction) : mFriction(friction) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsFriction(mFriction);
+ object->updateFlags();
+ }
+ return true;
+ }
+ } sendfunc(friction);
+ getSelection()->applyToObjects(&sendfunc);
+}
+
+void LLSelectMgr::selectionSetGravity(F32 gravity )
+{
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mGravity;
+ f(const F32& gravity) : mGravity(gravity) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsGravity(mGravity);
+ object->updateFlags();
+ }
+ return true;
+ }
+ } sendfunc(gravity);
+ getSelection()->applyToObjects(&sendfunc);
+}
+
+void LLSelectMgr::selectionSetDensity(F32 density )
+{
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mDensity;
+ f(const F32& density ) : mDensity(density) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsDensity(mDensity);
+ object->updateFlags();
+ }
+ return true;
+ }
+ } sendfunc(density);
+ getSelection()->applyToObjects(&sendfunc);
+}
+
+void LLSelectMgr::selectionSetRestitution(F32 restitution)
+{
+ struct f : public LLSelectedObjectFunctor
+ {
+ F32 mRestitution;
+ f(const F32& restitution ) : mRestitution(restitution) {}
+ virtual bool apply(LLViewerObject* object)
+ {
+ if (object->permModify())
+ {
+ object->setPhysicsRestitution(mRestitution);
+ object->updateFlags();
+ }
+ return true;
+ }
+ } sendfunc(restitution);
+ getSelection()->applyToObjects(&sendfunc);
+}
+
+
//-----------------------------------------------------------------------------
// selectionSetMaterial()
//-----------------------------------------------------------------------------
@@ -3936,45 +4033,6 @@ void LLSelectMgr::selectionUpdateCastShadows(BOOL cast_shadows)
getSelection()->applyToObjects(&func);
}
-struct LLSelectMgrApplyPhysicsParam : public LLSelectedObjectFunctor
-{
- LLSelectMgrApplyPhysicsParam(U8 type, F32 gravity, F32 friction,
- F32 density, F32 restitution) :
- mType(type),
- mGravity(gravity),
- mFriction(friction),
- mDensity(density),
- mRestitution(restitution)
- {}
- U8 mType;
- F32 mGravity;
- F32 mFriction;
- F32 mDensity;
- F32 mRestitution;
- virtual bool apply(LLViewerObject* object)
- {
- if ( object->permModify() ) // preemptive permissions check
- {
- object->setPhysicsShapeType( mType );
- object->setPhysicsGravity(mGravity);
- object->setPhysicsFriction(mFriction);
- object->setPhysicsDensity(mDensity);
- object->setPhysicsRestitution(mRestitution);
- object->updateFlags();
- }
- return true;
- }
-};
-
-
-void LLSelectMgr::selectionUpdatePhysicsParam(U8 type, F32 gravity, F32 friction,
- F32 density, F32 restitution)
-{
- llwarns << "physics shape type ->" << (U32)type << llendl;
- LLSelectMgrApplyPhysicsParam func(type, gravity, friction, density, restitution);
- getSelection()->applyToObjects(&func);
-}
-
//----------------------------------------------------------------------
// Helpful packing functions for sendObjectMessage()
//----------------------------------------------------------------------