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

Method onAdd

Engine/source/T3D/tsStatic.cpp:316–380  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314}
315
316bool TSStatic::onAdd()
317{
318 PROFILE_SCOPE(TSStatic_onAdd);
319
320 if (isServerObject())
321 {
322 // Handle the old "usePolysoup" field
323 SimFieldDictionary* fieldDict = getFieldDictionary();
324
325 if (fieldDict)
326 {
327 StringTableEntry slotName = StringTable->insert("usePolysoup");
328
329 SimFieldDictionary::Entry* entry = fieldDict->findDynamicField(slotName);
330
331 if (entry)
332 {
333 // Was "usePolysoup" set?
334 bool usePolysoup = dAtob(entry->value);
335
336 // "usePolysoup" maps to the new VisibleMesh type
337 if (usePolysoup)
338 mCollisionType = VisibleMesh;
339
340 // Remove the field in favor on the new "collisionType" field
341 fieldDict->setFieldValue(slotName, "");
342 }
343 }
344 }
345
346 if (!Parent::onAdd())
347 return false;
348
349 // Setup the shape.
350 if (!_createShape())
351 {
352 Con::errorf("TSStatic::onAdd() - Shape creation failed!");
353 return false;
354 }
355
356 setRenderTransform(mObjToWorld);
357
358 // Register for the resource change signal.
359 //ResourceManager::get().getChangedSignal().notify(this, &TSStatic::_onResourceChanged);
360
361 addToScene();
362
363 if (isClientObject())
364 {
365 mCubeReflector.unregisterReflector();
366
367 if (reflectorDesc)
368 mCubeReflector.registerReflector(this, reflectorDesc);
369 }
370
371 _updateShouldTick();
372
373 // Accumulation and environment mapping

Callers

nothing calls this directly

Calls 7

dAtobFunction · 0.85
findDynamicFieldMethod · 0.80
errorfFunction · 0.50
insertMethod · 0.45
setFieldValueMethod · 0.45
unregisterReflectorMethod · 0.45
registerReflectorMethod · 0.45

Tested by

no test coverage detected