When clearing the dynmat, should clear all of them. Also fixes a crash.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 3949c210f6
commit 586c25f864

@ -706,6 +706,9 @@ public:
/// Create the dynamic material from the current material parameters /// Create the dynamic material from the current material parameters
void createDynMat(); void createDynMat();
/// Creates a clean dynamic material instance
void createCleanDynMat();
// Private. For Driver only. // Private. For Driver only.
CSmartPtr<ITexture> _Textures[IDRV_MAT_MAXTEXTURES]; CSmartPtr<ITexture> _Textures[IDRV_MAT_MAXTEXTURES];
uint8 _TexAddrMode[IDRV_MAT_MAXTEXTURES]; // texture addressing enum packed as bytes uint8 _TexAddrMode[IDRV_MAT_MAXTEXTURES]; // texture addressing enum packed as bytes

@ -652,10 +652,7 @@ bool CMaterial::isSupportedByDriver(IDriver &drv, bool forceBaseCaps) const
void CMaterial::createDynMat() void CMaterial::createDynMat()
{ {
if( dynMat == NULL ) createCleanDynMat();
dynMat = new CDynMaterial();
else
dynMat->reconstruct();
SRenderPass *p = dynMat->getPass( 0 ); SRenderPass *p = dynMat->getPass( 0 );
@ -862,5 +859,13 @@ void CMaterial::createDynMat()
} }
} }
void CMaterial::createCleanDynMat()
{
if( dynMat == NULL )
dynMat = new CDynMaterial();
else
dynMat->reconstruct();
}
} }

@ -299,7 +299,9 @@ namespace MaterialEditor
{ {
if( currentShape.empty() ) if( currentShape.empty() )
return; return;
currentShape.getMaterial( 0 ).getObjectPtr()->getDynMat()->clear();
for( int i = 0; i < currentShape.getNumMaterials(); i++ )
currentShape.getMaterial( i ).getObjectPtr()->createCleanDynMat();
} }
bool CNel3DInterface::selectSubMaterial( int id ) bool CNel3DInterface::selectSubMaterial( int id )

Loading…
Cancel
Save