- fbx: read Geometry -> Skin and Model -> Cluster connections. Improve logging, some refactoring.

This commit is contained in:
Alexander Gessler
2012-07-26 19:13:19 +02:00
parent 06acead438
commit 05ec3c2e90
5 changed files with 113 additions and 33 deletions
+44
View File
@@ -108,6 +108,50 @@ boost::shared_ptr<const PropertyTable> GetPropertyTable(const Document& doc,
const Element &element,
const Scope& sc);
// ------------------------------------------------------------------------------------------------
template <typename T>
inline const T* ProcessSimpleConnection(const Connection& con,
bool is_object_property_conn,
const char* name,
const Element& element,
const char** propNameOut = NULL)
{
if (is_object_property_conn && con.PropertyName().length()) {
DOMWarning("expected incoming " + std::string(name) +
" link to be an object-object connection, ignoring",
&element
);
return NULL;
}
else if (!is_object_property_conn && !con.PropertyName().length()) {
DOMWarning("expected incoming " + std::string(name) +
" link to be an object-property connection, ignoring",
&element
);
return NULL;
}
if(is_object_property_conn && propNameOut) {
// note: this is ok, the return value of PropertyValue() is guaranteed to
// remain valid and unchanged as long as the document exists.
*propNameOut = con.PropertyName().c_str();
}
const Object* const ob = con.SourceObject();
if(!ob) {
DOMWarning("failed to read source object for incoming" + std::string(name) +
" link, ignoring",
&element);
return NULL;
}
return dynamic_cast<const T*>(ob);
}
} //!Util
} //!FBX
} //!Assimp