Fixed a bug in NURBS weights conversion

This commit is contained in:
Gyedo Jeon 2008-06-20 02:05:40 +00:00
parent e8b4443ae3
commit 31dde9d31d

View File

@ -594,8 +594,6 @@ public:
EggGroup *_parent;
MDagPath _shape_dag_path;
int _vert_count;
unsigned _uNumCvs;
unsigned _vNumCvs;
MFloatPointArray _vertexArray;
MVectorArray _normalArray;
@ -885,6 +883,9 @@ public:
MDoubleArray _vKnotArray;
unsigned _uDegree;
unsigned _vDegree;
unsigned _uNumCvs;
unsigned _vNumCvs;
MFnNurbsSurface::Form _uForm;
MFnNurbsSurface::Form _vForm;
@ -1108,22 +1109,9 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
}
MFnSkinCluster skinCluster(oldplugs[0].node());
MIntArray influenceIndices;
MFnComponent *pComponent;
if (shape.typeName() == "mesh") {
MFnSingleIndexedComponent *pSingleComponent = new MFnSingleIndexedComponent();
pSingleComponent->create(MFn::kMeshVertComponent);
pSingleComponent->setCompleteData(M->_vert_count);
pComponent = pSingleComponent;
} else if (shape.typeName() == "nurbsSurface") {
MFnDoubleIndexedComponent *pDoubleComponent = new MFnDoubleIndexedComponent();
pDoubleComponent->create(MFn::kSurfaceCVComponent);
pDoubleComponent->setCompleteData(M->_uNumCvs, M->_vNumCvs);
pComponent = pDoubleComponent;
} else {
// we only support mesh and nurbsSurface
return;
}
MFnSingleIndexedComponent component;
component.create(MFn::kMeshVertComponent); // [gjeon] Interestingly, we can use MFn::kMeshVertComponent for NURBS surface, too
component.setCompleteData(M->_vert_count);
for (unsigned int i=0; i<joints.size(); i++) {
unsigned int index = skinCluster.indexForInfluenceObject(joints[i]->_joint_dag_path, &status);
if (status != MStatus::kSuccess) {
@ -1145,7 +1133,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
perror("skinCluster index");
return;
}
skinCluster.setWeights(M->_shape_dag_path, pComponent->object(), index, 0.0, false, NULL);
skinCluster.setWeights(M->_shape_dag_path, component.object(), index, 0.0, false, NULL);
}
MFloatArray values;
@ -1161,7 +1149,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
values[vert->_index * joints.size() + joint->_index] = (float)strength;
}
}
skinCluster.setWeights(M->_shape_dag_path, pComponent->object(), influenceIndices, values, false, NULL);
skinCluster.setWeights(M->_shape_dag_path, component.object(), influenceIndices, values, false, NULL);
for (unsigned int i=0; i<joints.size(); i++) {
/*