MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / Get

Method Get

Engine/lib/assimp/code/AssetLib/FBX/FBXDocument.cpp:76–223  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

74
75// ------------------------------------------------------------------------------------------------
76const Object* LazyObject::Get(bool dieOnError) {
77 if(IsBeingConstructed() || FailedToConstruct()) {
78 return nullptr;
79 }
80
81 if (object.get()) {
82 return object.get();
83 }
84
85 const Token& key = element.KeyToken();
86 const TokenList& tokens = element.Tokens();
87
88 if(tokens.size() < 3) {
89 DOMError("expected at least 3 tokens: id, name and class tag",&element);
90 }
91
92 const char* err;
93 std::string name = ParseTokenAsString(*tokens[1],err);
94 if (err) {
95 DOMError(err,&element);
96 }
97
98 // small fix for binary reading: binary fbx files don't use
99 // prefixes such as Model:: in front of their names. The
100 // loading code expects this at many places, though!
101 // so convert the binary representation (a 0x0001) to the
102 // double colon notation.
103 if(tokens[1]->IsBinary()) {
104 for (size_t i = 0; i < name.length(); ++i) {
105 if (name[i] == 0x0 && name[i+1] == 0x1) {
106 name = name.substr(i+2) + "::" + name.substr(0,i);
107 }
108 }
109 }
110
111 const std::string classtag = ParseTokenAsString(*tokens[2],err);
112 if (err) {
113 DOMError(err,&element);
114 }
115
116 // prevent recursive calls
117 flags |= BEING_CONSTRUCTED;
118
119 try {
120 // this needs to be relatively fast since it happens a lot,
121 // so avoid constructing strings all the time.
122 const char* obtype = key.begin();
123 const size_t length = static_cast<size_t>(key.end()-key.begin());
124
125 // For debugging
126 //dumpObjectClassInfo( objtype, classtag );
127
128 if (!strncmp(obtype,"Geometry",length)) {
129 if (!strcmp(classtag.c_str(),"Mesh")) {
130 object.reset(new MeshGeometry(id,element,name,doc));
131 }
132 if (!strcmp(classtag.c_str(), "Shape")) {
133 object.reset(new ShapeGeometry(id, element, name, doc));

Callers 15

Export_NodeMethod · 0.45
Export_MaterialMethod · 0.45
WritePropIntFunction · 0.45
WritePropDoubleFunction · 0.45
WritePropEnumFunction · 0.45
WritePropColorFunction · 0.45
WritePropStringFunction · 0.45
has_phong_matFunction · 0.45
WriteObjectsMethod · 0.45
FBXConverterMethod · 0.45
SetTexturePropertiesMethod · 0.45

Calls 13

DOMErrorFunction · 0.85
ParseTokenAsStringFunction · 0.85
substrMethod · 0.80
getMethod · 0.45
sizeMethod · 0.45
IsBinaryMethod · 0.45
lengthMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
c_strMethod · 0.45
resetMethod · 0.45
SettingsMethod · 0.45

Tested by

no test coverage detected