public static Renderer PrepareMaterialPropertiesForAnimationMode(MaterialProperty[] properties, bool isMaterialEditable) { bool flag = AnimationMode.InAnimationMode(); Renderer renderFromInspector = MaterialEditor.GetAssociatedRenderFromInspector(); if ((UnityEngine.Object) renderFromInspector != (UnityEngine.Object) null) { MaterialEditor.ForwardApplyMaterialModification materialModification = new MaterialEditor.ForwardApplyMaterialModification(renderFromInspector, isMaterialEditable); MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock(); renderFromInspector.GetPropertyBlock(materialPropertyBlock); foreach (MaterialProperty property in properties) { property.ReadFromMaterialPropertyBlock(materialPropertyBlock); if (flag) property.applyPropertyCallback = new MaterialProperty.ApplyPropertyCallback(materialModification.DidModifyAnimationModeMaterialProperty); } } if (flag) return renderFromInspector; return (Renderer) null; }
public static Renderer PrepareMaterialPropertiesForAnimationMode(MaterialProperty[] properties, bool isMaterialEditable) { bool flag = AnimationMode.InAnimationMode(); Renderer associatedRenderFromInspector = MaterialEditor.GetAssociatedRenderFromInspector(); if (associatedRenderFromInspector != null) { MaterialEditor.ForwardApplyMaterialModification @object = new MaterialEditor.ForwardApplyMaterialModification(associatedRenderFromInspector, isMaterialEditable); MaterialPropertyBlock materialPropertyBlock = new MaterialPropertyBlock(); associatedRenderFromInspector.GetPropertyBlock(materialPropertyBlock); for (int i = 0; i < properties.Length; i++) { MaterialProperty materialProperty = properties[i]; materialProperty.ReadFromMaterialPropertyBlock(materialPropertyBlock); if (flag) { materialProperty.applyPropertyCallback = new MaterialProperty.ApplyPropertyCallback(@object.DidModifyAnimationModeMaterialProperty); } } } if (flag) { return associatedRenderFromInspector; } return null; }