Browse Source

FlowchartWindow stale repaints

- during undo and redo operations
- when command data is stale due to modification by user
master
desktop-maesty/steve 6 years ago
parent
commit
efd39d2fa3
  1. 6
      Assets/Fungus/Scripts/Editor/CommandEditor.cs
  2. 17
      Assets/Fungus/Scripts/Editor/FlowchartWindow.cs

6
Assets/Fungus/Scripts/Editor/CommandEditor.cs

@ -13,6 +13,7 @@ namespace Fungus.EditorUtils
{ {
#region statics #region statics
public static Command selectedCommand; public static Command selectedCommand;
public static bool SelectedCommandDataStale { get; set; }
public static CommandInfoAttribute GetCommandInfo(System.Type commandType) public static CommandInfoAttribute GetCommandInfo(System.Type commandType)
{ {
@ -109,7 +110,12 @@ namespace Fungus.EditorUtils
EditorGUILayout.Separator(); EditorGUILayout.Separator();
EditorGUI.BeginChangeCheck();
DrawCommandGUI(); DrawCommandGUI();
if(EditorGUI.EndChangeCheck())
{
SelectedCommandDataStale = true;
}
EditorGUILayout.Separator(); EditorGUILayout.Separator();

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

@ -262,15 +262,22 @@ namespace Fungus.EditorUtils
EditorApplication.update += OnEditorUpdate; EditorApplication.update += OnEditorUpdate;
Undo.undoRedoPerformed += ForceRepaint;
} }
protected virtual void OnDisable() protected virtual void OnDisable()
{ {
EditorApplication.update -= OnEditorUpdate; EditorApplication.update -= OnEditorUpdate;
Undo.undoRedoPerformed -= ForceRepaint;
} }
void OnEditorUpdate() protected void ForceRepaint()
{
Repaint();
}
protected void OnEditorUpdate()
{ {
HandleFlowchartSelectionChange(); HandleFlowchartSelectionChange();
@ -288,6 +295,12 @@ namespace Fungus.EditorUtils
flowchart.SelectedCommandsStale = false; flowchart.SelectedCommandsStale = false;
Repaint(); Repaint();
} }
if(CommandEditor.SelectedCommandDataStale)
{
CommandEditor.SelectedCommandDataStale = false;
Repaint();
}
} }
else else
{ {
@ -1199,7 +1212,7 @@ namespace Fungus.EditorUtils
//cache these once as they can end up being called thousands of times per frame otherwise //cache these once as they can end up being called thousands of times per frame otherwise
var curRealTime = Time.realtimeSinceStartup; var curRealTime = Time.realtimeSinceStartup;
var fadeTimer = curRealTime + FungusConstants.ExecutingIconFadeTime;
for (int i = 0; i < blocks.Length; ++i) for (int i = 0; i < blocks.Length; ++i)
{ {
var b = blocks[i]; var b = blocks[i];

Loading…
Cancel
Save