This commit is contained in:
David Rose 2003-02-28 22:53:33 +00:00
parent 2c0c98394f
commit d2425ca4f7
2 changed files with 20 additions and 3 deletions

View File

@ -27,6 +27,10 @@
#include <maya/MStatus.h>
#include "post_maya_include.h"
#ifdef WIN32_VC
#include <direct.h> // for chdir()
#endif
MayaApi *MayaApi::_global_api = (MayaApi *)NULL;
////////////////////////////////////////////////////////////////////
@ -37,7 +41,19 @@ MayaApi *MayaApi::_global_api = (MayaApi *)NULL;
////////////////////////////////////////////////////////////////////
MayaApi::
MayaApi(const string &program_name) {
// Beginning with Maya4.5, the call to initialize seems to change
// the current directory! Yikes!
Filename cwd = ExecutionEnvironment::get_cwd();
MStatus stat = MLibrary::initialize((char *)program_name.c_str());
// Restore the current directory.
string dirname = cwd.to_os_specific();
if (chdir(dirname.c_str()) < 0) {
maya_cat.warning()
<< "Unable to restore current directory to " << cwd
<< " after initializing Maya.\n";
}
if (!stat) {
stat.perror("MLibrary::initialize");
_is_valid = false;
@ -151,6 +167,7 @@ read(const Filename &filename) {
MFileIO::newFile(true);
maya_cat.info() << "Reading " << filename << "\n";
// Load the file into Maya
string os_filename = filename.to_os_specific();

View File

@ -77,7 +77,7 @@ get_bool_attribute(MObject &node, const string &attribute_name,
if (!get_maya_attribute(node, attribute_name, value)) {
maya_cat.error()
<< "Attribute " << attribute_name
<< " does not have an bool value.\n";
<< " does not have a bool value.\n";
describe_maya_attribute(node, attribute_name);
return false;
}
@ -267,7 +267,7 @@ set_string_attribute(MObject &node, const string &attribute_name,
if (!get_maya_attribute(node, attribute_name, string_object)) {
maya_cat.error()
<< "Attribute " << attribute_name
<< " does not have an string object value.\n";
<< " does not have a string object value.\n";
describe_maya_attribute(node, attribute_name);
return false;
}
@ -291,7 +291,7 @@ set_string_attribute(MObject &node, const string &attribute_name,
if (!set_maya_attribute(node, attribute_name, string_object)) {
maya_cat.error()
<< "Attribute " << attribute_name
<< " suddenly does not have an string object value.\n";
<< " suddenly does not have a string object value.\n";
return false;
}