Generate container for skeleton during FBX-Import

kimkulling/create_skeleton_data_issue_4015
Kim Kulling 2022-04-28 21:12:26 +02:00
parent 37be87b0bd
commit 6cdd1d3cc6
9 changed files with 109 additions and 178 deletions

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2022, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -87,11 +86,6 @@ AnimationCurve::AnimationCurve(uint64_t id, const Element &element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------
AnimationCurve::~AnimationCurve() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, const std::string &name, AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element &element, const std::string &name,
const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/, const Document &doc, const char *const *target_prop_whitelist /*= nullptr*/,
@ -147,11 +141,6 @@ 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() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
const AnimationCurveMap &AnimationCurveNode::Curves() const { const AnimationCurveMap &AnimationCurveNode::Curves() const {
if (curves.empty()) { if (curves.empty()) {
@ -193,11 +182,6 @@ 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() {
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
AnimationCurveNodeList AnimationLayer::Nodes(const char *const *target_prop_whitelist /*= nullptr*/, AnimationCurveNodeList AnimationLayer::Nodes(const char *const *target_prop_whitelist /*= nullptr*/,
size_t whitelist_size /*= 0*/) const { size_t whitelist_size /*= 0*/) const {
@ -279,11 +263,6 @@ AnimationStack::AnimationStack(uint64_t id, const Element &element, const std::s
} }
} }
// ------------------------------------------------------------------------------------------------
AnimationStack::~AnimationStack() {
// empty
}
} // namespace FBX } // namespace FBX
} // namespace Assimp } // namespace Assimp

View File

@ -907,7 +907,6 @@ void FBXConverter::ConvertModel(const Model &model, aiNode *parent, aiNode *root
meshes.reserve(geos.size()); meshes.reserve(geos.size());
for (const Geometry *geo : geos) { for (const Geometry *geo : geos) {
const MeshGeometry *const mesh = dynamic_cast<const MeshGeometry *>(geo); const MeshGeometry *const mesh = dynamic_cast<const MeshGeometry *>(geo);
const LineGeometry *const line = dynamic_cast<const LineGeometry *>(geo); const LineGeometry *const line = dynamic_cast<const LineGeometry *>(geo);
if (mesh) { if (mesh) {
@ -1151,8 +1150,10 @@ unsigned int FBXConverter::ConvertMeshSingleMaterial(const MeshGeometry &mesh, c
ConvertMaterialForMesh(out_mesh, model, mesh, mindices[0]); ConvertMaterialForMesh(out_mesh, model, mesh, mindices[0]);
} }
if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr) { if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr && !doc.Settings().useSkeleton) {
ConvertWeights(out_mesh, mesh, absolute_transform, parent, NO_MATERIAL_SEPARATION, nullptr); ConvertWeights(out_mesh, mesh, absolute_transform, parent, NO_MATERIAL_SEPARATION, nullptr);
} else if (doc.Settings().readWeights && mesh.DeformerSkin() != nullptr && doc.Settings().useSkeleton) {
ConvertWeightsToSkeleton(out_mesh, mesh, absolute_transform, parent, NO_MATERIAL_SEPARATION, nullptr);
} }
std::vector<aiAnimMesh *> animMeshes; std::vector<aiAnimMesh *> animMeshes;
@ -1435,25 +1436,35 @@ unsigned int FBXConverter::ConvertMeshMultiMaterial(const MeshGeometry &mesh, co
return static_cast<unsigned int>(mMeshes.size() - 1); return static_cast<unsigned int>(mMeshes.size() - 1);
} }
void ConvertWeightsToSkeleton(const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform, aiNode *parent, unsigned int materialIndex, static void copyBoneToSkeletonBone(aiMesh *mesh, aiBone *bone, aiSkeletonBone *skeletonBone ) {
std::vector<unsigned int> *outputVertStartIndices) { skeletonBone->mNumnWeights = bone->mNumWeights;
ai_assert(geo.DeformerSkin() != nullptr); skeletonBone->mWeights = bone->mWeights;
skeletonBone->mOffsetMatrix = bone->mOffsetMatrix;
skeletonBone->mMeshId = mesh;
skeletonBone->mNode = bone->mNode;
skeletonBone->mParent = -1;
}
aiSkeleton *skeleton = new aiSkeleton; void FBXConverter::ConvertWeightsToSkeleton(aiMesh *out, const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform, aiNode *parent, unsigned int materialIndex,
const Skin &sk = *geo.DeformerSkin(); std::vector<unsigned int> *outputVertStartIndices, SkeletonBoneContainer &skeletonContainer) {
try {
for (auto &cluster : sk.Clusters()) {
const WeightIndexArray &indices = cluster->GetIndices();
const MatIndexArray &mats = geo.GetMaterialIndices();
aiMatrix4x4 transform = cluster->Transform(); if (skeletonContainer.SkeletonBoneToMeshLookup.find(out) != skeletonContainer.SkeletonBoneToMeshLookup.end()) {
for (WeightIndexArray::value_type index : indices) { return;
unsigned int count = 0;
const unsigned int *out_idx = geo.ToOutputVertexIndex(index, count);
} }
ConvertWeights(out, geo, absolute_transform, parent, materialIndex, outputVertStartIndices);
skeletonContainer.MeshArray.emplace_back(out);
SkeletonBoneArray *ba = new SkeletonBoneArray;
for (size_t i = 0; i < out->mNumBones; ++i) {
aiBone *bone = out->mBones[i];
if (bone == nullptr) {
continue;
} }
} catch (...) { aiSkeletonBone *skeletonBone = new aiSkeletonBone;
copyBoneToSkeletonBone(out, bone, skeletonBone);
ba->emplace_back(skeletonBone);
} }
skeletonContainer.SkeletonBoneToMeshLookup[out] = ba;
} }
void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo, void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo,
@ -1539,12 +1550,11 @@ void FBXConverter::ConvertWeights(aiMesh *out, const MeshGeometry &geo,
out->mBones = nullptr; out->mBones = nullptr;
out->mNumBones = 0; out->mNumBones = 0;
return; return;
} else { }
out->mBones = new aiBone *[bones.size()](); out->mBones = new aiBone *[bones.size()]();
out->mNumBones = static_cast<unsigned int>(bones.size()); out->mNumBones = static_cast<unsigned int>(bones.size());
std::swap_ranges(bones.begin(), bones.end(), out->mBones); std::swap_ranges(bones.begin(), bones.end(), out->mBones);
}
} }
void FBXConverter::ConvertCluster(std::vector<aiBone*> &local_mesh_bones, const Cluster *cluster, void FBXConverter::ConvertCluster(std::vector<aiBone*> &local_mesh_bones, const Cluster *cluster,

View File

@ -75,7 +75,18 @@ typedef std::map<int64_t, morphKeyData*> morphAnimData;
namespace Assimp { namespace Assimp {
namespace FBX { namespace FBX {
class MeshGeometry;
using SkeletonBoneArray = std::vector<aiSkeletonBone *>;
using SkeletonBoneToMesh = std::map<aiMesh*, SkeletonBoneArray*>;
struct SkeletonBoneContainer {
std::vector<aiMesh *> MeshArray;
SkeletonBoneToMesh SkeletonBoneToMeshLookup;
};
class Document; class Document;
/** /**
* Convert a FBX #Document to #aiScene * Convert a FBX #Document to #aiScene
* @param out Empty scene to be populated * @param out Empty scene to be populated
@ -224,6 +235,11 @@ private:
aiNode *parent = nullptr, unsigned int materialIndex = NO_MATERIAL_SEPARATION, aiNode *parent = nullptr, unsigned int materialIndex = NO_MATERIAL_SEPARATION,
std::vector<unsigned int> *outputVertStartIndices = nullptr); std::vector<unsigned int> *outputVertStartIndices = nullptr);
// ------------------------------------------------------------------------------------------------
void ConvertWeightsToSkeleton(aiMesh *out, const MeshGeometry &geo, const aiMatrix4x4 &absolute_transform,
aiNode *parent, unsigned int materialIndex, std::vector<unsigned int> *outputVertStartIndices,
SkeletonBoneContainer &skeletonContainer);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ConvertCluster(std::vector<aiBone *> &local_mesh_bones, const Cluster *cl, void ConvertCluster(std::vector<aiBone *> &local_mesh_bones, const Cluster *cl,
std::vector<size_t> &out_indices, std::vector<size_t> &index_out_indices, std::vector<size_t> &out_indices, std::vector<size_t> &index_out_indices,
@ -301,7 +317,8 @@ private:
void ConvertAnimationStack(const AnimationStack& st); void ConvertAnimationStack(const AnimationStack& st);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void ProcessMorphAnimDatas(std::map<std::string, morphAnimData*>* morphAnimDatas, const BlendShapeChannel* bsc, const AnimationCurveNode* node); void ProcessMorphAnimDatas(std::map<std::string, morphAnimData*>* morphAnimDatas,
const BlendShapeChannel* bsc, const AnimationCurveNode* node);
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
void GenerateNodeAnimations(std::vector<aiNodeAnim*>& node_anims, void GenerateNodeAnimations(std::vector<aiNodeAnim*>& node_anims,

View File

@ -4,7 +4,6 @@ Open Asset Import Library (assimp)
Copyright (c) 2006-2022, assimp team Copyright (c) 2006-2022, assimp team
All rights reserved. All rights reserved.
Redistribution and use of this software in source and binary forms, Redistribution and use of this software in source and binary forms,
@ -68,23 +67,13 @@ namespace FBX {
using namespace Util; using namespace Util;
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject::LazyObject(uint64_t id, const Element& element, const Document& doc) LazyObject::LazyObject(uint64_t id, const Element& element, const Document& doc) :
: doc(doc) doc(doc), element(element), id(id), flags() {
, element(element)
, id(id)
, flags() {
// empty // empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
LazyObject::~LazyObject() const Object* LazyObject::Get(bool dieOnError) {
{
// empty
}
// ------------------------------------------------------------------------------------------------
const Object* LazyObject::Get(bool dieOnError)
{
if(IsBeingConstructed() || FailedToConstruct()) { if(IsBeingConstructed() || FailedToConstruct()) {
return nullptr; return nullptr;
} }
@ -234,17 +223,8 @@ const Object* LazyObject::Get(bool dieOnError)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Object::Object(uint64_t id, const Element& element, const std::string& name) Object::Object(uint64_t id, const Element& element, const std::string& name) :
: element(element) element(element), name(name), id(id) {
, name(name)
, id(id)
{
// empty
}
// ------------------------------------------------------------------------------------------------
Object::~Object()
{
// empty // empty
} }
@ -254,12 +234,6 @@ FileGlobalSettings::FileGlobalSettings(const Document &doc, std::shared_ptr<cons
// empty // empty
} }
// ------------------------------------------------------------------------------------------------
FileGlobalSettings::~FileGlobalSettings()
{
// empty
}
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Document::Document(const Parser& parser, const ImportSettings& settings) Document::Document(const Parser& parser, const ImportSettings& settings)
: settings(settings) : settings(settings)
@ -575,14 +549,12 @@ std::vector<const Connection*> Document::GetConnectionsSequenced(uint64_t id, co
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,
const char* const* classnames, const char* const* classnames,
size_t count) const size_t count) const {
{
ai_assert(classnames); ai_assert(classnames);
ai_assert( count != 0 ); ai_assert( count != 0 );
ai_assert( count <= MAX_CLASSNAMES); ai_assert( count <= MAX_CLASSNAMES);
size_t lengths[MAX_CLASSNAMES]; size_t lengths[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) {
@ -657,9 +629,7 @@ std::vector<const Connection*> Document::GetConnectionsByDestinationSequenced(ui
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
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 {
{
return GetConnectionsSequenced(dest, false, ConnectionsByDestination(),classnames, count); return GetConnectionsSequenced(dest, false, ConnectionsByDestination(),classnames, count);
} }

View File

@ -89,7 +89,7 @@ class LazyObject {
public: public:
LazyObject(uint64_t id, const Element& element, const Document& doc); LazyObject(uint64_t id, const Element& element, const Document& doc);
~LazyObject(); ~LazyObject() = default;
const Object* Get(bool dieOnError = false); const Object* Get(bool dieOnError = false);
@ -139,7 +139,7 @@ class Object {
public: public:
Object(uint64_t id, const Element& element, const std::string& name); Object(uint64_t id, const Element& element, const std::string& name);
virtual ~Object(); virtual ~Object() = default;
const Element& SourceElement() const { const Element& SourceElement() const {
return element; return element;
@ -165,7 +165,7 @@ class NodeAttribute : public Object {
public: public:
NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name); NodeAttribute(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~NodeAttribute(); virtual ~NodeAttribute() = default;
const PropertyTable& Props() const { const PropertyTable& Props() const {
ai_assert(props.get()); ai_assert(props.get());
@ -181,7 +181,7 @@ class CameraSwitcher : public NodeAttribute {
public: public:
CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name); CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~CameraSwitcher(); virtual ~CameraSwitcher() = default;
int CameraID() const { int CameraID() const {
return cameraId; return cameraId;
@ -226,7 +226,7 @@ class Camera : public NodeAttribute {
public: public:
Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name); Camera(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Camera(); virtual ~Camera() = default;
fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0)) fbx_simple_property(Position, aiVector3D, aiVector3D(0,0,0))
fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0)) fbx_simple_property(UpVector, aiVector3D, aiVector3D(0,1,0))
@ -251,21 +251,21 @@ public:
class Null : public NodeAttribute { class Null : public NodeAttribute {
public: public:
Null(uint64_t id, const Element& element, const Document& doc, const std::string& name); Null(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Null(); virtual ~Null() = default;
}; };
/** DOM base class for FBX limb node markers attached to a node */ /** DOM base class for FBX limb node markers attached to a node */
class LimbNode : public NodeAttribute { class LimbNode : public NodeAttribute {
public: public:
LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name); LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~LimbNode(); virtual ~LimbNode() = default;
}; };
/** DOM base class for FBX lights attached to a node */ /** DOM base class for FBX lights attached to a node */
class Light : public NodeAttribute { class Light : public NodeAttribute {
public: public:
Light(uint64_t id, const Element& element, const Document& doc, const std::string& name); Light(uint64_t id, const Element& element, const Document& doc, const std::string& name);
virtual ~Light(); virtual ~Light() = default;
enum Type enum Type
{ {
@ -697,7 +697,7 @@ typedef std::vector<float> KeyValueList;
class AnimationCurve : public Object { class AnimationCurve : public Object {
public: public:
AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationCurve(); virtual ~AnimationCurve() = default;
/** get list of keyframe positions (time). /** get list of keyframe positions (time).
* Invariant: |GetKeys()| > 0 */ * Invariant: |GetKeys()| > 0 */
@ -738,7 +738,7 @@ public:
AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc, AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc,
const char *const *target_prop_whitelist = nullptr, size_t whitelist_size = 0); const char *const *target_prop_whitelist = nullptr, size_t whitelist_size = 0);
virtual ~AnimationCurveNode(); virtual ~AnimationCurveNode() = default;
const PropertyTable& Props() const { const PropertyTable& Props() const {
ai_assert(props.get()); ai_assert(props.get());
@ -783,7 +783,7 @@ typedef std::vector<const AnimationCurveNode*> AnimationCurveNodeList;
class AnimationLayer : public Object { class AnimationLayer : public Object {
public: public:
AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc); AnimationLayer(uint64_t id, const Element& element, const std::string& name, const Document& doc);
virtual ~AnimationLayer(); virtual ~AnimationLayer() = default;
const PropertyTable& Props() const { const PropertyTable& Props() const {
ai_assert(props.get()); ai_assert(props.get());
@ -806,7 +806,7 @@ typedef std::vector<const AnimationLayer*> AnimationLayerList;
class AnimationStack : public Object { class AnimationStack : public Object {
public: 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() = default;
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)
@ -1022,7 +1022,7 @@ class FileGlobalSettings {
public: public:
FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props); FileGlobalSettings(const Document& doc, std::shared_ptr<const PropertyTable> props);
~FileGlobalSettings(); ~FileGlobalSettings() = default;
const PropertyTable& Props() const { const PropertyTable& Props() const {
ai_assert(props.get()); ai_assert(props.get());

View File

@ -132,6 +132,7 @@ public:
/** Determine the face to which a particular output vertex index belongs. /** Determine the face to which a particular output vertex index belongs.
* This mapping is always unique. */ * This mapping is always unique. */
unsigned int FaceForVertexIndex( unsigned int in_index ) const; unsigned int FaceForVertexIndex( unsigned int in_index ) const;
private: private:
void ReadLayer( const Scope& layer ); void ReadLayer( const Scope& layer );
void ReadLayerElement( const Scope& layerElement ); void ReadLayerElement( const Scope& layerElement );

View File

@ -57,114 +57,65 @@ 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) :
: Object(id,element,name) Object(id, element, name), props() {
, props() const Scope &sc = GetRequiredScope(element);
{
const Scope& sc = GetRequiredScope(element);
const std::string& classname = ParseTokenAsString(GetRequiredToken(element,2)); const std::string &classname = ParseTokenAsString(GetRequiredToken(element, 2));
// hack on the deriving type but Null/LimbNode attributes are the only case in which // hack on the deriving type but Null/LimbNode attributes are the only case in which
// the property table is by design absent and no warning should be generated // the property table is by design absent and no warning should be generated
// for it. // for it.
const bool is_null_or_limb = !strcmp(classname.c_str(), "Null") || !strcmp(classname.c_str(), "LimbNode"); const bool is_null_or_limb = !strcmp(classname.c_str(), "Null") || !strcmp(classname.c_str(), "LimbNode");
props = GetPropertyTable(doc,"NodeAttribute.Fbx" + classname,element,sc, is_null_or_limb); props = GetPropertyTable(doc, "NodeAttribute.Fbx" + classname, element, sc, is_null_or_limb);
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
NodeAttribute::~NodeAttribute() CameraSwitcher::CameraSwitcher(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
{ NodeAttribute(id, element, doc, name) {
// empty const Scope &sc = GetRequiredScope(element);
} const Element *const CameraId = sc["CameraId"];
const Element *const CameraName = sc["CameraName"];
const Element *const CameraIndexName = sc["CameraIndexName"];
if (CameraId) {
// ------------------------------------------------------------------------------------------------ cameraId = ParseTokenAsInt(GetRequiredToken(*CameraId, 0));
CameraSwitcher::CameraSwitcher(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: NodeAttribute(id,element,doc,name)
{
const Scope& sc = GetRequiredScope(element);
const Element* const CameraId = sc["CameraId"];
const Element* const CameraName = sc["CameraName"];
const Element* const CameraIndexName = sc["CameraIndexName"];
if(CameraId) {
cameraId = ParseTokenAsInt(GetRequiredToken(*CameraId,0));
} }
if(CameraName) { if (CameraName) {
cameraName = GetRequiredToken(*CameraName,0).StringContents(); cameraName = GetRequiredToken(*CameraName, 0).StringContents();
} }
if(CameraIndexName && CameraIndexName->Tokens().size()) { if (CameraIndexName && CameraIndexName->Tokens().size()) {
cameraIndexName = GetRequiredToken(*CameraIndexName,0).StringContents(); cameraIndexName = GetRequiredToken(*CameraIndexName, 0).StringContents();
} }
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
CameraSwitcher::~CameraSwitcher() Camera::Camera(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
{ NodeAttribute(id, element, doc, name) {
// empty // empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Camera::Camera(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 // empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Camera::~Camera() Null::Null(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
{ NodeAttribute(id, element, doc, name) {
// empty // empty
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
Light::Light(uint64_t id, const Element& element, const Document& doc, const std::string& name) LimbNode::LimbNode(uint64_t id, const Element &element, const Document &doc, const std::string &name) :
: NodeAttribute(id,element,doc,name) NodeAttribute(id, element, doc, name) {
{
// empty // empty
} }
} // namespace FBX
} // namespace Assimp
// ------------------------------------------------------------------------------------------------ #endif // ASSIMP_BUILD_NO_FBX_IMPORTER
Light::~Light()
{
}
// ------------------------------------------------------------------------------------------------
Null::Null(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: NodeAttribute(id,element,doc,name)
{
}
// ------------------------------------------------------------------------------------------------
Null::~Null()
{
}
// ------------------------------------------------------------------------------------------------
LimbNode::LimbNode(uint64_t id, const Element& element, const Document& doc, const std::string& name)
: NodeAttribute(id,element,doc,name)
{
}
// ------------------------------------------------------------------------------------------------
LimbNode::~LimbNode()
{
}
}
}
#endif

View File

@ -949,8 +949,7 @@ void ParseVectorDataArray(std::vector<float>& out, const Element& el)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// read an array of uints // read an array of uints
void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el) void ParseVectorDataArray(std::vector<unsigned int>& out, const Element& el) {
{
out.resize( 0 ); out.resize( 0 );
const TokenList& tok = el.Tokens(); const TokenList& tok = el.Tokens();
if(tok.empty()) { if(tok.empty()) {
@ -1174,7 +1173,6 @@ aiMatrix4x4 ReadMatrix(const Element& element)
return result; return result;
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// wrapper around ParseTokenAsString() with ParseError handling // wrapper around ParseTokenAsString() with ParseError handling
std::string ParseTokenAsString(const Token& t) std::string ParseTokenAsString(const Token& t)

View File

@ -946,6 +946,7 @@ struct aiSkeletonBone {
/// The parent bone index, is -1 one if this bone represents the root bone. /// The parent bone index, is -1 one if this bone represents the root bone.
int mParent; int mParent;
#ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS #ifndef ASSIMP_BUILD_NO_ARMATUREPOPULATE_PROCESS
/// The bone armature node - used for skeleton conversion /// The bone armature node - used for skeleton conversion
/// you must enable aiProcess_PopulateArmatureData to populate this /// you must enable aiProcess_PopulateArmatureData to populate this
@ -959,6 +960,9 @@ struct aiSkeletonBone {
/// @brief The number of weights /// @brief The number of weights
unsigned int mNumnWeights; unsigned int mNumnWeights;
/// The mesh index, which will get influenced by the weight.
C_STRUCT aiMesh *mMeshId;
/// The influence weights of this bone, by vertex index. /// The influence weights of this bone, by vertex index.
C_STRUCT aiVertexWeight *mWeights; C_STRUCT aiVertexWeight *mWeights;
@ -984,6 +988,7 @@ struct aiSkeletonBone {
mArmature(nullptr), mArmature(nullptr),
mNode(nullptr), mNode(nullptr),
mNumnWeights(0), mNumnWeights(0),
mMeshId(nullptr),
mWeights(nullptr), mWeights(nullptr),
mOffsetMatrix(), mOffsetMatrix(),
mLocalMatrix() { mLocalMatrix() {