FBX: fix some minor findings.

pull/1431/head
Kim Kulling 2017-09-12 19:07:17 +02:00
parent cbedc448c6
commit e3163ec15e
9 changed files with 47 additions and 137 deletions

View File

@ -87,17 +87,16 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurve::~AnimationCurve() AnimationCurve::~AnimationCurve()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc, AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name,
const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/) const Document& doc, const char* const * target_prop_whitelist /*= NULL*/,
size_t whitelist_size /*= 0*/)
: Object(id, element, name) : Object(id, element, name)
, target() , target()
, doc(doc) , doc(doc)
@ -154,18 +153,16 @@ AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, cons
props = GetPropertyTable(doc,"AnimationCurveNode.FbxAnimCurveNode",element,sc,false); props = GetPropertyTable(doc,"AnimationCurveNode.FbxAnimCurveNode",element,sc,false);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNode::~AnimationCurveNode() AnimationCurveNode::~AnimationCurveNode()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const AnimationCurveMap& AnimationCurveNode::Curves() const const AnimationCurveMap& AnimationCurveNode::Curves() const
{ {
if(curves.empty()) { if ( curves.empty() ) {
// resolve attached animation curves // resolve attached animation curves
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve"); const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
@ -195,7 +192,6 @@ const AnimationCurveMap& AnimationCurveNode::Curves() const
return curves; return curves;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc) AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc)
: Object(id, element, name) : Object(id, element, name)
@ -207,14 +203,12 @@ AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::s
props = GetPropertyTable(doc,"AnimationLayer.FbxAnimLayer",element,sc, true); props = GetPropertyTable(doc,"AnimationLayer.FbxAnimLayer",element,sc, true);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationLayer::~AnimationLayer() AnimationLayer::~AnimationLayer()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/, AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/,
size_t whitelist_size /*= 0*/) const size_t whitelist_size /*= 0*/) const
@ -298,14 +292,13 @@ AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationStack::~AnimationStack() AnimationStack::~AnimationStack()
{ {
// empty
} }
} //!FBX } //!FBX
} //!Assimp } //!Assimp
#endif #endif // ASSIMP_BUILD_NO_FBX_IMPORTER

View File

@ -66,4 +66,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# endif # endif
#endif #endif
#endif #endif // INCLUDED_AI_FBX_COMPILECONFIG_H

View File

