From 0054da14d149de5c02c1f93b618ea31f10f14086 Mon Sep 17 00:00:00 2001 From: David Rose Date: Fri, 12 Apr 2002 23:47:50 +0000 Subject: [PATCH] workaround for maya bug --- pandatool/src/maya/mayaFile.cxx | 10 ++++++---- pandatool/src/maya/mayaFile.h | 13 +++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/pandatool/src/maya/mayaFile.cxx b/pandatool/src/maya/mayaFile.cxx index c3b5da0869..be9ef49ad7 100644 --- a/pandatool/src/maya/mayaFile.cxx +++ b/pandatool/src/maya/mayaFile.cxx @@ -262,6 +262,7 @@ process_node(const MDagPath &dag_path, EggData &data) { get_transform(dag_path, egg_group); MFnMesh mesh(dag_path, &status); + if (!status) { if (verbose >= 2) { nout << "Error in node " << dag_path.fullPathName() << ":\n" @@ -337,7 +338,8 @@ get_transform(const MDagPath &dag_path, EggGroup *egg_group) { } void MayaFile:: -make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, +make_nurbs_surface(const MDagPath &dag_path, + MFnNurbsSurface &surface, EggGroup *egg_group) { MStatus status; string name = surface.name().asChar(); @@ -535,7 +537,7 @@ make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, } EggNurbsCurve *MayaFile:: -make_trim_curve(MFnNurbsCurve curve, const string &nurbs_name, +make_trim_curve(const MFnNurbsCurve &curve, const string &nurbs_name, EggGroupNode *egg_group, int trim_curve_index) { if (verbose >= 3) { nout << "Trim curve:\n"; @@ -609,7 +611,7 @@ make_trim_curve(MFnNurbsCurve curve, const string &nurbs_name, } void MayaFile:: -make_nurbs_curve(const MDagPath &, MFnNurbsCurve curve, +make_nurbs_curve(const MDagPath &, const MFnNurbsCurve &curve, EggGroup *egg_group) { MStatus status; string name = curve.name().asChar(); @@ -682,7 +684,7 @@ make_nurbs_curve(const MDagPath &, MFnNurbsCurve curve, } void MayaFile:: -make_polyset(const MDagPath &dag_path, MFnMesh mesh, +make_polyset(const MDagPath &dag_path, const MFnMesh &mesh, EggGroup *egg_group, MayaShader *default_shader) { MStatus status; string name = mesh.name().asChar(); diff --git a/pandatool/src/maya/mayaFile.h b/pandatool/src/maya/mayaFile.h index 2975de7629..567a471265 100644 --- a/pandatool/src/maya/mayaFile.h +++ b/pandatool/src/maya/mayaFile.h @@ -52,15 +52,20 @@ private: bool traverse(EggData &data); bool process_node(const MDagPath &dag_path, EggData &data); void get_transform(const MDagPath &dag_path, EggGroup *egg_group); - void make_nurbs_surface(const MDagPath &dag_path, MFnNurbsSurface surface, + + // I ran into core dumps trying to pass around a MFnMesh object by + // value. From now on, all MFn* objects will be passed around by + // reference. + void make_nurbs_surface(const MDagPath &dag_path, + MFnNurbsSurface &surface, EggGroup *group); - EggNurbsCurve *make_trim_curve(MFnNurbsCurve curve, + EggNurbsCurve *make_trim_curve(const MFnNurbsCurve &curve, const string &nurbs_name, EggGroupNode *egg_group, int trim_curve_index); - void make_nurbs_curve(const MDagPath &dag_path, MFnNurbsCurve curve, + void make_nurbs_curve(const MDagPath &dag_path, const MFnNurbsCurve &curve, EggGroup *group); - void make_polyset(const MDagPath &dag_path, MFnMesh mesh, + void make_polyset(const MDagPath &dag_path, const MFnMesh &mesh, EggGroup *egg_group, MayaShader *default_shader = NULL);