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

Package Functions

void Initialize (PropertyInspectorCustomEditorWindow parent)
 
void Update ()
 

Properties

bool Initialized [get, set]
 

Member Function Documentation

◆ Initialize()

void MarkOostveen.TimeRewizer.Editor.Baking.PropertyHierarchyEditorWindow.Initialize ( PropertyInspectorCustomEditorWindow  parent)
package
21  {
22  m_ScrolPosition = Vector2.zero;
23 
24  m_SelectedIndex = 0;
25 
26  m_ParentWindow = parent;
27 
28  m_Inspector = new PropertyValueInspector();
29 
30  m_Changes = false;
31 
32  Initialized = true;
33  }
+ Here is the caller graph for this function:

◆ Update()

void MarkOostveen.TimeRewizer.Editor.Baking.PropertyHierarchyEditorWindow.Update ( )
package
36  {
37  InternalValueBaker.PropertyInfo property = m_ParentWindow.PropertyInfo;
38 
39  if (GUILayout.Button("Save"))
40  {
41  m_ParentWindow.m_AttachedScript.SaveChanges();
42  ICache<InternalValueBaker.PropertyInfo> cache =
43  EditorRewizeSystemUtility.GetCache<InternalValueRewizeWindowCache>(
44  m_ParentWindow.m_AttachedScript.Gameobject, PropertySelectionEditorWindow.CACHENAME);
45  cache.Snapshots = m_ParentWindow.m_AttachedScript.Snapshots;
46  EditorRewizeSystemUtility.SaveDirtyObject((ScriptableObject)cache);
47  AssetDatabase.SaveAssets();
48  m_Changes = false;
49 
50  EditorRewizerDebug.Log("Saved Hierarchy with: " + property.m_Values.Count + " Items.");
51  }
52 
53  if (GUILayout.Button("Add"))
54  {
55  dynamic newitem =
56  RewizeUtilityFunctions.CreateInstanceByType(m_ParentWindow.m_ListType.GetGenericArguments()[0]);
57  newitem.m_Value = (dynamic)RewizeUtilityFunctions.CreateInstanceByType(m_ParentWindow.m_VariableType);
58  property.m_Values.Add(newitem);
59  m_ParentWindow.PropertyInfo = property;
60  }
61 
62  EditorGUILayout.Space();
63  m_ScrolPosition = EditorGUILayout.BeginScrollView(m_ScrolPosition);
64 
65  for (int i = 0; i < property.m_Values.Count; i++)
66  {
67  GUILayout.BeginHorizontal();
68 
69  if (i == m_SelectedIndex)
70  {
71  GUILayout.Label("> " + i);
72  }
73  else
74  {
75  GUILayout.Label(i.ToString());
76  }
77 
78  if (GUILayout.Button("Select"))
79  {
80  m_SelectedIndex = i;
81  m_Inspector.Initialize(ref property, m_SelectedIndex);
82  m_Changes = true;
83  GUI.FocusControl("");
84  }
85 
86  if (GUILayout.Button("Remove"))
87  {
88  property.m_Values.RemoveAt(i);
89  m_ParentWindow.PropertyInfo = property;
90  }
91 
92  GUILayout.EndHorizontal();
93 
94  if (m_SelectedIndex == i)
95  {
96  m_Inspector.Update(property);
97  m_ParentWindow.PropertyInfo = property;
98  }
99  }
100 
101  EditorGUILayout.EndScrollView();
102 
103  if (GUILayout.Button("Clean Hierarchy"))
104  {
105  property.m_Values.Clear();
106  m_ParentWindow.PropertyInfo = property;
107  }
108 
109  if (m_Changes)
110  {
111  GUIContent content = new GUIContent("Warning: Possible hierarchy Changes NOT saved!");
112  GUILayout.Label(content, new GUIStyle() { fontStyle = FontStyle.Bold, fontSize = 10, wordWrap = true });
113  }
114  }
+ Here is the call graph for this function:

Property Documentation

◆ Initialized

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