| 497 | } |
| 498 | |
| 499 | bool 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 | |
| 528 | void Material::onRemove() |
| 529 | { |
nothing calls this directly
no test coverage detected