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

Method onAdd

Engine/source/T3D/tsStatic.cpp:256–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256bool TSStatic::onAdd()
257{
258 PROFILE_SCOPE(TSStatic_onAdd);
259
260 if ( isServerObject() )
261 {
262 // Handle the old "usePolysoup" field
263 SimFieldDictionary* fieldDict = getFieldDictionary();
264
265 if ( fieldDict )
266 {
267 StringTableEntry slotName = StringTable->insert( "usePolysoup" );
268
269 SimFieldDictionary::Entry * entry = fieldDict->findDynamicField( slotName );
270
271 if ( entry )
272 {
273 // Was "usePolysoup" set?
274 bool usePolysoup = dAtob( entry->value );
275
276 // "usePolysoup" maps to the new VisibleMesh type
277 if ( usePolysoup )
278 mCollisionType = VisibleMesh;
279
280 // Remove the field in favor on the new "collisionType" field
281 fieldDict->setFieldValue( slotName, "" );
282 }
283 }
284 }
285
286 if ( !Parent::onAdd() )
287 return false;
288
289 // Setup the shape.
290 if ( !_createShape() )
291 {
292 Con::errorf( "TSStatic::onAdd() - Shape creation failed!" );
293 return false;
294 }
295
296 setRenderTransform(mObjToWorld);
297
298 // Register for the resource change signal.
299 ResourceManager::get().getChangedSignal().notify( this, &TSStatic::_onResourceChanged );
300
301 addToScene();
302
303 if ( isClientObject() )
304 {
305 mCubeReflector.unregisterReflector();
306
307 if ( reflectorDesc )
308 mCubeReflector.registerReflector( this, reflectorDesc );
309 }
310
311 _updateShouldTick();
312
313 // Accumulation and environment mapping

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected