Skip to content

Commit

Permalink
Made the PathEditor queue another update loop whenever scene or inspe…
Browse files Browse the repository at this point in the history
…ctor controls are changed. This will let external scripts react to changes in their Update loop if they have the [ExecuteAlways] or [ExecuteInEditMode] attributes added to their script.
  • Loading branch information
keenanwoodall committed Feb 5, 2019
1 parent ec55324 commit 5bafe42
Showing 1 changed file with 32 additions and 22 deletions.
54 changes: 32 additions & 22 deletions PathCreator/Core/Editor/PathEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public override void OnInspectorGUI()

void DrawBezierPathInspector()
{

using (var check = new EditorGUI.ChangeCheckScope())
{
// Path options:
Expand Down Expand Up @@ -177,6 +176,7 @@ void DrawBezierPathInspector()
if (check.changed)
{
SceneView.RepaintAll();
EditorApplication.QueuePlayerLoopUpdate ();
}
}
}
Expand All @@ -196,7 +196,8 @@ void DrawVertexPathInspector()
{
data.VertexPathSettingsChanged();
SceneView.RepaintAll();
}
EditorApplication.QueuePlayerLoopUpdate ();
}
}
}

Expand All @@ -211,6 +212,7 @@ void DrawVertexPathInspector()
if (check.changed)
{
SceneView.RepaintAll();
EditorApplication.QueuePlayerLoopUpdate ();
}
}
DrawGlobalDisplaySettingsInspector();
Expand All @@ -231,7 +233,7 @@ void DrawGlobalDisplaySettingsInspector()
{
UpdateGlobalDisplaySettings();
SceneView.RepaintAll();
}
}
}
}

Expand All @@ -241,25 +243,33 @@ void DrawGlobalDisplaySettingsInspector()

void OnSceneGUI()
{
handlesStartCol = Handles.color;
switch (data.tabIndex)
{
case bezierPathTab:
ProcessBezierPathInput(Event.current);
DrawBezierPathSceneEditor();
break;
case vertexPathTab:
DrawVertexPathSceneEditor();
break;
}


// Don't allow clicking over empty space to deselect the object
if (Event.current.type == EventType.Layout)
{
HandleUtility.AddDefaultControl(0);
}
}
using (var check = new EditorGUI.ChangeCheckScope ())
{
handlesStartCol = Handles.color;
switch (data.tabIndex)
{
case bezierPathTab:
ProcessBezierPathInput (Event.current);
DrawBezierPathSceneEditor ();
break;
case vertexPathTab:
DrawVertexPathSceneEditor ();
break;
}


// Don't allow clicking over empty space to deselect the object
if (Event.current.type == EventType.Layout)
{
HandleUtility.AddDefaultControl (0);
}

if (check.changed)
{
EditorApplication.QueuePlayerLoopUpdate ();
}
}
}

void DrawVertexPathSceneEditor()
{
Expand Down

0 comments on commit 5bafe42

Please sign in to comment.