public void HandleKajAnimatable() { Rect lastRect = GUILayoutUtility.GetLastRect(); if (ShaderEditor.currentlyDrawing.isLockedMaterial == false && Event.current.isMouse && Event.current.button == 1 && lastRect.Contains(Event.current.mousePosition)) { if (Event.current.control && Config.Singleton.renameAnimatedProps) { if (!is_animated) { is_animated = true; } if (is_animated) { is_renaming = !is_renaming; } } else { is_animated = !is_animated; } ShaderOptimizer.SetAnimatedTag(materialProperty, is_animated ? (is_renaming ? "2" : "1") : ""); EditorUtility.SetDirty(materialProperty.targets[0]); } if (is_animated) { Rect r = new Rect(8, lastRect.y + 2, 16, 16); GUI.DrawTexture(r, is_renaming ? Styles.texture_animated_renamed : Styles.texture_animated, ScaleMode.StretchToFill, true); } }
public virtual void HandleRightClickToggles(bool isInHeader) { if (ShaderEditor.input.RightClick && DrawingData.tooltipCheckRect.Contains(Event.current.mousePosition)) { //Preset toggle if (Event.current.shift) { if (shaderEditor._isPresetEditor && isInHeader == false) { is_preset = !is_preset; Presets.SetProperty(shaderEditor.materials[0], materialProperty, is_preset); ShaderEditor.Repaint(); ShaderEditor.input.Use(); } } //Animated toggle else { if (is_animatable && isInHeader == false && this is ShaderHeader == false) { if (Event.current.control && Config.Singleton.renameAnimatedProps) { if (!is_animated) { is_animated = true; is_renaming = true; } else if (!is_renaming) { is_renaming = true; } else { is_animated = false; is_renaming = false; } } else { is_animated = !is_animated; is_renaming = false; } ShaderOptimizer.SetAnimatedTag(materialProperty, is_animated ? (is_renaming ? "2" : "1") : ""); ShaderEditor.Repaint(); ShaderEditor.input.Use(); } } } }