I am fairly new to Collada, and I’m hoping that my problem has a simple solution.
I have been using the Collada DOM to output assets from various applications. Until now, I have been working in an application neutral context. As a stand alone executable, my application works fine, creating several Collada files. Unfortunately, when I wrapper the code in a Maya plugin, maya crashes when I attempt to run the command. The issue emmerges during the save() function, where the system crashes.
I have simplified to code down to the most basic elements. Essentially, I create a document and try to save it. Here’s the code:
template <typename DOM_ELT, typename PARENT>
DOM_ELT* createDomElement(PARENT* parent, const daeString& asset_type)
{
DOM_ELT* new_elt = daeSafeCast<DOM_ELT>(parent->createAndPlace(asset_type));
if ( new_elt == NULL )
{
std::cerr << "Failed to create the library types needed
";
}
return new_elt;
}
ColladaExportVisitor::ColladaExportVisitor(const std::string& path)
: my_path(path)
{
// Initialize our database
my_database = boost::shared_ptr<DAE>(new DAE());
my_database->setIOPlugin( NULL );
my_database->setDatabase( NULL );
daeDocument *doc = NULL;
std::string doc_name = "/job/HOME/gwedig/test.txt";
daeInt error = my_database->getDatabase()->insertDocument( doc_name.c_str(), &doc );
if ( error != DAE_OK || doc == NULL )
{
std::cerr << "Failed to create new document " << doc_name << "
";
return;
}
domCOLLADA *collection = daeSafeCast<domCOLLADA>( doc->getDomRoot() );
std::cout << "ALL1" << std::endl;
error = my_database->save(doc_name.c_str());
std::cout << "ALL2" << std::endl;
}
The save() function does not return, but instead crashes the program. And I’m at a loss to figure out why.
Has anyone else experienced anything similar, and if so, do you have a solution and/or any information that might help?
Thanks!