Add boolean check for if paramters are showing.
This commit is contained in:
@@ -14,6 +14,8 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
[CustomEditor(typeof(AnimatedModel)), DefaultEditor]
|
||||
public class AnimatedModelEditor : ActorEditor
|
||||
{
|
||||
private bool _parametersAdded = false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
@@ -33,6 +35,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
(instance, parameter, tag) => ((AnimatedModel)instance).GetParameterValue(parameter.Identifier),
|
||||
(instance, value, parameter, tag) => ((AnimatedModel)instance).SetParameterValue(parameter.Identifier, value),
|
||||
Values);
|
||||
_parametersAdded = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,12 +45,13 @@ namespace FlaxEditor.CustomEditors.Dedicated
|
||||
base.Refresh();
|
||||
|
||||
// Check if parameters group is still showing if not in play mode and hide it.
|
||||
if (!Editor.Instance.StateMachine.IsPlayMode)
|
||||
if (!Editor.Instance.StateMachine.IsPlayMode && _parametersAdded)
|
||||
{
|
||||
var group = Layout.Children.Find(x => x is GroupElement g && g.Panel.HeaderText.Equals("Parameters", StringComparison.Ordinal));
|
||||
if (group != null)
|
||||
{
|
||||
RebuildLayout();
|
||||
_parametersAdded = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user