fixed the bug were the first object created was translated back to the

origin
This commit is contained in:
nicola.candussi
2008-09-24 12:40:15 +00:00
parent 752eb583d0
commit e0d1c1d057
4 changed files with 16 additions and 8 deletions

View File

@@ -120,6 +120,11 @@ dSolverCmd::redoIt()
m_dgModifier->connect(plgOutTime, plgInTime);
m_dgModifier->doIt();
}
//force update of the solver on creation
MPlug plgRigidBodies(dSolverObj, dSolverNode::oa_rigidBodies);
bool update;
plgRigidBodies.getValue(update);
setResult(MFnDependencyNode(dSolverObj).name());
return stat;

View File

@@ -622,7 +622,7 @@ void dSolverNode::applyFields(MPlugArray &rbConnections, float dt)
void dSolverNode::computeRigidBodies(const MPlug& plug, MDataBlock& data)
{
// std::cout << "dSolverNode::computeRigidBodies" << std::endl;
// std::cout << "dSolverNode::computeRigidBodies" << std::endl;
bool enabled = data.inputValue(ia_enabled).asBool();
if(!enabled) {

View File

@@ -409,7 +409,7 @@ void rigidBodyNode::computeRigidBody(const MPlug& plug, MDataBlock& data)
void rigidBodyNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data)
{
//std::cout << "rigidBodyNode::computeWorldMatrix" << std::endl;
// std::cout << "rigidBodyNode::computeWorldMatrix" << std::endl;
MObject thisObject(thisMObject());
MFnDagNode fnDagNode(thisObject);
@@ -421,8 +421,12 @@ void rigidBodyNode::computeWorldMatrix(const MPlug& plug, MDataBlock& data)
vec3f pos;
quatf rot;
MFnTransform fnParentTransform(fnDagNode.parent(0));
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform);
MStatus status;
MFnTransform fnParentTransform(fnDagNode.parent(0, &status));
MVector mtranslation = fnParentTransform.getTranslation(MSpace::kTransform, &status);
MQuaternion mrotation;
fnParentTransform.getRotation(mrotation, MSpace::kTransform);
double mscale[3];

View File

@@ -404,6 +404,9 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
connectAttr ($selection[$i * 2] + ".message") ($collisionShapeNode + ".inShape");
hide $shapeTransforms[0];
}
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
float $pos[]= `getAttr ($shapeTransforms[0] + ".translate")`;
float $rot[]= `getAttr ($shapeTransforms[0] + ".rotate")`;
@@ -412,9 +415,6 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
setAttr ($rigidBodyTransforms[0] + ".rotate") -type double3 $rot[0] $rot[1] $rot[2];
// setAttr ($rigidBodyNode + ".initialRotation") -type double3 $rot[0] $rot[1] $rot[2];
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
$newBodies[$i] = $rigidBodyTransforms[0];
}
@@ -426,7 +426,6 @@ proc dynamicaUI_createRigidBody(int $active, int $collisionShapeType)
setAttr ($rigidBodyNode + ".active" ) $active;
setAttr ($collisionShapeNode + ".type" ) $collisionShapeType;
$newBodies[0] = $rigidBodyTransforms[0];
}