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

Method setObjectModel

Engine/source/T3D/guiMaterialPreview.cpp:258–277  ·  view source on GitHub ↗

This is used to set the model we want to view in the control object.

Source from the content-addressed store, hash-verified

256
257// This is used to set the model we want to view in the control object.
258void GuiMaterialPreview::setObjectModel(const char* modelName)
259{
260 deleteModel();
261
262 Resource<TSShape> model = ResourceManager::get().load(modelName);
263 if (! bool(model))
264 {
265 Con::warnf(avar("GuiMaterialPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName));
266 return;
267 }
268
269 mModel = new TSShapeInstance(model, true);
270 AssertFatal(mModel, avar("GuiMaterialPreview: Failed to load model %s. Please check your model name and load a valid model.", modelName));
271
272 // Initialize camera values:
273 mOrbitPos = mModel->getShape()->center;
274 mMinOrbitDist = mModel->getShape()->mRadius;
275
276 lastRenderTime = Platform::getVirtualMilliseconds();
277}
278
279void GuiMaterialPreview::deleteModel()
280{

Callers 1

Calls 5

avarFunction · 0.85
getFunction · 0.50
warnfFunction · 0.50
loadMethod · 0.45
getShapeMethod · 0.45

Tested by

no test coverage detected