Explorar el Código

- fbx: attach node attachments to their nodes.

Alexander Gessler hace 13 años
padre
commit
cab713b4c5
Se han modificado 2 ficheros con 15 adiciones y 3 borrados
  1. 9 2
      code/FBXDocument.h
  2. 6 1
      code/FBXModel.cpp

+ 9 - 2
code/FBXDocument.h

@@ -149,8 +149,8 @@ protected:
 
 
 
-/** DOM class for generic FBX NoteAttribute blocks. NoteAttributes just hold a property table,
- *  actualy members are added by deriving classes. */
+/** DOM class for generic FBX NoteAttribute blocks. NoteAttribute's just hold a property table,
+ *  fixed members are added by deriving classes. */
 class NodeAttribute : public Object
 {
 public:
@@ -236,6 +236,12 @@ public:
 		return geometry;
 	}
 
+
+	/** Get node attachments */
+	const std::vector<const NodeAttribute*>& GetAttributes() const {
+		return attributes;
+	}
+
 private:
 
 	void ResolveLinks(const Element& element, const Document& doc);
@@ -244,6 +250,7 @@ private:
 
 	std::vector<const Material*> materials;
 	std::vector<const Geometry*> geometry;
+	std::vector<const NodeAttribute*> attributes;
 
 	std::string shading;
 	std::string culling;

+ 6 - 1
code/FBXModel.cpp

@@ -89,7 +89,7 @@ Model::~Model()
 // ------------------------------------------------------------------------------------------------
 void Model::ResolveLinks(const Element& element, const Document& doc)
 {
-	const char* const arr[] = {"Geometry","Material"};
+	const char* const arr[] = {"Geometry","Material","NodeAttribute"};
 
 	// resolve material
 	const std::vector<const Connection*>& conns = doc.GetConnectionsByDestinationSequenced(ID(),arr, 2);
@@ -121,6 +121,11 @@ void Model::ResolveLinks(const Element& element, const Document& doc)
 			continue;
 		}
 
+		const NodeAttribute* const att = dynamic_cast<const NodeAttribute*>(ob);
+		if(att) {
+			attributes.push_back(att);
+			continue;
+		}
 
 		DOMWarning("source object for model link is neither Material or Geometry, ignoring",&element);
 		continue;