private void AddPropertiesFromSelectedNodes() { int[] ids = m_TreeView.GetSelection(); for (int i = 0; i < ids.Length; ++i) { var node = m_TreeView.FindItem(ids[i]); var propertyNode = node as AddCurvesPopupPropertyNode; if (propertyNode != null) { AddCurvesPopup.AddNewCurve(propertyNode); } else if (node.hasChildren) { foreach (var childNode in node.children) { var childPropertyNode = childNode as AddCurvesPopupPropertyNode; if (childPropertyNode != null) { AddCurvesPopup.AddNewCurve(childPropertyNode); } } } } m_TreeView.ReloadData(); }
private void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= new AssemblyReloadEvents.AssemblyReloadCallback(base.Close); AddCurvesPopup.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AddCurvesPopup.s_AddCurvesPopup = null; AddCurvesPopup.s_Hierarchy = null; }
void OnDisable() { AssemblyReloadEvents.beforeAssemblyReload -= Close; s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; s_AddCurvesPopup = null; s_Hierarchy = null; }
public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused) { base.OnRowGUI(rowRect, node, row, selected, focused); // Is it propertynode. If not, then we don't need plusButton so quit here AddCurvesPopupPropertyNode hierarchyNode = node as AddCurvesPopupPropertyNode; if (hierarchyNode == null || hierarchyNode.curveBindings == null || hierarchyNode.curveBindings.Length == 0) { return; } Rect buttonRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, plusButtonStyle.fixedHeight); // TODO Make a style for add curves popup // Draw background behind plus button to prevent text overlapping GUI.Box(buttonRect, GUIContent.none, plusButtonBackgroundStyle); // Check if the curve already exists and remove plus button if (GUI.Button(buttonRect, GUIContent.none, plusButtonStyle)) { AddCurvesPopup.AddNewCurve(hierarchyNode); owner.Close(); } }
private void DoAddCurveButton(Rect rowRect, TreeViewItem node) { // Is it propertynode. If not, then we don't need plusButton so quit here AddCurvesPopupPropertyNode hierarchyNode = node as AddCurvesPopupPropertyNode; if (hierarchyNode == null || hierarchyNode.curveBindings == null || hierarchyNode.curveBindings.Length == 0) { return; } Rect buttonRect = new Rect(rowRect.width - plusButtonWidth, rowRect.yMin, plusButtonWidth, plusButtonStyle.fixedHeight); // TODO Make a style for add curves popup // Draw background behind plus button to prevent text overlapping GUI.Box(buttonRect, GUIContent.none, plusButtonBackgroundStyle); // Check if the curve already exists and remove plus button if (GUI.Button(buttonRect, GUIContent.none, plusButtonStyle)) { AddCurvesPopup.AddNewCurve(hierarchyNode); // Hold shift key to add new curves and keep window opened. if (Event.current.shift) { m_TreeView.ReloadData(); } else { owner.Close(); } } }
internal static void AddNewCurve(AddCurvesPopupPropertyNode node) { AnimationWindowUtility.CreateDefaultCurves(AddCurvesPopup.s_State, node.selectionItem, node.curveBindings); if (AddCurvesPopup.NewCurveAddedCallback != null) { AddCurvesPopup.NewCurveAddedCallback(node); } }
internal static bool ShowAtPosition(Rect buttonRect, AnimationWindowState state) { if (DateTime.Now.Ticks / 10000L < AddCurvesPopup.s_LastClosedTime + 50L) return false; Event.current.Use(); if ((UnityEngine.Object) AddCurvesPopup.s_AddCurvesPopup == (UnityEngine.Object) null) AddCurvesPopup.s_AddCurvesPopup = ScriptableObject.CreateInstance<AddCurvesPopup>(); AddCurvesPopup.s_State = state; AddCurvesPopup.s_AddCurvesPopup.Init(buttonRect); return true; }
private void DoAddCurveButton(Rect rect, AnimationWindowHierarchyNode node, int row) { float num = (rect.width - 230f) / 2f; float num2 = 10f; Rect rect2 = new Rect(rect.xMin + num, rect.yMin + num2, rect.width - num * 2f, rect.height - num2 * 2f); if (this.DoTreeViewButton(this.m_HierarchyItemButtonControlIDs[row], rect2, this.k_AnimatePropertyLabel, GUI.skin.button)) { AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true; if (AddCurvesPopup.ShowAtPosition(rect2, this.state, new AddCurvesPopup.OnNewCurveAdded(this.OnNewCurveAdded))) { GUIUtility.ExitGUI(); } } }
internal static bool ShowAtPosition(Rect buttonRect, AnimationWindowState state) { if (DateTime.Now.Ticks / 10000L < AddCurvesPopup.s_LastClosedTime + 50L) { return(false); } Event.current.Use(); if ((UnityEngine.Object)AddCurvesPopup.s_AddCurvesPopup == (UnityEngine.Object)null) { AddCurvesPopup.s_AddCurvesPopup = ScriptableObject.CreateInstance <AddCurvesPopup>(); } AddCurvesPopup.s_State = state; AddCurvesPopup.s_AddCurvesPopup.Init(buttonRect); return(true); }
private void DoAddCurveButton(Rect rect) { float num2 = (rect.width - 230f) / 2f; float num3 = 10f; Rect position = new Rect(rect.xMin + num2, rect.yMin + num3, rect.width - (num2 * 2f), rect.height - (num3 * 2f)); if (GUI.Button(position, this.k_AnimatePropertyLabel)) { AddCurvesPopup.gameObject = this.state.activeRootGameObject; AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true; if (AddCurvesPopup.ShowAtPosition(position, this.state)) { GUIUtility.ExitGUI(); } } }
internal static bool ShowAtPosition(Rect buttonRect, AnimationWindowState state) { long num = DateTime.Now.Ticks / 0x2710L; if (num < (s_LastClosedTime + 50L)) { return false; } Event.current.Use(); if (s_AddCurvesPopup == null) { s_AddCurvesPopup = ScriptableObject.CreateInstance<AddCurvesPopup>(); } s_State = state; s_AddCurvesPopup.Init(buttonRect); return true; }
public override void OnRowGUI(Rect rowRect, TreeViewItem node, int row, bool selected, bool focused) { base.OnRowGUI(rowRect, node, row, selected, focused); AddCurvesPopupPropertyNode addCurvesPopupPropertyNode = node as AddCurvesPopupPropertyNode; if (addCurvesPopupPropertyNode != null && addCurvesPopupPropertyNode.curveBindings != null && addCurvesPopupPropertyNode.curveBindings.Length != 0) { Rect position = new Rect(rowRect.width - 17f, rowRect.yMin, 17f, this.plusButtonStyle.fixedHeight); GUI.Box(position, GUIContent.none, this.plusButtonBackgroundStyle); if (GUI.Button(position, GUIContent.none, this.plusButtonStyle)) { AddCurvesPopup.AddNewCurve(addCurvesPopupPropertyNode); this.owner.Close(); } } }
internal static bool ShowAtPosition(Rect buttonRect, AnimationWindowState state) { long num = DateTime.Now.Ticks / 10000L; if (num >= AddCurvesPopup.s_LastClosedTime + 50L) { Event.current.Use(); if (AddCurvesPopup.s_AddCurvesPopup == null) { AddCurvesPopup.s_AddCurvesPopup = ScriptableObject.CreateInstance <AddCurvesPopup>(); } AddCurvesPopup.s_State = state; AddCurvesPopup.s_AddCurvesPopup.Init(buttonRect); return(true); } return(false); }
internal static bool ShowAtPosition(Rect buttonRect, IAnimationRecordingState state, OnNewCurveAdded newCurveCallback) { long num = DateTime.Now.Ticks / 0x2710L; if (num >= (s_LastClosedTime + 50L)) { Event.current.Use(); if (s_AddCurvesPopup == null) { s_AddCurvesPopup = ScriptableObject.CreateInstance<AddCurvesPopup>(); } NewCurveAddedCallback = newCurveCallback; s_State = state; s_AddCurvesPopup.Init(buttonRect); return true; } return false; }
private void DoAddCurveButton(Rect rect) { float num1 = (float)(((double)rect.width - 230.0) / 2.0); float num2 = 10f; Rect rect1 = new Rect(rect.xMin + num1, rect.yMin + num2, rect.width - num1 * 2f, rect.height - num2 * 2f); if (!GUI.Button(rect1, this.k_AnimatePropertyLabel)) { return; } AddCurvesPopup.gameObject = this.state.activeRootGameObject; AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true; if (!AddCurvesPopup.ShowAtPosition(rect1, this.state)) { return; } GUIUtility.ExitGUI(); }
internal static bool ShowAtPosition(Rect buttonRect, IAnimationRecordingState state, AddCurvesPopup.OnNewCurveAdded newCurveCallback) { long num = DateTime.Now.Ticks / 10000L; if (num >= AddCurvesPopup.s_LastClosedTime + 50L) { Event.current.Use(); if (AddCurvesPopup.s_AddCurvesPopup == null) { AddCurvesPopup.s_AddCurvesPopup = ScriptableObject.CreateInstance <AddCurvesPopup>(); } AddCurvesPopup.NewCurveAddedCallback = newCurveCallback; AddCurvesPopup.s_State = state; AddCurvesPopup.s_AddCurvesPopup.Init(buttonRect); return(true); } return(false); }
public override Rect OnRowGUI(TreeViewItem node, int row, float rowWidth, bool selected, bool focused) { Rect result = base.OnRowGUI(node, row, rowWidth, selected, focused); Rect position = new Rect(rowWidth - 17f, result.yMin, 17f, this.plusButtonStyle.fixedHeight); AddCurvesPopupPropertyNode addCurvesPopupPropertyNode = node as AddCurvesPopupPropertyNode; if (addCurvesPopupPropertyNode == null || addCurvesPopupPropertyNode.curveBindings == null || addCurvesPopupPropertyNode.curveBindings.Length == 0) { return(result); } GUI.Box(position, GUIContent.none, this.plusButtonBackgroundStyle); if (GUI.Button(position, GUIContent.none, this.plusButtonStyle)) { AddCurvesPopup.AddNewCurve(addCurvesPopupPropertyNode); this.owner.Close(); this.m_TreeView.ReloadData(); } return(result); }
private void DoAddCurveButton(Rect rect) { float num = (rect.width - 230f) / 2f; float num2 = 10f; Rect rect2 = new Rect(rect.xMin + num, rect.yMin + num2, rect.width - num * 2f, rect.height - num2 * 2f); if (GUI.Button(rect2, this.k_AnimatePropertyLabel)) { if (!this.state.m_AnimationWindow.EnsureAnimationMode()) { return; } AddCurvesPopup.gameObject = this.state.m_RootGameObject; AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true; if (AddCurvesPopup.ShowAtPosition(rect2, this.state)) { GUIUtility.ExitGUI(); } } }
internal static bool ShowAtPosition(Rect buttonRect, AnimationWindowState state, OnNewCurveAdded newCurveCallback) { // We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting playmode, we assume an increasing time when comparing time. long nowMilliSeconds = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond; bool justClosed = nowMilliSeconds < s_LastClosedTime + 50; if (!justClosed) { Event.current.Use(); if (s_AddCurvesPopup == null) { s_AddCurvesPopup = ScriptableObject.CreateInstance <AddCurvesPopup>(); } NewCurveAddedCallback = newCurveCallback; s_State = state; s_AddCurvesPopup.Init(buttonRect); return(true); } return(false); }
private void DoAddCurveButton(Rect rect, AnimationWindowHierarchyNode node, int row) { const int k_ButtonWidth = 230; float xMargin = (rect.width - k_ButtonWidth) / 2f; float yMargin = 10f; Rect rectWithMargin = new Rect(rect.xMin + xMargin, rect.yMin + yMargin, rect.width - xMargin * 2f, rect.height - yMargin * 2f); // case 767863. // This control id is unique to the hierarchy node it refers to. // The tree view only renders the elements that are visible, and will cause // the control id counter to shift when scrolling through the view. if (DoTreeViewButton(m_HierarchyItemButtonControlIDs[row], rectWithMargin, k_AnimatePropertyLabel, GUI.skin.button)) { AddCurvesPopupHierarchyDataSource.showEntireHierarchy = true; if (AddCurvesPopup.ShowAtPosition(rectWithMargin, state, OnNewCurveAdded)) { GUIUtility.ExitGUI(); } } }
private void OnDisable() { AddCurvesPopup.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AddCurvesPopup.s_AddCurvesPopup = (AddCurvesPopup) null; AddCurvesPopup.s_Hierarchy = (AddCurvesPopupHierarchy) null; }
private void OnDisable() { AddCurvesPopup.s_LastClosedTime = DateTime.Now.Ticks / 10000L; AddCurvesPopup.s_AddCurvesPopup = null; AddCurvesPopup.s_Hierarchy = null; }
private void OnDisable() { s_LastClosedTime = DateTime.Now.Ticks / 0x2710L; s_AddCurvesPopup = null; s_Hierarchy = null; }
private void OnDisable() { s_LastClosedTime = DateTime.Now.Ticks / 0x2710L; s_AddCurvesPopup = null; s_Hierarchy = null; }