diff --git a/Source/Editor/Content/Import/AudioImportSettings.cs b/Source/Editor/Content/Import/AudioImportSettings.cs index b645c1509..a0af8c154 100644 --- a/Source/Editor/Content/Import/AudioImportSettings.cs +++ b/Source/Editor/Content/Import/AudioImportSettings.cs @@ -12,7 +12,7 @@ namespace FlaxEngine.Tools { partial struct Options { - private bool ShowBtiDepth => Format != AudioFormat.Vorbis; + private bool ShowBitDepth => Format != AudioFormat.Vorbis; } } } diff --git a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs index 10dcdf671..58df5f836 100644 --- a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs +++ b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs @@ -2,6 +2,7 @@ using System; using FlaxEditor.GUI.ContextMenu; +using FlaxEditor.GUI.Input; using FlaxEngine; using Object = FlaxEngine.Object; @@ -14,7 +15,7 @@ namespace FlaxEditor.Viewport.Previews public class AnimatedModelPreview : AssetPreview { private AnimatedModel _previewModel; - private ContextMenuButton _showNodesButton, _showBoundsButton, _showFloorButton, _showNodesNamesButton; + private ContextMenuButton _showNodesButton, _showBoundsButton, _showFloorButton, _showNodesNamesButton, _nodeNameSizeButton; private bool _showNodes, _showBounds, _showFloor, _showNodesNames; private StaticModel _floorModel; private bool _playAnimation, _playAnimationOnce, _autoAdjustCamera = true; @@ -110,9 +111,16 @@ namespace FlaxEditor.Viewport.Previews ShowDebugDraw = true; if (_showNodesNamesButton != null) _showNodesNamesButton.Checked = value; + if (_nodeNameSizeButton != null) + _nodeNameSizeButton.Enabled = value; } } + /// + /// The font size used in the node name debug draw. + /// + public int NodeNamesSize = 10; + /// /// Gets or sets a value indicating whether show animated model bounding box debug view. /// @@ -210,6 +218,15 @@ namespace FlaxEditor.Viewport.Previews _showFloorButton.CloseMenuOnClick = false; } + _nodeNameSizeButton = ViewWidgetButtonMenu.AddButton("Skeleton Names Size"); + _nodeNameSizeButton.CloseMenuOnClick = false; + var nodeNameSizeValue = new IntValueBox(NodeNamesSize, 118, 2, 70.0f, 1, 32) + { + Parent = _nodeNameSizeButton + }; + _nodeNameSizeButton.Enabled = ShowNodesNames; + nodeNameSizeValue.ValueChanged += () => NodeNamesSize = nodeNameSizeValue.Value; + // Enable shadows PreviewLight.ShadowsMode = ShadowsCastingMode.All; PreviewLight.CascadeCount = 3; @@ -378,7 +395,7 @@ namespace FlaxEditor.Viewport.Previews if (nodesMask != null && !nodesMask[nodeIndex]) continue; //var t = new Transform(pose[nodeIndex].TranslationVector, Quaternion.Identity, new Float3(0.1f)); - DebugDraw.DrawText(nodes[nodeIndex].Name, pose[nodeIndex].TranslationVector, Color.White, 20, 0.0f, 0.1f); + DebugDraw.DrawText(nodes[nodeIndex].Name, pose[nodeIndex].TranslationVector, Color.White, NodeNamesSize, 0.0f, 0.25f); } } } diff --git a/Source/Engine/Level/Actors/AnimatedModel.h b/Source/Engine/Level/Actors/AnimatedModel.h index 5e549e4a8..8d0959147 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.h +++ b/Source/Engine/Level/Actors/AnimatedModel.h @@ -98,99 +98,99 @@ public: /// /// The skinned model asset used for rendering. /// - API_FIELD(Attributes="EditorOrder(10), DefaultValue(null), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(10), DefaultValue(null), EditorDisplay(\"Skeleton\")") AssetReference SkinnedModel; /// /// The animation graph asset used for the skinned mesh skeleton bones evaluation (controls the animation). /// - API_FIELD(Attributes="EditorOrder(15), DefaultValue(null), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(15), DefaultValue(null), EditorDisplay(\"Skeleton\")") AssetReference AnimationGraph; /// /// If true, use per-bone motion blur on this skeletal model. It requires additional rendering, can be disabled to save performance. /// - API_FIELD(Attributes="EditorOrder(20), DefaultValue(true), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(20), DefaultValue(true), EditorDisplay(\"Rendering\")") bool PerBoneMotionBlur = true; /// /// If true, animation speed will be affected by the global timescale parameter. /// - API_FIELD(Attributes="EditorOrder(30), DefaultValue(true), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(30), DefaultValue(true), EditorDisplay(\"Update\")") bool UseTimeScale = true; /// /// If true, the animation will be updated even when an actor cannot be seen by any camera. Otherwise, the animations themselves will also stop running when the actor is off-screen. /// - API_FIELD(Attributes="EditorOrder(40), DefaultValue(false), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(40), DefaultValue(false), EditorDisplay(\"Update\")") bool UpdateWhenOffscreen = false; /// /// The animation update delta timescale. Can be used to speed up animation playback or create slow motion effect. /// - API_FIELD(Attributes="EditorOrder(45), Limit(0, float.MaxValue, 0.025f), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(45), Limit(0, float.MaxValue, 0.025f), EditorDisplay(\"Update\")") float UpdateSpeed = 1.0f; /// /// The animation update mode. Can be used to optimize the performance. /// - API_FIELD(Attributes="EditorOrder(50), DefaultValue(AnimationUpdateMode.Auto), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(50), DefaultValue(AnimationUpdateMode.Auto), EditorDisplay(\"Update\")") AnimationUpdateMode UpdateMode = AnimationUpdateMode::Auto; /// /// The master scale parameter for the actor bounding box. Helps to reduce mesh flickering effect on screen edges. /// - API_FIELD(Attributes="EditorOrder(60), DefaultValue(1.5f), Limit(0, float.MaxValue, 0.025f), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(60), DefaultValue(1.5f), Limit(0, float.MaxValue, 0.025f), EditorDisplay(\"Rendering\")") float BoundsScale = 1.5f; /// /// The custom bounds(in actor local space). If set to empty bounds then source skinned model bind pose bounds will be used. /// - API_FIELD(Attributes="EditorOrder(70), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(70), EditorDisplay(\"Rendering\")") BoundingBox CustomBounds = BoundingBox::Zero; /// /// The model Level Of Detail bias value. Allows to increase or decrease rendered model quality. /// - API_FIELD(Attributes="EditorOrder(80), DefaultValue(0), Limit(-100, 100, 0.1f), EditorDisplay(\"Skinned Model\", \"LOD Bias\")") + API_FIELD(Attributes="EditorOrder(80), DefaultValue(0), Limit(-100, 100, 0.1f), EditorDisplay(\"Rendering\", \"LOD Bias\")") int32 LODBias = 0; /// /// Gets the model forced Level Of Detail index. Allows to bind the given model LOD to show. Value -1 disables this feature. /// - API_FIELD(Attributes="EditorOrder(90), DefaultValue(-1), Limit(-1, 100, 0.1f), EditorDisplay(\"Skinned Model\", \"Forced LOD\")") + API_FIELD(Attributes="EditorOrder(90), DefaultValue(-1), Limit(-1, 100, 0.1f), EditorDisplay(\"Rendering\", \"Forced LOD\")") int32 ForcedLOD = -1; /// /// The draw passes to use for rendering this object. /// - API_FIELD(Attributes="EditorOrder(100), DefaultValue(DrawPass.Default), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(100), DefaultValue(DrawPass.Default), EditorDisplay(\"Rendering\")") DrawPass DrawModes = DrawPass::Default; /// /// The object sort order key used when sorting drawable objects during rendering. Use lower values to draw object before others, higher values are rendered later (on top). Can be used to control transparency drawing. /// - API_FIELD(Attributes="EditorDisplay(\"Skinned Model\"), EditorOrder(110), DefaultValue(0)") + API_FIELD(Attributes="EditorOrder(110), DefaultValue(0), EditorDisplay(\"Rendering\")") int8 SortOrder = 0; /// /// The shadows casting mode. /// [Deprecated on 26.10.2022, expires on 26.10.2024] /// - API_FIELD(Attributes="EditorOrder(110), DefaultValue(ShadowsCastingMode.All), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(110), DefaultValue(ShadowsCastingMode.All), EditorDisplay(\"Rendering\")") DEPRECATED() ShadowsCastingMode ShadowsMode = ShadowsCastingMode::All; /// /// The animation root motion apply target. If not specified the animated model will apply it itself. /// - API_FIELD(Attributes="EditorOrder(120), DefaultValue(null), EditorDisplay(\"Skinned Model\")") + API_FIELD(Attributes="EditorOrder(120), DefaultValue(null), EditorDisplay(\"Skeleton\")") ScriptingObjectReference RootMotionTarget; #if USE_EDITOR /// - /// If checked, the skeleton pose will be shawn during debug shapes drawing. + /// If checked, the skeleton pose will be shown during debug shapes drawing. /// - API_FIELD(Attributes="EditorOrder(200), EditorDisplay(\"Skinned Model\")") bool ShowDebugDrawSkeleton = false; + API_FIELD(Attributes="EditorOrder(200), EditorDisplay(\"Debug\"), VisibleIf(nameof(ShowDebugDrawOptions))") bool ShowDebugDrawSkeleton = false; #endif public: @@ -440,6 +440,16 @@ public: API_FUNCTION() bool IsPlayingSlotAnimation(const StringView& slotName, Animation* anim = nullptr); private: +#if USE_EDITOR + /// + /// Used to hide options if when the skinned model or animation graph is null. + /// + API_PROPERTY(Attributes = "HideInEditor, NoSerialize") bool GetShowDebugDrawOptions() const + { + return SkinnedModel != nullptr && AnimationGraph != nullptr; + } +#endif + void ApplyRootMotion(const Transform& rootMotionDelta); void SyncParameters(); void RunBlendShapeDeformer(const MeshBase* mesh, struct MeshDeformationData& deformation); diff --git a/Source/Engine/Tools/AudioTool/AudioTool.h b/Source/Engine/Tools/AudioTool/AudioTool.h index b0c9c4c76..289b61c72 100644 --- a/Source/Engine/Tools/AudioTool/AudioTool.h +++ b/Source/Engine/Tools/AudioTool/AudioTool.h @@ -70,7 +70,7 @@ public: /// /// The size of a single sample in bits. The clip will be converted to this bit depth on import. /// - API_FIELD(Attributes="EditorOrder(50), VisibleIf(nameof(ShowBtiDepth))") + API_FIELD(Attributes="EditorOrder(50), VisibleIf(nameof(ShowBitDepth))") BitDepth BitDepth = BitDepth::_16; String ToString() const;