Merge pull request #284 from SHADE-DP/Fix-Material
Fixed crash which occurs when changing the material of an object twice in a row in the inspector
This commit is contained in:
commit
e20675b144
|
@ -66,10 +66,12 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
oldMaterial = material;
|
oldMaterial = material;
|
||||||
material = {};
|
material = {};
|
||||||
|
oldMatIsShared = false;
|
||||||
}
|
}
|
||||||
else if (sharedMaterial)
|
else if (sharedMaterial)
|
||||||
{
|
{
|
||||||
oldMaterial = sharedMaterial;
|
oldMaterial = sharedMaterial;
|
||||||
|
oldMatIsShared = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the material
|
// Update the material
|
||||||
|
@ -150,7 +152,7 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
matChanged = false;
|
matChanged = false;
|
||||||
meshChanged = false;
|
meshChanged = false;
|
||||||
if (oldMaterial)
|
if (oldMaterial && !oldMatIsShared)
|
||||||
oldMaterial.Free();
|
oldMaterial.Free();
|
||||||
oldMaterial = {};
|
oldMaterial = {};
|
||||||
oldMesh = {};
|
oldMesh = {};
|
||||||
|
|
|
@ -90,6 +90,7 @@ namespace SHADE
|
||||||
bool matChanged = true;
|
bool matChanged = true;
|
||||||
Handle<SHMaterialInstance> oldMaterial;
|
Handle<SHMaterialInstance> oldMaterial;
|
||||||
uint8_t lightLayer;
|
uint8_t lightLayer;
|
||||||
|
bool oldMatIsShared = false;
|
||||||
|
|
||||||
RTTR_ENABLE()
|
RTTR_ENABLE()
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue