diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index 5703aa341a..e582aa3435 100755 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -65,6 +65,7 @@ #include #include #include +#include #include #include "post_maya_include.h" @@ -954,7 +955,10 @@ void MayaEggLoader::TraverseEggNode(EggNode *node, EggGroup *context, string del for (ci = poly->begin(); ci != poly->end(); ++ci) { EggVertex *vtx = (*ci); EggVertexPool *pool = poly->get_pool(); - TexCoordd uv = vtx->get_uv(); + TexCoordd uv(0,0); + if (vtx->has_uv()) { + uv = vtx->get_uv(); + } vertIndices.push_back(mesh->GetVert(vtx, context)); tvertIndices.push_back(mesh->GetTVert(uv * uvtrans)); cvertIndices.push_back(mesh->GetCVert(vtx->get_color())); @@ -1177,6 +1181,9 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a << " -ef: " << _end_frame << endl; } + // masad: keep track of maximum frames of animation on all these joints + MTime maxFrame(_start_frame - 1, _timeUnit); + for (ei = _anim_tab.begin(); ei != _anim_tab.end(); ++ei) { MayaAnim *anim = (*ei).second; MObject node = GetDependencyNode(anim->_joint->get_name()); @@ -1263,6 +1270,13 @@ bool MayaEggLoader::ConvertEggData(EggData *data, bool merge, bool model, bool a mfnAnimCurveSY.addKey(time, scale[1], tangent, tangent, NULL, &status); mfnAnimCurveSZ.addKey(time, scale[2], tangent, tangent, NULL, &status); } + if (maxFrame < time) { + maxFrame = time; + } + } + if (anim) { + // masad: set the control's max time with maxFrame + MAnimControl::setMaxTime(maxFrame); } for (ci = _mesh_tab.begin(); ci != _mesh_tab.end(); ++ci) { diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index 35579a7158..896242f0ff 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -425,6 +425,7 @@ convert_maya() { end_frame = get_end_frame(); } else { end_frame = MAnimControl::maxTime().value(); + //end_frame = MAnimControl::animationEndTime().value(); //masad: we could use this } if (has_frame_inc()) { frame_inc = get_frame_inc();