Time Rewizer  v.1.1
Created by: Mark Oostveen
MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy Class Reference
+ Inheritance diagram for MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy:
+ Collaboration diagram for MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy:

Package Functions

void Initialize (PositionRotationEditorWindow parent)
 
void Update ()
 

Properties

bool Initialized [get, set]
 

Member Function Documentation

◆ Initialize()

void MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy.Initialize ( PositionRotationEditorWindow  parent)
package
21  {
22  m_ScrolPosition = Vector2.zero;
23  m_Parent = parent;
24  m_NodeInpector = new PositionRotationEditorWindowNodeProperties();
25  m_Changes = false;
26  Initialized = true;
27  }

◆ Update()

void MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy.Update ( )
package
30  {
32 
33  if (GUILayout.Button("Save Hierarchy"))
34  {
35  m_Parent.m_AttachedScript.SaveChanges();
36  m_Changes = false;
37  }
38 
39  if (GUILayout.Button("Add Node"))
40  {
41  int selected = m_Parent.m_AttachedScript.GetSelected(Selection.activeTransform);
42 
43  Transform newnode;
44 
45  if (selected == 9999999)
46  {
47  newnode = m_Parent.m_AttachedScript.AddNode(0);
48  }
49  else
50  {
51  newnode = m_Parent.m_AttachedScript.AddNode(selected);
52  }
53 
54  Selection.activeObject = newnode;
55  m_Parent.m_AttachedScript.m_SelectedTransform = newnode;
56 
57  m_Changes = true;
58  }
59 
60  m_ScrolPosition = GUILayout.BeginScrollView(m_ScrolPosition);
61  for (int i = 0; i < m_Parent.m_AttachedScript.Snapshots.Count; i++)
62  {
63  GUILayout.BeginHorizontal();
64  if (i == m_Selected)
65  {
66  GUILayout.Label(">");
67  }
68  else
69  {
70  GUILayout.Label(" ");
71  }
72 
73  GUILayout.Label(i.ToString());
74 
75  if (GUILayout.Button("Select"))
76  {
77  Selection.activeObject = m_Parent.m_AttachedScript.Snapshots[i].m_Transform;
78  m_Parent.m_AttachedScript.m_SelectedTransform = m_Parent.m_AttachedScript.Snapshots[i].m_Transform;
79  m_NodeInpector.Initialize(
81  m_Changes = true;
82  GUI.FocusControl("");
83  }
84 
85  if (GUILayout.Button("Remove"))
86  {
87  Transform selectedtransform = m_Parent.m_AttachedScript.Snapshots[i].m_Transform;
88  int selected = m_Parent.m_AttachedScript.GetSelected(selectedtransform);
89 
90  if (selected != 9999999)
91  {
92  m_Parent.m_AttachedScript.DeleteNode(selected);
93  }
94 
95  Transform newselection = null;
96 
97  if (selected == 0)
98  {
99  if (m_Parent.m_AttachedScript.Snapshots.Count > 0)
100  {
101  newselection = m_Parent.m_AttachedScript.Snapshots[selected].m_Transform;
102  }
103  }
104  else if (selected != 9999999)
105  {
106  newselection = m_Parent.m_AttachedScript.Snapshots[selected - 1].m_Transform;
107  }
108 
109  Selection.activeObject = newselection;
110  m_Parent.m_AttachedScript.m_SelectedTransform = newselection;
111 
112  m_Changes = true;
113  }
114 
115  GUILayout.EndHorizontal();
116  if (m_Selected == i)
117  {
118  m_NodeInpector.Update();
119  EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
120  }
121  }
122 
123  GUILayout.EndScrollView();
124 
125  if (GUILayout.Button("Clear hierarchy"))
126  {
127  m_Parent.m_AttachedScript.Clear();
128  m_Changes = true;
129  }
130 
131  if (m_Changes)
132  {
133  GUIContent content = new GUIContent("Warning: Possible hierarchy Changes NOT saved!");
134  GUILayout.Label(content, new GUIStyle() { fontStyle = FontStyle.Bold, fontSize = 10, wordWrap = true });
135  }
136  }
+ Here is the call graph for this function:

Property Documentation

◆ Initialized

bool MarkOostveen.TimeRewizer.Editor.Baking.PositionRotationEditorWindowNodeHierarchy.Initialized
getset
18 { get; set; }