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

Method onAdd

Engine/source/materials/materialDefinition.cpp:499–526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

497}
498
499bool Material::onAdd()
500{
501 if (Parent::onAdd() == false)
502 return false;
503
504 mCubemapData = dynamic_cast<CubemapData*>(Sim::findObject( mCubemapName ) );
505
506 if( mTranslucentBlendOp >= NumBlendTypes || mTranslucentBlendOp < 0 )
507 {
508 Con::errorf( "Invalid blend op in material: %s", getName() );
509 mTranslucentBlendOp = LerpAlpha;
510 }
511
512 SimSet *matSet = MATMGR->getMaterialSet();
513 if( matSet )
514 matSet->addObject( (SimObject*)this );
515
516 // save the current script path for texture lookup later
517 const String scriptFile = Con::getVariable("$Con::File"); // current script file - local materials.cs
518
519 String::SizeType slash = scriptFile.find( '/', scriptFile.length(), String::Right );
520 if ( slash != String::NPos )
521 mPath = scriptFile.substr( 0, slash + 1 );
522
523 _mapMaterial();
524
525 return true;
526}
527
528void Material::onRemove()
529{

Callers

nothing calls this directly

Calls 9

errorfFunction · 0.85
getVariableFunction · 0.85
getMaterialSetMethod · 0.80
substrMethod · 0.80
findObjectFunction · 0.50
getNameFunction · 0.50
addObjectMethod · 0.45
findMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected