mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 02:15:43 -04:00
Fixed a bug in CreateSkinCluster()
This commit is contained in:
parent
030dbf11f5
commit
b8c77b1ac9
@ -1092,7 +1092,6 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
|
|||||||
}
|
}
|
||||||
|
|
||||||
MPlugArray oldplugs;
|
MPlugArray oldplugs;
|
||||||
|
|
||||||
MPlug inPlug;
|
MPlug inPlug;
|
||||||
if (shape.typeName() == "mesh") {
|
if (shape.typeName() == "mesh") {
|
||||||
inPlug = shape.findPlug("inMesh");
|
inPlug = shape.findPlug("inMesh");
|
||||||
@ -1109,15 +1108,17 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
|
|||||||
}
|
}
|
||||||
MFnSkinCluster skinCluster(oldplugs[0].node());
|
MFnSkinCluster skinCluster(oldplugs[0].node());
|
||||||
MIntArray influenceIndices;
|
MIntArray influenceIndices;
|
||||||
MFnComponent component;
|
MFnComponent *pComponent;
|
||||||
if (shape.typeName() == "mesh") {
|
if (shape.typeName() == "mesh") {
|
||||||
MFnSingleIndexedComponent component;
|
MFnSingleIndexedComponent *pSingleComponent = new MFnSingleIndexedComponent();
|
||||||
component.create(MFn::kMeshVertComponent);
|
pSingleComponent->create(MFn::kMeshVertComponent);
|
||||||
component.setCompleteData(M->_vert_count);
|
pSingleComponent->setCompleteData(M->_vert_count);
|
||||||
|
pComponent = pSingleComponent;
|
||||||
} else if (shape.typeName() == "nurbsSurface") {
|
} else if (shape.typeName() == "nurbsSurface") {
|
||||||
MFnDoubleIndexedComponent component;
|
MFnDoubleIndexedComponent *pDoubleComponent = new MFnDoubleIndexedComponent();
|
||||||
component.create(MFn::kSurfaceCVComponent);
|
pDoubleComponent->create(MFn::kSurfaceCVComponent);
|
||||||
component.setCompleteData(M->_uNumCvs, M->_vNumCvs);
|
pDoubleComponent->setCompleteData(M->_uNumCvs, M->_vNumCvs);
|
||||||
|
pComponent = pDoubleComponent;
|
||||||
} else {
|
} else {
|
||||||
// we only support mesh and nurbsSurface
|
// we only support mesh and nurbsSurface
|
||||||
return;
|
return;
|
||||||
@ -1144,7 +1145,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
|
|||||||
perror("skinCluster index");
|
perror("skinCluster index");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
skinCluster.setWeights(M->_shape_dag_path, component.object(), index, 0.0, false, NULL);
|
skinCluster.setWeights(M->_shape_dag_path, pComponent->object(), index, 0.0, false, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MFloatArray values;
|
MFloatArray values;
|
||||||
@ -1160,7 +1161,7 @@ void MayaEggLoader::CreateSkinCluster(MayaEggGeom *M)
|
|||||||
values[vert->_index * joints.size() + joint->_index] = (float)strength;
|
values[vert->_index * joints.size() + joint->_index] = (float)strength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
skinCluster.setWeights(M->_shape_dag_path, component.object(), influenceIndices, values, false, NULL);
|
skinCluster.setWeights(M->_shape_dag_path, pComponent->object(), influenceIndices, values, false, NULL);
|
||||||
|
|
||||||
for (unsigned int i=0; i<joints.size(); i++) {
|
for (unsigned int i=0; i<joints.size(); i++) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user