|
@@ -181,6 +181,13 @@ convert_file(const Filename &filename) {
|
|
|
<< "Maya is not available.\n";
|
|
<< "Maya is not available.\n";
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // We must ensure our Maya pointers are cleared before we reset the
|
|
|
|
|
+ // Maya scene, because resetting the Maya scene will invalidate all
|
|
|
|
|
+ // the Maya pointers we are holding and cause a crash if we try to
|
|
|
|
|
+ // free them later.
|
|
|
|
|
+ clear();
|
|
|
|
|
+
|
|
|
if (!_maya->read(filename)) {
|
|
if (!_maya->read(filename)) {
|
|
|
mayaegg_cat.error()
|
|
mayaegg_cat.error()
|
|
|
<< "Unable to read " << filename << "\n";
|
|
<< "Unable to read " << filename << "\n";
|
|
@@ -220,8 +227,8 @@ get_input_units() {
|
|
|
bool MayaToEggConverter::
|
|
bool MayaToEggConverter::
|
|
|
convert_maya(bool from_selection) {
|
|
convert_maya(bool from_selection) {
|
|
|
_from_selection = from_selection;
|
|
_from_selection = from_selection;
|
|
|
- _textures.clear();
|
|
|
|
|
- _shaders.clear();
|
|
|
|
|
|
|
+
|
|
|
|
|
+ clear();
|
|
|
|
|
|
|
|
if (!open_api()) {
|
|
if (!open_api()) {
|
|
|
mayaegg_cat.error()
|
|
mayaegg_cat.error()
|
|
@@ -364,11 +371,26 @@ open_api() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
void MayaToEggConverter::
|
|
void MayaToEggConverter::
|
|
|
close_api() {
|
|
close_api() {
|
|
|
- // We have to clear the shaders before we release the Maya API.
|
|
|
|
|
- _shaders.clear();
|
|
|
|
|
|
|
+ // We have to clear the shaders, at least, before we release the
|
|
|
|
|
+ // Maya API.
|
|
|
|
|
+ clear();
|
|
|
_maya.clear();
|
|
_maya.clear();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: MayaToEggConverter::clear
|
|
|
|
|
+// Access: Public
|
|
|
|
|
+// Description: Frees all of the Maya pointers kept within this
|
|
|
|
|
+// object, in preparation for loading a new scene or
|
|
|
|
|
+// releasing the Maya API.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+void MayaToEggConverter::
|
|
|
|
|
+clear() {
|
|
|
|
|
+ _tree.clear();
|
|
|
|
|
+ _textures.clear();
|
|
|
|
|
+ _shaders.clear();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: MayaToEggConverter::convert_flip
|
|
// Function: MayaToEggConverter::convert_flip
|
|
|
// Access: Private
|
|
// Access: Private
|
|
@@ -561,6 +583,7 @@ process_model_node(MayaNodeDesc *node_desc) {
|
|
|
MFnDagNode dag_node(dag_path, &status);
|
|
MFnDagNode dag_node(dag_path, &status);
|
|
|
if (!status) {
|
|
if (!status) {
|
|
|
status.perror("MFnDagNode constructor");
|
|
status.perror("MFnDagNode constructor");
|
|
|
|
|
+ mayaegg_cat.error() << dag_path.fullPathName() << "\n";
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|