Fix missing blend shape refresh for Skinned Model window preview
This commit is contained in:
@@ -292,9 +292,9 @@ namespace FlaxEditor.Content.Import
|
||||
public bool SplitObjects { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The zero-based index for the mesh/animation clip to import. If the source file has more than one mesh/animation it can be used to pick a desire object.
|
||||
/// The zero-based index for the mesh/animation clip to import. If the source file has more than one mesh/animation it can be used to pick a desire object. Default -1 imports all objects.
|
||||
/// </summary>
|
||||
[EditorOrder(2010), DefaultValue(-1), EditorDisplay("Splitting"), Tooltip("The zero-based index for the mesh/animation clip to import. If the source file has more than one mesh/animation it can be used to pick a desire object.")]
|
||||
[EditorOrder(2010), DefaultValue(-1), EditorDisplay("Splitting"), Tooltip("The zero-based index for the mesh/animation clip to import. If the source file has more than one mesh/animation it can be used to pick a desire object. Default -1 imports all objects.")]
|
||||
public int ObjectIndex { get; set; } = -1;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
private AnimatedModel _previewModel;
|
||||
private StaticModel _floorModel;
|
||||
private ContextMenuButton _showCurrentLODButton;
|
||||
private bool _playAnimation;
|
||||
private bool _playAnimation, _playAnimationOnce;
|
||||
private float _playSpeed = 1.0f;
|
||||
|
||||
/// <summary>
|
||||
@@ -234,6 +234,17 @@ namespace FlaxEditor.Viewport.Previews
|
||||
_previewModel.UpdateAnimation();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the weight of the blend shape and updates the preview model (if not animated right now).
|
||||
/// </summary>
|
||||
/// <param name="name">The blend shape name.</param>
|
||||
/// <param name="value">The normalized weight of the blend shape (in range -1:1).</param>
|
||||
public void SetBlendShapeWeight(string name, float value)
|
||||
{
|
||||
_previewModel.SetBlendShapeWeight(name, value);
|
||||
_playAnimationOnce = true;
|
||||
}
|
||||
|
||||
private void OnBegin(RenderTask task, GPUContext context)
|
||||
{
|
||||
if (!ScaleToFit)
|
||||
@@ -380,8 +391,9 @@ namespace FlaxEditor.Viewport.Previews
|
||||
base.Update(deltaTime);
|
||||
|
||||
// Manually update animation
|
||||
if (PlayAnimation)
|
||||
if (PlayAnimation || _playAnimationOnce)
|
||||
{
|
||||
_playAnimationOnce = false;
|
||||
_previewModel.UpdateAnimation();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
editor.FloatValue.MinValue = -1;
|
||||
editor.FloatValue.MaxValue = 1;
|
||||
editor.FloatValue.SlideSpeed = 0.01f;
|
||||
editor.FloatValue.ValueChanged += () => { proxy.Window._preview.PreviewActor.SetBlendShapeWeight(blendShape, editor.FloatValue.Value); };
|
||||
editor.FloatValue.ValueChanged += () => { proxy.Window._preview.SetBlendShapeWeight(blendShape, editor.FloatValue.Value); };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user