diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index 4d942967b8..5ea0c0cea9 100755 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -105,12 +105,12 @@ public: MayaEggNurbsSurface *GetSurface(EggVertexPool *pool, EggGroup *parent); - typedef phash_map MeshTable; + typedef phash_map MeshTable; typedef phash_map AnimTable; typedef phash_map JointTable; typedef phash_map GroupTable; typedef phash_map TexTable; - typedef phash_map SurfaceTable; + typedef phash_map SurfaceTable; MeshTable _mesh_tab; AnimTable _anim_tab; @@ -331,6 +331,23 @@ MayaEggGroup *MayaEggLoader::MakeGroup(EggGroup *group, EggGroup *context) result->_name = group->get_name(); result->_group = dgn.create("transform", MString(result->_name.c_str()), parent, &status); + if (group->has_transform3d()) { + LMatrix4d tMat = group->get_transform3d(); + double matData[4][4] = {{tMat.get_cell(0,0), tMat.get_cell(0,1), tMat.get_cell(0,2), tMat.get_cell(0,3)}, + {tMat.get_cell(1,0), tMat.get_cell(1,1), tMat.get_cell(1,2), tMat.get_cell(1,3)}, + {tMat.get_cell(2,0), tMat.get_cell(2,1), tMat.get_cell(2,2), tMat.get_cell(2,3)}, + {tMat.get_cell(3,0), tMat.get_cell(3,1), tMat.get_cell(3,2), tMat.get_cell(3,3)}}; + MMatrix mat(matData); + + MTransformationMatrix matrix = MTransformationMatrix(mat); + MFnTransform tFn = MFnTransform(result->_group, &status); + if (status != MStatus::kSuccess) { + status.perror("MFnTransformNode:create failed!"); + } else { + tFn.set(matrix); + } + } + if (status != MStatus::kSuccess) { status.perror("MFnDagNode:create failed!"); } @@ -906,7 +923,7 @@ int MayaEggMesh::GetCVert(Colorf col) MayaEggMesh *MayaEggLoader::GetMesh(EggVertexPool *pool, EggGroup *parent) { - MayaEggMesh *result = _mesh_tab[pool]; + MayaEggMesh *result = _mesh_tab[parent]; if (result == 0) { result = new MayaEggMesh; result->_pool = pool; @@ -922,7 +939,7 @@ MayaEggMesh *MayaEggLoader::GetMesh(EggVertexPool *pool, EggGroup *parent) result->_faceIndices.clear(); result->_eggObjectTypes.clear(); result->_renameTrans = false; - _mesh_tab[pool] = result; + _mesh_tab[parent] = result; } return result; } @@ -1001,7 +1018,7 @@ public: MayaEggNurbsSurface *MayaEggLoader::GetSurface(EggVertexPool *pool, EggGroup *parent) { - MayaEggNurbsSurface *result = _surface_tab[pool]; + MayaEggNurbsSurface *result = _surface_tab[parent]; if (result == 0) { result = new MayaEggNurbsSurface; result->_pool = pool; @@ -1026,7 +1043,7 @@ MayaEggNurbsSurface *MayaEggLoader::GetSurface(EggVertexPool *pool, EggGroup *pa result->_eggObjectTypes.clear(); result->_renameTrans = false; - _surface_tab[pool] = result; + _surface_tab[parent] = result; } return result; }