@ -55,9 +55,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "StringComparison.h" #include "StringComparison.h"
#include <assimp/scene.h> #include <assimp/scene.h>
#include <tuple> #include <tuple>
#include <memory> #include <memory>
#include <iterator> #include <iterator>
#include <vector> #include <vector>
@ -931,7 +931,7 @@ bool Converter::NeedsComplexTransformationChain( const Model& model )
const TransformationComp comp = static_cast< TransformationComp >( i ); const TransformationComp comp = static_cast< TransformationComp >( i );
if ( comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || comp == TransformationComp_Translation || if ( comp == TransformationComp_Rotation || comp == TransformationComp_Scaling || comp == TransformationComp_Translation ||
comp == TransformationComp_GeometricScaling || comp == TransformationComp_GeometricRotation || comp == TransformationComp_GeometricTranslation ) { comp == TransformationComp_GeometricScaling || comp == TransformationComp_GeometricRotation || comp == TransformationComp_GeometricTranslation ) {
continue; continue;
} }
@ -949,8 +949,7 @@ std::string Converter::NameTransformationChainNode( const std::string& name, Tra
return name + std::string( MAGIC_NODE_TAG ) + "_" + NameTransformationComp( comp ); return name + std::string( MAGIC_NODE_TAG ) + "_" + NameTransformationComp( comp );
} }
void Converter::GenerateTransformationNodeChain( const Model& model, void Converter::GenerateTransformationNodeChain( const Model& model, std::vector<aiNode*>& output_nodes )
std::vector<aiNode*>& output_nodes )
{ {
const PropertyTable& props = model.Props(); const PropertyTable& props = model.Props();
const Model::RotOrder rot = model.RotationOrder(); const Model::RotOrder rot = model.RotationOrder();
@ -3119,7 +3118,6 @@ void Converter::InterpolateKeys( aiVectorKey* valOut, const KeyTimeList& keys, c
} }
} }
void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs, void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, const KeyFrameListList& inputs,
const aiVector3D& def_value, const aiVector3D& def_value,
double& maxTime, double& maxTime,
@ -3140,7 +3138,6 @@ void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, con
valOut[ i ].mTime = temp[ i ].mTime; valOut[ i ].mTime = temp[ i ].mTime;
GetRotationMatrix( order, temp[ i ].mValue, m ); GetRotationMatrix( order, temp[ i ].mValue, m );
aiQuaternion quat = aiQuaternion( aiMatrix3x3( m ) ); aiQuaternion quat = aiQuaternion( aiMatrix3x3( m ) );
@ -3159,7 +3156,6 @@ void Converter::InterpolateKeys( aiQuatKey* valOut, const KeyTimeList& keys, con
} }
} }
void Converter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey* out_scale, void Converter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey* out_scale,
aiVectorKey* out_translation, aiVectorKey* out_translation,
const KeyFrameListList& scaling, const KeyFrameListList& scaling,
@ -3218,7 +3214,6 @@ void Converter::ConvertTransformOrder_TRStoSRT( aiQuatKey* out_quat, aiVectorKey
} }
} }
aiQuaternion Converter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrder order ) aiQuaternion Converter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrder order )
{ {
aiMatrix4x4 m; aiMatrix4x4 m;
@ -3227,7 +3222,6 @@ aiQuaternion Converter::EulerToQuaternion( const aiVector3D& rot, Model::RotOrde
return aiQuaternion( aiMatrix3x3( m ) ); return aiQuaternion( aiMatrix3x3( m ) );
} }
void Converter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/, void Converter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, const LayerMap& /*layers*/,
int64_t start, int64_t stop, int64_t start, int64_t stop,
double& maxTime, double& maxTime,
@ -3248,7 +3242,6 @@ void Converter::ConvertScaleKeys( aiNodeAnim* na, const std::vector<const Animat
InterpolateKeys( na->mScalingKeys, keys, inputs, aiVector3D( 1.0f, 1.0f, 1.0f ), maxTime, minTime ); InterpolateKeys( na->mScalingKeys, keys, inputs, aiVector3D( 1.0f, 1.0f, 1.0f ), maxTime, minTime );
} }
void Converter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, void Converter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/, const LayerMap& /*layers*/,
int64_t start, int64_t stop, int64_t start, int64_t stop,
@ -3267,7 +3260,6 @@ void Converter::ConvertTranslationKeys( aiNodeAnim* na, const std::vector<const
InterpolateKeys( na->mPositionKeys, keys, inputs, aiVector3D( 0.0f, 0.0f, 0.0f ), maxTime, minTime ); InterpolateKeys( na->mPositionKeys, keys, inputs, aiVector3D( 0.0f, 0.0f, 0.0f ), maxTime, minTime );
} }
void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes, void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const AnimationCurveNode*>& nodes,
const LayerMap& /*layers*/, const LayerMap& /*layers*/,
int64_t start, int64_t stop, int64_t start, int64_t stop,
@ -3289,7 +3281,8 @@ void Converter::ConvertRotationKeys( aiNodeAnim* na, const std::vector<const Ani
void Converter::TransferDataToScene() void Converter::TransferDataToScene()
{ {
ai_assert( !out->mMeshes && !out->mNumMeshes ); ai_assert( !out->mMeshes );
ai_assert( !out->mNumMeshes );
// note: the trailing () ensures initialization with NULL - not // note: the trailing () ensures initialization with NULL - not
// many C++ users seem to know this, so pointing it out to avoid // many C++ users seem to know this, so pointing it out to avoid

View File

@ -70,13 +70,13 @@ LazyObject::LazyObject(uint64_t id, const Element& element, const Document& doc)
, id(id) , id(id)
, flags() , flags()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject::~LazyObject() LazyObject::~LazyObject()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
@ -232,16 +232,15 @@ Object::Object(uint64_t id, const Element& element, const std::string& name)
, name(name) , name(name)
, id(id) , id(id)
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Object::~Object() Object::~Object()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
FileGlobalSettings::FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props) FileGlobalSettings::FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props)
: props(props) : props(props)
@ -361,7 +360,6 @@ void Document::ReadGlobalSettings()
globals.reset(new FileGlobalSettings(*this, props)); globals.reset(new FileGlobalSettings(*this, props));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Document::ReadObjects() void Document::ReadObjects()
{ {
@ -387,7 +385,6 @@ void Document::ReadObjects()
} }
const char* err; const char* err;
const uint64_t id = ParseTokenAsID(*tok[0], err); const uint64_t id = ParseTokenAsID(*tok[0], err);
if(err) { if(err) {
DOMError(err,el.second); DOMError(err,el.second);
@ -469,8 +466,6 @@ void Document::ReadPropertyTemplates()
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Document::ReadConnections() void Document::ReadConnections()
{ {
@ -482,7 +477,6 @@ void Document::ReadConnections()
} }
uint64_t insertionOrder = 0l; uint64_t insertionOrder = 0l;
const Scope& sconns = *econns->Compound(); const Scope& sconns = *econns->Compound();
const ElementCollection conns = sconns.GetCollection("C"); const ElementCollection conns = sconns.GetCollection("C");
for(ElementMap::const_iterator it = conns.first; it != conns.second; ++it) { for(ElementMap::const_iterator it = conns.first; it != conns.second; ++it) {
@ -491,7 +485,9 @@ void Document::ReadConnections()
// PP = property-property connection, ignored for now // PP = property-property connection, ignored for now
// (tokens: "PP", ID1, "Property1", ID2, "Property2") // (tokens: "PP", ID1, "Property1", ID2, "Property2")
if(type == "PP") continue; if ( type == "PP" ) {
continue;
}
const uint64_t src = ParseTokenAsID(GetRequiredToken(el,1)); const uint64_t src = ParseTokenAsID(GetRequiredToken(el,1));
const uint64_t dest = ParseTokenAsID(GetRequiredToken(el,2)); const uint64_t dest = ParseTokenAsID(GetRequiredToken(el,2));
@ -518,11 +514,10 @@ void Document::ReadConnections()
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const std::vector<const AnimationStack*>& Document::AnimationStacks() const const std::vector<const AnimationStack*>& Document::AnimationStacks() const
{ {
if (!animationStacksResolved.empty() || !animationStacks.size()) { if (!animationStacksResolved.empty() || animationStacks.empty()) {
return animationStacksResolved; return animationStacksResolved;
} }
@ -540,7 +535,6 @@ const std::vector<const AnimationStack*>& Document::AnimationStacks() const
return animationStacksResolved; return animationStacksResolved;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject* Document::GetObject(uint64_t id) const LazyObject* Document::GetObject(uint64_t id) const
{ {
@ -551,8 +545,7 @@ LazyObject* Document::GetObject(uint64_t id) const
#define MAX_CLASSNAMES 6 #define MAX_CLASSNAMES 6
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, const ConnectionMap& conns) const
const ConnectionMap& conns) const
{ {
std::vector<const Connection*> temp; std::vector<const Connection*> temp;
@ -569,7 +562,6 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id,
return temp; // NRVO should handle this return temp; // NRVO should handle this
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bool is_src, std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bool is_src,
const ConnectionMap& conns, const ConnectionMap& conns,
@ -578,17 +570,17 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bo
{ {
ai_assert(classnames); ai_assert(classnames);
ai_assert(count != 0 && count <= MAX_CLASSNAMES); ai_assert( count != 0 );
ai_assert( count <= MAX_CLASSNAMES);
size_t lenghts[MAX_CLASSNAMES]; size_t lenghts[MAX_CLASSNAMES];
const size_t c = count; const size_t c = count;
for (size_t i = 0; i < c; ++i) { for (size_t i = 0; i < c; ++i) {
lenghts[i] = strlen(classnames[i]); lenghts[ i ] = strlen(classnames[i]);
} }
std::vector<const Connection*> temp; std::vector<const Connection*> temp;
const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range = const std::pair<ConnectionMap::const_iterator,ConnectionMap::const_iterator> range =
conns.equal_range(id); conns.equal_range(id);
@ -620,49 +612,40 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, bo
return temp; // NRVO should handle this return temp; // NRVO should handle this
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source) const std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source) const
{ {
return GetConnectionsSequenced(source, ConnectionsBySource()); return GetConnectionsSequenced(source, ConnectionsBySource());
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t dest, const char* classname) const
const char* classname) const
{ {
const char* arr[] = {classname}; const char* arr[] = {classname};
return GetConnectionsBySourceSequenced(dest, arr,1); return GetConnectionsBySourceSequenced(dest, arr,1);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source, std::vector<const Connection*> Document::GetConnectionsBySourceSequenced(uint64_t source,
const char* const* classnames, size_t count) const const char* const* classnames, size_t count) const
{ {
return GetConnectionsSequenced(source, true, ConnectionsBySource(),classnames, count); return GetConnectionsSequenced(source, true, ConnectionsBySource(),classnames, count);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest,
const char* classname) const const char* classname) const
{ {
const char* arr[] = {classname}; const char* arr[] = {classname};
return GetConnectionsByDestinationSequenced(dest, arr,1); return GetConnectionsByDestinationSequenced(dest, arr,1);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest) const std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest) const
{ {
return GetConnectionsSequenced(dest, ConnectionsByDestination()); return GetConnectionsSequenced(dest, ConnectionsByDestination());
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest, std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(uint64_t dest,
const char* const* classnames, size_t count) const const char* const* classnames, size_t count) const
@ -671,10 +654,9 @@ std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(ui
return GetConnectionsSequenced(dest, false, ConnectionsByDestination(),classnames, count); return GetConnectionsSequenced(dest, false, ConnectionsByDestination(),classnames, count);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Connection::Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop, Connection::Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, const std::string& prop,
const Document& doc) const Document& doc)
: insertionOrder(insertionOrder) : insertionOrder(insertionOrder)
, prop(prop) , prop(prop)
@ -687,14 +669,12 @@ Connection::Connection(uint64_t insertionOrder, uint64_t src, uint64_t dest, co
ai_assert(!dest || doc.Objects().find(dest) != doc.Objects().end()); ai_assert(!dest || doc.Objects().find(dest) != doc.Objects().end());
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Connection::~Connection() Connection::~Connection()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject& Connection::LazySourceObject() const LazyObject& Connection::LazySourceObject() const
{ {
@ -703,7 +683,6 @@ LazyObject& Connection::LazySourceObject() const
return *lazy; return *lazy;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject& Connection::LazyDestinationObject() const LazyObject& Connection::LazyDestinationObject() const
{ {
@ -712,7 +691,6 @@ LazyObject& Connection::LazyDestinationObject() const
return *lazy; return *lazy;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const Object* Connection::SourceObject() const const Object* Connection::SourceObject() const
{ {
@ -721,7 +699,6 @@ const Object* Connection::SourceObject() const
return lazy->Get(); return lazy->Get();
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const Object* Connection::DestinationObject() const const Object* Connection::DestinationObject() const
{ {
@ -734,4 +711,3 @@ const Object* Connection::DestinationObject() const
} // !Assimp } // !Assimp
#endif #endif

View File

@ -338,12 +338,7 @@ public:
class Model : public Object class Model : public Object
{ {
public: public:
Model(uint64_t id, const Element& element, const Document& doc, const std::string& name); enum RotOrder {
virtual ~Model();
public:
enum RotOrder
{
RotOrder_EulerXYZ = 0, RotOrder_EulerXYZ = 0,
RotOrder_EulerXZY, RotOrder_EulerXZY,
RotOrder_EulerYZX, RotOrder_EulerYZX,
@ -357,8 +352,7 @@ public:
}; };
enum TransformInheritance enum TransformInheritance {
{
TransformInheritance_RrSs = 0, TransformInheritance_RrSs = 0,
TransformInheritance_RSrs, TransformInheritance_RSrs,
TransformInheritance_Rrs, TransformInheritance_Rrs,
@ -366,7 +360,10 @@ public:
TransformInheritance_MAX // end-of-enum sentinel TransformInheritance_MAX // end-of-enum sentinel
}; };
public: Model(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Model();
fbx_simple_property(QuaternionInterpolate, int, 0) fbx_simple_property(QuaternionInterpolate, int, 0)
fbx_simple_property(RotationOffset, aiVector3D, aiVector3D()) fbx_simple_property(RotationOffset, aiVector3D, aiVector3D())
@ -443,7 +440,6 @@ public:
fbx_simple_property(LODBox, bool, false) fbx_simple_property(LODBox, bool, false)
fbx_simple_property(Freeze, bool, false) fbx_simple_property(Freeze, bool, false)
public:
const std::string& Shading() const { const std::string& Shading() const {
return shading; return shading;
} }
@ -462,13 +458,11 @@ public:
return materials; return materials;
} }
/** Get geometry links */ /** Get geometry links */
const std::vector<const Geometry*>& GetGeometry() const { const std::vector<const Geometry*>& GetGeometry() const {
return geometry; return geometry;
} }
/** Get node attachments */ /** Get node attachments */
const std::vector<const NodeAttribute*>& GetAttributes() const { const std::vector<const NodeAttribute*>& GetAttributes() const {
return attributes; return attributes;
@ -477,7 +471,6 @@ public:
/** convenience method to check if the node has a Null node marker */ /** convenience method to check if the node has a Null node marker */
bool IsNull() const; bool IsNull() const;
private: private:
void ResolveLinks(const Element& element, const Document& doc); void ResolveLinks(const Element& element, const Document& doc);
@ -805,7 +798,6 @@ private:
typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList; typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList;
/** Represents a FBX animation layer (i.e. a list of node animations) */ /** Represents a FBX animation layer (i.e. a list of node animations) */
class AnimationLayer : public Object class AnimationLayer : public Object
{ {
@ -828,10 +820,8 @@ private:
const Document& doc; const Document& doc;
}; };
typedef std::vector<const AnimationLayer*> AnimationLayerList; typedef std::vector<const AnimationLayer*> AnimationLayerList;
/** Represents a FBX animation stack (i.e. a list of animation layers) */ /** Represents a FBX animation stack (i.e. a list of animation layers) */
class AnimationStack : public Object class AnimationStack : public Object
{ {
@ -839,7 +829,6 @@ public:
AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationStack(); virtual ~AnimationStack();
public:
fbx_simple_property(LocalStart, int64_t, 0L) fbx_simple_property(LocalStart, int64_t, 0L)
fbx_simple_property(LocalStop, int64_t, 0L) fbx_simple_property(LocalStop, int64_t, 0L)
fbx_simple_property(ReferenceStart, int64_t, 0L) fbx_simple_property(ReferenceStart, int64_t, 0L)
@ -879,7 +868,6 @@ private:
typedef std::vector<float> WeightArray; typedef std::vector<float> WeightArray;
typedef std::vector<unsigned int> WeightIndexArray; typedef std::vector<unsigned int> WeightIndexArray;
/** DOM class for skin deformer clusters (aka subdeformers) */ /** DOM class for skin deformer clusters (aka subdeformers) */
class Cluster : public Deformer class Cluster : public Deformer
{ {
@ -924,8 +912,6 @@ private:
const Model* node; const Model* node;
}; };
/** DOM class for skin deformers */ /** DOM class for skin deformers */
class Skin : public Deformer class Skin : public Deformer
{ {
@ -1009,10 +995,8 @@ public:
typedef std::map<uint64_t, LazyObject*> ObjectMap; typedef std::map<uint64_t, LazyObject*> ObjectMap;
typedef std::fbx_unordered_map<std::string, std::shared_ptr<const PropertyTable> > PropertyTemplateMap; typedef std::fbx_unordered_map<std::string, std::shared_ptr<const PropertyTable> > PropertyTemplateMap;
typedef std::multimap<uint64_t, const Connection*> ConnectionMap; typedef std::multimap<uint64_t, const Connection*> ConnectionMap;
/** DOM class for global document settings, a single instance per document can /** DOM class for global document settings, a single instance per document can
* be accessed via Document.Globals(). */ * be accessed via Document.Globals(). */
class FileGlobalSettings class FileGlobalSettings
@ -1074,9 +1058,6 @@ private:
const Document& doc; const Document& doc;
}; };
/** DOM root for a FBX file */ /** DOM root for a FBX file */
class Document class Document
{ {
@ -1154,8 +1135,6 @@ private:
const ConnectionMap&, const ConnectionMap&,
const char* const* classnames, const char* const* classnames,
size_t count) const; size_t count) const;
private:
void ReadHeader(); void ReadHeader();
void ReadObjects(); void ReadObjects();
void ReadPropertyTemplates(); void ReadPropertyTemplates();

View File

@ -77,14 +77,12 @@ Model::Model(uint64_t id, const Element& element, const Document& doc, const std
ResolveLinks(element,doc); ResolveLinks(element,doc);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Model::~Model() Model::~Model()
{ {
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void Model::ResolveLinks(const Element& element, const Document& doc) void Model::ResolveLinks(const Element& element, const Document& doc)
{ {
@ -132,7 +130,6 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
bool Model::IsNull() const bool Model::IsNull() const
{ {

View File

@ -53,7 +53,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
namespace Assimp { namespace Assimp {
namespace FBX { namespace FBX {
using namespace Util; using namespace Util;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
NodeAttribute::NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name) NodeAttribute::NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name)
@ -75,7 +75,7 @@ NodeAttribute::NodeAttribute(uint64_t id, const Element& element, const Document
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
NodeAttribute::~NodeAttribute() NodeAttribute::~NodeAttribute()
{ {
// empty
} }
@ -101,33 +101,30 @@ CameraSwitcher::CameraSwitcher(uint64_t id, const Element& element, const Docume
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CameraSwitcher::~CameraSwitcher() CameraSwitcher::~CameraSwitcher()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Camera::Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name) Camera::Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: NodeAttribute(id,element,doc,name) : NodeAttribute(id,element,doc,name)
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Camera::~Camera() Camera::~Camera()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name) Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: NodeAttribute(id,element,doc,name) : NodeAttribute(id,element,doc,name)
{ {
// empty
} }

View File

@ -224,41 +224,36 @@ Parser::Parser (const TokenList& tokens, bool is_binary)
root.reset(new Scope(*this,true)); root.reset(new Scope(*this,true));
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Parser::~Parser() Parser::~Parser()
{ {
// empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TokenPtr Parser::AdvanceToNextToken() TokenPtr Parser::AdvanceToNextToken()
{ {
last = current; last = current;
if (cursor == tokens.end()) { if (cursor == tokens.end()) {
current = NULL; current = NULL;
} } else {
else {
current = *cursor++; current = *cursor++;
} }
return current; return current;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TokenPtr Parser::CurrentToken() const TokenPtr Parser::CurrentToken() const
{ {
return current; return current;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
TokenPtr Parser::LastToken() const TokenPtr Parser::LastToken() const
{ {
return last; return last;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
uint64_t ParseTokenAsID(const Token& t, const char*& err_out) uint64_t ParseTokenAsID(const Token& t, const char*& err_out)
{ {
@ -296,7 +291,6 @@ uint64_t ParseTokenAsID(const Token& t, const char*& err_out)
return id; return id;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
size_t ParseTokenAsDim(const Token& t, const char*& err_out) size_t ParseTokenAsDim(const Token& t, const char*& err_out)
{ {

View File

@ -85,12 +85,9 @@ typedef std::pair<ElementMap::const_iterator,ElementMap::const_iterator> Element
class Element class Element
{ {
public: public:
Element(const Token& key_token, Parser& parser); Element(const Token& key_token, Parser& parser);
~Element(); ~Element();
public:
const Scope* Compound() const { const Scope* Compound() const {
return compound.get(); return compound.get();
} }
@ -104,14 +101,11 @@ public:
} }
private: private:
const Token& key_token; const Token& key_token;
TokenList tokens; TokenList tokens;
std::unique_ptr<Scope> compound; std::unique_ptr<Scope> compound;
}; };
/** FBX data entity that consists of a 'scope', a collection /** FBX data entity that consists of a 'scope', a collection
* of not necessarily unique #Element instances. * of not necessarily unique #Element instances.
* *
@ -125,14 +119,10 @@ private:
* @endverbatim */ * @endverbatim */
class Scope class Scope
{ {
public: public:
Scope(Parser& parser, bool topLevel = false); Scope(Parser& parser, bool topLevel = false);
~Scope(); ~Scope();
public:
const Element* operator[] (const std::string& index) const { const Element* operator[] (const std::string& index) const {
ElementMap::const_iterator it = elements.find(index); ElementMap::const_iterator it = elements.find(index);
return it == elements.end() ? NULL : (*it).second; return it == elements.end() ? NULL : (*it).second;
@ -158,28 +148,23 @@ public:
} }
private: private:
ElementMap elements; ElementMap elements;
}; };
/** FBX parsing class, takes a list of input tokens and generates a hierarchy /** FBX parsing class, takes a list of input tokens and generates a hierarchy
* of nested #Scope instances, representing the fbx DOM.*/ * of nested #Scope instances, representing the fbx DOM.*/
class Parser class Parser
{ {
public: public:
/** Parse given a token list. Does not take ownership of the tokens - /** Parse given a token list. Does not take ownership of the tokens -
* the objects must persist during the entire parser lifetime */ * the objects must persist during the entire parser lifetime */
Parser (const TokenList& tokens,bool is_binary); Parser (const TokenList& tokens,bool is_binary);
~Parser(); ~Parser();
public:
const Scope& GetRootScope() const { const Scope& GetRootScope() const {
return *root.get(); return *root.get();
} }
bool IsBinary() const { bool IsBinary() const {
return is_binary; return is_binary;
} }
@ -233,8 +218,6 @@ void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el);
void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& e); void ParseVectorDataArray(std::vector<uint64_t>& out, const Element& e);
void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el); void ParseVectorDataArray(std::vector<int64_t>& out, const Element& el);
// extract a required element from a scope, abort if the element cannot be found // extract a required element from a scope, abort if the element cannot be found
const Element& GetRequiredElement(const Scope& sc, const std::string& index, const Element* element = NULL); const Element& GetRequiredElement(const Scope& sc, const std::string& index, const Element* element = NULL);
@ -243,8 +226,6 @@ const Scope& GetRequiredScope(const Element& el);
// get token at a particular index // get token at a particular index
const Token& GetRequiredToken(const Element& el, unsigned int index); const Token& GetRequiredToken(const Element& el, unsigned int index);
// read a 4x4 matrix from an array of 16 floats // read a 4x4 matrix from an array of 16 floats
aiMatrix4x4 ReadMatrix(const Element& element); aiMatrix4x4 ReadMatrix(const Element& element);