Mostly formatting commit, small elaboration in extra handling API (take pointer to importer).
This commit is contained in:
@@ -92,42 +92,6 @@
|
||||
// creates empties for each imported bone on layer 2, for debugging
|
||||
// #define ARMATURE_TEST
|
||||
|
||||
/** Class that needs to be implemented by a writer.
|
||||
IMPORTANT: The write functions are called in arbitrary order.*/
|
||||
/*
|
||||
private:
|
||||
std::string mFilename;
|
||||
|
||||
bContext *mContext;
|
||||
|
||||
UnitConverter unit_converter;
|
||||
ArmatureImporter armature_importer;
|
||||
MeshImporter mesh_importer;
|
||||
AnimationImporter anim_importer;
|
||||
|
||||
std::map<COLLADAFW::UniqueId, Image*> uid_image_map;
|
||||
std::map<COLLADAFW::UniqueId, Material*> uid_material_map;
|
||||
std::map<COLLADAFW::UniqueId, Material*> uid_effect_map;
|
||||
std::map<COLLADAFW::UniqueId, Camera*> uid_camera_map;
|
||||
std::map<COLLADAFW::UniqueId, Lamp*> uid_lamp_map;
|
||||
std::map<Material*, TexIndexTextureArrayMap> material_texture_mapping_map;
|
||||
std::map<COLLADAFW::UniqueId, Object*> object_map;
|
||||
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> node_map;
|
||||
std::vector<const COLLADAFW::VisualScene*> vscenes;
|
||||
std::vector<Object*> libnode_ob;
|
||||
|
||||
std::map<COLLADAFW::UniqueId, COLLADAFW::Node*> root_map;
|
||||
*/
|
||||
// find root joint by child joint uid, for bone tree evaluation during resampling
|
||||
|
||||
// animation
|
||||
// std::map<COLLADAFW::UniqueId, std::vector<FCurve*> > uid_fcurve_map;
|
||||
// Nodes don't share AnimationLists (Arystan)
|
||||
// std::map<COLLADAFW::UniqueId, Animation> uid_animated_map; // AnimationList->uniqueId to AnimatedObject map
|
||||
|
||||
//public:
|
||||
|
||||
/** Constructor. */
|
||||
DocumentImporter::DocumentImporter(bContext *C, const char *filename) :
|
||||
mImportStage(General),
|
||||
mFilename(filename),
|
||||
@@ -137,7 +101,6 @@ private:
|
||||
anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C))
|
||||
{}
|
||||
|
||||
/** Destructor. */
|
||||
DocumentImporter::~DocumentImporter() {}
|
||||
|
||||
bool DocumentImporter::import()
|
||||
@@ -145,7 +108,7 @@ private:
|
||||
/** TODO Add error handler (implement COLLADASaxFWL::IErrorHandler */
|
||||
COLLADASaxFWL::Loader loader;
|
||||
COLLADAFW::Root root(&loader, this);
|
||||
ExtraHandler *ehandler = new ExtraHandler();
|
||||
ExtraHandler *ehandler = new ExtraHandler(this);
|
||||
|
||||
loader.registerExtraDataCallbackHandler(ehandler);
|
||||
|
||||
@@ -181,7 +144,6 @@ private:
|
||||
|
||||
void DocumentImporter::start(){}
|
||||
|
||||
/** This method is called after the last write* method. No other methods will be called after this.*/
|
||||
void DocumentImporter::finish()
|
||||
{
|
||||
if(mImportStage!=General)
|
||||
@@ -1035,5 +997,8 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool DocumentImporter::addElementData( const COLLADAFW::UniqueId &uid)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -121,6 +121,9 @@ class DocumentImporter : COLLADAFW::IWriter
|
||||
|
||||
bool writeKinematicsScene(const COLLADAFW::KinematicsScene*);
|
||||
|
||||
/** Add element and data for UniqueId */
|
||||
bool addElementData(const COLLADAFW::UniqueId &uid);
|
||||
|
||||
private:
|
||||
|
||||
/** Current import stage we're in. */
|
||||
|
@@ -27,12 +27,14 @@
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "BLI_string.h"
|
||||
|
||||
#include "ExtraHandler.h"
|
||||
|
||||
ExtraHandler::ExtraHandler(){}
|
||||
ExtraHandler::ExtraHandler(DocumentImporter *dimp)
|
||||
{
|
||||
this->dimp = dimp;
|
||||
}
|
||||
|
||||
ExtraHandler::~ExtraHandler() {}
|
||||
|
||||
@@ -45,6 +47,7 @@ bool ExtraHandler::elementBegin( const char* elementName, const char** attribute
|
||||
bool ExtraHandler::elementEnd(const char* elementName )
|
||||
{
|
||||
printf("end: %s\n", elementName);
|
||||
currentUid = COLLADAFW::UniqueId();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -62,6 +65,7 @@ bool ExtraHandler::parseElement (
|
||||
const COLLADAFW::UniqueId& uniqueId ) {
|
||||
if(BLI_strcaseeq(profileName, "blender")) {
|
||||
printf("In parseElement for supported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
|
||||
currentUid = uniqueId;
|
||||
return true;
|
||||
}
|
||||
printf("In parseElement for unsupported profile %s for id %s\n", profileName, uniqueId.toAscii().c_str());
|
||||
|
@@ -33,6 +33,7 @@
|
||||
|
||||
#include "COLLADASaxFWLIExtraDataCallbackHandler.h"
|
||||
|
||||
#include "DocumentImporter.h"
|
||||
|
||||
/** \brief Handler class for <extra> data, through which different
|
||||
* profiles can be handled
|
||||
@@ -41,7 +42,7 @@ class ExtraHandler : public COLLADASaxFWL::IExtraDataCallbackHandler
|
||||
{
|
||||
public:
|
||||
/** Constructor. */
|
||||
ExtraHandler();
|
||||
ExtraHandler(DocumentImporter *dimp);
|
||||
|
||||
/** Destructor. */
|
||||
virtual ~ExtraHandler();
|
||||
@@ -65,5 +66,10 @@ private:
|
||||
ExtraHandler( const ExtraHandler& pre );
|
||||
/** Disable default assignment operator. */
|
||||
const ExtraHandler& operator= ( const ExtraHandler& pre );
|
||||
|
||||
/** Handle to DocumentImporter for interface to extra element data saving. */
|
||||
DocumentImporter* dimp;
|
||||
/** Holds Id of element for which <extra> XML elements are handled. */
|
||||
COLLADAFW::UniqueId currentUid;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user