MCPcopy Create free account
hub / github.com/assimp/assimp / ResolveLinks

Method ResolveLinks

code/AssetLib/FBX/FBXModel.cpp:79–122  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

77
78// ------------------------------------------------------------------------------------------------
79void Model::ResolveLinks(const Element&, const Document &doc) {
80 const char *const arr[] = { "Geometry", "Material", "NodeAttribute" };
81
82 // resolve material
83 const std::vector<const Connection *> &conns = doc.GetConnectionsByDestinationSequenced(ID(), arr, 3);
84
85 materials.reserve(conns.size());
86 geometry.reserve(conns.size());
87 attributes.reserve(conns.size());
88 for (const Connection *con : conns) {
89
90 // material and geometry links should be Object-Object connections
91 if (con->PropertyName().length()) {
92 continue;
93 }
94
95 const Object *const ob = con->SourceObject();
96 if (!ob) {
97 DOMWarning("failed to read source object for incoming Model link, ignoring", &element);
98 continue;
99 }
100
101 const Material *const mat = dynamic_cast<const Material *>(ob);
102 if (mat) {
103 materials.push_back(mat);
104 continue;
105 }
106
107 const Geometry *const geo = dynamic_cast<const Geometry *>(ob);
108 if (geo) {
109 geometry.push_back(geo);
110 continue;
111 }
112
113 const NodeAttribute *const att = dynamic_cast<const NodeAttribute *>(ob);
114 if (att) {
115 attributes.push_back(att);
116 continue;
117 }
118
119 DOMWarning("source object for model link is neither Material, NodeAttribute nor Geometry, ignoring", &element);
120 continue;
121 }
122}
123
124// ------------------------------------------------------------------------------------------------
125bool Model::IsNull() const {

Callers

nothing calls this directly

Calls 7

IDClass · 0.85
DOMWarningFunction · 0.85
SourceObjectMethod · 0.80
reserveMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected