From d9c4529a265b764e50b52a0132ffdcbfa74bdc5e Mon Sep 17 00:00:00 2001 From: "erwin.coumans" Date: Wed, 6 May 2009 19:55:05 +0000 Subject: [PATCH] + bugfix in btAlignedObjectArray, not calling destructors on resize to smaller array. Thanks Benoit for pointing this out, and bugfix: http://code.google.com/p/bullet/issues/detail?id=218 + Added point to point, hinge, slider and generic 6dof constraints to Maya Dynamica plugin Thanks to Herbert Law for the constribution: http://code.google.com/p/bullet/issues/detail?id=221 --- Extras/MayaPlugin/BulletDynamica.6_module | 2 +- Extras/MayaPlugin/BulletMayaPlugin.sln | 4 +- Extras/MayaPlugin/BulletMayaPlugin.vcproj | 593 +++++++++------- Extras/MayaPlugin/bt_rigid_body.h | 20 + Extras/MayaPlugin/bt_solver.h | 17 +- Extras/MayaPlugin/bullet.nsi | 6 +- .../constraint/bt_hinge_constraint.h | 125 ++++ .../{ => constraint}/bt_nail_constraint.h | 188 ++--- .../constraint/bt_sixdof_constraint.h | 123 ++++ .../constraint/bt_slider_constraint.h | 128 ++++ .../MayaPlugin/{ => constraint}/constraint.h | 104 +-- .../{ => constraint}/constraint_impl.h | 74 +- .../constraint/dHingeConstraintCmd.cpp | 133 ++++ .../constraint/dHingeConstraintCmd.h | 58 ++ .../{ => constraint}/dNailConstraintCmd.cpp | 266 +++---- .../{ => constraint}/dNailConstraintCmd.h | 116 +-- .../constraint/dSliderConstraintCmd.cpp | 133 ++++ .../constraint/dSliderConstraintCmd.h | 58 ++ .../constraint/dsixdofConstraintCmd.cpp | 133 ++++ .../constraint/dsixdofConstraintCmd.h | 58 ++ .../constraint/hingeConstraintNode.cpp | 443 ++++++++++++ .../constraint/hingeConstraintNode.h | 106 +++ .../constraint/hinge_constraint_impl.h | 52 ++ .../{ => constraint}/nailConstraintNode.cpp | 663 +++++++++--------- .../{ => constraint}/nailConstraintNode.h | 188 ++--- .../{ => constraint}/nail_constraint.h | 187 ++--- .../{ => constraint}/nail_constraint_impl.h | 93 +-- .../constraint/sixdofConstraintNode.cpp | 419 +++++++++++ .../constraint/sixdofConstraintNode.h | 100 +++ .../MayaPlugin/constraint/sixdof_constraint.h | 116 +++ .../constraint/sixdof_constraint_impl.h | 50 ++ .../constraint/sliderConstraintNode.cpp | 419 +++++++++++ .../constraint/sliderConstraintNode.h | 100 +++ .../MayaPlugin/constraint/slider_constraint.h | 116 +++ .../icons/dynamicaCreate6DofConstraint.xpm | 213 ++++++ .../dynamicaCreateConeTwistConstraint.xpm | 213 ++++++ .../icons/dynamicaCreateHingeConstraint.xpm | 213 ++++++ .../icons/dynamicaCreateSliderConstraint.xpm | 213 ++++++ Extras/MayaPlugin/install.bat | 7 +- Extras/MayaPlugin/pluginMain.cpp | 73 +- Extras/MayaPlugin/rigidBodyNode.cpp | 7 + Extras/MayaPlugin/rigid_body.h | 4 + Extras/MayaPlugin/rigid_body_impl.h | 5 + Extras/MayaPlugin/scenes/pointConstraint.ma | 197 ++++++ Extras/MayaPlugin/scenes/sliderConstraint.ma | 196 ++++++ .../scripts/AEdHingeConstraintTemplate.mel | 52 ++ .../AEdSixdofConstraintTemplate.mel} | 96 ++- .../scripts/AEdSliderConstraintTemplate.mel | 44 ++ Extras/MayaPlugin/scripts/dynamicaUI.mel | 82 ++- Extras/MayaPlugin/solver.cpp | 13 +- Extras/MayaPlugin/solver.h | 9 +- Extras/MayaPlugin/solver_impl.h | 9 +- .../ConstraintSolver/btHingeConstraint.h | 30 +- .../ConstraintSolver/btSliderConstraint.cpp | 16 + .../ConstraintSolver/btSliderConstraint.h | 1 + src/LinearMath/btAlignedObjectArray.h | 4 +- 56 files changed, 5851 insertions(+), 1237 deletions(-) create mode 100644 Extras/MayaPlugin/constraint/bt_hinge_constraint.h rename Extras/MayaPlugin/{ => constraint}/bt_nail_constraint.h (69%) create mode 100644 Extras/MayaPlugin/constraint/bt_sixdof_constraint.h create mode 100644 Extras/MayaPlugin/constraint/bt_slider_constraint.h rename Extras/MayaPlugin/{ => constraint}/constraint.h (96%) rename Extras/MayaPlugin/{ => constraint}/constraint_impl.h (96%) create mode 100644 Extras/MayaPlugin/constraint/dHingeConstraintCmd.cpp create mode 100644 Extras/MayaPlugin/constraint/dHingeConstraintCmd.h rename Extras/MayaPlugin/{ => constraint}/dNailConstraintCmd.cpp (95%) rename Extras/MayaPlugin/{ => constraint}/dNailConstraintCmd.h (96%) create mode 100644 Extras/MayaPlugin/constraint/dSliderConstraintCmd.cpp create mode 100644 Extras/MayaPlugin/constraint/dSliderConstraintCmd.h create mode 100644 Extras/MayaPlugin/constraint/dsixdofConstraintCmd.cpp create mode 100644 Extras/MayaPlugin/constraint/dsixdofConstraintCmd.h create mode 100644 Extras/MayaPlugin/constraint/hingeConstraintNode.cpp create mode 100644 Extras/MayaPlugin/constraint/hingeConstraintNode.h create mode 100644 Extras/MayaPlugin/constraint/hinge_constraint_impl.h rename Extras/MayaPlugin/{ => constraint}/nailConstraintNode.cpp (89%) rename Extras/MayaPlugin/{ => constraint}/nailConstraintNode.h (96%) rename Extras/MayaPlugin/{ => constraint}/nail_constraint.h (82%) rename Extras/MayaPlugin/{ => constraint}/nail_constraint_impl.h (84%) create mode 100644 Extras/MayaPlugin/constraint/sixdofConstraintNode.cpp create mode 100644 Extras/MayaPlugin/constraint/sixdofConstraintNode.h create mode 100644 Extras/MayaPlugin/constraint/sixdof_constraint.h create mode 100644 Extras/MayaPlugin/constraint/sixdof_constraint_impl.h create mode 100644 Extras/MayaPlugin/constraint/sliderConstraintNode.cpp create mode 100644 Extras/MayaPlugin/constraint/sliderConstraintNode.h create mode 100644 Extras/MayaPlugin/constraint/slider_constraint.h create mode 100644 Extras/MayaPlugin/icons/dynamicaCreate6DofConstraint.xpm create mode 100644 Extras/MayaPlugin/icons/dynamicaCreateConeTwistConstraint.xpm create mode 100644 Extras/MayaPlugin/icons/dynamicaCreateHingeConstraint.xpm create mode 100644 Extras/MayaPlugin/icons/dynamicaCreateSliderConstraint.xpm create mode 100644 Extras/MayaPlugin/scenes/pointConstraint.ma create mode 100644 Extras/MayaPlugin/scenes/sliderConstraint.ma create mode 100644 Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel rename Extras/MayaPlugin/{bt_constraint.h => scripts/AEdSixdofConstraintTemplate.mel} (56%) create mode 100644 Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel diff --git a/Extras/MayaPlugin/BulletDynamica.6_module b/Extras/MayaPlugin/BulletDynamica.6_module index 23e3a2777..8ef926e8f 100644 --- a/Extras/MayaPlugin/BulletDynamica.6_module +++ b/Extras/MayaPlugin/BulletDynamica.6_module @@ -1 +1 @@ -+ BulletDynamica2.73 1.0 \ No newline at end of file ++ BulletDynamica2.75 1.0 \ No newline at end of file diff --git a/Extras/MayaPlugin/BulletMayaPlugin.sln b/Extras/MayaPlugin/BulletMayaPlugin.sln index 1fcfc9752..2c9a13658 100644 --- a/Extras/MayaPlugin/BulletMayaPlugin.sln +++ b/Extras/MayaPlugin/BulletMayaPlugin.sln @@ -3,12 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 9.00 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BulletMayaPlugin", "BulletMayaPlugin.vcproj", "{681412B0-F197-4A2F-9263-DEA2E8690146}" ProjectSection(ProjectDependencies) = postProject {6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE} = {6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE} + {ED51AA4D-82EF-089C-CD6D-91CF224E2A9E} = {ED51AA4D-82EF-089C-CD6D-91CF224E2A9E} {B1B5F775-54A9-2437-E4AC-7E817E492142} = {B1B5F775-54A9-2437-E4AC-7E817E492142} {61BD1097-CF2E-B296-DAA9-73A6FE135319} = {61BD1097-CF2E-B296-DAA9-73A6FE135319} - {A0958CD9-0E39-4A77-3711-9B488F508FBF} = {A0958CD9-0E39-4A77-3711-9B488F508FBF} {6AB01C9C-9163-F400-B5C3-20D046631E17} = {6AB01C9C-9163-F400-B5C3-20D046631E17} - {ED51AA4D-82EF-089C-CD6D-91CF224E2A9E} = {ED51AA4D-82EF-089C-CD6D-91CF224E2A9E} {7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A} = {7D6E339F-9C2C-31DA-FDB0-5EE50973CF2A} + {A0958CD9-0E39-4A77-3711-9B488F508FBF} = {A0958CD9-0E39-4A77-3711-9B488F508FBF} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbulletcollision", "..\..\msvc\8\libbulletcollision.vcproj", "{6ADA430D-009C-2ED4-A787-2AC2D6FEB8CE}" diff --git a/Extras/MayaPlugin/BulletMayaPlugin.vcproj b/Extras/MayaPlugin/BulletMayaPlugin.vcproj index d0f0068ad..ae45b4f72 100644 --- a/Extras/MayaPlugin/BulletMayaPlugin.vcproj +++ b/Extras/MayaPlugin/BulletMayaPlugin.vcproj @@ -110,6 +110,7 @@ /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -710,150 +1055,18 @@ RelativePath=".\scripts\AEdRigidBodyTemplate.mel" > + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -862,106 +1075,6 @@ RelativePath=".\scripts\dynamicaUI.mel" > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Extras/MayaPlugin/bt_rigid_body.h b/Extras/MayaPlugin/bt_rigid_body.h index ad3b54c66..4789dcf14 100644 --- a/Extras/MayaPlugin/bt_rigid_body.h +++ b/Extras/MayaPlugin/bt_rigid_body.h @@ -28,6 +28,8 @@ Written by: Nicola Candussi #include "shared_ptr.h" #include "rigid_body_impl.h" #include "bt_collision_shape.h" +#include "LinearMath/btAlignedObjectArray.h" +#include "constraint/bt_constraint.h" class bt_rigid_body_t: public rigid_body_impl_t { public: @@ -153,10 +155,28 @@ public: m_body->applyTorque(btVector3(t[0], t[1], t[2])); } + virtual void update_constraint() + { + int count = m_constraintRef.size(); + for(int i=0; iupdate_constraint(); + } + } + btRigidBody* body() { return m_body.get(); } + virtual void add_constraint(bt_constraint_t* constraint) + { + m_constraintRef.push_back(constraint); + } + virtual void remove_constraint(bt_constraint_t* constraint) + { + m_constraintRef.remove(constraint); + } protected: friend class bt_solver_t; + btAlignedObjectArray m_constraintRef; bt_rigid_body_t(collision_shape_impl_t* cs): m_collision_shape(cs), diff --git a/Extras/MayaPlugin/bt_solver.h b/Extras/MayaPlugin/bt_solver.h index a48bbf155..3fa887a82 100644 --- a/Extras/MayaPlugin/bt_solver.h +++ b/Extras/MayaPlugin/bt_solver.h @@ -37,7 +37,10 @@ Written by: Nicola Candussi #include "bt_box_shape.h" #include "bt_convex_hull_shape.h" #include "bt_mesh_shape.h" -#include "bt_nail_constraint.h" +#include "constraint/bt_nail_constraint.h" +#include "constraint/bt_hinge_constraint.h" +#include "constraint/bt_slider_constraint.h" +#include "constraint/bt_sixdof_constraint.h" class bt_solver_t: public solver_impl_t { @@ -76,6 +79,18 @@ public: { return new bt_nail_constraint_t(rb, pivot); } + virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot) + { + return new bt_hinge_constraint_t(rb, pivot); + } + virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) + { + return new bt_slider_constraint_t(rbA, pivotA, rbB, pivotB); + } + virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) + { + return new bt_sixdof_constraint_t(rbA, pivotA, rbB, pivotB); + } virtual void add_rigid_body(rigid_body_impl_t* rb) { diff --git a/Extras/MayaPlugin/bullet.nsi b/Extras/MayaPlugin/bullet.nsi index a1c78a283..1d6dd0bb3 100644 --- a/Extras/MayaPlugin/bullet.nsi +++ b/Extras/MayaPlugin/bullet.nsi @@ -8,14 +8,14 @@ ;-------------------------------- ; The name of the installer -Name "Dynamica Bullet 2.73 physics plugin for Maya 2008" +Name "Dynamica Bullet 2.75 physics plugin for Maya 2008" ; The file to write -OutFile "DynamicaForMaya2009_32bit.exe" +OutFile "DynamicaForMaya2008_32bit.exe" ; The default installation directory -InstallDir $PROGRAMFILES\DynamicaBullet2.73\ +InstallDir $PROGRAMFILES\DynamicaBullet2.75\ UninstPage uninstConfirm UninstPage instfiles diff --git a/Extras/MayaPlugin/constraint/bt_hinge_constraint.h b/Extras/MayaPlugin/constraint/bt_hinge_constraint.h new file mode 100644 index 000000000..12777f594 --- /dev/null +++ b/Extras/MayaPlugin/constraint/bt_hinge_constraint.h @@ -0,0 +1,125 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//bt_hinge_constraint.h + +#ifndef DYN_BT_HINGE_CONSTRAINT_H +#define DYN_BT_HINGE_CONSTRAINT_H + +#include "bt_constraint.h" +#include "hinge_constraint_impl.h" + +class bt_hinge_constraint_t: public bt_constraint_t, public hinge_constraint_impl_t { +public: + + virtual void set_damping(float d) { +// btHingeConstraint* p2pc = static_cast(m_constraint.get()); +// p2pc->m_setting.m_damping = d; + } + + virtual void set_limit(float lower, float upper, float softness, float bias_factor, float relaxation_factor) { + btHingeConstraint* hinge = static_cast(m_constraint.get()); + hinge->setLimit(lower, upper, softness, bias_factor, relaxation_factor); + } + + virtual void set_axis(vec3f const &p) { + btHingeConstraint* hinge = static_cast(m_constraint.get()); + btVector3 axis(p[0], p[1], p[2]); + hinge->setAxis(axis); + } + + virtual float damping() const { +// btHingeConstraint const* hc = static_cast(m_constraint.get()); +// return hc->m_setting.m_damping; + return 0; + } + + // + virtual void set_pivot(vec3f const &p) { +/* btHingeConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 bt_pivot(p[0], p[1], p[2]); + p2pc->setPivotA(bt_pivot); + p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransform()(bt_pivot)); + // p2pc->buildJacobian(); +*/ } + + virtual void get_pivot(vec3f &p) const { +/* btHingeConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInA().x(); + p[1] = hc->getPivotInA().y(); + p[2] = hc->getPivotInA().z(); +*/ } + + virtual void get_world_pivot(vec3f &p) const { +/* btHingeConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInB().x(); + p[1] = hc->getPivotInB().y(); + p[2] = hc->getPivotInB().z(); +*/ } + + virtual void set_world(vec3f const &p) { + btHingeConstraint* hc = static_cast(m_constraint.get()); + btVector3 world(p[0], p[1], p[2]); + btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().inverse() (world); + hc->getAFrame().getOrigin() = pivotA; + hc->getBFrame().getOrigin() = world; + // p2pc->buildJacobian(); + } + + virtual void get_world(vec3f &p) const { + btHingeConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getBFrame().getOrigin().x(); + p[1] = hc->getBFrame().getOrigin().y(); + p[2] = hc->getBFrame().getOrigin().z(); + } + + virtual void enable_motor(bool enable, float velocity, float impulse) { + btHingeConstraint* hinge = static_cast(m_constraint.get()); + hinge->enableAngularMotor(enable, velocity, impulse); + } + + virtual void update_constraint() + { + btHingeConstraint* hc = static_cast(m_constraint.get()); + btVector3 world = hc->getBFrame().getOrigin(); + btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().inverse() (world); + hc->getAFrame().getOrigin() = pivotA; + } +protected: + friend class bt_solver_t; + + bt_hinge_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot): + hinge_constraint_impl_t() + { + btRigidBody& bt_body = *static_cast(rb)->body(); + btVector3 pivotA = bt_body.getCenterOfMassPosition(); + btVector3 btAxisA( 0.0f, 1.0f, 0.0f ); // pointing upwards, aka Y-axis + btHingeConstraint * hinge = new btHingeConstraint(bt_body, -pivotA, btAxisA); + m_constraint.reset(hinge); + rb->add_constraint(this); + } + +private: + +}; + +#endif //DYN_BT_HINGE_CONSTRAINT_H diff --git a/Extras/MayaPlugin/bt_nail_constraint.h b/Extras/MayaPlugin/constraint/bt_nail_constraint.h similarity index 69% rename from Extras/MayaPlugin/bt_nail_constraint.h rename to Extras/MayaPlugin/constraint/bt_nail_constraint.h index 5a8b2c928..119e99471 100644 --- a/Extras/MayaPlugin/bt_nail_constraint.h +++ b/Extras/MayaPlugin/constraint/bt_nail_constraint.h @@ -1,82 +1,106 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//bt_nail_constraint.h - -#ifndef DYN_BT_NAIL_CONSTRAINT_H -#define DYN_BT_NAIL_CONSTRAINT_H - -#include "bt_constraint.h" -#include "nail_constraint_impl.h" - -class bt_nail_constraint_t: public bt_constraint_t, public nail_constraint_impl_t { -public: - - virtual void set_damping(float d) { - btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); - p2pc->m_setting.m_damping = d; - } - - virtual float damping() const { - btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); - return p2pc->m_setting.m_damping; - } - - // - virtual void set_pivot(vec3f const &p) { - btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); - btVector3 bt_pivot(p[0], p[1], p[2]); - p2pc->setPivotA(bt_pivot); - p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransform()(bt_pivot)); - // p2pc->buildJacobian(); - } - - virtual void get_pivot(vec3f &p) const { - btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); - p[0] = p2pc->getPivotInA().x(); - p[1] = p2pc->getPivotInA().y(); - p[2] = p2pc->getPivotInA().z(); - } - - virtual void get_world_pivot(vec3f &p) const { - btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); - p[0] = p2pc->getPivotInB().x(); - p[1] = p2pc->getPivotInB().y(); - p[2] = p2pc->getPivotInB().z(); - } - -protected: - friend class bt_solver_t; - - bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot): - nail_constraint_impl_t() - { - btRigidBody& bt_body = *static_cast(rb)->body(); - - m_constraint.reset(new btPoint2PointConstraint(bt_body, btVector3(pivot[0], pivot[1], pivot[2]))); - } - -private: - -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//bt_nail_constraint.h + +#ifndef DYN_BT_NAIL_CONSTRAINT_H +#define DYN_BT_NAIL_CONSTRAINT_H + +#include "bt_constraint.h" +#include "nail_constraint_impl.h" + +class bt_nail_constraint_t: public bt_constraint_t, public nail_constraint_impl_t { +public: + + virtual void set_damping(float d) { + btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); + p2pc->m_setting.m_damping = d; + } + + virtual float damping() const { + btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); + return p2pc->m_setting.m_damping; + } + + // + virtual void set_pivotA(vec3f const &p) { + btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 bt_pivot(p[0], p[1], p[2]); + p2pc->setPivotA(bt_pivot); + p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransform()(bt_pivot)); + // p2pc->buildJacobian(); + } + + virtual void get_pivotA(vec3f &p) const { + btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); + p[0] = p2pc->getPivotInA().x(); + p[1] = p2pc->getPivotInA().y(); + p[2] = p2pc->getPivotInA().z(); + } + + virtual void get_world_pivot(vec3f &p) const { + btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); + p[0] = p2pc->getPivotInB().x(); + p[1] = p2pc->getPivotInB().y(); + p[2] = p2pc->getPivotInB().z(); + } + + virtual void set_world(vec3f const &p) { + btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 world(p[0], p[1], p[2]); + btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world); + p2pc->setPivotA(pivotA); + p2pc->setPivotB(world); + p2pc->buildJacobian(); + } + + virtual void get_world(vec3f &p) const { + btPoint2PointConstraint const* p2pc = static_cast(m_constraint.get()); + p[0] = p2pc->getPivotInB().x(); + p[1] = p2pc->getPivotInB().y(); + p[2] = p2pc->getPivotInB().z(); + } + + virtual void update_constraint() + { + btPoint2PointConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 world = p2pc->getPivotInB(); + btVector3 pivotA = p2pc->getRigidBodyA().getWorldTransform().inverse() (world); + p2pc->setPivotA(pivotA); + } +protected: + friend class bt_solver_t; + + bt_nail_constraint_t(rigid_body_impl_t* rb, vec3f const& pivot): + nail_constraint_impl_t() + { + btRigidBody& bt_body = *static_cast(rb)->body(); + btVector3 pivotA = bt_body.getCenterOfMassPosition(); + m_constraint.reset(new btPoint2PointConstraint(bt_body, -pivotA)); + rb->add_constraint(this); + } + +private: + +}; + +#endif diff --git a/Extras/MayaPlugin/constraint/bt_sixdof_constraint.h b/Extras/MayaPlugin/constraint/bt_sixdof_constraint.h new file mode 100644 index 000000000..01d4fb2db --- /dev/null +++ b/Extras/MayaPlugin/constraint/bt_sixdof_constraint.h @@ -0,0 +1,123 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//bt_sixdof_constraint.h + +#ifndef DYN_BT_SIXDOF_CONSTRAINT_H +#define DYN_BT_SIXDOF_CONSTRAINT_H + +#include "bt_constraint.h" +#include "sixdof_constraint_impl.h" + +class bt_sixdof_constraint_t: public bt_constraint_t, public sixdof_constraint_impl_t { +public: + + virtual void set_damping(float d) { +// btGeneric6DofConstraint* p2pc = static_cast(m_constraint.get()); +// p2pc->m_setting.m_damping = d; + } + + virtual void set_LinLimit(float lower, float upper) { + btGeneric6DofConstraint* sixdof = static_cast(m_constraint.get()); +// sixdof->setLowerLinLimit(lower); +// sixdof->setUpperLinLimit(upper); + } + + virtual void set_AngLimit(float lower, float upper) { + btGeneric6DofConstraint* sixdof = static_cast(m_constraint.get()); +// sixdof->setLowerAngLimit(lower); +// sixdof->setUpperAngLimit(upper); + } + + virtual float damping() const { +// btGeneric6DofConstraint const* hc = static_cast(m_constraint.get()); +// return hc->m_setting.m_damping; + return 0; + } + + // + virtual void set_pivot(vec3f const &p) { +/* btGeneric6DofConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 bt_pivot(p[0], p[1], p[2]); + p2pc->setPivotA(bt_pivot); + p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransform()(bt_pivot)); + // p2pc->buildJacobian(); +*/ } + + virtual void get_pivot(vec3f &p) const { +/* btGeneric6DofConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInA().x(); + p[1] = hc->getPivotInA().y(); + p[2] = hc->getPivotInA().z(); +*/ } + + virtual void get_world_pivot(vec3f &p) const { +/* btGeneric6DofConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInB().x(); + p[1] = hc->getPivotInB().y(); + p[2] = hc->getPivotInB().z(); +*/ } + + virtual void set_world(vec3f const &p) { + btGeneric6DofConstraint* constraint = static_cast(m_constraint.get()); + btTransform framInA = constraint->getRigidBodyA().getCenterOfMassTransform().inverse(); + btTransform framInB = constraint->getRigidBodyB().getCenterOfMassTransform().inverse(); + constraint->getFrameOffsetA() = framInA; + constraint->getFrameOffsetB() = framInB; + world = p; + } + + virtual void get_world(vec3f &p) const { +/* btGeneric6DofConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getFrameOffsetB().getOrigin().x(); + p[1] = hc->getFrameOffsetB().getOrigin().y(); + p[2] = hc->getFrameOffsetB().getOrigin().z(); +*/ p = world; + } + + virtual void update_constraint() + { + btGeneric6DofConstraint* constraint = static_cast(m_constraint.get()); + constraint->getFrameOffsetA() = constraint->getRigidBodyA().getCenterOfMassTransform().inverse(); + constraint->getFrameOffsetB() = constraint->getRigidBodyB().getCenterOfMassTransform().inverse(); + } +protected: + friend class bt_solver_t; + vec3f world; + + bt_sixdof_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB): + sixdof_constraint_impl_t() + { + btRigidBody& bt_bodyA = *static_cast(rbA)->body(); + btRigidBody& bt_bodyB = *static_cast(rbB)->body(); + btTransform framInA = bt_bodyA.getCenterOfMassTransform().inverse(); + btTransform framInB = bt_bodyB.getCenterOfMassTransform().inverse(); + btGeneric6DofConstraint * sixdof = new btGeneric6DofConstraint(bt_bodyA, bt_bodyB, framInA, framInB, true); + m_constraint.reset(sixdof); + rbA->add_constraint(this); + } + +private: + +}; + +#endif //DYN_BT_SIXDOF_CONSTRAINT_H diff --git a/Extras/MayaPlugin/constraint/bt_slider_constraint.h b/Extras/MayaPlugin/constraint/bt_slider_constraint.h new file mode 100644 index 000000000..a5656550f --- /dev/null +++ b/Extras/MayaPlugin/constraint/bt_slider_constraint.h @@ -0,0 +1,128 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//bt_slider_constraint.h + +#ifndef DYN_BT_SLIDER_CONSTRAINT_H +#define DYN_BT_SLIDER_CONSTRAINT_H + +#include "bt_constraint.h" +#include "slider_constraint_impl.h" + +class bt_slider_constraint_t: public bt_constraint_t, public slider_constraint_impl_t { +public: + + virtual void set_damping(float d) { +// btSliderConstraint* p2pc = static_cast(m_constraint.get()); +// p2pc->m_setting.m_damping = d; + } + + virtual void set_LinLimit(float lower, float upper) { + btSliderConstraint* slider = static_cast(m_constraint.get()); + slider->setLowerLinLimit(lower); + slider->setUpperLinLimit(upper); + } + + virtual void set_AngLimit(float lower, float upper) { + btSliderConstraint* slider = static_cast(m_constraint.get()); + slider->setLowerAngLimit(lower); + slider->setUpperAngLimit(upper); + } + + virtual float damping() const { +// btSliderConstraint const* hc = static_cast(m_constraint.get()); +// return hc->m_setting.m_damping; + return 0; + } + + // + virtual void set_pivot(vec3f const &p) { +/* btSliderConstraint* p2pc = static_cast(m_constraint.get()); + btVector3 bt_pivot(p[0], p[1], p[2]); + p2pc->setPivotA(bt_pivot); + p2pc->setPivotB(m_constraint->getRigidBodyA().getCenterOfMassTransform()(bt_pivot)); + // p2pc->buildJacobian(); +*/ } + + virtual void get_pivot(vec3f &p) const { +/* btSliderConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInA().x(); + p[1] = hc->getPivotInA().y(); + p[2] = hc->getPivotInA().z(); +*/ } + + virtual void get_world_pivot(vec3f &p) const { +/* btSliderConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getPivotInB().x(); + p[1] = hc->getPivotInB().y(); + p[2] = hc->getPivotInB().z(); +*/ } + + virtual void set_world(vec3f const &p) { +/* btSliderConstraint* hc = static_cast(m_constraint.get()); + btVector3 world(p[0], p[1], p[2]); + btVector3 pivotA = hc->getRigidBodyA().getWorldTransform().inverse() (world); + hc->getFrameOffsetA().getOrigin() = pivotA; + hc->getFrameOffsetB().getOrigin() = world; + */ // p2pc->buildJacobian(); + world = p; + } + + virtual void get_world(vec3f &p) const { +/* btSliderConstraint const* hc = static_cast(m_constraint.get()); + p[0] = hc->getFrameOffsetB().getOrigin().x(); + p[1] = hc->getFrameOffsetB().getOrigin().y(); + p[2] = hc->getFrameOffsetB().getOrigin().z(); +*/ p = world; + } + + virtual void update_constraint() + { +/* btRigidBody& bt_bodyA = *static_cast(rbA)->body(); + btRigidBody& bt_bodyB = *static_cast(rbB)->body(); + btTransform framInA = btTransform::getIdentity(); + btTransform framInB = btTransform::getIdentity(); + btSliderConstraint* slider = static_cast(m_constraint.get()); + slider->getFrameOffsetA(); +*/ } + +protected: + friend class bt_solver_t; + vec3f world; + + bt_slider_constraint_t(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB): + slider_constraint_impl_t() + { + btRigidBody& bt_bodyA = *static_cast(rbA)->body(); + btRigidBody& bt_bodyB = *static_cast(rbB)->body(); + btTransform framInA = btTransform::getIdentity(); + btTransform framInB = btTransform::getIdentity(); + btSliderConstraint * slider = new btSliderConstraint(bt_bodyA, bt_bodyB, framInA, framInB, true); + m_constraint.reset(slider); + rbA->add_constraint(this); + } + +private: + +}; + +#endif //DYN_BT_SLIDER_CONSTRAINT_H diff --git a/Extras/MayaPlugin/constraint.h b/Extras/MayaPlugin/constraint/constraint.h similarity index 96% rename from Extras/MayaPlugin/constraint.h rename to Extras/MayaPlugin/constraint/constraint.h index fdc5aa871..2002c579c 100644 --- a/Extras/MayaPlugin/constraint.h +++ b/Extras/MayaPlugin/constraint/constraint.h @@ -1,52 +1,52 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//constraint.h - -#ifndef DYN_CONSTRAINT_H -#define DYN_CONSTRAINT_H - -#include "shared_ptr.h" -#include "constraint_impl.h" - -class constraint_t -{ -public: - //typedefs - typedef shared_ptr pointer; - -public: - virtual ~constraint_t() {} - -protected: - friend class solver_t; - - constraint_t(constraint_impl_t* impl): m_impl(impl) { } - - constraint_impl_t* impl() { return m_impl.get(); } - constraint_impl_t const* impl() const { return m_impl.get(); } - -protected: - shared_ptr m_impl; -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//constraint.h + +#ifndef DYN_CONSTRAINT_H +#define DYN_CONSTRAINT_H + +#include "shared_ptr.h" +#include "constraint_impl.h" + +class constraint_t +{ +public: + //typedefs + typedef shared_ptr pointer; + +public: + virtual ~constraint_t() {} + +protected: + friend class solver_t; + + constraint_t(constraint_impl_t* impl): m_impl(impl) { } + + constraint_impl_t* impl() { return m_impl.get(); } + constraint_impl_t const* impl() const { return m_impl.get(); } + +protected: + shared_ptr m_impl; +}; + +#endif diff --git a/Extras/MayaPlugin/constraint_impl.h b/Extras/MayaPlugin/constraint/constraint_impl.h similarity index 96% rename from Extras/MayaPlugin/constraint_impl.h rename to Extras/MayaPlugin/constraint/constraint_impl.h index 36d69b435..919c0e3fa 100644 --- a/Extras/MayaPlugin/constraint_impl.h +++ b/Extras/MayaPlugin/constraint/constraint_impl.h @@ -1,37 +1,37 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//constraint_impl.h - -#ifndef DYN_CONSTRAINT_IMPL_H -#define DYN_CONSTRAINT_IMPL_H - -class constraint_impl_t -{ -public: - // - -public: - virtual ~constraint_impl_t() {}; -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//constraint_impl.h + +#ifndef DYN_CONSTRAINT_IMPL_H +#define DYN_CONSTRAINT_IMPL_H + +class constraint_impl_t +{ +public: + // + +public: + virtual ~constraint_impl_t() {}; +}; + +#endif diff --git a/Extras/MayaPlugin/constraint/dHingeConstraintCmd.cpp b/Extras/MayaPlugin/constraint/dHingeConstraintCmd.cpp new file mode 100644 index 000000000..5883f2952 --- /dev/null +++ b/Extras/MayaPlugin/constraint/dHingeConstraintCmd.cpp @@ -0,0 +1,133 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dHingeConstraintCmd.cpp + +#include +#include +#include + +#include "hingeConstraintNode.h" +#include "dHingeConstraintCmd.h" + + +MString dHingeConstraintCmd::typeName("dHingeConstraint"); + +dHingeConstraintCmd::dHingeConstraintCmd() + : m_argDatabase(0), + m_dagModifier(0) +{ +} + + +dHingeConstraintCmd::~dHingeConstraintCmd() +{ + if (m_argDatabase) { + delete m_argDatabase; + } + + if (m_dagModifier) { + delete m_dagModifier; + } +} + + +void * +dHingeConstraintCmd::creator() +{ + return new dHingeConstraintCmd; +} + + +MSyntax +dHingeConstraintCmd::syntax() +{ + MSyntax syntax; + syntax.enableQuery(false); + syntax.enableEdit(false); + + syntax.addFlag("-n", "-name", MSyntax::kString); + // syntax.addFlag("-fn", "-filename", MSyntax::kString); + // syntax.addFlag("-col", "-color", MSyntax::kString); + // syntax.addFlag("-dia", "-diameter", MSyntax::kDouble); + + return syntax; +} + + +MStatus +dHingeConstraintCmd::doIt(const MArgList &args) +{ + MStatus stat; + m_argDatabase = new MArgDatabase(syntax(), args, &stat); + if (stat == MS::kFailure) { + return stat; + } + return redoIt(); +} + + +MStatus +dHingeConstraintCmd::undoIt() +{ + MGlobal::setActiveSelectionList(m_undoSelectionList); + + if (m_dagModifier) { + m_dagModifier->undoIt(); + delete m_dagModifier; + m_dagModifier = 0; + } + + return MS::kSuccess; +} + + +MStatus +dHingeConstraintCmd::redoIt() +{ + MGlobal::getActiveSelectionList(m_undoSelectionList); + + MString name; + if (m_argDatabase->isFlagSet("-name")) { + m_argDatabase->getFlagArgument("-name", 0, name); + } + if (!name.length()) { + name = "dHingeConstraint"; + } + + m_dagModifier = new MDagModifier; + + MObject parentObj = m_dagModifier->createNode("transform"); + m_dagModifier->renameNode(parentObj, name + "#"); + m_dagModifier->doIt(); + + MObject dConstraintObj = m_dagModifier->createNode(hingeConstraintNode::typeId, parentObj); + std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar(); + std::string::size_type pos = dConstraintName.find_last_not_of("0123456789"); + dConstraintName.insert(pos + 1, "Shape"); + m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str()); + m_dagModifier->doIt(); + + setResult(MFnDependencyNode(dConstraintObj).name()); + + return MS::kSuccess; +} diff --git a/Extras/MayaPlugin/constraint/dHingeConstraintCmd.h b/Extras/MayaPlugin/constraint/dHingeConstraintCmd.h new file mode 100644 index 000000000..f16c7d4cc --- /dev/null +++ b/Extras/MayaPlugin/constraint/dHingeConstraintCmd.h @@ -0,0 +1,58 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dHingeConstraintCmd.h + +#ifndef DYN_HINGE_CONSTRAINT_CMD_H +#define DYN_HINGE_CONSTRAINT_CMD_H + +#include +#include +#include + +#include + +class dHingeConstraintCmd : public MPxCommand +{ +public: + dHingeConstraintCmd(); + virtual ~dHingeConstraintCmd(); + + static void *creator(); + static MSyntax syntax(); + + MStatus doIt(const MArgList &i_mArgList); + MStatus redoIt(); + MStatus undoIt(); + bool isUndoable() const { return true; } + bool hasSyntax() const { return true; } + + static MString typeName; + +protected: + MArgDatabase *m_argDatabase; + MDagModifier *m_dagModifier; + + MSelectionList m_undoSelectionList; +}; + +#endif //DYN_HINGE_CONSTRAINT_CMD_H diff --git a/Extras/MayaPlugin/dNailConstraintCmd.cpp b/Extras/MayaPlugin/constraint/dNailConstraintCmd.cpp similarity index 95% rename from Extras/MayaPlugin/dNailConstraintCmd.cpp rename to Extras/MayaPlugin/constraint/dNailConstraintCmd.cpp index d9d2a5894..9acc1d9f5 100644 --- a/Extras/MayaPlugin/dNailConstraintCmd.cpp +++ b/Extras/MayaPlugin/constraint/dNailConstraintCmd.cpp @@ -1,133 +1,133 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//dNailConstraintCmd.cpp - -#include -#include -#include - -#include "nailConstraintNode.h" -#include "dNailConstraintCmd.h" - - -MString dNailConstraintCmd::typeName("dNailConstraint"); - -dNailConstraintCmd::dNailConstraintCmd() - : m_argDatabase(0), - m_dagModifier(0) -{ -} - - -dNailConstraintCmd::~dNailConstraintCmd() -{ - if (m_argDatabase) { - delete m_argDatabase; - } - - if (m_dagModifier) { - delete m_dagModifier; - } -} - - -void * -dNailConstraintCmd::creator() -{ - return new dNailConstraintCmd; -} - - -MSyntax -dNailConstraintCmd::syntax() -{ - MSyntax syntax; - syntax.enableQuery(false); - syntax.enableEdit(false); - - syntax.addFlag("-n", "-name", MSyntax::kString); - // syntax.addFlag("-fn", "-filename", MSyntax::kString); - // syntax.addFlag("-col", "-color", MSyntax::kString); - // syntax.addFlag("-dia", "-diameter", MSyntax::kDouble); - - return syntax; -} - - -MStatus -dNailConstraintCmd::doIt(const MArgList &args) -{ - MStatus stat; - m_argDatabase = new MArgDatabase(syntax(), args, &stat); - if (stat == MS::kFailure) { - return stat; - } - return redoIt(); -} - - -MStatus -dNailConstraintCmd::undoIt() -{ - MGlobal::setActiveSelectionList(m_undoSelectionList); - - if (m_dagModifier) { - m_dagModifier->undoIt(); - delete m_dagModifier; - m_dagModifier = 0; - } - - return MS::kSuccess; -} - - -MStatus -dNailConstraintCmd::redoIt() -{ - MGlobal::getActiveSelectionList(m_undoSelectionList); - - MString name; - if (m_argDatabase->isFlagSet("-name")) { - m_argDatabase->getFlagArgument("-name", 0, name); - } - if (!name.length()) { - name = "dNailConstraint"; - } - - m_dagModifier = new MDagModifier; - - MObject parentObj = m_dagModifier->createNode("transform"); - m_dagModifier->renameNode(parentObj, name + "#"); - m_dagModifier->doIt(); - - MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj); - std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar(); - std::string::size_type pos = dConstraintName.find_last_not_of("0123456789"); - dConstraintName.insert(pos + 1, "Shape"); - m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str()); - m_dagModifier->doIt(); - - setResult(MFnDependencyNode(dConstraintObj).name()); - - return MS::kSuccess; -} +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//dNailConstraintCmd.cpp + +#include +#include +#include + +#include "nailConstraintNode.h" +#include "dNailConstraintCmd.h" + + +MString dNailConstraintCmd::typeName("dNailConstraint"); + +dNailConstraintCmd::dNailConstraintCmd() + : m_argDatabase(0), + m_dagModifier(0) +{ +} + + +dNailConstraintCmd::~dNailConstraintCmd() +{ + if (m_argDatabase) { + delete m_argDatabase; + } + + if (m_dagModifier) { + delete m_dagModifier; + } +} + + +void * +dNailConstraintCmd::creator() +{ + return new dNailConstraintCmd; +} + + +MSyntax +dNailConstraintCmd::syntax() +{ + MSyntax syntax; + syntax.enableQuery(false); + syntax.enableEdit(false); + + syntax.addFlag("-n", "-name", MSyntax::kString); + // syntax.addFlag("-fn", "-filename", MSyntax::kString); + // syntax.addFlag("-col", "-color", MSyntax::kString); + // syntax.addFlag("-dia", "-diameter", MSyntax::kDouble); + + return syntax; +} + + +MStatus +dNailConstraintCmd::doIt(const MArgList &args) +{ + MStatus stat; + m_argDatabase = new MArgDatabase(syntax(), args, &stat); + if (stat == MS::kFailure) { + return stat; + } + return redoIt(); +} + + +MStatus +dNailConstraintCmd::undoIt() +{ + MGlobal::setActiveSelectionList(m_undoSelectionList); + + if (m_dagModifier) { + m_dagModifier->undoIt(); + delete m_dagModifier; + m_dagModifier = 0; + } + + return MS::kSuccess; +} + + +MStatus +dNailConstraintCmd::redoIt() +{ + MGlobal::getActiveSelectionList(m_undoSelectionList); + + MString name; + if (m_argDatabase->isFlagSet("-name")) { + m_argDatabase->getFlagArgument("-name", 0, name); + } + if (!name.length()) { + name = "dNailConstraint"; + } + + m_dagModifier = new MDagModifier; + + MObject parentObj = m_dagModifier->createNode("transform"); + m_dagModifier->renameNode(parentObj, name + "#"); + m_dagModifier->doIt(); + + MObject dConstraintObj = m_dagModifier->createNode(nailConstraintNode::typeId, parentObj); + std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar(); + std::string::size_type pos = dConstraintName.find_last_not_of("0123456789"); + dConstraintName.insert(pos + 1, "Shape"); + m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str()); + m_dagModifier->doIt(); + + setResult(MFnDependencyNode(dConstraintObj).name()); + + return MS::kSuccess; +} diff --git a/Extras/MayaPlugin/dNailConstraintCmd.h b/Extras/MayaPlugin/constraint/dNailConstraintCmd.h similarity index 96% rename from Extras/MayaPlugin/dNailConstraintCmd.h rename to Extras/MayaPlugin/constraint/dNailConstraintCmd.h index d09a092bc..6baf287a9 100644 --- a/Extras/MayaPlugin/dNailConstraintCmd.h +++ b/Extras/MayaPlugin/constraint/dNailConstraintCmd.h @@ -1,58 +1,58 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//dNailConstraintCmd.h - -#ifndef DYN_NAIL_CONSTRAINT_CMD_H -#define DYN_NAIL_CONSTRAINT_CMD_H - -#include -#include -#include - -#include - -class dNailConstraintCmd : public MPxCommand -{ -public: - dNailConstraintCmd(); - virtual ~dNailConstraintCmd(); - - static void *creator(); - static MSyntax syntax(); - - MStatus doIt(const MArgList &i_mArgList); - MStatus redoIt(); - MStatus undoIt(); - bool isUndoable() const { return true; } - bool hasSyntax() const { return true; } - - static MString typeName; - -protected: - MArgDatabase *m_argDatabase; - MDagModifier *m_dagModifier; - - MSelectionList m_undoSelectionList; -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//dNailConstraintCmd.h + +#ifndef DYN_NAIL_CONSTRAINT_CMD_H +#define DYN_NAIL_CONSTRAINT_CMD_H + +#include +#include +#include + +#include + +class dNailConstraintCmd : public MPxCommand +{ +public: + dNailConstraintCmd(); + virtual ~dNailConstraintCmd(); + + static void *creator(); + static MSyntax syntax(); + + MStatus doIt(const MArgList &i_mArgList); + MStatus redoIt(); + MStatus undoIt(); + bool isUndoable() const { return true; } + bool hasSyntax() const { return true; } + + static MString typeName; + +protected: + MArgDatabase *m_argDatabase; + MDagModifier *m_dagModifier; + + MSelectionList m_undoSelectionList; +}; + +#endif diff --git a/Extras/MayaPlugin/constraint/dSliderConstraintCmd.cpp b/Extras/MayaPlugin/constraint/dSliderConstraintCmd.cpp new file mode 100644 index 000000000..e0ace3695 --- /dev/null +++ b/Extras/MayaPlugin/constraint/dSliderConstraintCmd.cpp @@ -0,0 +1,133 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dSliderConstraintCmd.cpp + +#include +#include +#include + +#include "sliderConstraintNode.h" +#include "dSliderConstraintCmd.h" + + +MString dSliderConstraintCmd::typeName("dSliderConstraint"); + +dSliderConstraintCmd::dSliderConstraintCmd() + : m_argDatabase(0), + m_dagModifier(0) +{ +} + + +dSliderConstraintCmd::~dSliderConstraintCmd() +{ + if (m_argDatabase) { + delete m_argDatabase; + } + + if (m_dagModifier) { + delete m_dagModifier; + } +} + + +void * +dSliderConstraintCmd::creator() +{ + return new dSliderConstraintCmd; +} + + +MSyntax +dSliderConstraintCmd::syntax() +{ + MSyntax syntax; + syntax.enableQuery(false); + syntax.enableEdit(false); + + syntax.addFlag("-n", "-name", MSyntax::kString); + // syntax.addFlag("-fn", "-filename", MSyntax::kString); + // syntax.addFlag("-col", "-color", MSyntax::kString); + // syntax.addFlag("-dia", "-diameter", MSyntax::kDouble); + + return syntax; +} + + +MStatus +dSliderConstraintCmd::doIt(const MArgList &args) +{ + MStatus stat; + m_argDatabase = new MArgDatabase(syntax(), args, &stat); + if (stat == MS::kFailure) { + return stat; + } + return redoIt(); +} + + +MStatus +dSliderConstraintCmd::undoIt() +{ + MGlobal::setActiveSelectionList(m_undoSelectionList); + + if (m_dagModifier) { + m_dagModifier->undoIt(); + delete m_dagModifier; + m_dagModifier = 0; + } + + return MS::kSuccess; +} + + +MStatus +dSliderConstraintCmd::redoIt() +{ + MGlobal::getActiveSelectionList(m_undoSelectionList); + + MString name; + if (m_argDatabase->isFlagSet("-name")) { + m_argDatabase->getFlagArgument("-name", 0, name); + } + if (!name.length()) { + name = "dSliderConstraint"; + } + + m_dagModifier = new MDagModifier; + + MObject parentObj = m_dagModifier->createNode("transform"); + m_dagModifier->renameNode(parentObj, name + "#"); + m_dagModifier->doIt(); + + MObject dConstraintObj = m_dagModifier->createNode(sliderConstraintNode::typeId, parentObj); + std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar(); + std::string::size_type pos = dConstraintName.find_last_not_of("0123456789"); + dConstraintName.insert(pos + 1, "Shape"); + m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str()); + m_dagModifier->doIt(); + + setResult(MFnDependencyNode(dConstraintObj).name()); + + return MS::kSuccess; +} diff --git a/Extras/MayaPlugin/constraint/dSliderConstraintCmd.h b/Extras/MayaPlugin/constraint/dSliderConstraintCmd.h new file mode 100644 index 000000000..6a130aad6 --- /dev/null +++ b/Extras/MayaPlugin/constraint/dSliderConstraintCmd.h @@ -0,0 +1,58 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dSliderConstraintCmd.h + +#ifndef DYN_SLIDER_CONSTRAINT_CMD_H +#define DYN_SLIDER_CONSTRAINT_CMD_H + +#include +#include +#include + +#include + +class dSliderConstraintCmd : public MPxCommand +{ +public: + dSliderConstraintCmd(); + virtual ~dSliderConstraintCmd(); + + static void *creator(); + static MSyntax syntax(); + + MStatus doIt(const MArgList &i_mArgList); + MStatus redoIt(); + MStatus undoIt(); + bool isUndoable() const { return true; } + bool hasSyntax() const { return true; } + + static MString typeName; + +protected: + MArgDatabase *m_argDatabase; + MDagModifier *m_dagModifier; + + MSelectionList m_undoSelectionList; +}; + +#endif //DYN_SLIDER_CONSTRAINT_CMD_H diff --git a/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.cpp b/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.cpp new file mode 100644 index 000000000..d55b1ea5a --- /dev/null +++ b/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.cpp @@ -0,0 +1,133 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dSixdofConstraintCmd.cpp + +#include +#include +#include + +#include "sixdofConstraintNode.h" +#include "dSixdofConstraintCmd.h" + + +MString dSixdofConstraintCmd::typeName("dSixdofConstraint"); + +dSixdofConstraintCmd::dSixdofConstraintCmd() + : m_argDatabase(0), + m_dagModifier(0) +{ +} + + +dSixdofConstraintCmd::~dSixdofConstraintCmd() +{ + if (m_argDatabase) { + delete m_argDatabase; + } + + if (m_dagModifier) { + delete m_dagModifier; + } +} + + +void * +dSixdofConstraintCmd::creator() +{ + return new dSixdofConstraintCmd; +} + + +MSyntax +dSixdofConstraintCmd::syntax() +{ + MSyntax syntax; + syntax.enableQuery(false); + syntax.enableEdit(false); + + syntax.addFlag("-n", "-name", MSyntax::kString); + // syntax.addFlag("-fn", "-filename", MSyntax::kString); + // syntax.addFlag("-col", "-color", MSyntax::kString); + // syntax.addFlag("-dia", "-diameter", MSyntax::kDouble); + + return syntax; +} + + +MStatus +dSixdofConstraintCmd::doIt(const MArgList &args) +{ + MStatus stat; + m_argDatabase = new MArgDatabase(syntax(), args, &stat); + if (stat == MS::kFailure) { + return stat; + } + return redoIt(); +} + + +MStatus +dSixdofConstraintCmd::undoIt() +{ + MGlobal::setActiveSelectionList(m_undoSelectionList); + + if (m_dagModifier) { + m_dagModifier->undoIt(); + delete m_dagModifier; + m_dagModifier = 0; + } + + return MS::kSuccess; +} + + +MStatus +dSixdofConstraintCmd::redoIt() +{ + MGlobal::getActiveSelectionList(m_undoSelectionList); + + MString name; + if (m_argDatabase->isFlagSet("-name")) { + m_argDatabase->getFlagArgument("-name", 0, name); + } + if (!name.length()) { + name = "dSixdofConstraint"; + } + + m_dagModifier = new MDagModifier; + + MObject parentObj = m_dagModifier->createNode("transform"); + m_dagModifier->renameNode(parentObj, name + "#"); + m_dagModifier->doIt(); + + MObject dConstraintObj = m_dagModifier->createNode(sixdofConstraintNode::typeId, parentObj); + std::string dConstraintName = MFnDependencyNode(parentObj).name().asChar(); + std::string::size_type pos = dConstraintName.find_last_not_of("0123456789"); + dConstraintName.insert(pos + 1, "Shape"); + m_dagModifier->renameNode(dConstraintObj, dConstraintName.c_str()); + m_dagModifier->doIt(); + + setResult(MFnDependencyNode(dConstraintObj).name()); + + return MS::kSuccess; +} diff --git a/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.h b/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.h new file mode 100644 index 000000000..dac3a517e --- /dev/null +++ b/Extras/MayaPlugin/constraint/dsixdofConstraintCmd.h @@ -0,0 +1,58 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//dSixdofConstraintCmd.h + +#ifndef DYN_SIXDOF_CONSTRAINT_CMD_H +#define DYN_SIXDOF_CONSTRAINT_CMD_H + +#include +#include +#include + +#include + +class dSixdofConstraintCmd : public MPxCommand +{ +public: + dSixdofConstraintCmd(); + virtual ~dSixdofConstraintCmd(); + + static void *creator(); + static MSyntax syntax(); + + MStatus doIt(const MArgList &i_mArgList); + MStatus redoIt(); + MStatus undoIt(); + bool isUndoable() const { return true; } + bool hasSyntax() const { return true; } + + static MString typeName; + +protected: + MArgDatabase *m_argDatabase; + MDagModifier *m_dagModifier; + + MSelectionList m_undoSelectionList; +}; + +#endif //DYN_SIXDOF_CONSTRAINT_CMD_H diff --git a/Extras/MayaPlugin/constraint/hingeConstraintNode.cpp b/Extras/MayaPlugin/constraint/hingeConstraintNode.cpp new file mode 100644 index 000000000..d67ba23f6 --- /dev/null +++ b/Extras/MayaPlugin/constraint/hingeConstraintNode.cpp @@ -0,0 +1,443 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//hingeConstraintNode.cpp + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rigidBodyNode.h" +#include "hingeConstraintNode.h" +#include "mayaUtils.h" + +#include "solver.h" + +MTypeId hingeConstraintNode::typeId(0x10033B); +MString hingeConstraintNode::typeName("dHingeConstraint"); + +MObject hingeConstraintNode::ia_rigidBody; +MObject hingeConstraintNode::ia_damping; +MObject hingeConstraintNode::ia_lowerLimit; +MObject hingeConstraintNode::ia_upperLimit; +MObject hingeConstraintNode::ia_limitSoftness; +MObject hingeConstraintNode::ia_biasFactor; +MObject hingeConstraintNode::ia_relaxationFactor; +MObject hingeConstraintNode::ia_hingeAxis; + +MObject hingeConstraintNode::ia_enableAngularMotor; +MObject hingeConstraintNode::ia_motorTargetVelocity; +MObject hingeConstraintNode::ia_maxMotorImpulse; + +MObject hingeConstraintNode::ca_constraint; +MObject hingeConstraintNode::ca_constraintParam; + +MStatus hingeConstraintNode::initialize() +{ + MStatus status; + MFnMessageAttribute fnMsgAttr; + MFnNumericAttribute fnNumericAttr; + MFnMatrixAttribute fnMatrixAttr; + + ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status); + MCHECKSTATUS(status, "creating inRigidBody attribute") + status = addAttribute(ia_rigidBody); + MCHECKSTATUS(status, "adding inRigidBody attribute") + + ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status); + MCHECKSTATUS(status, "creating damping attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_damping); + MCHECKSTATUS(status, "adding damping attribute") + + ia_lowerLimit = fnNumericAttr.create("lowerLimit", "llmt", MFnNumericData::kDouble, -1.57, &status); + MCHECKSTATUS(status, "creating lower limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_lowerLimit); + MCHECKSTATUS(status, "adding lower limit attribute") + + ia_upperLimit = fnNumericAttr.create("upperLimit", "ulmt", MFnNumericData::kDouble, 1.57, &status); + MCHECKSTATUS(status, "creating upper limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_upperLimit); + MCHECKSTATUS(status, "adding upper limit attribute") + + ia_limitSoftness = fnNumericAttr.create("limitSoftness", "lmSo", MFnNumericData::kDouble, 0.9, &status); + MCHECKSTATUS(status, "creating limitSoftness attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_limitSoftness); + MCHECKSTATUS(status, "adding limitSoftness attribute") + + ia_biasFactor = fnNumericAttr.create("biasFactor", "biFa", MFnNumericData::kDouble, 0.3, &status); + MCHECKSTATUS(status, "creating biasFactor attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_biasFactor); + MCHECKSTATUS(status, "adding biasFactor attribute") + + ia_relaxationFactor = fnNumericAttr.create("relaxationFactor", "reFa", MFnNumericData::kDouble, 1.0, &status); + MCHECKSTATUS(status, "creating relaxationFactor attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_relaxationFactor); + MCHECKSTATUS(status, "adding relaxationFactor attribute") + + ia_hingeAxis = fnNumericAttr.createPoint("hingeAxis", "hgAx", &status); + MCHECKSTATUS(status, "creating hingeAxis attribute") + status = addAttribute(ia_hingeAxis); + MCHECKSTATUS(status, "adding hingeAxis attribute") + + //------------------------------------------------------------------------------ + + ia_enableAngularMotor = fnNumericAttr.create("enableAngularMotor", "enAM", MFnNumericData::kBoolean, false, &status); + MCHECKSTATUS(status, "creating enableAngularMotor attribute") + status = addAttribute(ia_enableAngularMotor); + MCHECKSTATUS(status, "adding enableAngularMotor attribute") + + ia_motorTargetVelocity = fnNumericAttr.create("motorTargetVelocity", "mTV", MFnNumericData::kDouble, 1, &status); + MCHECKSTATUS(status, "creating motorTargetVelocity attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_motorTargetVelocity); + MCHECKSTATUS(status, "adding motorTargetVelocity attribute") + + ia_maxMotorImpulse = fnNumericAttr.create("maxMotorImpulse", "mMI", MFnNumericData::kDouble, 1, &status); + MCHECKSTATUS(status, "creating maxMotorImpulse attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_maxMotorImpulse); + MCHECKSTATUS(status, "adding maxMotorImpulse attribute") + + //------------------------------------------------------------------------------ + + ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraint attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraint); + MCHECKSTATUS(status, "adding ca_constraint attribute") + + ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraintParam attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraintParam); + MCHECKSTATUS(status, "adding ca_constraintParam attribute") + + + status = attributeAffects(ia_rigidBody, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)") + + status = attributeAffects(ia_rigidBody, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)") + + status = attributeAffects(ia_damping, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)") + + status = attributeAffects(ia_lowerLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLimit, ca_constraintParam)") + + status = attributeAffects(ia_upperLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_upperLimit, ca_constraintParam)") + + status = attributeAffects(ia_limitSoftness, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_limitSoftness, ca_constraintParam)") + status = attributeAffects(ia_biasFactor, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_biasFactor, ca_constraintParam)") + status = attributeAffects(ia_relaxationFactor, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_relaxationFactor, ca_constraintParam)") + + status = attributeAffects(ia_hingeAxis, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_hingeAxis, ca_constraintParam)") + + status = attributeAffects(ia_enableAngularMotor, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_enableAngularMotor, ca_constraintParam)") + status = attributeAffects(ia_motorTargetVelocity, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_motorTargetVelocity, ca_constraintParam)") + status = attributeAffects(ia_maxMotorImpulse, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_maxMotorImpulse, ca_constraintParam)") + + return MS::kSuccess; +} + +hingeConstraintNode::hingeConstraintNode() +{ + // std::cout << "hingeConstraintNode::hingeConstraintNode" << std::endl; +} + +hingeConstraintNode::~hingeConstraintNode() +{ + // std::cout << "hingeConstraintNode::~hingeConstraintNode" << std::endl; +} + +void hingeConstraintNode::nodeRemoved(MObject& node, void *clientData) +{ + // std::cout << "hingeConstraintNode::nodeRemoved" << std::endl; + MFnDependencyNode fnNode(node); + hingeConstraintNode *pNode = static_cast(fnNode.userNode()); + constraint_t::pointer constraint = static_cast(pNode->m_constraint); + solver_t::remove_constraint(constraint); +} + +void* hingeConstraintNode::creator() +{ + return new hingeConstraintNode(); +} + + +bool hingeConstraintNode::setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx) +{ + /* if ((plug == pdbFiles) || (plug == ia_scale) || (plug == ia_percent)) { + m_framesDirty = true; + } else if(plug == textureFiles) { + gpufx::m_renderer.setColorTextureDirty(); + }*/ + return false; //setInternalValueInContext(plug,dataHandle,ctx); +} + +MStatus hingeConstraintNode::compute(const MPlug& plug, MDataBlock& data) +{ + //std::cout << "hingeConstraintNode::compute: " << plug.name() << std::endl; + //MTime time = data.inputValue( hingeConstraintNode::inTime ).asTime(); + if(plug == ca_constraint) { + computeConstraint(plug, data); + } else if(plug == ca_constraintParam) { + computeConstraintParam(plug, data); + } else if(plug.isElement()) { + if(plug.array() == worldMatrix && plug.logicalIndex() == 0) { + computeWorldMatrix(plug, data); + } else { + return MStatus::kUnknownParameter; + } + } else { + return MStatus::kUnknownParameter; + } + return MStatus::kSuccess; +} + +void hingeConstraintNode::draw( M3dView & view, const MDagPath &path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ) +{ + // std::cout << "hingeConstraintNode::draw" << std::endl; + + update(); + + view.beginGL(); + glPushAttrib( GL_ALL_ATTRIB_BITS ); + + glDisable(GL_LIGHTING); + + if( !(status == M3dView::kActive || + status == M3dView::kLead || + status == M3dView::kHilite || + ( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) { + glColor3f(1.0, 1.0, 0.0); + } + + vec3f pos; + if (m_constraint) { + vec3f world; + m_constraint->get_world(world); + vec3f posA; + quatf rotA; + m_constraint->rigid_body()->get_transform(posA, rotA); + pos = posA - world; + } + + glBegin(GL_LINES); + glVertex3f(0.0, 0.0, 0.0); + glVertex3f(pos[0], pos[1], pos[2]); + + glVertex3f(-1.0, 0.0, 0.0); + glVertex3f(1.0, 0.0, 0.0); + + glVertex3f(0.0, -1.0, 0.0); + glVertex3f(0.0, 1.0, 0.0); + + glVertex3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, 1.0); + glEnd(); + + glPopAttrib(); + view.endGL(); +} + +bool hingeConstraintNode::isBounded() const +{ + //return true; + return false; +} + +MBoundingBox hingeConstraintNode::boundingBox() const +{ + // std::cout << "hingeConstraintNode::boundingBox()" << std::endl; + //load the pdbs + MObject node = thisMObject(); + + MPoint corner1(-1, -1, -1); + MPoint corner2(1, 1, 1); + return MBoundingBox(corner1, corner2); +} + +//standard attributes +void hingeConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "hingeConstraintNode::computeConstraint" << std::endl; + + MObject thisObject(thisMObject()); + MPlug plgRigidBody(thisObject, ia_rigidBody); + MObject update; + //force evaluation of the rigidBody + plgRigidBody.getValue(update); + + rigid_body_t::pointer rigid_body; + if(plgRigidBody.isConnected()) { + MPlugArray connections; + plgRigidBody.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNode(connections[0].node()); + if(fnNode.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNode = static_cast(fnNode.userNode()); + rigid_body = pRigidBodyNode->rigid_body(); + } else { + std::cout << "hingeConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + if(rigid_body) { + //not connected to a rigid body, put a default one + constraint_t::pointer constraint = static_cast(m_constraint); + solver_t::remove_constraint(constraint); + m_constraint = solver_t::create_hinge_constraint(rigid_body); + constraint = static_cast(m_constraint); + solver_t::add_constraint(constraint); + } + + data.outputValue(ca_constraint).set(true); + data.setClean(plug); +} + + +void hingeConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "hingeConstraintNode::computeWorldMatrix" << std::endl; + + MObject thisObject(thisMObject()); + MFnDagNode fnDagNode(thisObject); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + + MStatus status; + + MFnTransform fnParentTransform(fnDagNode.parent(0, &status)); + + MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); + + // MQuaternion mrotation; + // fnParentTransform.getRotation(mrotation, MSpace::kTransform); + + if(m_constraint) { + vec3f world_pivot; + m_constraint->get_world(world_pivot); + if(world_pivot[0] != float(mtranslation.x) || + world_pivot[1] != float(mtranslation.y) || + world_pivot[2] != float(mtranslation.z)) { + +// mat4x4f xform; +// m_constraint->rigid_body()->get_transform(xform); +// vec4f pivot = prod(trans(xform), vec4f(mtranslation.x, mtranslation.y, mtranslation.z, 1.0)); +// m_constraint->set_pivot(vec3f(pivot[0], pivot[1], pivot[2])); + m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2])); + } + } + + data.setClean(plug); +} + +void hingeConstraintNode::computeConstraintParam(const MPlug& plug, MDataBlock& data) +{ + //std::cout << "hingeConstraintNode::computeRigidBodyParam data.className=" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + + MPlug(thisObject, ca_constraint).getValue(update); + if(m_constraint) { + float damping = (float) data.inputValue(ia_damping).asDouble(); + m_constraint->set_damping(damping); + float lower = (float) data.inputValue(ia_lowerLimit).asDouble(); + float upper = (float) data.inputValue(ia_upperLimit).asDouble(); + float limit_softness = (float) data.inputValue(ia_limitSoftness).asDouble(); + float bias_factor = (float) data.inputValue(ia_biasFactor).asDouble(); + float relaxation_factor = (float) data.inputValue(ia_relaxationFactor).asDouble(); + + m_constraint->set_limit(lower, upper, limit_softness, bias_factor, relaxation_factor); + + float* axis = data.inputValue(ia_hingeAxis).asFloat3(); + m_constraint->set_axis(vec3f(axis[0], axis[1], axis[2])); + + bool enable_motor = data.inputValue(ia_enableAngularMotor).asBool(); + float motorTargetVelocity = (float) data.inputValue(ia_motorTargetVelocity).asDouble(); + float maxMotorImpulse = (float) data.inputValue(ia_maxMotorImpulse).asDouble(); + m_constraint->enable_motor(enable_motor, motorTargetVelocity, maxMotorImpulse); + } + + data.outputValue(ca_constraintParam).set(true); + data.setClean(plug); +} + +hinge_constraint_t::pointer hingeConstraintNode::constraint() +{ + // std::cout << "hingeConstraintNode::rigid_body" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + return m_constraint; +} + +void hingeConstraintNode::update() +{ + MObject thisObject(thisMObject()); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + MPlug(thisObject, worldMatrix).elementByLogicalIndex(0).getValue(update); +} diff --git a/Extras/MayaPlugin/constraint/hingeConstraintNode.h b/Extras/MayaPlugin/constraint/hingeConstraintNode.h new file mode 100644 index 000000000..00c999977 --- /dev/null +++ b/Extras/MayaPlugin/constraint/hingeConstraintNode.h @@ -0,0 +1,106 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//hingeConstraintNode.h + +#ifndef DYN_HINGE_CONSTRAINT_NODE_H +#define DYN_HINGE_CONSTRAINT_NODE_H + +#include +#include +#include + +#include "solver.h" + +class hingeConstraintNode: public MPxLocatorNode +{ +public: + hingeConstraintNode(); + virtual ~hingeConstraintNode(); + + virtual bool setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx); + + // virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray); + + virtual MStatus compute( const MPlug& plug, MDataBlock& data ); + + virtual void draw( M3dView & view, const MDagPath & path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ); + + + virtual bool isBounded() const ; + virtual MBoundingBox boundingBox() const; + + virtual bool excludeAsLocator() const { return false; } + virtual bool isTransparent() const { return false; } + + static void * creator(); + static MStatus initialize(); + +public: + + hinge_constraint_t::pointer constraint(); + +public: + + //Attributes + static MObject ia_rigidBody; + static MObject ia_damping; + + static MObject ia_lowerLimit; + static MObject ia_upperLimit; + static MObject ia_limitSoftness; + static MObject ia_biasFactor; + static MObject ia_relaxationFactor; + + static MObject ia_hingeAxis; + + static MObject ca_constraint; + static MObject ca_constraintParam; + + static MObject ia_enableAngularMotor; + static MObject ia_motorTargetVelocity; + static MObject ia_maxMotorImpulse; + +public: + static MTypeId typeId; + static MString typeName; + +private: + void update(); + void computeConstraint(const MPlug& plug, MDataBlock& data); + void computeConstraintParam(const MPlug& plug, MDataBlock& data); + void computeWorldMatrix(const MPlug& plug, MDataBlock& data); + +public: + static void nodeRemoved(MObject& node, void *clientData); + +private: + hinge_constraint_t::pointer m_constraint; +}; + + + +#endif //DYN_HINGE_CONSTRAINT_NODE_H diff --git a/Extras/MayaPlugin/constraint/hinge_constraint_impl.h b/Extras/MayaPlugin/constraint/hinge_constraint_impl.h new file mode 100644 index 000000000..c656bcc20 --- /dev/null +++ b/Extras/MayaPlugin/constraint/hinge_constraint_impl.h @@ -0,0 +1,52 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//hinge_constraint_impl.h + +#ifndef DYN_HINGE_CONSTRAINT_IMPL_H +#define DYN_HINGE_CONSTRAINT_IMPL_H + +#include "constraint_impl.h" + +class hinge_constraint_impl_t: public constraint_impl_t +{ +public: + // + virtual void set_pivot(vec3f const& p) = 0; + virtual void get_pivot(vec3f& p) const = 0; + virtual void get_world_pivot(vec3f& p) const = 0; + virtual void set_world(vec3f const& p) = 0; + virtual void get_world(vec3f& p) const = 0; + + // + virtual void set_damping(float d) = 0; + virtual float damping() const = 0; + virtual void set_limit(float lower, float upper, float softness, float bias_factor, float relaxation_factor) = 0; + virtual void set_axis(vec3f const& p) = 0; + + virtual void enable_motor(bool enable, float velocity, float impulse) = 0; + +public: + virtual ~hinge_constraint_impl_t() {}; +}; + +#endif //DYN_HINGE_CONSTRAINT_IMPL_H diff --git a/Extras/MayaPlugin/nailConstraintNode.cpp b/Extras/MayaPlugin/constraint/nailConstraintNode.cpp similarity index 89% rename from Extras/MayaPlugin/nailConstraintNode.cpp rename to Extras/MayaPlugin/constraint/nailConstraintNode.cpp index 57328b656..d454950fc 100644 --- a/Extras/MayaPlugin/nailConstraintNode.cpp +++ b/Extras/MayaPlugin/constraint/nailConstraintNode.cpp @@ -1,324 +1,339 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//nailConstraintNode.cpp - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "rigidBodyNode.h" -#include "nailConstraintNode.h" -#include "mayaUtils.h" - -#include "solver.h" - -MTypeId nailConstraintNode::typeId(0x10033A); -MString nailConstraintNode::typeName("dNailConstraint"); - -MObject nailConstraintNode::ia_rigidBody; -MObject nailConstraintNode::ia_damping; -MObject nailConstraintNode::ca_constraint; -MObject nailConstraintNode::ca_constraintParam; - - -MStatus nailConstraintNode::initialize() -{ - MStatus status; - MFnMessageAttribute fnMsgAttr; - MFnNumericAttribute fnNumericAttr; - MFnMatrixAttribute fnMatrixAttr; - - ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status); - MCHECKSTATUS(status, "creating inRigidBody attribute") - status = addAttribute(ia_rigidBody); - MCHECKSTATUS(status, "adding inRigidBody attribute") - - ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status); - MCHECKSTATUS(status, "creating damping attribute") - fnNumericAttr.setKeyable(true); - status = addAttribute(ia_damping); - MCHECKSTATUS(status, "adding damping attribute") - - ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status); - MCHECKSTATUS(status, "creating ca_constraint attribute") - fnNumericAttr.setConnectable(false); - fnNumericAttr.setHidden(true); - fnNumericAttr.setStorable(false); - fnNumericAttr.setKeyable(false); - status = addAttribute(ca_constraint); - MCHECKSTATUS(status, "adding ca_constraint attribute") - - ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status); - MCHECKSTATUS(status, "creating ca_constraintParam attribute") - fnNumericAttr.setConnectable(false); - fnNumericAttr.setHidden(true); - fnNumericAttr.setStorable(false); - fnNumericAttr.setKeyable(false); - status = addAttribute(ca_constraintParam); - MCHECKSTATUS(status, "adding ca_constraintParam attribute") - - - status = attributeAffects(ia_rigidBody, ca_constraint); - MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)") - - status = attributeAffects(ia_rigidBody, ca_constraintParam); - MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)") - - status = attributeAffects(ia_damping, ca_constraintParam); - MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)") - - return MS::kSuccess; -} - -nailConstraintNode::nailConstraintNode() -{ - // std::cout << "nailConstraintNode::nailConstraintNode" << std::endl; -} - -nailConstraintNode::~nailConstraintNode() -{ - // std::cout << "nailConstraintNode::~nailConstraintNode" << std::endl; -} - -void nailConstraintNode::nodeRemoved(MObject& node, void *clientData) -{ - // std::cout << "nailConstraintNode::nodeRemoved" << std::endl; - MFnDependencyNode fnNode(node); - nailConstraintNode *pNode = static_cast(fnNode.userNode()); - constraint_t::pointer constraint = static_cast(pNode->m_constraint); - solver_t::remove_constraint(constraint); -} - -void* nailConstraintNode::creator() -{ - return new nailConstraintNode(); -} - - -bool nailConstraintNode::setInternalValueInContext ( const MPlug & plug, - const MDataHandle & dataHandle, - MDGContext & ctx) -{ - /* if ((plug == pdbFiles) || (plug == ia_scale) || (plug == ia_percent)) { - m_framesDirty = true; - } else if(plug == textureFiles) { - gpufx::m_renderer.setColorTextureDirty(); - }*/ - return false; //setInternalValueInContext(plug,dataHandle,ctx); -} - -MStatus nailConstraintNode::compute(const MPlug& plug, MDataBlock& data) -{ - //std::cout << "nailConstraintNode::compute: " << plug.name() << std::endl; - //MTime time = data.inputValue( nailConstraintNode::inTime ).asTime(); - if(plug == ca_constraint) { - computeConstraint(plug, data); - } else if(plug == ca_constraintParam) { - computeConstraintParam(plug, data); - } else if(plug.isElement()) { - if(plug.array() == worldMatrix && plug.logicalIndex() == 0) { - computeWorldMatrix(plug, data); - } else { - return MStatus::kUnknownParameter; - } - } else { - return MStatus::kUnknownParameter; - } - return MStatus::kSuccess; -} - -void nailConstraintNode::draw( M3dView & view, const MDagPath &path, - M3dView::DisplayStyle style, - M3dView::DisplayStatus status ) -{ - // std::cout << "nailConstraintNode::draw" << std::endl; - - update(); - - view.beginGL(); - glPushAttrib( GL_ALL_ATTRIB_BITS ); - - glDisable(GL_LIGHTING); - - if( !(status == M3dView::kActive || - status == M3dView::kLead || - status == M3dView::kHilite || - ( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) { - glColor3f(1.0, 1.0, 0.0); - } - - glBegin(GL_LINES); - glVertex3f(-1.0, 0.0, 0.0); - glVertex3f(1.0, 0.0, 0.0); - - glVertex3f(0.0, -1.0, 0.0); - glVertex3f(0.0, 1.0, 0.0); - - glVertex3f(0.0, 0.0, -1.0); - glVertex3f(0.0, 0.0, 1.0); - glEnd(); - - glPopAttrib(); - view.endGL(); -} - -bool nailConstraintNode::isBounded() const -{ - //return true; - return false; -} - -MBoundingBox nailConstraintNode::boundingBox() const -{ - // std::cout << "nailConstraintNode::boundingBox()" << std::endl; - //load the pdbs - MObject node = thisMObject(); - - MPoint corner1(-1, -1, -1); - MPoint corner2(1, 1, 1); - return MBoundingBox(corner1, corner2); -} - -//standard attributes -void nailConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data) -{ - // std::cout << "nailConstraintNode::computeConstraint" << std::endl; - - MObject thisObject(thisMObject()); - MPlug plgRigidBody(thisObject, ia_rigidBody); - MObject update; - //force evaluation of the rigidBody - plgRigidBody.getValue(update); - - rigid_body_t::pointer rigid_body; - if(plgRigidBody.isConnected()) { - MPlugArray connections; - plgRigidBody.connectedTo(connections, true, true); - if(connections.length() != 0) { - MFnDependencyNode fnNode(connections[0].node()); - if(fnNode.typeId() == rigidBodyNode::typeId) { - rigidBodyNode *pRigidBodyNode = static_cast(fnNode.userNode()); - rigid_body = pRigidBodyNode->rigid_body(); - } else { - std::cout << "nailConstraintNode connected to a non-rigidbody node!" << std::endl; - } - } - } - - if(rigid_body) { - //not connected to a rigid body, put a default one - constraint_t::pointer constraint = static_cast(m_constraint); - solver_t::remove_constraint(constraint); - m_constraint = solver_t::create_nail_constraint(rigid_body); - constraint = static_cast(m_constraint); - solver_t::add_constraint(constraint); - } - - data.outputValue(ca_constraint).set(true); - data.setClean(plug); -} - - -void nailConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) -{ - // std::cout << "nailConstraintNode::computeWorldMatrix" << std::endl; - - MObject thisObject(thisMObject()); - MFnDagNode fnDagNode(thisObject); - - MObject update; - MPlug(thisObject, ca_constraint).getValue(update); - MPlug(thisObject, ca_constraintParam).getValue(update); - - - MStatus status; - - MFnTransform fnParentTransform(fnDagNode.parent(0, &status)); - - MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); - - // MQuaternion mrotation; - // fnParentTransform.getRotation(mrotation, MSpace::kTransform); - - if(m_constraint) { - vec3f world_pivot; - m_constraint->get_world_pivot(world_pivot); - if(world_pivot[0] != float(mtranslation.x) || - world_pivot[1] != float(mtranslation.y) || - world_pivot[2] != float(mtranslation.z)) { - - mat4x4f xform; - m_constraint->rigid_body()->get_transform(xform); - vec4f pivot = prod(trans(xform), vec4f(mtranslation.x, mtranslation.y, mtranslation.z, 1.0)); - m_constraint->set_pivot(vec3f(pivot[0], pivot[1], pivot[2])); - } - } - - data.setClean(plug); -} - -void nailConstraintNode::computeConstraintParam(const MPlug& plug, MDataBlock& data) -{ - // std::cout << "nailConstraintNode::computeRigidBodyParam" << std::endl; - - MObject thisObject(thisMObject()); - MObject update; - - MPlug(thisObject, ca_constraint).getValue(update); - if(m_constraint) { - m_constraint->set_damping(data.inputValue(ia_damping).asDouble()); - } - - data.outputValue(ca_constraintParam).set(true); - data.setClean(plug); -} - -nail_constraint_t::pointer nailConstraintNode::constraint() -{ - // std::cout << "nailConstraintNode::rigid_body" << std::endl; - - MObject thisObject(thisMObject()); - MObject update; - MPlug(thisObject, ca_constraint).getValue(update); - MPlug(thisObject, ca_constraintParam).getValue(update); - - return m_constraint; -} - -void nailConstraintNode::update() -{ - MObject thisObject(thisMObject()); - - MObject update; - MPlug(thisObject, ca_constraint).getValue(update); - MPlug(thisObject, ca_constraintParam).getValue(update); - MPlug(thisObject, worldMatrix).elementByLogicalIndex(0).getValue(update); -} +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//nailConstraintNode.cpp + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rigidBodyNode.h" +#include "nailConstraintNode.h" +#include "mayaUtils.h" + +#include "solver.h" + +MTypeId nailConstraintNode::typeId(0x10033A); +MString nailConstraintNode::typeName("dNailConstraint"); + +MObject nailConstraintNode::ia_rigidBody; +MObject nailConstraintNode::ia_damping; +MObject nailConstraintNode::ca_constraint; +MObject nailConstraintNode::ca_constraintParam; + + +MStatus nailConstraintNode::initialize() +{ + MStatus status; + MFnMessageAttribute fnMsgAttr; + MFnNumericAttribute fnNumericAttr; + MFnMatrixAttribute fnMatrixAttr; + + ia_rigidBody = fnMsgAttr.create("inRigidBody", "inrb", &status); + MCHECKSTATUS(status, "creating inRigidBody attribute") + status = addAttribute(ia_rigidBody); + MCHECKSTATUS(status, "adding inRigidBody attribute") + + ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status); + MCHECKSTATUS(status, "creating damping attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_damping); + MCHECKSTATUS(status, "adding damping attribute") + + ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraint attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraint); + MCHECKSTATUS(status, "adding ca_constraint attribute") + + ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraintParam attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraintParam); + MCHECKSTATUS(status, "adding ca_constraintParam attribute") + + + status = attributeAffects(ia_rigidBody, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraint)") + + status = attributeAffects(ia_rigidBody, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBody, ca_constraintParam)") + + status = attributeAffects(ia_damping, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)") + + return MS::kSuccess; +} + +nailConstraintNode::nailConstraintNode() +{ + // std::cout << "nailConstraintNode::nailConstraintNode" << std::endl; +} + +nailConstraintNode::~nailConstraintNode() +{ + // std::cout << "nailConstraintNode::~nailConstraintNode" << std::endl; +} + +void nailConstraintNode::nodeRemoved(MObject& node, void *clientData) +{ + // std::cout << "nailConstraintNode::nodeRemoved" << std::endl; + MFnDependencyNode fnNode(node); + nailConstraintNode *pNode = static_cast(fnNode.userNode()); + constraint_t::pointer constraint = static_cast(pNode->m_constraint); + solver_t::remove_constraint(constraint); +} + +void* nailConstraintNode::creator() +{ + return new nailConstraintNode(); +} + + +bool nailConstraintNode::setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx) +{ + /* if ((plug == pdbFiles) || (plug == ia_scale) || (plug == ia_percent)) { + m_framesDirty = true; + } else if(plug == textureFiles) { + gpufx::m_renderer.setColorTextureDirty(); + }*/ + return false; //setInternalValueInContext(plug,dataHandle,ctx); +} + +MStatus nailConstraintNode::compute(const MPlug& plug, MDataBlock& data) +{ + //std::cout << "nailConstraintNode::compute: " << plug.name() << std::endl; + //MTime time = data.inputValue( nailConstraintNode::inTime ).asTime(); + if(plug == ca_constraint) { + computeConstraint(plug, data); + } else if(plug == ca_constraintParam) { + computeConstraintParam(plug, data); + } else if(plug.isElement()) { + if(plug.array() == worldMatrix && plug.logicalIndex() == 0) { + computeWorldMatrix(plug, data); + } else { + return MStatus::kUnknownParameter; + } + } else { + return MStatus::kUnknownParameter; + } + return MStatus::kSuccess; +} + +void nailConstraintNode::draw( M3dView & view, const MDagPath &path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ) +{ + // std::cout << "nailConstraintNode::draw" << std::endl; + + update(); + + view.beginGL(); + glPushAttrib( GL_ALL_ATTRIB_BITS ); + + glDisable(GL_LIGHTING); + + if( !(status == M3dView::kActive || + status == M3dView::kLead || + status == M3dView::kHilite || + ( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) { + glColor3f(1.0, 1.0, 0.0); + } + vec3f pos; + if (m_constraint) { + vec3f world; + m_constraint->get_world(world); + vec3f posA; + quatf rotA; + m_constraint->rigid_body()->get_transform(posA, rotA); + pos = posA - world; + } + + glBegin(GL_LINES); + glVertex3f(0.0, 0.0, 0.0); + glVertex3f(pos[0], pos[1], pos[2]); + + glVertex3f(-1.0, 0.0, 0.0); + glVertex3f(1.0, 0.0, 0.0); + + glVertex3f(0.0, -1.0, 0.0); + glVertex3f(0.0, 1.0, 0.0); + + glVertex3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, 1.0); + glEnd(); + + glPopAttrib(); + view.endGL(); +} + +bool nailConstraintNode::isBounded() const +{ + //return true; + return false; +} + +MBoundingBox nailConstraintNode::boundingBox() const +{ + // std::cout << "nailConstraintNode::boundingBox()" << std::endl; + //load the pdbs + MObject node = thisMObject(); + + MPoint corner1(-1, -1, -1); + MPoint corner2(1, 1, 1); + return MBoundingBox(corner1, corner2); +} + +//standard attributes +void nailConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "nailConstraintNode::computeConstraint" << std::endl; + + MObject thisObject(thisMObject()); + MPlug plgRigidBody(thisObject, ia_rigidBody); + MObject update; + //force evaluation of the rigidBody + plgRigidBody.getValue(update); + + rigid_body_t::pointer rigid_body; + if(plgRigidBody.isConnected()) { + MPlugArray connections; + plgRigidBody.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNode(connections[0].node()); + if(fnNode.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNode = static_cast(fnNode.userNode()); + rigid_body = pRigidBodyNode->rigid_body(); + } else { + std::cout << "nailConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + if(rigid_body) { + //not connected to a rigid body, put a default one + constraint_t::pointer constraint = static_cast(m_constraint); + solver_t::remove_constraint(constraint); + m_constraint = solver_t::create_nail_constraint(rigid_body); + constraint = static_cast(m_constraint); + solver_t::add_constraint(constraint); + } + + data.outputValue(ca_constraint).set(true); + data.setClean(plug); +} + + +void nailConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "nailConstraintNode::computeWorldMatrix" << std::endl; + + MObject thisObject(thisMObject()); + MFnDagNode fnDagNode(thisObject); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + + MStatus status; + + MFnTransform fnParentTransform(fnDagNode.parent(0, &status)); + + MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); + + // MQuaternion mrotation; + // fnParentTransform.getRotation(mrotation, MSpace::kTransform); + + if(m_constraint) { + vec3f world; + m_constraint->get_world(world); + if(world[0] != float(mtranslation.x) || + world[1] != float(mtranslation.y) || + world[2] != float(mtranslation.z)) { + +/* mat4x4f xform; + m_constraint->rigid_body()->get_transform(xform); + vec4f pivot = prod(trans(xform), vec4f(mtranslation.x, mtranslation.y, mtranslation.z, 1.0)); + std::cout << "pivot (" << pivot[0] << "," << pivot[0] << "," << pivot[0] << ")" << std::endl; +*/ +// std::cout << "mtranslation (" << mtranslation[0] << "," << mtranslation[0] << "," << mtranslation[0] << ")" << std::endl; + m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2])); + } + } + + data.setClean(plug); +} + +void nailConstraintNode::computeConstraintParam(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "nailConstraintNode::computeRigidBodyParam" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + + MPlug(thisObject, ca_constraint).getValue(update); + if(m_constraint) { + m_constraint->set_damping((float) data.inputValue(ia_damping).asDouble()); + } + + data.outputValue(ca_constraintParam).set(true); + data.setClean(plug); +} + +nail_constraint_t::pointer nailConstraintNode::constraint() +{ + // std::cout << "nailConstraintNode::rigid_body" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + return m_constraint; +} + +void nailConstraintNode::update() +{ + MObject thisObject(thisMObject()); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + MPlug(thisObject, worldMatrix).elementByLogicalIndex(0).getValue(update); +} diff --git a/Extras/MayaPlugin/nailConstraintNode.h b/Extras/MayaPlugin/constraint/nailConstraintNode.h similarity index 96% rename from Extras/MayaPlugin/nailConstraintNode.h rename to Extras/MayaPlugin/constraint/nailConstraintNode.h index bda62bbad..c93d43604 100644 --- a/Extras/MayaPlugin/nailConstraintNode.h +++ b/Extras/MayaPlugin/constraint/nailConstraintNode.h @@ -1,94 +1,94 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//nailConstraintNode.h - -#ifndef DYN_NAIL_CONSTRAINT_NODE_H -#define DYN_NAIL_CONSTRAINT_NODE_H - -#include -#include -#include - -#include "solver.h" - -class nailConstraintNode: public MPxLocatorNode -{ -public: - nailConstraintNode(); - virtual ~nailConstraintNode(); - - virtual bool setInternalValueInContext ( const MPlug & plug, - const MDataHandle & dataHandle, - MDGContext & ctx); - - // virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray); - - virtual MStatus compute( const MPlug& plug, MDataBlock& data ); - - virtual void draw( M3dView & view, const MDagPath & path, - M3dView::DisplayStyle style, - M3dView::DisplayStatus status ); - - - virtual bool isBounded() const ; - virtual MBoundingBox boundingBox() const; - - virtual bool excludeAsLocator() const { return false; } - virtual bool isTransparent() const { return false; } - - static void * creator(); - static MStatus initialize(); - -public: - - nail_constraint_t::pointer constraint(); - -public: - - //Attributes - static MObject ia_rigidBody; - static MObject ia_damping; - - static MObject ca_constraint; - static MObject ca_constraintParam; - -public: - static MTypeId typeId; - static MString typeName; - -private: - void update(); - void computeConstraint(const MPlug& plug, MDataBlock& data); - void computeConstraintParam(const MPlug& plug, MDataBlock& data); - void computeWorldMatrix(const MPlug& plug, MDataBlock& data); - -public: - static void nodeRemoved(MObject& node, void *clientData); - -private: - nail_constraint_t::pointer m_constraint; -}; - - - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//nailConstraintNode.h + +#ifndef DYN_NAIL_CONSTRAINT_NODE_H +#define DYN_NAIL_CONSTRAINT_NODE_H + +#include +#include +#include + +#include "solver.h" + +class nailConstraintNode: public MPxLocatorNode +{ +public: + nailConstraintNode(); + virtual ~nailConstraintNode(); + + virtual bool setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx); + + // virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray); + + virtual MStatus compute( const MPlug& plug, MDataBlock& data ); + + virtual void draw( M3dView & view, const MDagPath & path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ); + + + virtual bool isBounded() const ; + virtual MBoundingBox boundingBox() const; + + virtual bool excludeAsLocator() const { return false; } + virtual bool isTransparent() const { return false; } + + static void * creator(); + static MStatus initialize(); + +public: + + nail_constraint_t::pointer constraint(); + +public: + + //Attributes + static MObject ia_rigidBody; + static MObject ia_damping; + + static MObject ca_constraint; + static MObject ca_constraintParam; + +public: + static MTypeId typeId; + static MString typeName; + +private: + void update(); + void computeConstraint(const MPlug& plug, MDataBlock& data); + void computeConstraintParam(const MPlug& plug, MDataBlock& data); + void computeWorldMatrix(const MPlug& plug, MDataBlock& data); + +public: + static void nodeRemoved(MObject& node, void *clientData); + +private: + nail_constraint_t::pointer m_constraint; +}; + + + +#endif diff --git a/Extras/MayaPlugin/nail_constraint.h b/Extras/MayaPlugin/constraint/nail_constraint.h similarity index 82% rename from Extras/MayaPlugin/nail_constraint.h rename to Extras/MayaPlugin/constraint/nail_constraint.h index 48fd6b273..6a44e3fc6 100644 --- a/Extras/MayaPlugin/nail_constraint.h +++ b/Extras/MayaPlugin/constraint/nail_constraint.h @@ -1,91 +1,96 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//nail_constraint.h - -#ifndef DYN_NAIL_CONSTRAINT_H -#define DYN_NAIL_CONSTRAINT_H - -#include "shared_ptr.h" -#include "rigid_body.h" -#include "mathUtils.h" - -#include "constraint.h" -#include "nail_constraint_impl.h" - -class nail_constraint_t: public constraint_t -{ -public: - //typedefs - typedef shared_ptr pointer; - - // - rigid_body_t::pointer rigid_body() { return m_rigid_body; } - - // - void set_pivot(vec3f const& p) - { - nail_constraint_impl_t* nail_impl = dynamic_cast(impl()); - nail_impl->set_pivot(p); - } - - //local space pivot - void get_pivot(vec3f& p) const { - nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); - nail_impl->get_pivot(p); - } - - // - void get_world_pivot(vec3f& p) const { - nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); - nail_impl->get_world_pivot(p); - } - - // - void set_damping(float d) { - nail_constraint_impl_t* nail_impl = dynamic_cast(impl()); - nail_impl->set_damping(d); - } - - float damping() const { - nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); - return nail_impl->damping(); - } - -public: - virtual ~nail_constraint_t() {}; - -protected: - friend class solver_t; - nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_body): - constraint_t(impl), - m_rigid_body(rigid_body) - { - } - -private: - rigid_body_t::pointer m_rigid_body; -}; - - - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//nail_constraint.h + +#ifndef DYN_NAIL_CONSTRAINT_H +#define DYN_NAIL_CONSTRAINT_H + +#include "shared_ptr.h" +#include "rigid_body.h" +#include "mathUtils.h" + +#include "constraint.h" +#include "nail_constraint_impl.h" + +class nail_constraint_t: public constraint_t +{ +public: + //typedefs + typedef shared_ptr pointer; + + // + rigid_body_t::pointer rigid_body() { return m_rigid_body; } + + // + void set_pivotA(vec3f const& p) { + nail_constraint_impl_t* nail_impl = dynamic_cast(impl()); + nail_impl->set_pivotA(p); + } + + //local space pivot + void get_pivotA(vec3f& p) const { + nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); + nail_impl->get_pivotA(p); + } + + // + void set_world(vec3f const& p) { + nail_constraint_impl_t* nail_impl = dynamic_cast(impl()); + nail_impl->set_world(p); + } + + // + void get_world(vec3f& p) const { + nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); + nail_impl->get_world(p); + } + + // + void set_damping(float d) { + nail_constraint_impl_t* nail_impl = dynamic_cast(impl()); + nail_impl->set_damping(d); + } + + float damping() const { + nail_constraint_impl_t const* nail_impl = dynamic_cast(impl()); + return nail_impl->damping(); + } + +public: + virtual ~nail_constraint_t() {}; + +protected: + friend class solver_t; + nail_constraint_t(nail_constraint_impl_t* impl, rigid_body_t::pointer& rigid_body): + constraint_t(impl), + m_rigid_body(rigid_body) + { + } + +private: + rigid_body_t::pointer m_rigid_body; +}; + + + +#endif diff --git a/Extras/MayaPlugin/nail_constraint_impl.h b/Extras/MayaPlugin/constraint/nail_constraint_impl.h similarity index 84% rename from Extras/MayaPlugin/nail_constraint_impl.h rename to Extras/MayaPlugin/constraint/nail_constraint_impl.h index b44974a36..8fbdd4040 100644 --- a/Extras/MayaPlugin/nail_constraint_impl.h +++ b/Extras/MayaPlugin/constraint/nail_constraint_impl.h @@ -1,46 +1,47 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//nail_constraint_impl.h - -#ifndef DYN_NAIL_CONSTRAINT_IMPL_H -#define DYN_NAIL_CONSTRAINT_IMPL_H - -#include "constraint_impl.h" - -class nail_constraint_impl_t: public constraint_impl_t -{ -public: - // - virtual void set_pivot(vec3f const& p) = 0; - virtual void get_pivot(vec3f& p) const = 0; - virtual void get_world_pivot(vec3f& p) const = 0; - - // - virtual void set_damping(float d) = 0; - virtual float damping() const = 0; - -public: - virtual ~nail_constraint_impl_t() {}; -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Walt Disney Studios + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Nicola Candussi +*/ + +//nail_constraint_impl.h + +#ifndef DYN_NAIL_CONSTRAINT_IMPL_H +#define DYN_NAIL_CONSTRAINT_IMPL_H + +#include "constraint_impl.h" + +class nail_constraint_impl_t: public constraint_impl_t +{ +public: + // + virtual void set_pivotA(vec3f const& p) = 0; + virtual void get_pivotA(vec3f& p) const = 0; + virtual void set_world(vec3f const& p) = 0; + virtual void get_world(vec3f& p) const = 0; + + // + virtual void set_damping(float d) = 0; + virtual float damping() const = 0; + +public: + virtual ~nail_constraint_impl_t() {}; +}; + +#endif diff --git a/Extras/MayaPlugin/constraint/sixdofConstraintNode.cpp b/Extras/MayaPlugin/constraint/sixdofConstraintNode.cpp new file mode 100644 index 000000000..43de99fc6 --- /dev/null +++ b/Extras/MayaPlugin/constraint/sixdofConstraintNode.cpp @@ -0,0 +1,419 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sixdofConstraintNode.cpp + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rigidBodyNode.h" +#include "sixdofConstraintNode.h" +#include "mayaUtils.h" + +#include "solver.h" + +MTypeId sixdofConstraintNode::typeId(0x10033D); +MString sixdofConstraintNode::typeName("dSixdofConstraint"); + +MObject sixdofConstraintNode::ia_rigidBodyA; +MObject sixdofConstraintNode::ia_rigidBodyB; +MObject sixdofConstraintNode::ia_damping; +MObject sixdofConstraintNode::ca_constraint; +MObject sixdofConstraintNode::ca_constraintParam; +MObject sixdofConstraintNode::ia_lowerLinLimit; +MObject sixdofConstraintNode::ia_upperLinLimit; +MObject sixdofConstraintNode::ia_lowerAngLimit; +MObject sixdofConstraintNode::ia_upperAngLimit; + +MStatus sixdofConstraintNode::initialize() +{ + MStatus status; + MFnMessageAttribute fnMsgAttr; + MFnNumericAttribute fnNumericAttr; + MFnMatrixAttribute fnMatrixAttr; + + ia_rigidBodyA = fnMsgAttr.create("inRigidBodyA", "inrbA", &status); + MCHECKSTATUS(status, "creating inRigidBodyA attribute") + status = addAttribute(ia_rigidBodyA); + MCHECKSTATUS(status, "adding inRigidBody attribute") + + ia_rigidBodyB = fnMsgAttr.create("inRigidBodyB", "inrbB", &status); + MCHECKSTATUS(status, "creating inRigidBodyB attribute") + status = addAttribute(ia_rigidBodyB); + MCHECKSTATUS(status, "adding inRigidBodyB attribute") + + ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status); + MCHECKSTATUS(status, "creating damping attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_damping); + MCHECKSTATUS(status, "adding damping attribute") + + ia_lowerLinLimit = fnNumericAttr.create("lowerLinLimit", "lllt", MFnNumericData::kDouble, 1, &status); + MCHECKSTATUS(status, "creating lower linear limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_lowerLinLimit); + MCHECKSTATUS(status, "adding lower linear limit attribute") + + ia_upperLinLimit = fnNumericAttr.create("upperLinLimit", "ullt", MFnNumericData::kDouble, -1, &status); + MCHECKSTATUS(status, "creating upper linear limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_upperLinLimit); + MCHECKSTATUS(status, "adding upper linear limit attribute") + + ia_lowerAngLimit = fnNumericAttr.create("lowerAngLimit", "lalt", MFnNumericData::kDouble, 0, &status); + MCHECKSTATUS(status, "creating lower angular limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_lowerAngLimit); + MCHECKSTATUS(status, "adding lower angular limit attribute") + + ia_upperAngLimit = fnNumericAttr.create("upperAngLimit", "ualt", MFnNumericData::kDouble, 0, &status); + MCHECKSTATUS(status, "creating upper angular limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_upperAngLimit); + MCHECKSTATUS(status, "adding upper angular limit attribute") + + ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraint attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraint); + MCHECKSTATUS(status, "adding ca_constraint attribute") + + ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraintParam attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraintParam); + MCHECKSTATUS(status, "adding ca_constraintParam attribute") + + + status = attributeAffects(ia_rigidBodyA, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraint)") + + status = attributeAffects(ia_rigidBodyA, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraintParam)") + + status = attributeAffects(ia_rigidBodyB, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraint)") + + status = attributeAffects(ia_rigidBodyB, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraintParam)") + + status = attributeAffects(ia_damping, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)") + + status = attributeAffects(ia_lowerLinLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLinLimit, ca_constraintParam)") + + status = attributeAffects(ia_upperLinLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_upperLinLimit, ca_constraintParam)") + + status = attributeAffects(ia_lowerAngLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_lowerAngLimit, ca_constraintParam)") + + status = attributeAffects(ia_upperAngLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_upperAngLimit, ca_constraintParam)") + + return MS::kSuccess; +} + +sixdofConstraintNode::sixdofConstraintNode() +{ + // std::cout << "sixdofConstraintNode::sixdofConstraintNode" << std::endl; +} + +sixdofConstraintNode::~sixdofConstraintNode() +{ + // std::cout << "sixdofConstraintNode::~sixdofConstraintNode" << std::endl; +} + +void sixdofConstraintNode::nodeRemoved(MObject& node, void *clientData) +{ + // std::cout << "sixdofConstraintNode::nodeRemoved" << std::endl; + MFnDependencyNode fnNode(node); + sixdofConstraintNode *pNode = static_cast(fnNode.userNode()); + constraint_t::pointer constraint = static_cast(pNode->m_constraint); + solver_t::remove_constraint(constraint); +} + +void* sixdofConstraintNode::creator() +{ + return new sixdofConstraintNode(); +} + + +bool sixdofConstraintNode::setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx) +{ + /* if ((plug == pdbFiles) || (plug == ia_scale) || (plug == ia_percent)) { + m_framesDirty = true; + } else if(plug == textureFiles) { + gpufx::m_renderer.setColorTextureDirty(); + }*/ + return false; //setInternalValueInContext(plug,dataHandle,ctx); +} + +MStatus sixdofConstraintNode::compute(const MPlug& plug, MDataBlock& data) +{ + //std::cout << "sixdofConstraintNode::compute: " << plug.name() << std::endl; + //MTime time = data.inputValue( sixdofConstraintNode::inTime ).asTime(); + if(plug == ca_constraint) { + computeConstraint(plug, data); + } else if(plug == ca_constraintParam) { + computeConstraintParam(plug, data); + } else if(plug.isElement()) { + if(plug.array() == worldMatrix && plug.logicalIndex() == 0) { + computeWorldMatrix(plug, data); + } else { + return MStatus::kUnknownParameter; + } + } else { + return MStatus::kUnknownParameter; + } + return MStatus::kSuccess; +} + +void sixdofConstraintNode::draw( M3dView & view, const MDagPath &path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ) +{ + // std::cout << "sixdofConstraintNode::draw" << std::endl; + + update(); + + view.beginGL(); + glPushAttrib( GL_ALL_ATTRIB_BITS ); + +// glPushMatrix(); + glDisable(GL_LIGHTING); + + if( !(status == M3dView::kActive || + status == M3dView::kLead || + status == M3dView::kHilite || + ( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) { + glColor3f(1.0, 1.0, 0.0); + } + + vec3f posA; + vec3f posB; + if (m_constraint) { + vec3f world; + m_constraint->get_world(world); + quatf rotA; + m_constraint->rigid_bodyA()->get_transform(posA, rotA); + posA = posA - world; + quatf rotB; + m_constraint->rigid_bodyB()->get_transform(posB, rotB); + posB = posB - world; + } + +// glLoadIdentity(); + glBegin(GL_LINES); + glVertex3f(posA[0], posA[1], posA[2]); + glVertex3f(posB[0], posB[1], posB[2]); + + glVertex3f(-1.0, 0.0, 0.0); + glVertex3f(1.0, 0.0, 0.0); + + glVertex3f(0.0, -1.0, 0.0); + glVertex3f(0.0, 1.0, 0.0); + + glVertex3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, 1.0); + glEnd(); + +// glPopMatrix(); + + glPopAttrib(); + view.endGL(); +} + +bool sixdofConstraintNode::isBounded() const +{ + //return true; + return false; +} + +MBoundingBox sixdofConstraintNode::boundingBox() const +{ + // std::cout << "sixdofConstraintNode::boundingBox()" << std::endl; + //load the pdbs + MObject node = thisMObject(); + + MPoint corner1(-1, -1, -1); + MPoint corner2(1, 1, 1); + return MBoundingBox(corner1, corner2); +} + +//standard attributes +void sixdofConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sixdofConstraintNode::computeConstraint" << std::endl; + + MObject thisObject(thisMObject()); + MPlug plgRigidBodyA(thisObject, ia_rigidBodyA); + MPlug plgRigidBodyB(thisObject, ia_rigidBodyB); + MObject update; + //force evaluation of the rigidBody + plgRigidBodyA.getValue(update); + plgRigidBodyB.getValue(update); + + rigid_body_t::pointer rigid_bodyA; + if(plgRigidBodyA.isConnected()) { + MPlugArray connections; + plgRigidBodyA.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNodeA(connections[0].node()); + if(fnNodeA.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNodeA = static_cast(fnNodeA.userNode()); + rigid_bodyA = pRigidBodyNodeA->rigid_body(); + } else { + std::cout << "sixdofConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + rigid_body_t::pointer rigid_bodyB; + if(plgRigidBodyB.isConnected()) { + MPlugArray connections; + plgRigidBodyB.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNodeB(connections[0].node()); + if(fnNodeB.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNodeB = static_cast(fnNodeB.userNode()); + rigid_bodyB = pRigidBodyNodeB->rigid_body(); + } else { + std::cout << "sixdofConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + if(rigid_bodyA && rigid_bodyB) { + //not connected to a rigid body, put a default one + constraint_t::pointer constraint = static_cast(m_constraint); + solver_t::remove_constraint(constraint); + m_constraint = solver_t::create_sixdof_constraint(rigid_bodyA, vec3f(), rigid_bodyB, vec3f()); + constraint = static_cast(m_constraint); + solver_t::add_constraint(constraint); + } + + data.outputValue(ca_constraint).set(true); + data.setClean(plug); +} + + +void sixdofConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sixdofConstraintNode::computeWorldMatrix" << std::endl; + + MObject thisObject(thisMObject()); + MFnDagNode fnDagNode(thisObject); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + + MStatus status; + + MFnTransform fnParentTransform(fnDagNode.parent(0, &status)); + + MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); + + // MQuaternion mrotation; + // fnParentTransform.getRotation(mrotation, MSpace::kTransform); + + if(m_constraint) { + vec3f world_pivot; + m_constraint->get_world(world_pivot); + if(world_pivot[0] != float(mtranslation.x) || + world_pivot[1] != float(mtranslation.y) || + world_pivot[2] != float(mtranslation.z)) { + +// mat4x4f xform; +// m_constraint->rigid_body()->get_transform(xform); +// vec4f pivot = prod(trans(xform), vec4f(mtranslation.x, mtranslation.y, mtranslation.z, 1.0)); +// m_constraint->set_pivot(vec3f(pivot[0], pivot[1], pivot[2])); + m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2])); + } + } + + data.setClean(plug); +} + +void sixdofConstraintNode::computeConstraintParam(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sixdofConstraintNode::computeRigidBodyParam" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + + MPlug(thisObject, ca_constraint).getValue(update); + if(m_constraint) { + m_constraint->set_damping((float) data.inputValue(ia_damping).asDouble()); + float lin_lower = (float) data.inputValue(ia_lowerLinLimit).asDouble(); + float lin_upper = (float) data.inputValue(ia_upperLinLimit).asDouble(); + m_constraint->set_LinLimit(lin_lower, lin_upper); + float ang_lower = (float) data.inputValue(ia_lowerAngLimit).asDouble(); + float ang_upper = (float) data.inputValue(ia_upperAngLimit).asDouble(); + m_constraint->set_AngLimit(ang_lower, ang_upper); + } + + data.outputValue(ca_constraintParam).set(true); + data.setClean(plug); +} + +sixdof_constraint_t::pointer sixdofConstraintNode::constraint() +{ + // std::cout << "sixdofConstraintNode::rigid_body" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + return m_constraint; +} + +void sixdofConstraintNode::update() +{ + MObject thisObject(thisMObject()); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + MPlug(thisObject, worldMatrix).elementByLogicalIndex(0).getValue(update); +} diff --git a/Extras/MayaPlugin/constraint/sixdofConstraintNode.h b/Extras/MayaPlugin/constraint/sixdofConstraintNode.h new file mode 100644 index 000000000..8605d785b --- /dev/null +++ b/Extras/MayaPlugin/constraint/sixdofConstraintNode.h @@ -0,0 +1,100 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sixdofConstraintNode.h + +#ifndef DYN_SIXDOF_CONSTRAINT_NODE_H +#define DYN_SIXDOF_CONSTRAINT_NODE_H + +#include +#include +#include + +#include "solver.h" + +class sixdofConstraintNode: public MPxLocatorNode +{ +public: + sixdofConstraintNode(); + virtual ~sixdofConstraintNode(); + + virtual bool setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx); + + // virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray); + + virtual MStatus compute( const MPlug& plug, MDataBlock& data ); + + virtual void draw( M3dView & view, const MDagPath & path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ); + + + virtual bool isBounded() const ; + virtual MBoundingBox boundingBox() const; + + virtual bool excludeAsLocator() const { return false; } + virtual bool isTransparent() const { return false; } + + static void * creator(); + static MStatus initialize(); + +public: + + sixdof_constraint_t::pointer constraint(); + +public: + + //Attributes + static MObject ia_rigidBodyA; + static MObject ia_rigidBodyB; + static MObject ia_damping; + + static MObject ia_lowerLinLimit; + static MObject ia_upperLinLimit; + static MObject ia_lowerAngLimit; + static MObject ia_upperAngLimit; + + static MObject ca_constraint; + static MObject ca_constraintParam; + +public: + static MTypeId typeId; + static MString typeName; + +private: + void update(); + void computeConstraint(const MPlug& plug, MDataBlock& data); + void computeConstraintParam(const MPlug& plug, MDataBlock& data); + void computeWorldMatrix(const MPlug& plug, MDataBlock& data); + +public: + static void nodeRemoved(MObject& node, void *clientData); + +private: + sixdof_constraint_t::pointer m_constraint; +}; + + + +#endif //DYN_SIXDOF_CONSTRAINT_NODE_H diff --git a/Extras/MayaPlugin/constraint/sixdof_constraint.h b/Extras/MayaPlugin/constraint/sixdof_constraint.h new file mode 100644 index 000000000..440c31ac7 --- /dev/null +++ b/Extras/MayaPlugin/constraint/sixdof_constraint.h @@ -0,0 +1,116 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sixdof_constraint.h + +#ifndef DYN_SIXDOF_CONSTRAINT_H +#define DYN_SIXDOF_CONSTRAINT_H + +#include "shared_ptr.h" +#include "rigid_body.h" +#include "mathUtils.h" + +#include "constraint.h" +#include "sixdof_constraint_impl.h" + +class sixdof_constraint_t: public constraint_t +{ +public: + //typedefs + typedef shared_ptr pointer; + + // + rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; } + rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; } + + // + void set_pivot(vec3f const& p) + { + sixdof_constraint_impl_t* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->set_pivot(p); + } + + //local space pivot + void get_pivot(vec3f& p) const { + sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->get_pivot(p); + } + + // + void get_world_pivot(vec3f& p) const { + sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->get_world_pivot(p); + } + + // + void set_damping(float d) { + sixdof_constraint_impl_t* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->set_damping(d); + } + + float damping() const { + sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast(impl()); + return sixdof_impl->damping(); + } + + void set_world(vec3f const& p) + { + sixdof_constraint_impl_t* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->set_world(p); + } + + //local space pivot + void get_world(vec3f& p) const { + sixdof_constraint_impl_t const* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->get_world(p); + } + + void set_LinLimit(float lower, float upper) { + sixdof_constraint_impl_t* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->set_LinLimit(lower, upper); + } + + void set_AngLimit(float lower, float upper) { + sixdof_constraint_impl_t* sixdof_impl = dynamic_cast(impl()); + sixdof_impl->set_AngLimit(lower, upper); + } + +public: + virtual ~sixdof_constraint_t() {}; + +protected: + friend class solver_t; + sixdof_constraint_t(sixdof_constraint_impl_t* impl, rigid_body_t::pointer& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB): + constraint_t(impl), + m_rigid_bodyA(rigid_bodyA), + m_rigid_bodyB(rigid_bodyB) + { + } + +private: + rigid_body_t::pointer m_rigid_bodyA; + rigid_body_t::pointer m_rigid_bodyB; +}; + + + +#endif //DYN_SIXDOF_CONSTRAINT_H diff --git a/Extras/MayaPlugin/constraint/sixdof_constraint_impl.h b/Extras/MayaPlugin/constraint/sixdof_constraint_impl.h new file mode 100644 index 000000000..bee5135b5 --- /dev/null +++ b/Extras/MayaPlugin/constraint/sixdof_constraint_impl.h @@ -0,0 +1,50 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sixdof_constraint_impl.h + +#ifndef DYN_SIXDOF_CONSTRAINT_IMPL_H +#define DYN_SIXDOF_CONSTRAINT_IMPL_H + +#include "constraint_impl.h" + +class sixdof_constraint_impl_t: public constraint_impl_t +{ +public: + // + virtual void set_pivot(vec3f const& p) = 0; + virtual void get_pivot(vec3f& p) const = 0; + virtual void get_world_pivot(vec3f& p) const = 0; + virtual void set_world(vec3f const& p) = 0; + virtual void get_world(vec3f& p) const = 0; + + // + virtual void set_damping(float d) = 0; + virtual float damping() const = 0; + virtual void set_LinLimit(float lower, float upper) = 0; + virtual void set_AngLimit(float lower, float upper) = 0; + +public: + virtual ~sixdof_constraint_impl_t() {}; +}; + +#endif //DYN_SIXDOF_CONSTRAINT_IMPL_H diff --git a/Extras/MayaPlugin/constraint/sliderConstraintNode.cpp b/Extras/MayaPlugin/constraint/sliderConstraintNode.cpp new file mode 100644 index 000000000..db77fcf11 --- /dev/null +++ b/Extras/MayaPlugin/constraint/sliderConstraintNode.cpp @@ -0,0 +1,419 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sliderConstraintNode.cpp + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "rigidBodyNode.h" +#include "sliderConstraintNode.h" +#include "mayaUtils.h" + +#include "solver.h" + +MTypeId sliderConstraintNode::typeId(0x10033C); +MString sliderConstraintNode::typeName("dSliderConstraint"); + +MObject sliderConstraintNode::ia_rigidBodyA; +MObject sliderConstraintNode::ia_rigidBodyB; +MObject sliderConstraintNode::ia_damping; +MObject sliderConstraintNode::ca_constraint; +MObject sliderConstraintNode::ca_constraintParam; +MObject sliderConstraintNode::ia_lowerLinLimit; +MObject sliderConstraintNode::ia_upperLinLimit; +MObject sliderConstraintNode::ia_lowerAngLimit; +MObject sliderConstraintNode::ia_upperAngLimit; + +MStatus sliderConstraintNode::initialize() +{ + MStatus status; + MFnMessageAttribute fnMsgAttr; + MFnNumericAttribute fnNumericAttr; + MFnMatrixAttribute fnMatrixAttr; + + ia_rigidBodyA = fnMsgAttr.create("inRigidBodyA", "inrbA", &status); + MCHECKSTATUS(status, "creating inRigidBodyA attribute") + status = addAttribute(ia_rigidBodyA); + MCHECKSTATUS(status, "adding inRigidBody attribute") + + ia_rigidBodyB = fnMsgAttr.create("inRigidBodyB", "inrbB", &status); + MCHECKSTATUS(status, "creating inRigidBodyB attribute") + status = addAttribute(ia_rigidBodyB); + MCHECKSTATUS(status, "adding inRigidBodyB attribute") + + ia_damping = fnNumericAttr.create("damping", "dmp", MFnNumericData::kDouble, 1.0, &status); + MCHECKSTATUS(status, "creating damping attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_damping); + MCHECKSTATUS(status, "adding damping attribute") + + ia_lowerLinLimit = fnNumericAttr.create("lowerLinLimit", "lllt", MFnNumericData::kDouble, 1, &status); + MCHECKSTATUS(status, "creating lower linear limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_lowerLinLimit); + MCHECKSTATUS(status, "adding lower linear limit attribute") + + ia_upperLinLimit = fnNumericAttr.create("upperLinLimit", "ullt", MFnNumericData::kDouble, -1, &status); + MCHECKSTATUS(status, "creating upper linear limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_upperLinLimit); + MCHECKSTATUS(status, "adding upper linear limit attribute") + + ia_lowerAngLimit = fnNumericAttr.create("lowerAngLimit", "lalt", MFnNumericData::kDouble, 0, &status); + MCHECKSTATUS(status, "creating lower angular limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_lowerAngLimit); + MCHECKSTATUS(status, "adding lower angular limit attribute") + + ia_upperAngLimit = fnNumericAttr.create("upperAngLimit", "ualt", MFnNumericData::kDouble, 0, &status); + MCHECKSTATUS(status, "creating upper angular limit attribute") + fnNumericAttr.setKeyable(true); + status = addAttribute(ia_upperAngLimit); + MCHECKSTATUS(status, "adding upper angular limit attribute") + + ca_constraint = fnNumericAttr.create("ca_constraint", "caco", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraint attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraint); + MCHECKSTATUS(status, "adding ca_constraint attribute") + + ca_constraintParam = fnNumericAttr.create("ca_constraintParam", "cacop", MFnNumericData::kBoolean, 0, &status); + MCHECKSTATUS(status, "creating ca_constraintParam attribute") + fnNumericAttr.setConnectable(false); + fnNumericAttr.setHidden(true); + fnNumericAttr.setStorable(false); + fnNumericAttr.setKeyable(false); + status = addAttribute(ca_constraintParam); + MCHECKSTATUS(status, "adding ca_constraintParam attribute") + + + status = attributeAffects(ia_rigidBodyA, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraint)") + + status = attributeAffects(ia_rigidBodyA, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyA, ca_constraintParam)") + + status = attributeAffects(ia_rigidBodyB, ca_constraint); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraint)") + + status = attributeAffects(ia_rigidBodyB, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_rigidBodyB, ca_constraintParam)") + + status = attributeAffects(ia_damping, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_damping, ca_constraintParam)") + + status = attributeAffects(ia_lowerLinLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_lowerLinLimit, ca_constraintParam)") + + status = attributeAffects(ia_upperLinLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_upperLinLimit, ca_constraintParam)") + + status = attributeAffects(ia_lowerAngLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_lowerAngLimit, ca_constraintParam)") + + status = attributeAffects(ia_upperAngLimit, ca_constraintParam); + MCHECKSTATUS(status, "adding attributeAffects(ia_upperAngLimit, ca_constraintParam)") + + return MS::kSuccess; +} + +sliderConstraintNode::sliderConstraintNode() +{ + // std::cout << "sliderConstraintNode::sliderConstraintNode" << std::endl; +} + +sliderConstraintNode::~sliderConstraintNode() +{ + // std::cout << "sliderConstraintNode::~sliderConstraintNode" << std::endl; +} + +void sliderConstraintNode::nodeRemoved(MObject& node, void *clientData) +{ + // std::cout << "sliderConstraintNode::nodeRemoved" << std::endl; + MFnDependencyNode fnNode(node); + sliderConstraintNode *pNode = static_cast(fnNode.userNode()); + constraint_t::pointer constraint = static_cast(pNode->m_constraint); + solver_t::remove_constraint(constraint); +} + +void* sliderConstraintNode::creator() +{ + return new sliderConstraintNode(); +} + + +bool sliderConstraintNode::setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx) +{ + /* if ((plug == pdbFiles) || (plug == ia_scale) || (plug == ia_percent)) { + m_framesDirty = true; + } else if(plug == textureFiles) { + gpufx::m_renderer.setColorTextureDirty(); + }*/ + return false; //setInternalValueInContext(plug,dataHandle,ctx); +} + +MStatus sliderConstraintNode::compute(const MPlug& plug, MDataBlock& data) +{ + //std::cout << "sliderConstraintNode::compute: " << plug.name() << std::endl; + //MTime time = data.inputValue( sliderConstraintNode::inTime ).asTime(); + if(plug == ca_constraint) { + computeConstraint(plug, data); + } else if(plug == ca_constraintParam) { + computeConstraintParam(plug, data); + } else if(plug.isElement()) { + if(plug.array() == worldMatrix && plug.logicalIndex() == 0) { + computeWorldMatrix(plug, data); + } else { + return MStatus::kUnknownParameter; + } + } else { + return MStatus::kUnknownParameter; + } + return MStatus::kSuccess; +} + +void sliderConstraintNode::draw( M3dView & view, const MDagPath &path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ) +{ + // std::cout << "sliderConstraintNode::draw" << std::endl; + + update(); + + view.beginGL(); + glPushAttrib( GL_ALL_ATTRIB_BITS ); + +// glPushMatrix(); + glDisable(GL_LIGHTING); + + if( !(status == M3dView::kActive || + status == M3dView::kLead || + status == M3dView::kHilite || + ( style != M3dView::kGouraudShaded && style != M3dView::kFlatShaded )) ) { + glColor3f(1.0, 1.0, 0.0); + } + + vec3f posA; + vec3f posB; + if (m_constraint) { + vec3f world; + m_constraint->get_world(world); + quatf rotA; + m_constraint->rigid_bodyA()->get_transform(posA, rotA); + posA = posA - world; + quatf rotB; + m_constraint->rigid_bodyB()->get_transform(posB, rotB); + posB = posB - world; + } + +// glLoadIdentity(); + glBegin(GL_LINES); + glVertex3f(posA[0], posA[1], posA[2]); + glVertex3f(posB[0], posB[1], posB[2]); + + glVertex3f(-1.0, 0.0, 0.0); + glVertex3f(1.0, 0.0, 0.0); + + glVertex3f(0.0, -1.0, 0.0); + glVertex3f(0.0, 1.0, 0.0); + + glVertex3f(0.0, 0.0, -1.0); + glVertex3f(0.0, 0.0, 1.0); + glEnd(); + +// glPopMatrix(); + + glPopAttrib(); + view.endGL(); +} + +bool sliderConstraintNode::isBounded() const +{ + //return true; + return false; +} + +MBoundingBox sliderConstraintNode::boundingBox() const +{ + // std::cout << "sliderConstraintNode::boundingBox()" << std::endl; + //load the pdbs + MObject node = thisMObject(); + + MPoint corner1(-1, -1, -1); + MPoint corner2(1, 1, 1); + return MBoundingBox(corner1, corner2); +} + +//standard attributes +void sliderConstraintNode::computeConstraint(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sliderConstraintNode::computeConstraint" << std::endl; + + MObject thisObject(thisMObject()); + MPlug plgRigidBodyA(thisObject, ia_rigidBodyA); + MPlug plgRigidBodyB(thisObject, ia_rigidBodyB); + MObject update; + //force evaluation of the rigidBody + plgRigidBodyA.getValue(update); + plgRigidBodyB.getValue(update); + + rigid_body_t::pointer rigid_bodyA; + if(plgRigidBodyA.isConnected()) { + MPlugArray connections; + plgRigidBodyA.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNodeA(connections[0].node()); + if(fnNodeA.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNodeA = static_cast(fnNodeA.userNode()); + rigid_bodyA = pRigidBodyNodeA->rigid_body(); + } else { + std::cout << "sliderConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + rigid_body_t::pointer rigid_bodyB; + if(plgRigidBodyB.isConnected()) { + MPlugArray connections; + plgRigidBodyB.connectedTo(connections, true, true); + if(connections.length() != 0) { + MFnDependencyNode fnNodeB(connections[0].node()); + if(fnNodeB.typeId() == rigidBodyNode::typeId) { + rigidBodyNode *pRigidBodyNodeB = static_cast(fnNodeB.userNode()); + rigid_bodyB = pRigidBodyNodeB->rigid_body(); + } else { + std::cout << "sliderConstraintNode connected to a non-rigidbody node!" << std::endl; + } + } + } + + if(rigid_bodyA && rigid_bodyB) { + //not connected to a rigid body, put a default one + constraint_t::pointer constraint = static_cast(m_constraint); + solver_t::remove_constraint(constraint); + m_constraint = solver_t::create_slider_constraint(rigid_bodyA, vec3f(), rigid_bodyB, vec3f()); + constraint = static_cast(m_constraint); + solver_t::add_constraint(constraint); + } + + data.outputValue(ca_constraint).set(true); + data.setClean(plug); +} + + +void sliderConstraintNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sliderConstraintNode::computeWorldMatrix" << std::endl; + + MObject thisObject(thisMObject()); + MFnDagNode fnDagNode(thisObject); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + + MStatus status; + + MFnTransform fnParentTransform(fnDagNode.parent(0, &status)); + + MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status); + + // MQuaternion mrotation; + // fnParentTransform.getRotation(mrotation, MSpace::kTransform); + + if(m_constraint) { + vec3f world_pivot; + m_constraint->get_world(world_pivot); + if(world_pivot[0] != float(mtranslation.x) || + world_pivot[1] != float(mtranslation.y) || + world_pivot[2] != float(mtranslation.z)) { + +// mat4x4f xform; +// m_constraint->rigid_body()->get_transform(xform); +// vec4f pivot = prod(trans(xform), vec4f(mtranslation.x, mtranslation.y, mtranslation.z, 1.0)); +// m_constraint->set_pivot(vec3f(pivot[0], pivot[1], pivot[2])); + m_constraint->set_world(vec3f((float) mtranslation[0], (float) mtranslation[1], (float) mtranslation[2])); + } + } + + data.setClean(plug); +} + +void sliderConstraintNode::computeConstraintParam(const MPlug& plug, MDataBlock& data) +{ + // std::cout << "sliderConstraintNode::computeRigidBodyParam" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + + MPlug(thisObject, ca_constraint).getValue(update); + if(m_constraint) { + m_constraint->set_damping((float) data.inputValue(ia_damping).asDouble()); + float lin_lower = (float) data.inputValue(ia_lowerLinLimit).asDouble(); + float lin_upper = (float) data.inputValue(ia_upperLinLimit).asDouble(); + m_constraint->set_LinLimit(lin_lower, lin_upper); + float ang_lower = (float) data.inputValue(ia_lowerAngLimit).asDouble(); + float ang_upper = (float) data.inputValue(ia_upperAngLimit).asDouble(); + m_constraint->set_AngLimit(ang_lower, ang_upper); + } + + data.outputValue(ca_constraintParam).set(true); + data.setClean(plug); +} + +slider_constraint_t::pointer sliderConstraintNode::constraint() +{ + // std::cout << "sliderConstraintNode::rigid_body" << std::endl; + + MObject thisObject(thisMObject()); + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + + return m_constraint; +} + +void sliderConstraintNode::update() +{ + MObject thisObject(thisMObject()); + + MObject update; + MPlug(thisObject, ca_constraint).getValue(update); + MPlug(thisObject, ca_constraintParam).getValue(update); + MPlug(thisObject, worldMatrix).elementByLogicalIndex(0).getValue(update); +} diff --git a/Extras/MayaPlugin/constraint/sliderConstraintNode.h b/Extras/MayaPlugin/constraint/sliderConstraintNode.h new file mode 100644 index 000000000..5c421b721 --- /dev/null +++ b/Extras/MayaPlugin/constraint/sliderConstraintNode.h @@ -0,0 +1,100 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//sliderConstraintNode.h + +#ifndef DYN_SLIDER_CONSTRAINT_NODE_H +#define DYN_SLIDER_CONSTRAINT_NODE_H + +#include +#include +#include + +#include "solver.h" + +class sliderConstraintNode: public MPxLocatorNode +{ +public: + sliderConstraintNode(); + virtual ~sliderConstraintNode(); + + virtual bool setInternalValueInContext ( const MPlug & plug, + const MDataHandle & dataHandle, + MDGContext & ctx); + + // virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray); + + virtual MStatus compute( const MPlug& plug, MDataBlock& data ); + + virtual void draw( M3dView & view, const MDagPath & path, + M3dView::DisplayStyle style, + M3dView::DisplayStatus status ); + + + virtual bool isBounded() const ; + virtual MBoundingBox boundingBox() const; + + virtual bool excludeAsLocator() const { return false; } + virtual bool isTransparent() const { return false; } + + static void * creator(); + static MStatus initialize(); + +public: + + slider_constraint_t::pointer constraint(); + +public: + + //Attributes + static MObject ia_rigidBodyA; + static MObject ia_rigidBodyB; + static MObject ia_damping; + + static MObject ia_lowerLinLimit; + static MObject ia_upperLinLimit; + static MObject ia_lowerAngLimit; + static MObject ia_upperAngLimit; + + static MObject ca_constraint; + static MObject ca_constraintParam; + +public: + static MTypeId typeId; + static MString typeName; + +private: + void update(); + void computeConstraint(const MPlug& plug, MDataBlock& data); + void computeConstraintParam(const MPlug& plug, MDataBlock& data); + void computeWorldMatrix(const MPlug& plug, MDataBlock& data); + +public: + static void nodeRemoved(MObject& node, void *clientData); + +private: + slider_constraint_t::pointer m_constraint; +}; + + + +#endif //DYN_SLIDER_CONSTRAINT_NODE_H diff --git a/Extras/MayaPlugin/constraint/slider_constraint.h b/Extras/MayaPlugin/constraint/slider_constraint.h new file mode 100644 index 000000000..f754418bf --- /dev/null +++ b/Extras/MayaPlugin/constraint/slider_constraint.h @@ -0,0 +1,116 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//slider_constraint.h + +#ifndef DYN_SLIDER_CONSTRAINT_H +#define DYN_SLIDER_CONSTRAINT_H + +#include "shared_ptr.h" +#include "rigid_body.h" +#include "mathUtils.h" + +#include "constraint.h" +#include "slider_constraint_impl.h" + +class slider_constraint_t: public constraint_t +{ +public: + //typedefs + typedef shared_ptr pointer; + + // + rigid_body_t::pointer rigid_bodyA() { return m_rigid_bodyA; } + rigid_body_t::pointer rigid_bodyB() { return m_rigid_bodyB; } + + // + void set_pivot(vec3f const& p) + { + slider_constraint_impl_t* slider_impl = dynamic_cast(impl()); + slider_impl->set_pivot(p); + } + + //local space pivot + void get_pivot(vec3f& p) const { + slider_constraint_impl_t const* slider_impl = dynamic_cast(impl()); + slider_impl->get_pivot(p); + } + + // + void get_world_pivot(vec3f& p) const { + slider_constraint_impl_t const* slider_impl = dynamic_cast(impl()); + slider_impl->get_world_pivot(p); + } + + // + void set_damping(float d) { + slider_constraint_impl_t* slider_impl = dynamic_cast(impl()); + slider_impl->set_damping(d); + } + + float damping() const { + slider_constraint_impl_t const* slider_impl = dynamic_cast(impl()); + return slider_impl->damping(); + } + + void set_world(vec3f const& p) + { + slider_constraint_impl_t* slider_impl = dynamic_cast(impl()); + slider_impl->set_world(p); + } + + //local space pivot + void get_world(vec3f& p) const { + slider_constraint_impl_t const* slider_impl = dynamic_cast(impl()); + slider_impl->get_world(p); + } + + void set_LinLimit(float lower, float upper) { + slider_constraint_impl_t* slider_impl = dynamic_cast(impl()); + slider_impl->set_LinLimit(lower, upper); + } + + void set_AngLimit(float lower, float upper) { + slider_constraint_impl_t* slider_impl = dynamic_cast(impl()); + slider_impl->set_AngLimit(lower, upper); + } + +public: + virtual ~slider_constraint_t() {}; + +protected: + friend class solver_t; + slider_constraint_t(slider_constraint_impl_t* impl, rigid_body_t::pointer& rigid_bodyA, rigid_body_t::pointer& rigid_bodyB): + constraint_t(impl), + m_rigid_bodyA(rigid_bodyA), + m_rigid_bodyB(rigid_bodyB) + { + } + +private: + rigid_body_t::pointer m_rigid_bodyA; + rigid_body_t::pointer m_rigid_bodyB; +}; + + + +#endif //DYN_SLIDER_CONSTRAINT_H diff --git a/Extras/MayaPlugin/icons/dynamicaCreate6DofConstraint.xpm b/Extras/MayaPlugin/icons/dynamicaCreate6DofConstraint.xpm new file mode 100644 index 000000000..cf5b30224 --- /dev/null +++ b/Extras/MayaPlugin/icons/dynamicaCreate6DofConstraint.xpm @@ -0,0 +1,213 @@ +/* XPM */ +static char * dynamicaCreatePinConstraint_xpm[] = { +"32 32 178 2", +" c #B1B1B1", +". c #A8A8A8", +"+ c #A5A5A5", +"@ c #718172", +"# c #6D866F", +"$ c #999999", +"% c #9B9B9B", +"& c #7B9B7E", +"* c #77CF80", +"= c #69846C", +"- c #8F8F8F", +"; c #989898", +"> c #82A185", +", c #88EC91", +"' c #57DD63", +") c #529C59", +"! c #878787", +"~ c #A2A2A2", +"{ c #949494", +"] c #88AA8B", +"^ c #8EED97", +"/ c #58E465", +"( c #23DC34", +"_ c #30B33C", +": c #667A68", +"< c #959595", +"[ c #9E9E9E", +"} c #757C76", +"| c #9BD9A1", +"1 c #87EC90", +"2 c #4BE259", +"3 c #17DA29", +"4 c #04D718", +"5 c #13C624", +"6 c #528C57", +"7 c #8B8B8B", +"8 c #A9A9A9", +"9 c #A6A6A6", +"0 c #717371", +"a c #99CB9E", +"b c #9BEFA3", +"c c #6FE87A", +"d c #30DE40", +"e c #09D71C", +"f c #00D614", +"g c #33A73E", +"h c #8E8E8E", +"i c #93BB97", +"j c #A3F0AA", +"k c #82EB8C", +"l c #49E257", +"m c #15D927", +"n c #01D615", +"o c #28B235", +"p c #419B49", +"q c #508D56", +"r c #9F9F9F", +"s c #89A68C", +"t c #A6F1AD", +"u c #8DED96", +"v c #59E466", +"w c #21DB32", +"x c #24B532", +"y c #858585", +"z c #969696", +"A c #929292", +"B c #809281", +"C c #A7EBAD", +"D c #94EE9C", +"E c #67E773", +"F c #2DDD3D", +"G c #06D119", +"H c #5E8061", +"I c #A0A0A0", +"J c #919191", +"K c #8A8A8A", +"L c #778278", +"M c #A0E2A6", +"N c #99EFA1", +"O c #73E87E", +"P c #3BDF4A", +"Q c #10D923", +"R c #36A441", +"S c #BE0000", +"T c #A20000", +"U c #7C1D14", +"V c #88744E", +"W c #877D52", +"X c #8B8F5F", +"Y c #95CA89", +"Z c #77E982", +"` c #46E155", +" . c #03D617", +".. c #13C424", +"+. c #69766B", +"@. c #AAAAAA", +"#. c #747D74", +"$. c #94D79B", +"%. c #86EC8F", +"&. c #7EEA88", +"*. c #6DE878", +"=. c #47E155", +"-. c #1CDB2E", +";. c #4C9053", +">. c #75C27C", +",. c #7AEA84", +"'. c #74E97F", +"). c #68E774", +"!. c #5AE467", +"~. c #4CE25A", +"{. c #38DF48", +"]. c #1DDB2F", +"^. c #07D71A", +"/. c #23B631", +"(. c #848484", +"_. c #66896A", +":. c #49C955", +"<. c #35DF45", +"[. c #2BDD3C", +"}. c #22DB33", +"|. c #1ADA2C", +"1. c #11D924", +"2. c #09CE1C", +"3. c #5D8160", +"4. c #69786A", +"5. c #32B03E", +"6. c #02D616", +"7. c #2BAF37", +"8. c #898989", +"9. c #A4A4A4", +"0. c #7F7F7F", +"a. c #399141", +"b. c #06D019", +"c. c #24B631", +"d. c #A7A7A7", +"e. c #AFAFAF", +"f. c #BDBDBD", +"g. c #528156", +"h. c #12C223", +"i. c #14C424", +"j. c #6C746C", +"k. c #AEAEAE", +"l. c #EBEBEB", +"m. c #F4F4F4", +"n. c #C2C2C2", +"o. c #697A6A", +"p. c #26AE33", +"q. c #09CE1B", +"r. c #627D64", +"s. c #A3A3A3", +"t. c #C7C7C7", +"u. c #FCFCFC", +"v. c #E6E6E6", +"w. c #DFDFDF", +"x. c #409C48", +"y. c #04D217", +"z. c #6E726F", +"A. c #B0B0B0", +"B. c #F8F8F8", +"C. c #8D8D8D", +"D. c #528B57", +"E. c #1BA610", +"F. c #5B835F", +"G. c #DDDDDD", +"H. c #EAEAEA", +"I. c #880000", +"J. c #B5B5B5", +"K. c #DEDEDE", +"L. c #E9E9E9", +"M. c #A1A1A1", +"N. c #CACACA", +"O. c #DCDCDC", +"P. c #ACACAC", +"Q. c #D8D8D8", +"R. c #C6C6C6", +"S. c #ADADAD", +"T. c #BA0000", +"U. c #BB0000", +" ", +" . + ", +" . @ # $ ", +" % & * = - ", +" ; > , ' ) ! ~ ", +" { ] ^ / ( _ : < ", +" [ } | 1 2 3 4 5 6 7 8 ", +" 9 0 a b c d e f f f g h ", +" 7 i j k l m n f o p q r ", +" h s t u v w 4 f x y z r ", +" A B C D E F e f G H I ", +" 8 J - K L M N O P Q n f R h ", +" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ", +" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ", +" S y >.,.'.).!.~.{.].^.f f /.(. ", +" S I _.:.<.[.}.|.1.^.n f 2.3.r ", +" S ; 4.5.^.4 4 6.n f f 7.8. ", +" S 9.0.a.b.f f f f f c.y ", +" S d.e.f.g.h.f f f f i.j.k. ", +" S e.; l.m.n.o.p.f f f q.r.8 ", +" S s.t.u.v.w.; (.x.y.f /.z.A. ", +" S @.~ B.v.w.9 9.A.C.D.E.F.r ", +" S r G.H.w.9.9. $ I.$ ", +" S + J.m.K.s.9. S ", +" S k.$ L.G.M.9. S ", +" S s.N.O.I + S ", +" S P.+ Q.r + S ", +" S ~ R.r 9 S ", +" S S.s.[ P. S ", +" S S S S T.U.S S S S S S S S S S S S ", +" ", +" "}; diff --git a/Extras/MayaPlugin/icons/dynamicaCreateConeTwistConstraint.xpm b/Extras/MayaPlugin/icons/dynamicaCreateConeTwistConstraint.xpm new file mode 100644 index 000000000..cf5b30224 --- /dev/null +++ b/Extras/MayaPlugin/icons/dynamicaCreateConeTwistConstraint.xpm @@ -0,0 +1,213 @@ +/* XPM */ +static char * dynamicaCreatePinConstraint_xpm[] = { +"32 32 178 2", +" c #B1B1B1", +". c #A8A8A8", +"+ c #A5A5A5", +"@ c #718172", +"# c #6D866F", +"$ c #999999", +"% c #9B9B9B", +"& c #7B9B7E", +"* c #77CF80", +"= c #69846C", +"- c #8F8F8F", +"; c #989898", +"> c #82A185", +", c #88EC91", +"' c #57DD63", +") c #529C59", +"! c #878787", +"~ c #A2A2A2", +"{ c #949494", +"] c #88AA8B", +"^ c #8EED97", +"/ c #58E465", +"( c #23DC34", +"_ c #30B33C", +": c #667A68", +"< c #959595", +"[ c #9E9E9E", +"} c #757C76", +"| c #9BD9A1", +"1 c #87EC90", +"2 c #4BE259", +"3 c #17DA29", +"4 c #04D718", +"5 c #13C624", +"6 c #528C57", +"7 c #8B8B8B", +"8 c #A9A9A9", +"9 c #A6A6A6", +"0 c #717371", +"a c #99CB9E", +"b c #9BEFA3", +"c c #6FE87A", +"d c #30DE40", +"e c #09D71C", +"f c #00D614", +"g c #33A73E", +"h c #8E8E8E", +"i c #93BB97", +"j c #A3F0AA", +"k c #82EB8C", +"l c #49E257", +"m c #15D927", +"n c #01D615", +"o c #28B235", +"p c #419B49", +"q c #508D56", +"r c #9F9F9F", +"s c #89A68C", +"t c #A6F1AD", +"u c #8DED96", +"v c #59E466", +"w c #21DB32", +"x c #24B532", +"y c #858585", +"z c #969696", +"A c #929292", +"B c #809281", +"C c #A7EBAD", +"D c #94EE9C", +"E c #67E773", +"F c #2DDD3D", +"G c #06D119", +"H c #5E8061", +"I c #A0A0A0", +"J c #919191", +"K c #8A8A8A", +"L c #778278", +"M c #A0E2A6", +"N c #99EFA1", +"O c #73E87E", +"P c #3BDF4A", +"Q c #10D923", +"R c #36A441", +"S c #BE0000", +"T c #A20000", +"U c #7C1D14", +"V c #88744E", +"W c #877D52", +"X c #8B8F5F", +"Y c #95CA89", +"Z c #77E982", +"` c #46E155", +" . c #03D617", +".. c #13C424", +"+. c #69766B", +"@. c #AAAAAA", +"#. c #747D74", +"$. c #94D79B", +"%. c #86EC8F", +"&. c #7EEA88", +"*. c #6DE878", +"=. c #47E155", +"-. c #1CDB2E", +";. c #4C9053", +">. c #75C27C", +",. c #7AEA84", +"'. c #74E97F", +"). c #68E774", +"!. c #5AE467", +"~. c #4CE25A", +"{. c #38DF48", +"]. c #1DDB2F", +"^. c #07D71A", +"/. c #23B631", +"(. c #848484", +"_. c #66896A", +":. c #49C955", +"<. c #35DF45", +"[. c #2BDD3C", +"}. c #22DB33", +"|. c #1ADA2C", +"1. c #11D924", +"2. c #09CE1C", +"3. c #5D8160", +"4. c #69786A", +"5. c #32B03E", +"6. c #02D616", +"7. c #2BAF37", +"8. c #898989", +"9. c #A4A4A4", +"0. c #7F7F7F", +"a. c #399141", +"b. c #06D019", +"c. c #24B631", +"d. c #A7A7A7", +"e. c #AFAFAF", +"f. c #BDBDBD", +"g. c #528156", +"h. c #12C223", +"i. c #14C424", +"j. c #6C746C", +"k. c #AEAEAE", +"l. c #EBEBEB", +"m. c #F4F4F4", +"n. c #C2C2C2", +"o. c #697A6A", +"p. c #26AE33", +"q. c #09CE1B", +"r. c #627D64", +"s. c #A3A3A3", +"t. c #C7C7C7", +"u. c #FCFCFC", +"v. c #E6E6E6", +"w. c #DFDFDF", +"x. c #409C48", +"y. c #04D217", +"z. c #6E726F", +"A. c #B0B0B0", +"B. c #F8F8F8", +"C. c #8D8D8D", +"D. c #528B57", +"E. c #1BA610", +"F. c #5B835F", +"G. c #DDDDDD", +"H. c #EAEAEA", +"I. c #880000", +"J. c #B5B5B5", +"K. c #DEDEDE", +"L. c #E9E9E9", +"M. c #A1A1A1", +"N. c #CACACA", +"O. c #DCDCDC", +"P. c #ACACAC", +"Q. c #D8D8D8", +"R. c #C6C6C6", +"S. c #ADADAD", +"T. c #BA0000", +"U. c #BB0000", +" ", +" . + ", +" . @ # $ ", +" % & * = - ", +" ; > , ' ) ! ~ ", +" { ] ^ / ( _ : < ", +" [ } | 1 2 3 4 5 6 7 8 ", +" 9 0 a b c d e f f f g h ", +" 7 i j k l m n f o p q r ", +" h s t u v w 4 f x y z r ", +" A B C D E F e f G H I ", +" 8 J - K L M N O P Q n f R h ", +" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ", +" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ", +" S y >.,.'.).!.~.{.].^.f f /.(. ", +" S I _.:.<.[.}.|.1.^.n f 2.3.r ", +" S ; 4.5.^.4 4 6.n f f 7.8. ", +" S 9.0.a.b.f f f f f c.y ", +" S d.e.f.g.h.f f f f i.j.k. ", +" S e.; l.m.n.o.p.f f f q.r.8 ", +" S s.t.u.v.w.; (.x.y.f /.z.A. ", +" S @.~ B.v.w.9 9.A.C.D.E.F.r ", +" S r G.H.w.9.9. $ I.$ ", +" S + J.m.K.s.9. S ", +" S k.$ L.G.M.9. S ", +" S s.N.O.I + S ", +" S P.+ Q.r + S ", +" S ~ R.r 9 S ", +" S S.s.[ P. S ", +" S S S S T.U.S S S S S S S S S S S S ", +" ", +" "}; diff --git a/Extras/MayaPlugin/icons/dynamicaCreateHingeConstraint.xpm b/Extras/MayaPlugin/icons/dynamicaCreateHingeConstraint.xpm new file mode 100644 index 000000000..cf5b30224 --- /dev/null +++ b/Extras/MayaPlugin/icons/dynamicaCreateHingeConstraint.xpm @@ -0,0 +1,213 @@ +/* XPM */ +static char * dynamicaCreatePinConstraint_xpm[] = { +"32 32 178 2", +" c #B1B1B1", +". c #A8A8A8", +"+ c #A5A5A5", +"@ c #718172", +"# c #6D866F", +"$ c #999999", +"% c #9B9B9B", +"& c #7B9B7E", +"* c #77CF80", +"= c #69846C", +"- c #8F8F8F", +"; c #989898", +"> c #82A185", +", c #88EC91", +"' c #57DD63", +") c #529C59", +"! c #878787", +"~ c #A2A2A2", +"{ c #949494", +"] c #88AA8B", +"^ c #8EED97", +"/ c #58E465", +"( c #23DC34", +"_ c #30B33C", +": c #667A68", +"< c #959595", +"[ c #9E9E9E", +"} c #757C76", +"| c #9BD9A1", +"1 c #87EC90", +"2 c #4BE259", +"3 c #17DA29", +"4 c #04D718", +"5 c #13C624", +"6 c #528C57", +"7 c #8B8B8B", +"8 c #A9A9A9", +"9 c #A6A6A6", +"0 c #717371", +"a c #99CB9E", +"b c #9BEFA3", +"c c #6FE87A", +"d c #30DE40", +"e c #09D71C", +"f c #00D614", +"g c #33A73E", +"h c #8E8E8E", +"i c #93BB97", +"j c #A3F0AA", +"k c #82EB8C", +"l c #49E257", +"m c #15D927", +"n c #01D615", +"o c #28B235", +"p c #419B49", +"q c #508D56", +"r c #9F9F9F", +"s c #89A68C", +"t c #A6F1AD", +"u c #8DED96", +"v c #59E466", +"w c #21DB32", +"x c #24B532", +"y c #858585", +"z c #969696", +"A c #929292", +"B c #809281", +"C c #A7EBAD", +"D c #94EE9C", +"E c #67E773", +"F c #2DDD3D", +"G c #06D119", +"H c #5E8061", +"I c #A0A0A0", +"J c #919191", +"K c #8A8A8A", +"L c #778278", +"M c #A0E2A6", +"N c #99EFA1", +"O c #73E87E", +"P c #3BDF4A", +"Q c #10D923", +"R c #36A441", +"S c #BE0000", +"T c #A20000", +"U c #7C1D14", +"V c #88744E", +"W c #877D52", +"X c #8B8F5F", +"Y c #95CA89", +"Z c #77E982", +"` c #46E155", +" . c #03D617", +".. c #13C424", +"+. c #69766B", +"@. c #AAAAAA", +"#. c #747D74", +"$. c #94D79B", +"%. c #86EC8F", +"&. c #7EEA88", +"*. c #6DE878", +"=. c #47E155", +"-. c #1CDB2E", +";. c #4C9053", +">. c #75C27C", +",. c #7AEA84", +"'. c #74E97F", +"). c #68E774", +"!. c #5AE467", +"~. c #4CE25A", +"{. c #38DF48", +"]. c #1DDB2F", +"^. c #07D71A", +"/. c #23B631", +"(. c #848484", +"_. c #66896A", +":. c #49C955", +"<. c #35DF45", +"[. c #2BDD3C", +"}. c #22DB33", +"|. c #1ADA2C", +"1. c #11D924", +"2. c #09CE1C", +"3. c #5D8160", +"4. c #69786A", +"5. c #32B03E", +"6. c #02D616", +"7. c #2BAF37", +"8. c #898989", +"9. c #A4A4A4", +"0. c #7F7F7F", +"a. c #399141", +"b. c #06D019", +"c. c #24B631", +"d. c #A7A7A7", +"e. c #AFAFAF", +"f. c #BDBDBD", +"g. c #528156", +"h. c #12C223", +"i. c #14C424", +"j. c #6C746C", +"k. c #AEAEAE", +"l. c #EBEBEB", +"m. c #F4F4F4", +"n. c #C2C2C2", +"o. c #697A6A", +"p. c #26AE33", +"q. c #09CE1B", +"r. c #627D64", +"s. c #A3A3A3", +"t. c #C7C7C7", +"u. c #FCFCFC", +"v. c #E6E6E6", +"w. c #DFDFDF", +"x. c #409C48", +"y. c #04D217", +"z. c #6E726F", +"A. c #B0B0B0", +"B. c #F8F8F8", +"C. c #8D8D8D", +"D. c #528B57", +"E. c #1BA610", +"F. c #5B835F", +"G. c #DDDDDD", +"H. c #EAEAEA", +"I. c #880000", +"J. c #B5B5B5", +"K. c #DEDEDE", +"L. c #E9E9E9", +"M. c #A1A1A1", +"N. c #CACACA", +"O. c #DCDCDC", +"P. c #ACACAC", +"Q. c #D8D8D8", +"R. c #C6C6C6", +"S. c #ADADAD", +"T. c #BA0000", +"U. c #BB0000", +" ", +" . + ", +" . @ # $ ", +" % & * = - ", +" ; > , ' ) ! ~ ", +" { ] ^ / ( _ : < ", +" [ } | 1 2 3 4 5 6 7 8 ", +" 9 0 a b c d e f f f g h ", +" 7 i j k l m n f o p q r ", +" h s t u v w 4 f x y z r ", +" A B C D E F e f G H I ", +" 8 J - K L M N O P Q n f R h ", +" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ", +" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ", +" S y >.,.'.).!.~.{.].^.f f /.(. ", +" S I _.:.<.[.}.|.1.^.n f 2.3.r ", +" S ; 4.5.^.4 4 6.n f f 7.8. ", +" S 9.0.a.b.f f f f f c.y ", +" S d.e.f.g.h.f f f f i.j.k. ", +" S e.; l.m.n.o.p.f f f q.r.8 ", +" S s.t.u.v.w.; (.x.y.f /.z.A. ", +" S @.~ B.v.w.9 9.A.C.D.E.F.r ", +" S r G.H.w.9.9. $ I.$ ", +" S + J.m.K.s.9. S ", +" S k.$ L.G.M.9. S ", +" S s.N.O.I + S ", +" S P.+ Q.r + S ", +" S ~ R.r 9 S ", +" S S.s.[ P. S ", +" S S S S T.U.S S S S S S S S S S S S ", +" ", +" "}; diff --git a/Extras/MayaPlugin/icons/dynamicaCreateSliderConstraint.xpm b/Extras/MayaPlugin/icons/dynamicaCreateSliderConstraint.xpm new file mode 100644 index 000000000..cf5b30224 --- /dev/null +++ b/Extras/MayaPlugin/icons/dynamicaCreateSliderConstraint.xpm @@ -0,0 +1,213 @@ +/* XPM */ +static char * dynamicaCreatePinConstraint_xpm[] = { +"32 32 178 2", +" c #B1B1B1", +". c #A8A8A8", +"+ c #A5A5A5", +"@ c #718172", +"# c #6D866F", +"$ c #999999", +"% c #9B9B9B", +"& c #7B9B7E", +"* c #77CF80", +"= c #69846C", +"- c #8F8F8F", +"; c #989898", +"> c #82A185", +", c #88EC91", +"' c #57DD63", +") c #529C59", +"! c #878787", +"~ c #A2A2A2", +"{ c #949494", +"] c #88AA8B", +"^ c #8EED97", +"/ c #58E465", +"( c #23DC34", +"_ c #30B33C", +": c #667A68", +"< c #959595", +"[ c #9E9E9E", +"} c #757C76", +"| c #9BD9A1", +"1 c #87EC90", +"2 c #4BE259", +"3 c #17DA29", +"4 c #04D718", +"5 c #13C624", +"6 c #528C57", +"7 c #8B8B8B", +"8 c #A9A9A9", +"9 c #A6A6A6", +"0 c #717371", +"a c #99CB9E", +"b c #9BEFA3", +"c c #6FE87A", +"d c #30DE40", +"e c #09D71C", +"f c #00D614", +"g c #33A73E", +"h c #8E8E8E", +"i c #93BB97", +"j c #A3F0AA", +"k c #82EB8C", +"l c #49E257", +"m c #15D927", +"n c #01D615", +"o c #28B235", +"p c #419B49", +"q c #508D56", +"r c #9F9F9F", +"s c #89A68C", +"t c #A6F1AD", +"u c #8DED96", +"v c #59E466", +"w c #21DB32", +"x c #24B532", +"y c #858585", +"z c #969696", +"A c #929292", +"B c #809281", +"C c #A7EBAD", +"D c #94EE9C", +"E c #67E773", +"F c #2DDD3D", +"G c #06D119", +"H c #5E8061", +"I c #A0A0A0", +"J c #919191", +"K c #8A8A8A", +"L c #778278", +"M c #A0E2A6", +"N c #99EFA1", +"O c #73E87E", +"P c #3BDF4A", +"Q c #10D923", +"R c #36A441", +"S c #BE0000", +"T c #A20000", +"U c #7C1D14", +"V c #88744E", +"W c #877D52", +"X c #8B8F5F", +"Y c #95CA89", +"Z c #77E982", +"` c #46E155", +" . c #03D617", +".. c #13C424", +"+. c #69766B", +"@. c #AAAAAA", +"#. c #747D74", +"$. c #94D79B", +"%. c #86EC8F", +"&. c #7EEA88", +"*. c #6DE878", +"=. c #47E155", +"-. c #1CDB2E", +";. c #4C9053", +">. c #75C27C", +",. c #7AEA84", +"'. c #74E97F", +"). c #68E774", +"!. c #5AE467", +"~. c #4CE25A", +"{. c #38DF48", +"]. c #1DDB2F", +"^. c #07D71A", +"/. c #23B631", +"(. c #848484", +"_. c #66896A", +":. c #49C955", +"<. c #35DF45", +"[. c #2BDD3C", +"}. c #22DB33", +"|. c #1ADA2C", +"1. c #11D924", +"2. c #09CE1C", +"3. c #5D8160", +"4. c #69786A", +"5. c #32B03E", +"6. c #02D616", +"7. c #2BAF37", +"8. c #898989", +"9. c #A4A4A4", +"0. c #7F7F7F", +"a. c #399141", +"b. c #06D019", +"c. c #24B631", +"d. c #A7A7A7", +"e. c #AFAFAF", +"f. c #BDBDBD", +"g. c #528156", +"h. c #12C223", +"i. c #14C424", +"j. c #6C746C", +"k. c #AEAEAE", +"l. c #EBEBEB", +"m. c #F4F4F4", +"n. c #C2C2C2", +"o. c #697A6A", +"p. c #26AE33", +"q. c #09CE1B", +"r. c #627D64", +"s. c #A3A3A3", +"t. c #C7C7C7", +"u. c #FCFCFC", +"v. c #E6E6E6", +"w. c #DFDFDF", +"x. c #409C48", +"y. c #04D217", +"z. c #6E726F", +"A. c #B0B0B0", +"B. c #F8F8F8", +"C. c #8D8D8D", +"D. c #528B57", +"E. c #1BA610", +"F. c #5B835F", +"G. c #DDDDDD", +"H. c #EAEAEA", +"I. c #880000", +"J. c #B5B5B5", +"K. c #DEDEDE", +"L. c #E9E9E9", +"M. c #A1A1A1", +"N. c #CACACA", +"O. c #DCDCDC", +"P. c #ACACAC", +"Q. c #D8D8D8", +"R. c #C6C6C6", +"S. c #ADADAD", +"T. c #BA0000", +"U. c #BB0000", +" ", +" . + ", +" . @ # $ ", +" % & * = - ", +" ; > , ' ) ! ~ ", +" { ] ^ / ( _ : < ", +" [ } | 1 2 3 4 5 6 7 8 ", +" 9 0 a b c d e f f f g h ", +" 7 i j k l m n f o p q r ", +" h s t u v w 4 f x y z r ", +" A B C D E F e f G H I ", +" 8 J - K L M N O P Q n f R h ", +" S S S S S S S S T U V W X Y D Z ` 3 .f ..+.@. ", +" S I #.$.N ^ %.&.*.=.-.4 f f ;.z ", +" S y >.,.'.).!.~.{.].^.f f /.(. ", +" S I _.:.<.[.}.|.1.^.n f 2.3.r ", +" S ; 4.5.^.4 4 6.n f f 7.8. ", +" S 9.0.a.b.f f f f f c.y ", +" S d.e.f.g.h.f f f f i.j.k. ", +" S e.; l.m.n.o.p.f f f q.r.8 ", +" S s.t.u.v.w.; (.x.y.f /.z.A. ", +" S @.~ B.v.w.9 9.A.C.D.E.F.r ", +" S r G.H.w.9.9. $ I.$ ", +" S + J.m.K.s.9. S ", +" S k.$ L.G.M.9. S ", +" S s.N.O.I + S ", +" S P.+ Q.r + S ", +" S ~ R.r 9 S ", +" S S.s.[ P. S ", +" S S S S T.U.S S S S S S S S S S S S ", +" ", +" "}; diff --git a/Extras/MayaPlugin/install.bat b/Extras/MayaPlugin/install.bat index c3abf31ee..88c09fc31 100644 --- a/Extras/MayaPlugin/install.bat +++ b/Extras/MayaPlugin/install.bat @@ -1,4 +1,3 @@ -xcopy /S /Y /C /I /h bin\*.* "C:\Program Files\Autodesk\Maya2008\bin" -xcopy /S /Y /C /I /h icons\*.* "C:\Program Files\Autodesk\Maya2008\icons" -xcopy /S /Y /C /I /h mvl\*.* "C:\Program Files\Autodesk\Maya2008\mvl" -xcopy /S /Y /C /I /h scripts\*.* "C:\Program Files\Autodesk\Maya2008\scripts" +xcopy /S /Y /C /I /h icons\*.xpm "C:\Program Files\Autodesk\Maya2008\icons" +xcopy /S /Y /C /I /h scripts\*.mel "C:\Program Files\Autodesk\Maya2008\scripts" +xcopy /S /Y /C /I /h BulletMayaPluginDebug.mll "C:\Program Files\Autodesk\Maya2008\bin\plug-ins" diff --git a/Extras/MayaPlugin/pluginMain.cpp b/Extras/MayaPlugin/pluginMain.cpp index 1c5775383..5289864e0 100644 --- a/Extras/MayaPlugin/pluginMain.cpp +++ b/Extras/MayaPlugin/pluginMain.cpp @@ -29,12 +29,18 @@ Written by: Nicola Candussi #include "rigidBodyNode.h" #include "rigidBodyArrayNode.h" #include "collisionShapeNode.h" -#include "nailConstraintNode.h" +#include "constraint/nailConstraintNode.h" +#include "constraint/hingeConstraintNode.h" +#include "constraint/sliderConstraintNode.h" +#include "constraint/sixdofConstraintNode.h" #include "dSolverNode.h" #include "dSolverCmd.h" #include "dRigidBodyCmd.h" #include "dRigidBodyArrayCmd.h" -#include "dNailConstraintCmd.h" +#include "constraint/dNailConstraintCmd.h" +#include "constraint/dHingeConstraintCmd.h" +#include "constraint/dSliderConstraintCmd.h" +#include "constraint/dSixdofConstraintCmd.h" #include "mvl/util.h" #include "colladaExport.h" @@ -51,7 +57,7 @@ const char *const colladaDefaultOptions = MStatus initializePlugin( MObject obj ) { MStatus status; - MFnPlugin plugin( obj, "Walt Disney Feature Animation", "2.73", "Any"); + MFnPlugin plugin( obj, "Walt Disney Feature Animation", "2.75", "Any"); solver_t::initialize(); @@ -97,8 +103,31 @@ MStatus initializePlugin( MObject obj ) MCHECKSTATUS(status, "registering nailConstraintNode") MDGMessage::addNodeRemovedCallback(nailConstraintNode::nodeRemoved, nailConstraintNode::typeName); + // + status = plugin.registerNode( hingeConstraintNode::typeName, hingeConstraintNode::typeId, + hingeConstraintNode::creator, + hingeConstraintNode::initialize, + MPxNode::kLocatorNode ); + MCHECKSTATUS(status, "registering hingeConstraintNode") + MDGMessage::addNodeRemovedCallback(hingeConstraintNode::nodeRemoved, hingeConstraintNode::typeName); - // + // + status = plugin.registerNode( sliderConstraintNode::typeName, sliderConstraintNode::typeId, + sliderConstraintNode::creator, + sliderConstraintNode::initialize, + MPxNode::kLocatorNode ); + MCHECKSTATUS(status, "registering sliderConstraintNode") + MDGMessage::addNodeRemovedCallback(sliderConstraintNode::nodeRemoved, sliderConstraintNode::typeName); + + // + status = plugin.registerNode( sixdofConstraintNode::typeName, sixdofConstraintNode::typeId, + sixdofConstraintNode::creator, + sixdofConstraintNode::initialize, + MPxNode::kLocatorNode ); + MCHECKSTATUS(status, "registering sixdofConstraintNode") + MDGMessage::addNodeRemovedCallback(sixdofConstraintNode::nodeRemoved, sixdofConstraintNode::typeName); + + // status = plugin.registerNode( dSolverNode::typeName, dSolverNode::typeId, dSolverNode::creator, dSolverNode::initialize, @@ -126,7 +155,22 @@ MStatus initializePlugin( MObject obj ) dNailConstraintCmd::syntax); MCHECKSTATUS(status, "registering dNailConstraintCmd") - MGlobal::executeCommand( "source dynamicaUI.mel" ); + status = plugin.registerCommand( dHingeConstraintCmd::typeName, + dHingeConstraintCmd::creator, + dHingeConstraintCmd::syntax); + MCHECKSTATUS(status, "registering dHingeConstraintCmd") + + status = plugin.registerCommand( dSliderConstraintCmd::typeName, + dSliderConstraintCmd::creator, + dSliderConstraintCmd::syntax); + MCHECKSTATUS(status, "registering dSliderConstraintCmd") + + status = plugin.registerCommand( dSixdofConstraintCmd::typeName, + dSixdofConstraintCmd::creator, + dSixdofConstraintCmd::syntax); + MCHECKSTATUS(status, "registering dSixdofConstraintCmd") + + MGlobal::executeCommand( "source dynamicaUI.mel" ); MGlobal::executeCommand( "dynamicaUI_initialize" ); return status; @@ -140,7 +184,13 @@ MStatus uninitializePlugin( MObject obj ) status = plugin.deregisterCommand(dNailConstraintCmd::typeName); MCHECKSTATUS(status, "deregistering dNailConstraintCmd") - status = plugin.deregisterCommand(dRigidBodyArrayCmd::typeName); + status = plugin.deregisterCommand(dHingeConstraintCmd::typeName); + MCHECKSTATUS(status, "deregistering dHingeConstraintCmd") + + status = plugin.deregisterCommand(dSliderConstraintCmd::typeName); + MCHECKSTATUS(status, "deregistering dSliderConstraintCmd") + + status = plugin.deregisterCommand(dRigidBodyArrayCmd::typeName); MCHECKSTATUS(status, "deregistering dRigidBodyArrayCmd") status = plugin.deregisterCommand(dRigidBodyCmd::typeName); @@ -155,7 +205,16 @@ MStatus uninitializePlugin( MObject obj ) status = plugin.deregisterNode(nailConstraintNode::typeId); MCHECKSTATUS(status, "deregistering nailConstraintNode") - status = plugin.deregisterNode(collisionShapeNode::typeId); + status = plugin.deregisterNode(hingeConstraintNode::typeId); + MCHECKSTATUS(status, "deregistering hingeConstraintNode") + + status = plugin.deregisterNode(sliderConstraintNode::typeId); + MCHECKSTATUS(status, "deregistering sliderConstraintNode") + + status = plugin.deregisterNode(sixdofConstraintNode::typeId); + MCHECKSTATUS(status, "deregistering sixdofConstraintNode") + + status = plugin.deregisterNode(collisionShapeNode::typeId); MCHECKSTATUS(status, "deregistering collisionShapeNode") status = plugin.deregisterNode(rigidBodyArrayNode::typeId); diff --git a/Extras/MayaPlugin/rigidBodyNode.cpp b/Extras/MayaPlugin/rigidBodyNode.cpp index e74fa8f10..20decc906 100644 --- a/Extras/MayaPlugin/rigidBodyNode.cpp +++ b/Extras/MayaPlugin/rigidBodyNode.cpp @@ -470,6 +470,13 @@ void rigidBodyNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data) m_rigid_body->set_transform(vec3f(mtranslation.x, mtranslation.y, mtranslation.z), quatf(mrotation.w, mrotation.x, mrotation.y, mrotation.z)); + if(pos[0] != float(mtranslation.x) || + pos[1] != float(mtranslation.y) || + pos[2] != float(mtranslation.z)) + { + m_rigid_body->update_constraint(); + } + data.setClean(plug); //set the scale to the collision shape diff --git a/Extras/MayaPlugin/rigid_body.h b/Extras/MayaPlugin/rigid_body.h index 48d62ef81..fe0022644 100644 --- a/Extras/MayaPlugin/rigid_body.h +++ b/Extras/MayaPlugin/rigid_body.h @@ -67,6 +67,10 @@ public: void apply_central_force(vec3f const& f) { m_impl->apply_central_force(f); } void apply_torque(vec3f const& t) { m_impl->apply_torque(t); } + void update_constraint() { m_impl->update_constraint(); } + void add_constraint(bt_constraint_t* constraint) { m_impl->add_constraint(constraint); } + void remove_constraint(bt_constraint_t* constraint) { m_impl->remove_constraint(constraint); } + public: virtual ~rigid_body_t() {}; diff --git a/Extras/MayaPlugin/rigid_body_impl.h b/Extras/MayaPlugin/rigid_body_impl.h index cd8669d94..4458c4437 100644 --- a/Extras/MayaPlugin/rigid_body_impl.h +++ b/Extras/MayaPlugin/rigid_body_impl.h @@ -27,6 +27,7 @@ Written by: Nicola Candussi #define DYN_RIGID_BODY_IMPL_H #include "mathUtils.h" +#include "constraint/bt_constraint.h" class rigid_body_impl_t { @@ -55,6 +56,10 @@ public: virtual void apply_central_force(vec3f const& f) = 0; virtual void apply_torque(vec3f const& t) = 0; + virtual void update_constraint() = 0; + virtual void add_constraint(bt_constraint_t* constraint) = 0; + virtual void remove_constraint(bt_constraint_t* constraint) = 0; + public: virtual ~rigid_body_impl_t() {}; }; diff --git a/Extras/MayaPlugin/scenes/pointConstraint.ma b/Extras/MayaPlugin/scenes/pointConstraint.ma new file mode 100644 index 000000000..184fae228 --- /dev/null +++ b/Extras/MayaPlugin/scenes/pointConstraint.ma @@ -0,0 +1,197 @@ +//Maya ASCII 2008 scene +//Name: pointConstraint.ma +//Last modified: Wed, May 06, 2009 12:39:07 PM +//Codeset: 1252 +requires maya "2008"; +requires "BulletMayaPlugin" "2.73"; +currentUnit -l centimeter -a degree -t film; +fileInfo "application" "maya"; +fileInfo "product" "Maya Unlimited 2008"; +fileInfo "version" "2008"; +fileInfo "cutIdentifier" "200708022245-704165"; +fileInfo "osv" "Microsoft Windows XP Service Pack 2 (Build 2600)\n"; +createNode transform -s -n "persp"; + setAttr ".v" no; + setAttr ".t" -type "double3" 5.4310852522104263 10.227807249820351 8.9834453601726043 ; + setAttr ".r" -type "double3" -36.938352729603878 18.200000000000443 0 ; +createNode camera -s -n "perspShape" -p "persp"; + setAttr -k off ".v" no; + setAttr ".fl" 34.999999999999993; + setAttr ".coi" 12.88344218879959; + setAttr ".imn" -type "string" "persp"; + setAttr ".den" -type "string" "persp_depth"; + setAttr ".man" -type "string" "persp_mask"; + setAttr ".hc" -type "string" "viewSet -p %camera"; +createNode transform -s -n "top"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 100.1 0 ; + setAttr ".r" -type "double3" -89.999999999999986 0 0 ; +createNode camera -s -n "topShape" -p "top"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "top"; + setAttr ".den" -type "string" "top_depth"; + setAttr ".man" -type "string" "top_mask"; + setAttr ".hc" -type "string" "viewSet -t %camera"; + setAttr ".o" yes; +createNode transform -s -n "front"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 0 100.1 ; +createNode camera -s -n "frontShape" -p "front"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "front"; + setAttr ".den" -type "string" "front_depth"; + setAttr ".man" -type "string" "front_mask"; + setAttr ".hc" -type "string" "viewSet -f %camera"; + setAttr ".o" yes; +createNode transform -s -n "side"; + setAttr ".v" no; + setAttr ".t" -type "double3" 100.1 0 0 ; + setAttr ".r" -type "double3" 0 89.999999999999986 0 ; +createNode camera -s -n "sideShape" -p "side"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "side"; + setAttr ".den" -type "string" "side_depth"; + setAttr ".man" -type "string" "side_mask"; + setAttr ".hc" -type "string" "viewSet -s %camera"; + setAttr ".o" yes; +createNode transform -n "dRigidBody1"; +createNode dRigidBody -n "dRigidBodyShape1" -p "dRigidBody1"; + setAttr -k off ".v"; + setAttr ".ma" 0; +createNode transform -n "dRigidBody2"; + setAttr ".t" -type "double3" 0 2.3922815322875977 0 ; + setAttr ".r" -type "double3" -1.5902777198834224e-015 -1.5902771511559264e-015 9.6200597810677602e-006 ; +createNode dRigidBody -n "dRigidBodyShape2" -p "dRigidBody2"; + setAttr -k off ".v"; + setAttr ".inpo" -type "float3" 0 2.3922815 0 ; + setAttr ".inro" -type "float3" 0 0 9.6200602e-006 ; +createNode transform -n "dRigidBody3"; + setAttr ".t" -type "double3" -1.1345885992050171 3.7411060333251953 0 ; + setAttr ".r" -type "double3" -2.484861663096116e-017 4.9695900306853732e-017 -0.00061626089443063338 ; +createNode dRigidBody -n "dRigidBodyShape3" -p "dRigidBody3"; + setAttr -k off ".v"; + setAttr ".inpo" -type "float3" -1.1345886 3.741106 0 ; + setAttr ".inro" -type "float3" 0 0 -0.00061626092 ; +createNode transform -n "dNailConstraint1"; + setAttr ".t" -type "double3" 0.34766338361584892 4.4408998843332972 0 ; +createNode dNailConstraint -n "dNailConstraintShape1" -p "dNailConstraint1"; + setAttr -k off ".v"; +createNode lightLinker -n "lightLinker1"; + setAttr -s 2 ".lnk"; + setAttr -s 2 ".slnk"; +createNode displayLayerManager -n "layerManager"; +createNode displayLayer -n "defaultLayer"; +createNode renderLayerManager -n "renderLayerManager"; +createNode renderLayer -n "defaultRenderLayer"; + setAttr ".g" yes; +createNode dSolver -n "dSolver1"; + setAttr ".grvt" -type "float3" 1.4012985e-045 -9.8100004 0 ; +createNode dCollisionShape -n "dCollisionShape1"; + setAttr ".tp" 6; +createNode dCollisionShape -n "dCollisionShape2"; + setAttr ".tp" 4; +createNode dCollisionShape -n "dCollisionShape3"; + setAttr ".tp" 4; +createNode script -n "uiConfigurationScriptNode"; + setAttr ".b" -type "string" ( + "// Maya Mel UI Configuration File.\n//\n// This script is machine generated. Edit at your own risk.\n//\n//\n\nglobal string $gMainPane;\nif (`paneLayout -exists $gMainPane`) {\n\n\tglobal int $gUseScenePanelConfig;\n\tint $useSceneConfig = $gUseScenePanelConfig;\n\tint $menusOkayInPanels = `optionVar -q allowMenusInPanels`;\tint $nVisPanes = `paneLayout -q -nvp $gMainPane`;\n\tint $nPanes = 0;\n\tstring $editorName;\n\tstring $panelName;\n\tstring $itemFilterName;\n\tstring $panelConfig;\n\n\t//\n\t// get current state of the UI\n\t//\n\tsceneUIReplacement -update $gMainPane;\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Top View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n" + + " -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n" + + " -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n" + + " -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n" + + " -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n" + + " -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Side View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n" + + " -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n" + + " -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n" + + " -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n" + + " -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Front View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n" + + " -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n" + + " -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n" + + " -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n" + + " -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n" + + " -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Persp View\")) `;\n\tif (\"\" == $panelName) {\n" + + "\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n" + + " -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n" + + " -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n" + + " -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n" + + " -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n" + + " -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"Outliner\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `outlinerPanel -unParent -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUnitlessCurves 1\n -showCompounds 1\n" + + " -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n" + + " -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"graphEditor\" (localizedPanelLabel(\"Graph Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"graphEditor\" -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 1\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n" + + " -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 1\n" + + " -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showResults \"off\" \n -showBufferCurves \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 1\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n" + + " -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 1\n" + + " -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showResults \"off\" \n -showBufferCurves \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dopeSheetPanel\" (localizedPanelLabel(\"Dope Sheet\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dopeSheetPanel\" -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 0\n" + + " -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n" + + " -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n" + + " -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n" + + " -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"clipEditorPanel\" (localizedPanelLabel(\"Trax Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"clipEditorPanel\" -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels `;\n" + + "\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayKeys 0\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"none\" \n -snapValue \"none\" \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayKeys 0\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"none\" \n -snapValue \"none\" \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperGraphPanel\" (localizedPanelLabel(\"Hypergraph Hierarchy\")) `;\n" + + "\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"hyperGraphPanel\" -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -zoom 1\n -animateTransition 0\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n -iconSize \"smallIcons\" \n -showCachedConnections 0\n" + + " $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -zoom 1\n -animateTransition 0\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n -iconSize \"smallIcons\" \n -showCachedConnections 0\n" + + " $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperShadePanel\" (localizedPanelLabel(\"Hypershade\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"hyperShadePanel\" -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"visorPanel\" (localizedPanelLabel(\"Visor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"visorPanel\" -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"polyTexturePlacementPanel\" (localizedPanelLabel(\"UV Texture Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"polyTexturePlacementPanel\" -l (localizedPanelLabel(\"UV Texture Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"UV Texture Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"multiListerPanel\" (localizedPanelLabel(\"Multilister\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"multiListerPanel\" -l (localizedPanelLabel(\"Multilister\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Multilister\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"renderWindowPanel\" (localizedPanelLabel(\"Render View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"renderWindowPanel\" -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"blendShapePanel\" (localizedPanelLabel(\"Blend Shape\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\tblendShapePanel -unParent -l (localizedPanelLabel(\"Blend Shape\")) -mbv $menusOkayInPanels ;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tblendShapePanel -edit -l (localizedPanelLabel(\"Blend Shape\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n" + + "\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynRelEdPanel\" (localizedPanelLabel(\"Dynamic Relationships\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dynRelEdPanel\" -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"devicePanel\" (localizedPanelLabel(\"Devices\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\tdevicePanel -unParent -l (localizedPanelLabel(\"Devices\")) -mbv $menusOkayInPanels ;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tdevicePanel -edit -l (localizedPanelLabel(\"Devices\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"relationshipPanel\" (localizedPanelLabel(\"Relationship Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"relationshipPanel\" -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"referenceEditorPanel\" (localizedPanelLabel(\"Reference Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"referenceEditorPanel\" -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"componentEditorPanel\" (localizedPanelLabel(\"Component Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"componentEditorPanel\" -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynPaintScriptedPanelType\" (localizedPanelLabel(\"Paint Effects\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dynPaintScriptedPanelType\" -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"webBrowserPanel\" (localizedPanelLabel(\"Web Browser\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"webBrowserPanel\" -l (localizedPanelLabel(\"Web Browser\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Web Browser\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"scriptEditorPanel\" (localizedPanelLabel(\"Script Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"scriptEditorPanel\" -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\tif ($useSceneConfig) {\n string $configName = `getPanel -cwl (localizedPanelLabel(\"Current Layout\"))`;\n if (\"\" != $configName) {\n\t\t\tpanelConfiguration -edit -label (localizedPanelLabel(\"Current Layout\")) \n\t\t\t\t-defaultImage \"\"\n\t\t\t\t-image \"\"\n\t\t\t\t-sc false\n\t\t\t\t-configString \"global string $gMainPane; paneLayout -e -cn \\\"single\\\" -ps 1 100 100 $gMainPane;\"\n\t\t\t\t-removeAllPanels\n\t\t\t\t-ap false\n\t\t\t\t\t(localizedPanelLabel(\"Persp View\")) \n\t\t\t\t\t\"modelPanel\"\n" + + "\t\t\t\t\t\"$panelName = `modelPanel -unParent -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels `;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"wireframe\\\" \\n -activeOnly 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 1\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 8192\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -maxConstantTransparency 1\\n -rendererName \\\"base_OpenGL_Renderer\\\" \\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -shadows 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName\"\n" + + "\t\t\t\t\t\"modelPanel -edit -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels $panelName;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"wireframe\\\" \\n -activeOnly 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 1\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 8192\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -maxConstantTransparency 1\\n -rendererName \\\"base_OpenGL_Renderer\\\" \\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -shadows 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName\"\n" + + "\t\t\t\t$configName;\n\n setNamedPanelLayout (localizedPanelLabel(\"Current Layout\"));\n }\n\n panelHistory -e -clear mainPanelHistory;\n setFocus `paneLayout -q -p1 $gMainPane`;\n sceneUIReplacement -deleteRemaining;\n sceneUIReplacement -clear;\n\t}\n\n\ngrid -spacing 5 -size 12 -divisions 5 -displayAxes yes -displayGridLines yes -displayDivisionLines yes -displayPerspectiveLabels no -displayOrthographicLabels no -displayAxesBold yes -perspectiveLabelPosition axis -orthographicLabelPosition edge;\n}\n"); + setAttr ".st" 3; +createNode script -n "sceneConfigurationScriptNode"; + setAttr ".b" -type "string" "playbackOptions -min 1 -max 1000 -ast 1 -aet 1000 "; + setAttr ".st" 6; +select -ne :time1; + setAttr ".o" 1; +select -ne :renderPartition; + setAttr -s 2 ".st"; +select -ne :renderGlobalsList1; +select -ne :defaultShaderList1; + setAttr -s 2 ".s"; +select -ne :postProcessList1; + setAttr -s 2 ".p"; +select -ne :lightList1; +select -ne :initialShadingGroup; + setAttr ".ro" yes; +select -ne :initialParticleSE; + setAttr ".ro" yes; +select -ne :hardwareRenderGlobals; + setAttr ".ctrs" 256; + setAttr ".btrs" 512; +select -ne :defaultHardwareRenderGlobals; + setAttr ".fn" -type "string" "im"; + setAttr ".res" -type "string" "ntsc_4d 646 485 1.333"; +connectAttr "dSolver1.rbds" "dRigidBodyShape1.solv"; +connectAttr "dCollisionShape1.oucs" "dRigidBodyShape1.incs"; +connectAttr "dSolver1.rbds" "dRigidBodyShape2.solv"; +connectAttr "dCollisionShape2.oucs" "dRigidBodyShape2.incs"; +connectAttr "dSolver1.rbds" "dRigidBodyShape3.solv"; +connectAttr "dCollisionShape3.oucs" "dRigidBodyShape3.incs"; +connectAttr "dRigidBodyShape3.msg" "dNailConstraintShape1.inrb"; +connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[0].llnk"; +connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[0].olnk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[1].llnk"; +connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[1].olnk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.slnk[0].sllk"; +connectAttr ":initialShadingGroup.msg" "lightLinker1.slnk[0].solk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.slnk[1].sllk"; +connectAttr ":initialParticleSE.msg" "lightLinker1.slnk[1].solk"; +connectAttr "layerManager.dli[0]" "defaultLayer.id"; +connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid"; +connectAttr ":time1.o" "dSolver1.it"; +connectAttr "lightLinker1.msg" ":lightList1.ln" -na; +// End of pointConstraint.ma diff --git a/Extras/MayaPlugin/scenes/sliderConstraint.ma b/Extras/MayaPlugin/scenes/sliderConstraint.ma new file mode 100644 index 000000000..bcddb2b1a --- /dev/null +++ b/Extras/MayaPlugin/scenes/sliderConstraint.ma @@ -0,0 +1,196 @@ +//Maya ASCII 2008 scene +//Name: sliderConstraint.ma +//Last modified: Wed, May 06, 2009 12:45:51 PM +//Codeset: 1252 +requires maya "2008"; +requires "BulletMayaPlugin" "2.73"; +currentUnit -l centimeter -a degree -t film; +fileInfo "application" "maya"; +fileInfo "product" "Maya Unlimited 2008"; +fileInfo "version" "2008"; +fileInfo "cutIdentifier" "200708022245-704165"; +fileInfo "osv" "Microsoft Windows XP Service Pack 2 (Build 2600)\n"; +createNode transform -s -n "persp"; + setAttr ".v" no; + setAttr ".t" -type "double3" -0.56341467921671107 10.723027971979135 23.053470331557246 ; + setAttr ".r" -type "double3" -24.938352729602354 -1.3999999999999964 0 ; +createNode camera -s -n "perspShape" -p "persp"; + setAttr -k off ".v" no; + setAttr ".fl" 34.999999999999993; + setAttr ".coi" 25.431540639855051; + setAttr ".imn" -type "string" "persp"; + setAttr ".den" -type "string" "persp_depth"; + setAttr ".man" -type "string" "persp_mask"; + setAttr ".hc" -type "string" "viewSet -p %camera"; +createNode transform -s -n "top"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 100.1 0 ; + setAttr ".r" -type "double3" -89.999999999999986 0 0 ; +createNode camera -s -n "topShape" -p "top"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "top"; + setAttr ".den" -type "string" "top_depth"; + setAttr ".man" -type "string" "top_mask"; + setAttr ".hc" -type "string" "viewSet -t %camera"; + setAttr ".o" yes; +createNode transform -s -n "front"; + setAttr ".v" no; + setAttr ".t" -type "double3" 0 0 100.1 ; +createNode camera -s -n "frontShape" -p "front"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "front"; + setAttr ".den" -type "string" "front_depth"; + setAttr ".man" -type "string" "front_mask"; + setAttr ".hc" -type "string" "viewSet -f %camera"; + setAttr ".o" yes; +createNode transform -s -n "side"; + setAttr ".v" no; + setAttr ".t" -type "double3" 100.1 0 0 ; + setAttr ".r" -type "double3" 0 89.999999999999986 0 ; +createNode camera -s -n "sideShape" -p "side"; + setAttr -k off ".v" no; + setAttr ".rnd" no; + setAttr ".coi" 100.1; + setAttr ".ow" 30; + setAttr ".imn" -type "string" "side"; + setAttr ".den" -type "string" "side_depth"; + setAttr ".man" -type "string" "side_mask"; + setAttr ".hc" -type "string" "viewSet -s %camera"; + setAttr ".o" yes; +createNode transform -n "dRigidBody1"; + setAttr ".t" -type "double3" -0.95629078149795532 4.8076047897338867 0 ; + setAttr ".r" -type "double3" -1.895758319773386e-022 -7.9513867036587919e-016 -2.3696978997167325e-023 ; +createNode dRigidBody -n "dRigidBodyShape1" -p "dRigidBody1"; + setAttr -k off ".v"; + setAttr ".inpo" -type "float3" -0.95629078 4.8076048 0 ; +createNode transform -n "dRigidBody2"; + setAttr ".t" -type "double3" 0.36419060826301575 4.8076047897338867 0 ; + setAttr ".r" -type "double3" 5.6872749593201579e-022 3.975693351829396e-016 1.9731698772535437e-039 ; +createNode dRigidBody -n "dRigidBodyShape2" -p "dRigidBody2"; + setAttr -k off ".v"; + setAttr ".inpo" -type "float3" 0.36419061 4.8076048 0 ; +createNode transform -n "dSliderConstraint1"; + setAttr ".t" -type "double3" 0 4.4119499147547163 0 ; +createNode dSliderConstraint -n "dSliderConstraintShape1" -p "dSliderConstraint1"; + setAttr -k off ".v"; +createNode transform -n "dRigidBody3"; +createNode dRigidBody -n "dRigidBodyShape3" -p "dRigidBody3"; + setAttr -k off ".v"; + setAttr ".ma" 0; +createNode lightLinker -n "lightLinker1"; + setAttr -s 2 ".lnk"; + setAttr -s 2 ".slnk"; +createNode displayLayerManager -n "layerManager"; +createNode displayLayer -n "defaultLayer"; +createNode renderLayerManager -n "renderLayerManager"; +createNode renderLayer -n "defaultRenderLayer"; + setAttr ".g" yes; +createNode dSolver -n "dSolver1"; + setAttr ".grvt" -type "float3" 1.4012985e-045 -9.8100004 0 ; +createNode dCollisionShape -n "dCollisionShape1"; + setAttr ".tp" 4; +createNode dCollisionShape -n "dCollisionShape2"; + setAttr ".tp" 4; +createNode dCollisionShape -n "dCollisionShape3"; + setAttr ".tp" 6; +createNode script -n "uiConfigurationScriptNode"; + setAttr ".b" -type "string" ( + "// Maya Mel UI Configuration File.\n//\n// This script is machine generated. Edit at your own risk.\n//\n//\n\nglobal string $gMainPane;\nif (`paneLayout -exists $gMainPane`) {\n\n\tglobal int $gUseScenePanelConfig;\n\tint $useSceneConfig = $gUseScenePanelConfig;\n\tint $menusOkayInPanels = `optionVar -q allowMenusInPanels`;\tint $nVisPanes = `paneLayout -q -nvp $gMainPane`;\n\tint $nPanes = 0;\n\tstring $editorName;\n\tstring $panelName;\n\tstring $itemFilterName;\n\tstring $panelConfig;\n\n\t//\n\t// get current state of the UI\n\t//\n\tsceneUIReplacement -update $gMainPane;\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Top View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n" + + " -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n" + + " -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n" + + " -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Top View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"top\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n" + + " -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n" + + " -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Side View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n" + + " -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n" + + " -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Side View\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"side\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n" + + " -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n" + + " -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Front View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n" + + " -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n" + + " -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n" + + " -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Front View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"front\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n" + + " -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n" + + " -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"modelPanel\" (localizedPanelLabel(\"Persp View\")) `;\n\tif (\"\" == $panelName) {\n" + + "\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `modelPanel -unParent -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n" + + " -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n" + + " -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tmodelPanel -edit -l (localizedPanelLabel(\"Persp View\")) -mbv $menusOkayInPanels $panelName;\n\t\t$editorName = $panelName;\n modelEditor -e \n -camera \"persp\" \n" + + " -useInteractiveMode 0\n -displayLights \"default\" \n -displayAppearance \"wireframe\" \n -activeOnly 0\n -wireframeOnShaded 0\n -headsUpDisplay 1\n -selectionHiliteDisplay 1\n -useDefaultMaterial 0\n -bufferMode \"double\" \n -twoSidedLighting 1\n -backfaceCulling 0\n -xray 0\n -jointXray 0\n -activeComponentsXray 0\n -displayTextures 0\n -smoothWireframe 0\n -lineWidth 1\n -textureAnisotropic 0\n -textureHilight 1\n -textureSampling 2\n -textureDisplay \"modulate\" \n -textureMaxSize 8192\n -fogging 0\n -fogSource \"fragment\" \n -fogMode \"linear\" \n -fogStart 0\n -fogEnd 100\n -fogDensity 0.1\n -fogColor 0.5 0.5 0.5 1 \n -maxConstantTransparency 1\n -rendererName \"base_OpenGL_Renderer\" \n -colorResolution 256 256 \n" + + " -bumpResolution 512 512 \n -textureCompression 0\n -transparencyAlgorithm \"frontAndBackCull\" \n -transpInShadows 0\n -cullingOverride \"none\" \n -lowQualityLighting 0\n -maximumNumHardwareLights 1\n -occlusionCulling 0\n -shadingModel 0\n -useBaseRenderer 0\n -useReducedRenderer 0\n -smallObjectCulling 0\n -smallObjectThreshold -1 \n -interactiveDisableShadows 0\n -interactiveBackFaceCull 0\n -sortTransparent 1\n -nurbsCurves 1\n -nurbsSurfaces 1\n -polymeshes 1\n -subdivSurfaces 1\n -planes 1\n -lights 1\n -cameras 1\n -controlVertices 1\n -hulls 1\n -grid 1\n -joints 1\n -ikHandles 1\n -deformers 1\n -dynamics 1\n -fluids 1\n -hairSystems 1\n -follicles 1\n -nCloths 1\n -nRigids 1\n" + + " -dynamicConstraints 1\n -locators 1\n -manipulators 1\n -dimensions 1\n -handles 1\n -pivots 1\n -textures 1\n -strokes 1\n -shadows 0\n $editorName;\nmodelEditor -e -viewSelected 0 $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"outlinerPanel\" (localizedPanelLabel(\"Outliner\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `outlinerPanel -unParent -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels `;\n\t\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUnitlessCurves 1\n -showCompounds 1\n" + + " -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\toutlinerPanel -edit -l (localizedPanelLabel(\"Outliner\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\t$editorName = $panelName;\n outlinerEditor -e \n -showShapes 0\n -showAttributes 0\n -showConnected 0\n -showAnimCurvesOnly 0\n -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 1\n -ignoreDagHierarchy 0\n -expandConnections 0\n -showUnitlessCurves 1\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 0\n -highlightActive 1\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"defaultSetFilter\" \n -showSetMembers 1\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n" + + " -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"graphEditor\" (localizedPanelLabel(\"Graph Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"graphEditor\" -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 1\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n" + + " -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 1\n" + + " -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showResults \"off\" \n -showBufferCurves \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Graph Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 1\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 1\n -showCompounds 0\n -showLeafs 1\n -showNumericAttrsOnly 1\n" + + " -highlightActive 0\n -autoSelectNewObjects 1\n -doNotSelectNewObjects 0\n -dropIsParent 1\n -transmitFilters 1\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"GraphEd\");\n animCurveEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 1\n" + + " -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -showResults \"off\" \n -showBufferCurves \"off\" \n -smoothness \"fine\" \n -resultSamples 1\n -resultScreenSamples 0\n -resultUpdate \"delayed\" \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dopeSheetPanel\" (localizedPanelLabel(\"Dope Sheet\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dopeSheetPanel\" -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n -showMuteInfo 0\n -autoExpand 0\n" + + " -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n -longNames 0\n -niceNames 1\n" + + " -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dope Sheet\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"OutlineEd\");\n outlinerEditor -e \n -showShapes 1\n -showAttributes 1\n -showConnected 1\n -showAnimCurvesOnly 1\n" + + " -showMuteInfo 0\n -autoExpand 0\n -showDagOnly 0\n -ignoreDagHierarchy 0\n -expandConnections 1\n -showUnitlessCurves 0\n -showCompounds 1\n -showLeafs 1\n -showNumericAttrsOnly 1\n -highlightActive 0\n -autoSelectNewObjects 0\n -doNotSelectNewObjects 1\n -dropIsParent 1\n -transmitFilters 0\n -setFilter \"0\" \n -showSetMembers 0\n -allowMultiSelection 1\n -alwaysToggleSelect 0\n -directSelect 0\n -displayMode \"DAG\" \n -expandObjects 0\n -setsIgnoreFilters 1\n -editAttrName 0\n -showAttrValues 0\n -highlightSecondary 0\n -showUVAttrsOnly 0\n -showTextureNodesOnly 0\n -attrAlphaOrder \"default\" \n -sortOrder \"none\" \n" + + " -longNames 0\n -niceNames 1\n -showNamespace 1\n $editorName;\n\n\t\t\t$editorName = ($panelName+\"DopeSheetEd\");\n dopeSheetEditor -e \n -displayKeys 1\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"integer\" \n -snapValue \"none\" \n -outliner \"dopeSheetPanel1OutlineEd\" \n -showSummary 1\n -showScene 0\n -hierarchyBelow 0\n -showTicks 1\n -selectionWindow 0 0 0 0 \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"clipEditorPanel\" (localizedPanelLabel(\"Trax Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"clipEditorPanel\" -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels `;\n" + + "\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayKeys 0\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"none\" \n -snapValue \"none\" \n $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Trax Editor\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = clipEditorNameFromPanel($panelName);\n clipEditor -e \n -displayKeys 0\n -displayTangents 0\n -displayActiveKeys 0\n -displayActiveKeyTangents 0\n -displayInfinities 0\n -autoFit 0\n -snapTime \"none\" \n -snapValue \"none\" \n $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperGraphPanel\" (localizedPanelLabel(\"Hypergraph Hierarchy\")) `;\n" + + "\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"hyperGraphPanel\" -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels `;\n\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -zoom 1\n -animateTransition 0\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n -iconSize \"smallIcons\" \n -showCachedConnections 0\n" + + " $editorName;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypergraph Hierarchy\")) -mbv $menusOkayInPanels $panelName;\n\n\t\t\t$editorName = ($panelName+\"HyperGraphEd\");\n hyperGraph -e \n -graphLayoutStyle \"hierarchicalLayout\" \n -orientation \"horiz\" \n -zoom 1\n -animateTransition 0\n -showShapes 0\n -showDeformers 0\n -showExpressions 0\n -showConstraints 0\n -showUnderworld 0\n -showInvisible 0\n -transitionFrames 1\n -freeform 0\n -imagePosition 0 0 \n -imageScale 1\n -imageEnabled 0\n -graphType \"DAG\" \n -updateSelection 1\n -updateNodeAdded 1\n -useDrawOverrideColor 0\n -limitGraphTraversal -1\n -iconSize \"smallIcons\" \n -showCachedConnections 0\n" + + " $editorName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"hyperShadePanel\" (localizedPanelLabel(\"Hypershade\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"hyperShadePanel\" -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Hypershade\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"visorPanel\" (localizedPanelLabel(\"Visor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"visorPanel\" -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Visor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"polyTexturePlacementPanel\" (localizedPanelLabel(\"UV Texture Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"polyTexturePlacementPanel\" -l (localizedPanelLabel(\"UV Texture Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"UV Texture Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"multiListerPanel\" (localizedPanelLabel(\"Multilister\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"multiListerPanel\" -l (localizedPanelLabel(\"Multilister\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Multilister\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"renderWindowPanel\" (localizedPanelLabel(\"Render View\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"renderWindowPanel\" -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Render View\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"blendShapePanel\" (localizedPanelLabel(\"Blend Shape\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\tblendShapePanel -unParent -l (localizedPanelLabel(\"Blend Shape\")) -mbv $menusOkayInPanels ;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tblendShapePanel -edit -l (localizedPanelLabel(\"Blend Shape\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n" + + "\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynRelEdPanel\" (localizedPanelLabel(\"Dynamic Relationships\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dynRelEdPanel\" -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Dynamic Relationships\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextPanel \"devicePanel\" (localizedPanelLabel(\"Devices\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\tdevicePanel -unParent -l (localizedPanelLabel(\"Devices\")) -mbv $menusOkayInPanels ;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tdevicePanel -edit -l (localizedPanelLabel(\"Devices\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n" + + "\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"relationshipPanel\" (localizedPanelLabel(\"Relationship Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"relationshipPanel\" -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Relationship Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"referenceEditorPanel\" (localizedPanelLabel(\"Reference Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"referenceEditorPanel\" -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Reference Editor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"componentEditorPanel\" (localizedPanelLabel(\"Component Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"componentEditorPanel\" -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Component Editor\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"dynPaintScriptedPanelType\" (localizedPanelLabel(\"Paint Effects\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"dynPaintScriptedPanelType\" -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Paint Effects\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"webBrowserPanel\" (localizedPanelLabel(\"Web Browser\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"webBrowserPanel\" -l (localizedPanelLabel(\"Web Browser\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Web Browser\")) -mbv $menusOkayInPanels $panelName;\n\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\t$panelName = `sceneUIReplacement -getNextScriptedPanel \"scriptEditorPanel\" (localizedPanelLabel(\"Script Editor\")) `;\n\tif (\"\" == $panelName) {\n\t\tif ($useSceneConfig) {\n\t\t\t$panelName = `scriptedPanel -unParent -type \"scriptEditorPanel\" -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels `;\n\t\t}\n\t} else {\n\t\t$label = `panel -q -label $panelName`;\n\t\tscriptedPanel -edit -l (localizedPanelLabel(\"Script Editor\")) -mbv $menusOkayInPanels $panelName;\n" + + "\t\tif (!$useSceneConfig) {\n\t\t\tpanel -e -l $label $panelName;\n\t\t}\n\t}\n\n\n\tif ($useSceneConfig) {\n string $configName = `getPanel -cwl (localizedPanelLabel(\"Current Layout\"))`;\n if (\"\" != $configName) {\n\t\t\tpanelConfiguration -edit -label (localizedPanelLabel(\"Current Layout\")) \n\t\t\t\t-defaultImage \"\"\n\t\t\t\t-image \"\"\n\t\t\t\t-sc false\n\t\t\t\t-configString \"global string $gMainPane; paneLayout -e -cn \\\"single\\\" -ps 1 100 100 $gMainPane;\"\n\t\t\t\t-removeAllPanels\n\t\t\t\t-ap false\n\t\t\t\t\t(localizedPanelLabel(\"Persp View\")) \n\t\t\t\t\t\"modelPanel\"\n" + + "\t\t\t\t\t\"$panelName = `modelPanel -unParent -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels `;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"wireframe\\\" \\n -activeOnly 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 1\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 8192\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -maxConstantTransparency 1\\n -rendererName \\\"base_OpenGL_Renderer\\\" \\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -shadows 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName\"\n" + + "\t\t\t\t\t\"modelPanel -edit -l (localizedPanelLabel(\\\"Persp View\\\")) -mbv $menusOkayInPanels $panelName;\\n$editorName = $panelName;\\nmodelEditor -e \\n -cam `findStartUpCamera persp` \\n -useInteractiveMode 0\\n -displayLights \\\"default\\\" \\n -displayAppearance \\\"wireframe\\\" \\n -activeOnly 0\\n -wireframeOnShaded 0\\n -headsUpDisplay 1\\n -selectionHiliteDisplay 1\\n -useDefaultMaterial 0\\n -bufferMode \\\"double\\\" \\n -twoSidedLighting 1\\n -backfaceCulling 0\\n -xray 0\\n -jointXray 0\\n -activeComponentsXray 0\\n -displayTextures 0\\n -smoothWireframe 0\\n -lineWidth 1\\n -textureAnisotropic 0\\n -textureHilight 1\\n -textureSampling 2\\n -textureDisplay \\\"modulate\\\" \\n -textureMaxSize 8192\\n -fogging 0\\n -fogSource \\\"fragment\\\" \\n -fogMode \\\"linear\\\" \\n -fogStart 0\\n -fogEnd 100\\n -fogDensity 0.1\\n -fogColor 0.5 0.5 0.5 1 \\n -maxConstantTransparency 1\\n -rendererName \\\"base_OpenGL_Renderer\\\" \\n -colorResolution 256 256 \\n -bumpResolution 512 512 \\n -textureCompression 0\\n -transparencyAlgorithm \\\"frontAndBackCull\\\" \\n -transpInShadows 0\\n -cullingOverride \\\"none\\\" \\n -lowQualityLighting 0\\n -maximumNumHardwareLights 1\\n -occlusionCulling 0\\n -shadingModel 0\\n -useBaseRenderer 0\\n -useReducedRenderer 0\\n -smallObjectCulling 0\\n -smallObjectThreshold -1 \\n -interactiveDisableShadows 0\\n -interactiveBackFaceCull 0\\n -sortTransparent 1\\n -nurbsCurves 1\\n -nurbsSurfaces 1\\n -polymeshes 1\\n -subdivSurfaces 1\\n -planes 1\\n -lights 1\\n -cameras 1\\n -controlVertices 1\\n -hulls 1\\n -grid 1\\n -joints 1\\n -ikHandles 1\\n -deformers 1\\n -dynamics 1\\n -fluids 1\\n -hairSystems 1\\n -follicles 1\\n -nCloths 1\\n -nRigids 1\\n -dynamicConstraints 1\\n -locators 1\\n -manipulators 1\\n -dimensions 1\\n -handles 1\\n -pivots 1\\n -textures 1\\n -strokes 1\\n -shadows 0\\n $editorName;\\nmodelEditor -e -viewSelected 0 $editorName\"\n" + + "\t\t\t\t$configName;\n\n setNamedPanelLayout (localizedPanelLabel(\"Current Layout\"));\n }\n\n panelHistory -e -clear mainPanelHistory;\n setFocus `paneLayout -q -p1 $gMainPane`;\n sceneUIReplacement -deleteRemaining;\n sceneUIReplacement -clear;\n\t}\n\n\ngrid -spacing 5 -size 12 -divisions 5 -displayAxes yes -displayGridLines yes -displayDivisionLines yes -displayPerspectiveLabels no -displayOrthographicLabels no -displayAxesBold yes -perspectiveLabelPosition axis -orthographicLabelPosition edge;\n}\n"); + setAttr ".st" 3; +createNode script -n "sceneConfigurationScriptNode"; + setAttr ".b" -type "string" "playbackOptions -min 1 -max 1000 -ast 1 -aet 1000 "; + setAttr ".st" 6; +select -ne :time1; + setAttr ".o" 1; +select -ne :renderPartition; + setAttr -s 2 ".st"; +select -ne :renderGlobalsList1; +select -ne :defaultShaderList1; + setAttr -s 2 ".s"; +select -ne :postProcessList1; + setAttr -s 2 ".p"; +select -ne :lightList1; +select -ne :initialShadingGroup; + setAttr ".ro" yes; +select -ne :initialParticleSE; + setAttr ".ro" yes; +select -ne :hardwareRenderGlobals; + setAttr ".ctrs" 256; + setAttr ".btrs" 512; +select -ne :defaultHardwareRenderGlobals; + setAttr ".fn" -type "string" "im"; + setAttr ".res" -type "string" "ntsc_4d 646 485 1.333"; +connectAttr "dSolver1.rbds" "dRigidBodyShape1.solv"; +connectAttr "dCollisionShape1.oucs" "dRigidBodyShape1.incs"; +connectAttr "dSolver1.rbds" "dRigidBodyShape2.solv"; +connectAttr "dCollisionShape2.oucs" "dRigidBodyShape2.incs"; +connectAttr "dRigidBodyShape1.msg" "dSliderConstraintShape1.inrbA"; +connectAttr "dRigidBodyShape2.msg" "dSliderConstraintShape1.inrbB"; +connectAttr "dSolver1.rbds" "dRigidBodyShape3.solv"; +connectAttr "dCollisionShape3.oucs" "dRigidBodyShape3.incs"; +connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[0].llnk"; +connectAttr ":initialShadingGroup.msg" "lightLinker1.lnk[0].olnk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.lnk[1].llnk"; +connectAttr ":initialParticleSE.msg" "lightLinker1.lnk[1].olnk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.slnk[0].sllk"; +connectAttr ":initialShadingGroup.msg" "lightLinker1.slnk[0].solk"; +connectAttr ":defaultLightSet.msg" "lightLinker1.slnk[1].sllk"; +connectAttr ":initialParticleSE.msg" "lightLinker1.slnk[1].solk"; +connectAttr "layerManager.dli[0]" "defaultLayer.id"; +connectAttr "renderLayerManager.rlmi[0]" "defaultRenderLayer.rlid"; +connectAttr ":time1.o" "dSolver1.it"; +connectAttr "lightLinker1.msg" ":lightList1.ln" -na; +// End of sliderConstraint.ma diff --git a/Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel b/Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel new file mode 100644 index 000000000..5832a7345 --- /dev/null +++ b/Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel @@ -0,0 +1,52 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//AEdHingeConstraintTemplate.mel + +global proc AEdHingeConstraintTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -addControl damping; + editorTemplate -addControl inRigidBody; + + editorTemplate -addControl lowerLimit; + editorTemplate -addControl upperLimit; + editorTemplate -addControl limitSoftness; + editorTemplate -addControl biasFactor; + editorTemplate -addControl relaxationFactor; + + separator; + + editorTemplate -addControl hingeAxis; + editorTemplate -addControl enableAngularMotor; + editorTemplate -addControl motorTargetVelocity; + editorTemplate -addControl maxMotorImpulse; + + AEdependNodeTemplate $nodeName; + + editorTemplate -addExtraControls; + editorTemplate -endScrollLayout; + +} + diff --git a/Extras/MayaPlugin/bt_constraint.h b/Extras/MayaPlugin/scripts/AEdSixdofConstraintTemplate.mel similarity index 56% rename from Extras/MayaPlugin/bt_constraint.h rename to Extras/MayaPlugin/scripts/AEdSixdofConstraintTemplate.mel index d0081f377..5c118c963 100644 --- a/Extras/MayaPlugin/bt_constraint.h +++ b/Extras/MayaPlugin/scripts/AEdSixdofConstraintTemplate.mel @@ -1,52 +1,44 @@ -/* -Bullet Continuous Collision Detection and Physics Library Maya Plugin -Copyright (c) 2008 Walt Disney Studios - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising -from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must -not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. - -Written by: Nicola Candussi -*/ - -//bt_constraint.h - -#ifndef DYN_BT_CONSTRAINT_H -#define DYN_BT_CONSTRAINT_H - -#include "btBulletCollisionCommon.h" -#include "btBulletDynamicsCommon.h" - -class bt_constraint_t -{ -public: - -protected: - friend class bt_solver_t; - - bt_constraint_t() { } - - btTypedConstraint* constraint() { return m_constraint.get(); } - void set_constraint(btTypedConstraint *constraint) { return m_constraint.reset(constraint); } - -public: - friend class bt_rigid_body_t; - - virtual ~bt_constraint_t() { } - -protected: - shared_ptr m_constraint; -}; - -#endif +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//AEdSixdofConstraintTemplate.mel + +global proc AEdSixdofConstraintTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -addControl damping; + editorTemplate -addControl inRigidBodyA; + editorTemplate -addControl inRigidBodyB; + editorTemplate -addControl lowerLinLimit; + editorTemplate -addControl upperLinLimit; + editorTemplate -addControl lowerAngLimit; + editorTemplate -addControl upperAngLimit; + + AEdependNodeTemplate $nodeName; + + editorTemplate -addExtraControls; + editorTemplate -endScrollLayout; + +} + diff --git a/Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel b/Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel new file mode 100644 index 000000000..1aa08ddb7 --- /dev/null +++ b/Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel @@ -0,0 +1,44 @@ +/* +Bullet Continuous Collision Detection and Physics Library Maya Plugin +Copyright (c) 2008 Herbert Law + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising +from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must +not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Written by: Herbert Law +*/ + +//AEdSliderConstraintTemplate.mel + +global proc AEdSliderConstraintTemplate( string $nodeName ) +{ + + editorTemplate -beginScrollLayout; + + editorTemplate -addControl damping; + editorTemplate -addControl inRigidBodyA; + editorTemplate -addControl inRigidBodyB; + editorTemplate -addControl lowerLinLimit; + editorTemplate -addControl upperLinLimit; + editorTemplate -addControl lowerAngLimit; + editorTemplate -addControl upperAngLimit; + + AEdependNodeTemplate $nodeName; + + editorTemplate -addExtraControls; + editorTemplate -endScrollLayout; + +} + diff --git a/Extras/MayaPlugin/scripts/dynamicaUI.mel b/Extras/MayaPlugin/scripts/dynamicaUI.mel index 8c854107c..6ba69214d 100644 --- a/Extras/MayaPlugin/scripts/dynamicaUI.mel +++ b/Extras/MayaPlugin/scripts/dynamicaUI.mel @@ -316,6 +316,19 @@ global proc string dynamicaUI_createMainTab() string $createNailConstraintBtn = `iconTextButton -style "iconAndTextVertical" -label "Nail" -width 100 -image1 "dynamicaCreateNailConstraint.xpm" -c ("dynamicaUI_createNailConstraint") -ann "Create a nail constraint"`; + string $createHingeConstraintBtn = `iconTextButton -style "iconAndTextVertical" -label "Hinge" + -width 100 -image1 "dynamicaCreateHingeConstraint.xpm" -c ("dynamicaUI_createHingeConstraint") + -ann "Create a hinge constraint"`; + string $createSliderConstraintBtn = `iconTextButton -style "iconAndTextVertical" -label "Slider" + -width 100 -image1 "dynamicaCreateSliderConstraint.xpm" -c ("dynamicaUI_createSliderConstraint") + -ann "Create a slider constraint"`; +/* string $createConeTwistConstraintBtn = `iconTextButton -style "iconAndTextVertical" -label "ConeTwist" + -width 100 -image1 "dynamicaCreateConeTwistConstraint.xpm" -c ("dynamicaUI_createConeTwistConstraint") + -ann "Create a conetwist constraint"`; +*/ string $create6DofConstraintBtn = `iconTextButton -style "iconAndTextVertical" -label "6Dof" + -width 100 -image1 "dynamicaCreate6DofConstraint.xpm" -c ("dynamicaUI_create6DofConstraint") + -ann "Create a 6dof constraint"`; + setParent ..; @@ -678,9 +691,8 @@ global proc dynamicaUI_createNailConstraint() //create dSolver node if necessary dSolver; - + string $newConstraints[]; - for($i = 0; $i < size($selection) / 2; $i++) { if($selection[$i * 2 + 1] == "dRigidBody") { string $constraintNode = `dNailConstraint`; @@ -689,9 +701,73 @@ global proc dynamicaUI_createNailConstraint() $newConstraints[$i] = $constraintTransforms[0]; } } - select -r $newConstraints; +} +global proc dynamicaUI_createHingeConstraint() +{ + string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`; + //create dSolver node if necessary + dSolver; + + string $newConstraints[]; + for($i = 0; $i < size($selection) / 2; $i++) { + if($selection[$i * 2 + 1] == "dRigidBody") { + string $constraintNode = `dHingeConstraint`; + connectAttr ($selection[$i * 2] + ".message") ($constraintNode + ".inRigidBody"); + string $constraintTransforms[] = `listRelatives -parent $constraintNode`; + $newConstraints[$i] = $constraintTransforms[0]; + } + } + select -r $newConstraints; +} +global proc dynamicaUI_createSliderConstraint() +{ + string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`; + + //create dSolver node if necessary + dSolver; + + string $newConstraints[]; + if (size($selection) < 4) + print("Requres 2 Rigid Body to create a Slider"); + for($i = 0; $i < size($selection) / 4; $i++) { + if($selection[$i * 2 + 1] == "dRigidBody" && $selection[$i * 2 + 3] == "dRigidBody") { + string $constraintNode = `dSliderConstraint`; + connectAttr ($selection[$i * 2] + ".message") ($constraintNode + ".inRigidBodyA"); + connectAttr ($selection[$i * 2 + 2] + ".message") ($constraintNode + ".inRigidBodyB"); + string $constraintTransforms[] = `listRelatives -parent $constraintNode`; + $newConstraints[$i] = $constraintTransforms[0]; + select -r $newConstraints; + } else + { + print("Requres 2 Rigid Body to create a slider constraint"); + } + } +} +global proc dynamicaUI_create6DofConstraint() +{ + string $selection[] = `ls -selection -dag -leaf -showType -type "geometry"`; + + //create dSolver node if necessary + dSolver; + + string $newConstraints[]; + if (size($selection) < 4) + print("Requres 2 Rigid Body to create a 6Dof constraint"); + for($i = 0; $i < size($selection) / 4; $i++) { + if($selection[$i * 2 + 1] == "dRigidBody" && $selection[$i * 2 + 3] == "dRigidBody") { + string $constraintNode = `dSixdofConstraint`; + connectAttr ($selection[$i * 2] + ".message") ($constraintNode + ".inRigidBodyA"); + connectAttr ($selection[$i * 2 + 2] + ".message") ($constraintNode + ".inRigidBodyB"); + string $constraintTransforms[] = `listRelatives -parent $constraintNode`; + $newConstraints[$i] = $constraintTransforms[0]; + select -r $newConstraints; + } else + { + print("Requres 2 Rigid Body to create a 6Dof constraint"); + } + } } global proc dyn_demo1() diff --git a/Extras/MayaPlugin/solver.cpp b/Extras/MayaPlugin/solver.cpp index ebc976b7c..fc6804aa1 100644 --- a/Extras/MayaPlugin/solver.cpp +++ b/Extras/MayaPlugin/solver.cpp @@ -89,7 +89,18 @@ nail_constraint_t::pointer solver_t::create_nail_constraint(rigid_body_t::point { return nail_constraint_t::pointer(new nail_constraint_t(m_impl->create_nail_constraint(rb->impl(), pivot), rb)); } - +hinge_constraint_t::pointer solver_t::create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot) +{ + return hinge_constraint_t::pointer(new hinge_constraint_t(m_impl->create_hinge_constraint(rb->impl(), pivot), rb)); +} +slider_constraint_t::pointer solver_t::create_slider_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB) +{ + return slider_constraint_t::pointer(new slider_constraint_t(m_impl->create_slider_constraint(rbA->impl(), pivotA, rbB->impl(), pivotB), rbA, rbB)); +} +sixdof_constraint_t::pointer solver_t::create_sixdof_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB) +{ + return sixdof_constraint_t::pointer(new sixdof_constraint_t(m_impl->create_sixdof_constraint(rbA->impl(), pivotA, rbB->impl(), pivotB), rbA, rbB)); +} //add/remove from world void solver_t::add_rigid_body(rigid_body_t::pointer& rb) diff --git a/Extras/MayaPlugin/solver.h b/Extras/MayaPlugin/solver.h index 818fec989..13cc8a6f6 100644 --- a/Extras/MayaPlugin/solver.h +++ b/Extras/MayaPlugin/solver.h @@ -38,9 +38,13 @@ Written by: Nicola Candussi #include "box_shape.h" #include "convex_hull_shape.h" #include "mesh_shape.h" -#include "nail_constraint.h" +#include "constraint/nail_constraint.h" #include "solver_impl.h" +#include "constraint/hinge_constraint.h" +#include "constraint/slider_constraint.h" +#include "constraint/sixdof_constraint.h" + class solver_t { public: @@ -65,6 +69,9 @@ public: static rigid_body_t::pointer create_rigid_body(collision_shape_t::pointer& cs); static nail_constraint_t::pointer create_nail_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0)); + static hinge_constraint_t::pointer create_hinge_constraint(rigid_body_t::pointer& rb, vec3f const& pivot = vec3f(0, 0, 0)); + static slider_constraint_t::pointer create_slider_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0)); + static sixdof_constraint_t::pointer create_sixdof_constraint(rigid_body_t::pointer& rbA, vec3f const& pivotA, rigid_body_t::pointer& rbB, vec3f const& pivotB = vec3f(0, 0, 0)); //add/remove from world static void add_rigid_body(rigid_body_t::pointer& rb); diff --git a/Extras/MayaPlugin/solver_impl.h b/Extras/MayaPlugin/solver_impl.h index 40996a401..a03892332 100644 --- a/Extras/MayaPlugin/solver_impl.h +++ b/Extras/MayaPlugin/solver_impl.h @@ -26,9 +26,13 @@ Written by: Nicola Candussi #define DYN_SOLVER_IMPL_H #include "rigid_body_impl.h" -#include "nail_constraint_impl.h" +#include "constraint/nail_constraint_impl.h" #include "collision_shape_impl.h" +#include "constraint/hinge_constraint_impl.h" +#include "constraint/slider_constraint_impl.h" +#include "constraint/sixdof_constraint_impl.h" + class solver_impl_t { public: @@ -49,6 +53,9 @@ public: virtual rigid_body_impl_t* create_rigid_body(collision_shape_impl_t* cs) = 0; virtual nail_constraint_impl_t* create_nail_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0; + virtual hinge_constraint_impl_t* create_hinge_constraint(rigid_body_impl_t* rb, vec3f const& pivot) = 0; + virtual slider_constraint_impl_t* create_slider_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0; + virtual sixdof_constraint_impl_t* create_sixdof_constraint(rigid_body_impl_t* rbA, vec3f const& pivotA, rigid_body_impl_t* rbB, vec3f const& pivotB) = 0; virtual void add_rigid_body(rigid_body_impl_t* rb) = 0; diff --git a/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h b/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h index 0af655f44..f8ee375f9 100644 --- a/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h +++ b/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h @@ -127,6 +127,29 @@ public: } + void setAxis(btVector3& axisInA = btVector3(0, 1, 0)) + { + btVector3 rbAxisA1, rbAxisA2; + btPlaneSpace1(axisInA, rbAxisA1, rbAxisA2); + btVector3 pivotInA = m_rbAFrame.getOrigin(); +// m_rbAFrame.getOrigin() = pivotInA; + m_rbAFrame.getBasis().setValue( rbAxisA1.getX(),rbAxisA2.getX(),axisInA.getX(), + rbAxisA1.getY(),rbAxisA2.getY(),axisInA.getY(), + rbAxisA1.getZ(),rbAxisA2.getZ(),axisInA.getZ() ); + + btVector3 axisInB = m_rbA.getCenterOfMassTransform().getBasis() * axisInA; + + btQuaternion rotationArc = shortestArcQuat(axisInA,axisInB); + btVector3 rbAxisB1 = quatRotate(rotationArc,rbAxisA1); + btVector3 rbAxisB2 = axisInB.cross(rbAxisB1); + + + m_rbBFrame.getOrigin() = m_rbA.getCenterOfMassTransform()(pivotInA); + m_rbBFrame.getBasis().setValue( rbAxisB1.getX(),rbAxisB2.getX(),axisInB.getX(), + rbAxisB1.getY(),rbAxisB2.getY(),axisInB.getY(), + rbAxisB1.getZ(),rbAxisB2.getZ(),axisInB.getZ() ); + } + btScalar getLowerLimit() const { return m_lowerLimit; @@ -143,8 +166,11 @@ public: void testLimit(); - const btTransform& getAFrame() { return m_rbAFrame; }; - const btTransform& getBFrame() { return m_rbBFrame; }; + const btTransform& getAFrame() const { return m_rbAFrame; }; + const btTransform& getBFrame() const { return m_rbBFrame; }; + + btTransform& getAFrame() { return m_rbAFrame; }; + btTransform& getBFrame() { return m_rbBFrame; }; inline int getSolveLimit() { diff --git a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp index 50d069603..271a29ea2 100755 --- a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp +++ b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp @@ -88,6 +88,22 @@ btSliderConstraint::btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const initParams(); } // btSliderConstraint::btSliderConstraint() +//----------------------------------------------------------------------------- +static btRigidBody s_fixed(0, 0, 0); +btSliderConstraint::btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB) + : btTypedConstraint(SLIDER_CONSTRAINT_TYPE, s_fixed, rbB) + , + m_frameInB(frameInB), + m_useLinearReferenceFrameA(useLinearReferenceFrameB), + m_useSolveConstraintObsolete(false) +// m_useSolveConstraintObsolete(true) +{ + ///not providing rigidbody B means implicitly using worldspace for body B +// m_frameInA.getOrigin() = m_rbA.getCenterOfMassTransform()(m_frameInA.getOrigin()); + + initParams(); +} // btSliderConstraint::btSliderConstraint() + //----------------------------------------------------------------------------- void btSliderConstraint::buildJacobian() diff --git a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h index 70fbce5d9..6b37a4c83 100755 --- a/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h +++ b/src/BulletDynamics/ConstraintSolver/btSliderConstraint.h @@ -126,6 +126,7 @@ protected: public: // constructors btSliderConstraint(btRigidBody& rbA, btRigidBody& rbB, const btTransform& frameInA, const btTransform& frameInB ,bool useLinearReferenceFrameA); + btSliderConstraint(btRigidBody& rbB, const btTransform& frameInB, bool useLinearReferenceFrameB); btSliderConstraint(); // overrides virtual void buildJacobian(); diff --git a/src/LinearMath/btAlignedObjectArray.h b/src/LinearMath/btAlignedObjectArray.h index bad1eee1f..7c013d375 100644 --- a/src/LinearMath/btAlignedObjectArray.h +++ b/src/LinearMath/btAlignedObjectArray.h @@ -171,9 +171,9 @@ class btAlignedObjectArray { int curSize = size(); - if (newsize < size()) + if (newsize < curSize) { - for(int i = curSize; i < newsize; i++) + for(int i = newsize; i < curSize; i++) { m_data[i].~T(); }