- fbx: read texture -> material connections.
parent
effcaf066a
commit
a0c45f9190
|
@ -184,7 +184,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
typedef std::fbx_unordered_map<std::string,Texture*> TextureMap;
|
||||
typedef std::fbx_unordered_map<std::string, const Texture*> TextureMap;
|
||||
|
||||
|
||||
/** DOM class for generic FBX materials */
|
||||
|
|
|
@ -94,7 +94,33 @@ Material::Material(uint64_t id, const Element& element, const Document& doc, con
|
|||
props = GetPropertyTable(doc,templateName,element,sc);
|
||||
|
||||
// resolve texture links
|
||||
doc.GetConnectionsByDestinationSequenced(ID());
|
||||
const std::vector<const Connection*> conns = doc.GetConnectionsByDestinationSequenced(ID());
|
||||
BOOST_FOREACH(const Connection* con, conns) {
|
||||
|
||||
// texture link to properties, not objects
|
||||
if (!con->PropertyName().length()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Object* const ob = con->SourceObject();
|
||||
if(!ob) {
|
||||
DOMWarning("failed to read source object for texture link, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const Texture* const tex = dynamic_cast<const Texture*>(ob);
|
||||
if(!tex) {
|
||||
DOMWarning("source object for texture link is not a texture, ignoring",&element);
|
||||
continue;
|
||||
}
|
||||
|
||||
const std::string& prop = con->PropertyName();
|
||||
if (textures.find(prop) != textures.end()) {
|
||||
DOMWarning("duplicate texture link: " + prop,&element);
|
||||
}
|
||||
|
||||
textures[prop] = tex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue