diff --git a/Source/Editor/Content/Import/ModelImportEntry.cs b/Source/Editor/Content/Import/ModelImportEntry.cs
index 3b5ba83a7..88388b8c3 100644
--- a/Source/Editor/Content/Import/ModelImportEntry.cs
+++ b/Source/Editor/Content/Import/ModelImportEntry.cs
@@ -292,9 +292,9 @@ namespace FlaxEditor.Content.Import
public bool SplitObjects { get; set; } = false;
///
- /// 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.
///
- [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)]
diff --git a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
index ca5cd22d0..f3b1d263e 100644
--- a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
+++ b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs
@@ -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;
///
@@ -234,6 +234,17 @@ namespace FlaxEditor.Viewport.Previews
_previewModel.UpdateAnimation();
}
+ ///
+ /// Sets the weight of the blend shape and updates the preview model (if not animated right now).
+ ///
+ /// The blend shape name.
+ /// The normalized weight of the blend shape (in range -1:1).
+ 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
diff --git a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs
index ea5240cb5..6904ebbfb 100644
--- a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs
+++ b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs
@@ -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); };
}
}
}