Пример #1
0
bool DocumentImporter::import()
{
	ErrorHandler errorHandler;
	COLLADASaxFWL::Loader loader(&errorHandler);
	COLLADAFW::Root root(&loader, this);
	ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer));
	
	loader.registerExtraDataCallbackHandler(ehandler);

	if (!root.loadDocument(mFilename))
		return false;
	
	if(errorHandler.hasError())
		return false;
	
	/** TODO set up scene graph and such here */
	
	mImportStage = Controller;
	
	COLLADASaxFWL::Loader loader2;
	COLLADAFW::Root root2(&loader2, this);
	
	if (!root2.loadDocument(mFilename))
		return false;
	
	
	delete ehandler;

	return true;
}
Пример #2
0
bool DocumentImporter::import()
{
	ErrorHandler errorHandler;
	COLLADASaxFWL::Loader loader(&errorHandler);
	COLLADAFW::Root root(&loader, this);
	ExtraHandler *ehandler = new ExtraHandler(this, &(this->anim_importer));
	
	loader.registerExtraDataCallbackHandler(ehandler);

	// deselect all to select new objects
	BKE_scene_base_deselect_all(CTX_data_scene(mContext));

	std::string mFilename = std::string(this->import_settings->filepath);
	const std::string encodedFilename = bc_url_encode(mFilename);
	if (!root.loadDocument(encodedFilename)) {
		fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 1st pass\n");
		delete ehandler;
		return false;
	}
	
	if (errorHandler.hasError()) {
		delete ehandler;
		return false;
	}
	
	/** TODO set up scene graph and such here */
	
	mImportStage = Controller;
	
	COLLADASaxFWL::Loader loader2;
	COLLADAFW::Root root2(&loader2, this);
	
	if (!root2.loadDocument(encodedFilename)) {
		fprintf(stderr, "COLLADAFW::Root::loadDocument() returned false on 2nd pass\n");
		delete ehandler;
		return false;
	}

	delete ehandler;

	return true;
}