Fix property value sliders usage in BT editor
This commit is contained in:
@@ -27,6 +27,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
private ScriptType _type;
|
||||
private InputBox _input;
|
||||
private OutputBox _output;
|
||||
internal bool _isValueEditing;
|
||||
|
||||
public BehaviorTreeNode Instance;
|
||||
|
||||
@@ -172,6 +173,13 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
{
|
||||
base.OnValuesChanged();
|
||||
|
||||
if (_isValueEditing)
|
||||
{
|
||||
// Skip updating instance when it's being edited by user via UI
|
||||
UpdateTitle();
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (Instance != null)
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_undo = new Undo();
|
||||
_undo.UndoDone += OnUndoRedo;
|
||||
_undo.RedoDone += OnUndoRedo;
|
||||
_undo.ActionDone += OnUndoRedo;
|
||||
_undo.ActionDone += OnUndoAction;
|
||||
|
||||
// Split Panels
|
||||
_split1 = new SplitPanel(Orientation.Horizontal, ScrollBars.None, ScrollBars.None)
|
||||
@@ -120,6 +120,12 @@ namespace FlaxEditor.Windows.Assets
|
||||
_nodePropertiesEditor.BuildLayoutOnUpdate();
|
||||
}
|
||||
|
||||
private void OnUndoAction(IUndoAction action)
|
||||
{
|
||||
MarkAsEdited();
|
||||
UpdateToolstrip();
|
||||
}
|
||||
|
||||
private void OnNodeSelectionChanged()
|
||||
{
|
||||
// Select node instances to view/edit
|
||||
@@ -149,7 +155,9 @@ namespace FlaxEditor.Windows.Assets
|
||||
{
|
||||
if (nodes[j] is Surface.Archetypes.BehaviorTree.Node node && node.Instance == instance)
|
||||
{
|
||||
node._isValueEditing = true;
|
||||
node.SetValue(1, FlaxEngine.Json.JsonSerializer.SaveToBytes(instance));
|
||||
node._isValueEditing = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user