mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-02-21 13:45:03 +08:00
parent
f3f2de3337
commit
7040e3992b
@ -65,27 +65,41 @@ namespace nadena.dev.modular_avatar.core.editor.Simulator
|
|||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
PropertyOverrides.Value = ImmutableDictionary<string, float>.Empty;
|
EditorApplication.delayCall += () =>
|
||||||
MenuItemOverrides.Value = ImmutableDictionary<string, ModularAvatarMenuItem>.Empty;
|
{
|
||||||
EditorApplication.delayCall += LoadUI;
|
PropertyOverrides.Value = ImmutableDictionary<string, float>.Empty;
|
||||||
Selection.selectionChanged += SelectionChanged;
|
MenuItemOverrides.Value = ImmutableDictionary<string, ModularAvatarMenuItem>.Empty;
|
||||||
is_enabled = true;
|
EditorApplication.delayCall += LoadUI;
|
||||||
|
EditorApplication.update += PeriodicRefresh;
|
||||||
|
Selection.selectionChanged += SelectionChanged;
|
||||||
|
is_enabled = true;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnDisable()
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
Selection.selectionChanged -= SelectionChanged;
|
|
||||||
is_enabled = false;
|
is_enabled = false;
|
||||||
|
|
||||||
// Delay this to ensure that we don't try to change this value from within assembly reload callbacks
|
// Delay this to ensure that we don't try to change this value from within assembly reload callbacks
|
||||||
// (which generates a noisy exception)
|
// (which generates a noisy exception)
|
||||||
EditorApplication.delayCall += () =>
|
EditorApplication.delayCall += () =>
|
||||||
{
|
{
|
||||||
|
Selection.selectionChanged -= SelectionChanged;
|
||||||
|
EditorApplication.update -= PeriodicRefresh;
|
||||||
|
|
||||||
PropertyOverrides.Value = null;
|
PropertyOverrides.Value = null;
|
||||||
MenuItemOverrides.Value = null;
|
MenuItemOverrides.Value = null;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void PeriodicRefresh()
|
||||||
|
{
|
||||||
|
if (_refreshPending)
|
||||||
|
{
|
||||||
|
RefreshUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ComputeContext _lastComputeContext;
|
private ComputeContext _lastComputeContext;
|
||||||
private GameObject currentSelection;
|
private GameObject currentSelection;
|
||||||
private GUIStyle lockButtonStyle;
|
private GUIStyle lockButtonStyle;
|
||||||
@ -102,7 +116,9 @@ namespace nadena.dev.modular_avatar.core.editor.Simulator
|
|||||||
|
|
||||||
_refreshPending = true;
|
_refreshPending = true;
|
||||||
|
|
||||||
EditorApplication.delayCall += RefreshUI;
|
// For some reason, this seems to get dropped occasionally, resulting in us being wedged with _refreshPending = true.
|
||||||
|
// Instead, we'll trigger this from EditorApplication.update...
|
||||||
|
// EditorApplication.delayCall += RefreshUI;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdatePropertyOverride(string prop, bool? enable, float f_val)
|
private void UpdatePropertyOverride(string prop, bool? enable, float f_val)
|
||||||
|
Loading…
Reference in New Issue
Block a user