ApplyMaterialModificationToAnimationRecording() public static method

public static ApplyMaterialModificationToAnimationRecording ( MaterialProperty materialProp, int changedMask, Renderer target, object oldValue ) : bool
materialProp UnityEditor.MaterialProperty
changedMask int
target UnityEngine.Renderer
oldValue object
return bool
        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);
            }
        }
        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);
        }