Browse Source

FlowchartWindow checks for staleness of EventHandler, Block header info and Flowchart header info

master
desktop-maesty/steve 6 years ago
parent
commit
d7ab327cc2
  1. 17
      Assets/Fungus/Scripts/Editor/BlockEditor.cs
  2. 13
      Assets/Fungus/Scripts/Editor/FlowchartEditor.cs
  3. 12
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs
  4. 2
      Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs

17
Assets/Fungus/Scripts/Editor/BlockEditor.cs

@ -19,6 +19,8 @@ namespace Fungus.EditorUtils
{
public static List<Action> actionList = new List<Action>();
public static bool SelectedBlockDataStale { get; set; }
protected Texture2D upIcon;
protected Texture2D downIcon;
protected Texture2D addIcon;
@ -101,6 +103,8 @@ namespace Fungus.EditorUtils
}
EditorGUI.BeginChangeCheck();
if (block == flowchart.SelectedBlock)
{
// Custom tinting
@ -251,6 +255,12 @@ namespace Fungus.EditorUtils
}
}
if (EditorGUI.EndChangeCheck())
{
SelectedBlockDataStale = true;
}
serializedObject.ApplyModifiedProperties();
}
@ -364,7 +374,14 @@ namespace Fungus.EditorUtils
EventHandlerEditor eventHandlerEditor = Editor.CreateEditor(block._EventHandler) as EventHandlerEditor;
if (eventHandlerEditor != null)
{
EditorGUI.BeginChangeCheck();
eventHandlerEditor.DrawInspectorGUI();
if(EditorGUI.EndChangeCheck())
{
SelectedBlockDataStale = true;
}
DestroyImmediate(eventHandlerEditor);
}
}

13
Assets/Fungus/Scripts/Editor/FlowchartEditor.cs

@ -27,7 +27,10 @@ namespace Fungus.EditorUtils
protected Texture2D addTexture;
protected VariableListAdaptor variableListAdaptor;
public static bool FlowchartDataStale { get; set; }
protected virtual void OnEnable()
{
if (NullTargetCheck()) // Check for an orphaned editor instance
@ -58,6 +61,8 @@ namespace Fungus.EditorUtils
flowchart.UpdateHideFlags();
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(descriptionProp);
EditorGUILayout.PropertyField(colorCommandsProp);
EditorGUILayout.PropertyField(hideComponentsProp);
@ -73,6 +78,12 @@ namespace Fungus.EditorUtils
//ReorderableListGUI.ListField(hideCommandsProp);
EditorGUILayout.PropertyField(hideCommandsProp, new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip), true);
if(EditorGUI.EndChangeCheck())
{
FlowchartDataStale = true;
}
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button(new GUIContent("Open Flowchart Window", "Opens the Flowchart Window")))

12
Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

@ -301,6 +301,18 @@ namespace Fungus.EditorUtils
CommandEditor.SelectedCommandDataStale = false;
Repaint();
}
if(BlockEditor.SelectedBlockDataStale)
{
BlockEditor.SelectedBlockDataStale = false;
Repaint();
}
if (FlowchartEditor.FlowchartDataStale)
{
FlowchartEditor.FlowchartDataStale = false;
Repaint();
}
}
else
{

2
Assets/Fungus/Scripts/Editor/PopupContent/EventSelectorPopupWindowContent.cs

@ -149,6 +149,8 @@ namespace Fungus.EditorUtils
block._EventHandler = newHandler;
}
BlockEditor.SelectedBlockDataStale = true;
// Because this is an async call, we need to force prefab instances to record changes
PrefabUtility.RecordPrefabInstancePropertyModifications(block);
}

Loading…
Cancel
Save