public static bool ApplyMaterialModificationToAnimationRecording(MaterialProperty materialProp, int changedMask, Renderer target, object oldValue) { switch (materialProp.type) { case MaterialProperty.PropType.Color: MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, (Object)target, (Color)oldValue); return(true); case MaterialProperty.PropType.Vector: MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, (Object)target, (Color)((Vector4)oldValue)); return(true); case MaterialProperty.PropType.Float: case MaterialProperty.PropType.Range: MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, (Object)target, (float)oldValue); return(true); case MaterialProperty.PropType.Texture: if (!MaterialProperty.IsTextureOffsetAndScaleChangedMask(changedMask)) { return(false); } string name = materialProp.name + "_ST"; MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(name, (Object)target, (Vector4)oldValue); return(true); default: return(false); } }
static public bool ApplyMaterialModificationToAnimationRecording(MaterialProperty materialProp, int changedMask, Renderer target, object oldValue) { bool applied = false; switch (materialProp.type) { case MaterialProperty.PropType.Color: SetupMaterialPropertyBlock(materialProp, changedMask, target); applied = ApplyMaterialModificationToAnimationRecording(MaterialPropertyToPropertyModifications(materialProp, target, (Color)oldValue), MaterialPropertyToPropertyModifications(materialProp, target, materialProp.colorValue)); if (!applied) { TearDownMaterialPropertyBlock(target); } return(applied); case MaterialProperty.PropType.Vector: SetupMaterialPropertyBlock(materialProp, changedMask, target); applied = ApplyMaterialModificationToAnimationRecording(MaterialPropertyToPropertyModifications(materialProp, target, (Vector4)oldValue), MaterialPropertyToPropertyModifications(materialProp, target, materialProp.vectorValue)); if (!applied) { TearDownMaterialPropertyBlock(target); } return(applied); case MaterialProperty.PropType.Float: case MaterialProperty.PropType.Range: SetupMaterialPropertyBlock(materialProp, changedMask, target); applied = ApplyMaterialModificationToAnimationRecording(MaterialPropertyToPropertyModifications(materialProp, target, (float)oldValue), MaterialPropertyToPropertyModifications(materialProp, target, materialProp.floatValue)); if (!applied) { TearDownMaterialPropertyBlock(target); } return(applied); case MaterialProperty.PropType.Texture: { if (MaterialProperty.IsTextureOffsetAndScaleChangedMask(changedMask)) { string name = materialProp.name + "_ST"; SetupMaterialPropertyBlock(materialProp, changedMask, target); applied = ApplyMaterialModificationToAnimationRecording(MaterialPropertyToPropertyModifications(name, target, (Vector4)oldValue), MaterialPropertyToPropertyModifications(name, target, materialProp.textureScaleAndOffset)); if (!applied) { TearDownMaterialPropertyBlock(target); } return(applied); } else { return(false); } } } return(false); }
public static bool ApplyMaterialModificationToAnimationRecording(MaterialProperty materialProp, int changedMask, Renderer target, object oldValue) { bool result; switch (materialProp.type) { case MaterialProperty.PropType.Color: { MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); bool flag = MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, target, (Color)oldValue); if (!flag) { MaterialAnimationUtility.TearDownMaterialPropertyBlock(target); } result = flag; break; } case MaterialProperty.PropType.Vector: { MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); bool flag = MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, target, (Vector4)oldValue); if (!flag) { MaterialAnimationUtility.TearDownMaterialPropertyBlock(target); } result = flag; break; } case MaterialProperty.PropType.Float: case MaterialProperty.PropType.Range: { MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); bool flag = MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(materialProp, target, (float)oldValue); if (!flag) { MaterialAnimationUtility.TearDownMaterialPropertyBlock(target); } result = flag; break; } case MaterialProperty.PropType.Texture: if (MaterialProperty.IsTextureOffsetAndScaleChangedMask(changedMask)) { string name = materialProp.name + "_ST"; MaterialAnimationUtility.SetupMaterialPropertyBlock(materialProp, changedMask, target); bool flag = MaterialAnimationUtility.ApplyMaterialModificationToAnimationRecording(name, target, (Vector4)oldValue); if (!flag) { MaterialAnimationUtility.TearDownMaterialPropertyBlock(target); } result = flag; } else { result = false; } break; default: result = false; break; } return(result); }