Refactor: Expand tabs to 4 spaces
This commit is contained in:
@@ -56,37 +56,37 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
namespace Assimp {
|
||||
namespace FBX {
|
||||
|
||||
using namespace Util;
|
||||
using namespace Util;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurve::AnimationCurve(uint64_t id, const Element& element, const std::string& name, const Document& /*doc*/)
|
||||
: Object(id, element, name)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Element& KeyTime = GetRequiredElement(sc,"KeyTime");
|
||||
const Element& KeyValueFloat = GetRequiredElement(sc,"KeyValueFloat");
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Element& KeyTime = GetRequiredElement(sc,"KeyTime");
|
||||
const Element& KeyValueFloat = GetRequiredElement(sc,"KeyValueFloat");
|
||||
|
||||
ParseVectorDataArray(keys, KeyTime);
|
||||
ParseVectorDataArray(values, KeyValueFloat);
|
||||
ParseVectorDataArray(keys, KeyTime);
|
||||
ParseVectorDataArray(values, KeyValueFloat);
|
||||
|
||||
if(keys.size() != values.size()) {
|
||||
DOMError("the number of key times does not match the number of keyframe values",&KeyTime);
|
||||
}
|
||||
if(keys.size() != values.size()) {
|
||||
DOMError("the number of key times does not match the number of keyframe values",&KeyTime);
|
||||
}
|
||||
|
||||
// check if the key times are well-ordered
|
||||
if(!std::equal(keys.begin(), keys.end() - 1, keys.begin() + 1, std::less<KeyTimeList::value_type>())) {
|
||||
DOMError("the keyframes are not in ascending order",&KeyTime);
|
||||
}
|
||||
// check if the key times are well-ordered
|
||||
if(!std::equal(keys.begin(), keys.end() - 1, keys.begin() + 1, std::less<KeyTimeList::value_type>())) {
|
||||
DOMError("the keyframes are not in ascending order",&KeyTime);
|
||||
}
|
||||
|
||||
const Element* KeyAttrDataFloat = sc["KeyAttrDataFloat"];
|
||||
if(KeyAttrDataFloat) {
|
||||
ParseVectorDataArray(attributes, *KeyAttrDataFloat);
|
||||
}
|
||||
const Element* KeyAttrDataFloat = sc["KeyAttrDataFloat"];
|
||||
if(KeyAttrDataFloat) {
|
||||
ParseVectorDataArray(attributes, *KeyAttrDataFloat);
|
||||
}
|
||||
|
||||
const Element* KeyAttrFlags = sc["KeyAttrFlags"];
|
||||
if(KeyAttrFlags) {
|
||||
ParseVectorDataArray(flags, *KeyAttrFlags);
|
||||
}
|
||||
const Element* KeyAttrFlags = sc["KeyAttrFlags"];
|
||||
if(KeyAttrFlags) {
|
||||
ParseVectorDataArray(flags, *KeyAttrFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,61 +99,61 @@ AnimationCurve::~AnimationCurve()
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurveNode::AnimationCurveNode(uint64_t id, const Element& element, const std::string& name, const Document& doc,
|
||||
const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/)
|
||||
const char* const * target_prop_whitelist /*= NULL*/, size_t whitelist_size /*= 0*/)
|
||||
: Object(id, element, name)
|
||||
, target()
|
||||
, doc(doc)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
// find target node
|
||||
const char* whitelist[] = {"Model","NodeAttribute"};
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
|
||||
// find target node
|
||||
const char* whitelist[] = {"Model","NodeAttribute"};
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsBySourceSequenced(ID(),whitelist,2);
|
||||
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// link should go for a property
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
// link should go for a property
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(target_prop_whitelist) {
|
||||
const char* const s = con->PropertyName().c_str();
|
||||
bool ok = false;
|
||||
for (size_t i = 0; i < whitelist_size; ++i) {
|
||||
if (!strcmp(s, target_prop_whitelist[i])) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(target_prop_whitelist) {
|
||||
const char* const s = con->PropertyName().c_str();
|
||||
bool ok = false;
|
||||
for (size_t i = 0; i < whitelist_size; ++i) {
|
||||
if (!strcmp(s, target_prop_whitelist[i])) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
throw std::range_error("AnimationCurveNode target property is not in whitelist");
|
||||
}
|
||||
}
|
||||
if (!ok) {
|
||||
throw std::range_error("AnimationCurveNode target property is not in whitelist");
|
||||
}
|
||||
}
|
||||
|
||||
const Object* const ob = con->DestinationObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read destination object for AnimationCurveNode->Model link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->DestinationObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read destination object for AnimationCurveNode->Model link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
// XXX support constraints as DOM class
|
||||
//ai_assert(dynamic_cast<const Model*>(ob) || dynamic_cast<const NodeAttribute*>(ob));
|
||||
target = ob;
|
||||
if(!target) {
|
||||
continue;
|
||||
}
|
||||
// XXX support constraints as DOM class
|
||||
//ai_assert(dynamic_cast<const Model*>(ob) || dynamic_cast<const NodeAttribute*>(ob));
|
||||
target = ob;
|
||||
if(!target) {
|
||||
continue;
|
||||
}
|
||||
|
||||
prop = con->PropertyName();
|
||||
break;
|
||||
}
|
||||
prop = con->PropertyName();
|
||||
break;
|
||||
}
|
||||
|
||||
if(!target) {
|
||||
DOMWarning("failed to resolve target Model/NodeAttribute/Constraint for AnimationCurveNode",&element);
|
||||
}
|
||||
if(!target) {
|
||||
DOMWarning("failed to resolve target Model/NodeAttribute/Constraint for AnimationCurveNode",&element);
|
||||
}
|
||||
|
||||
props = GetPropertyTable(doc,"AnimationCurveNode.FbxAnimCurveNode",element,sc,false);
|
||||
props = GetPropertyTable(doc,"AnimationCurveNode.FbxAnimCurveNode",element,sc,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -167,34 +167,34 @@ AnimationCurveNode::~AnimationCurveNode()
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const AnimationCurveMap& AnimationCurveNode::Curves() const
|
||||
{
|
||||
if(curves.empty()) {
|
||||
// resolve attached animation curves
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
|
||||
if(curves.empty()) {
|
||||
// resolve attached animation curves
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurve");
|
||||
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// link should go for a property
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
// link should go for a property
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationCurve->AnimationCurveNode link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationCurve->AnimationCurveNode link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const AnimationCurve* const anim = dynamic_cast<const AnimationCurve*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationCurveNode link is not an AnimationCurve",&element);
|
||||
continue;
|
||||
}
|
||||
const AnimationCurve* const anim = dynamic_cast<const AnimationCurve*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationCurveNode link is not an AnimationCurve",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
curves[con->PropertyName()] = anim;
|
||||
}
|
||||
}
|
||||
curves[con->PropertyName()] = anim;
|
||||
}
|
||||
}
|
||||
|
||||
return curves;
|
||||
return curves;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,10 +203,10 @@ AnimationLayer::AnimationLayer(uint64_t id, const Element& element, const std::s
|
||||
: Object(id, element, name)
|
||||
, doc(doc)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
// note: the props table here bears little importance and is usually absent
|
||||
props = GetPropertyTable(doc,"AnimationLayer.FbxAnimLayer",element,sc, true);
|
||||
// note: the props table here bears little importance and is usually absent
|
||||
props = GetPropertyTable(doc,"AnimationLayer.FbxAnimLayer",element,sc, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,85 +219,85 @@ AnimationLayer::~AnimationLayer()
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationCurveNodeList AnimationLayer::Nodes(const char* const * target_prop_whitelist /*= NULL*/,
|
||||
size_t whitelist_size /*= 0*/) const
|
||||
size_t whitelist_size /*= 0*/) const
|
||||
{
|
||||
AnimationCurveNodeList nodes;
|
||||
AnimationCurveNodeList nodes;
|
||||
|
||||
// resolve attached animation nodes
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurveNode");
|
||||
nodes.reserve(conns.size());
|
||||
// resolve attached animation nodes
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationCurveNode");
|
||||
nodes.reserve(conns.size());
|
||||
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// link should not go to a property
|
||||
if (con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
// link should not go to a property
|
||||
if (con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationCurveNode->AnimationLayer link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationCurveNode->AnimationLayer link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const AnimationCurveNode* const anim = dynamic_cast<const AnimationCurveNode*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationLayer link is not an AnimationCurveNode",&element);
|
||||
continue;
|
||||
}
|
||||
const AnimationCurveNode* const anim = dynamic_cast<const AnimationCurveNode*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationLayer link is not an AnimationCurveNode",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
if(target_prop_whitelist) {
|
||||
const char* s = anim->TargetProperty().c_str();
|
||||
bool ok = false;
|
||||
for (size_t i = 0; i < whitelist_size; ++i) {
|
||||
if (!strcmp(s, target_prop_whitelist[i])) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!ok) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nodes.push_back(anim);
|
||||
}
|
||||
if(target_prop_whitelist) {
|
||||
const char* s = anim->TargetProperty().c_str();
|
||||
bool ok = false;
|
||||
for (size_t i = 0; i < whitelist_size; ++i) {
|
||||
if (!strcmp(s, target_prop_whitelist[i])) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!ok) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
nodes.push_back(anim);
|
||||
}
|
||||
|
||||
return nodes; // pray for NRVO
|
||||
return nodes; // pray for NRVO
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AnimationStack::AnimationStack(uint64_t id, const Element& element, const std::string& name, const Document& doc)
|
||||
: Object(id, element, name)
|
||||
{
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
const Scope& sc = GetRequiredScope(element);
|
||||
|
||||
// note: we don't currently use any of these properties so we shouldn't bother if it is missing
|
||||
props = GetPropertyTable(doc,"AnimationStack.FbxAnimStack",element,sc, true);
|
||||
// note: we don't currently use any of these properties so we shouldn't bother if it is missing
|
||||
props = GetPropertyTable(doc,"AnimationStack.FbxAnimStack",element,sc, true);
|
||||
|
||||
// resolve attached animation layers
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
|
||||
layers.reserve(conns.size());
|
||||
// resolve attached animation layers
|
||||
const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),"AnimationLayer");
|
||||
layers.reserve(conns.size());
|
||||
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// link should not go to a property
|
||||
if (con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
// link should not go to a property
|
||||
if (con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationLayer->AnimationStack link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for AnimationLayer->AnimationStack link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const AnimationLayer* const anim = dynamic_cast<const AnimationLayer*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationStack link is not an AnimationLayer",&element);
|
||||
continue;
|
||||
}
|
||||
layers.push_back(anim);
|
||||
}
|
||||
const AnimationLayer* const anim = dynamic_cast<const AnimationLayer*>(ob);
|
||||
if(!anim) {
|
||||
DOMWarning("source object for ->AnimationStack link is not an AnimationLayer",&element);
|
||||
continue;
|
||||
}
|
||||
layers.push_back(anim);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user