+ 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
This commit is contained in:
52
Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel
Normal file
52
Extras/MayaPlugin/scripts/AEdHingeConstraintTemplate.mel
Normal file
@@ -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 <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//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;
|
||||
|
||||
}
|
||||
|
||||
44
Extras/MayaPlugin/scripts/AEdSixdofConstraintTemplate.mel
Normal file
44
Extras/MayaPlugin/scripts/AEdSixdofConstraintTemplate.mel
Normal file
@@ -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 <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//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;
|
||||
|
||||
}
|
||||
|
||||
44
Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel
Normal file
44
Extras/MayaPlugin/scripts/AEdSliderConstraintTemplate.mel
Normal file
@@ -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 <Herbert.Law@gmail.com>
|
||||
*/
|
||||
|
||||
//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;
|
||||
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user