Merge remote-tracking branch 'origin/master' into 1.6

This commit is contained in:
Wojtek Figat
2023-05-12 14:41:21 +02:00
16 changed files with 292 additions and 128 deletions

View File

@@ -1,8 +1,10 @@
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
using System;
using System.Linq; using System.Linq;
using FlaxEditor.Surface; using FlaxEditor.Surface;
using FlaxEngine; using FlaxEngine;
using FlaxEngine.GUI;
namespace FlaxEditor.CustomEditors.Dedicated namespace FlaxEditor.CustomEditors.Dedicated
{ {
@@ -13,6 +15,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
[CustomEditor(typeof(ParticleEffect)), DefaultEditor] [CustomEditor(typeof(ParticleEffect)), DefaultEditor]
public class ParticleEffectEditor : ActorEditor public class ParticleEffectEditor : ActorEditor
{ {
private Label _infoLabel;
private bool _isValid; private bool _isValid;
private bool _isActive; private bool _isActive;
private uint _parametersVersion; private uint _parametersVersion;
@@ -48,6 +51,15 @@ namespace FlaxEditor.CustomEditors.Dedicated
return null; return null;
} }
private void Foreach(Action<ParticleEffect> func)
{
foreach (var value in Values)
{
if (value is ParticleEffect player)
func(player);
}
}
/// <inheritdoc /> /// <inheritdoc />
public override void Initialize(LayoutElementsContainer layout) public override void Initialize(LayoutElementsContainer layout)
{ {
@@ -60,6 +72,26 @@ namespace FlaxEditor.CustomEditors.Dedicated
_parametersVersion = effect.ParametersVersion; _parametersVersion = effect.ParametersVersion;
_isActive = effect.IsActive; _isActive = effect.IsActive;
// Show playback options during simulation
if (Editor.IsPlayMode)
{
var playbackGroup = layout.Group("Playback");
playbackGroup.Panel.Open();
_infoLabel = playbackGroup.Label(string.Empty).Label;
_infoLabel.AutoHeight = true;
var grid = playbackGroup.CustomContainer<UniformGridPanel>();
var gridControl = grid.CustomControl;
gridControl.ClipChildren = false;
gridControl.Height = Button.DefaultHeight;
gridControl.SlotsHorizontally = 3;
gridControl.SlotsVertically = 1;
grid.Button("Play").Button.Clicked += () => Foreach(x => x.Play());
grid.Button("Pause").Button.Clicked += () => Foreach(x => x.Pause());
grid.Button("Stop").Button.Clicked += () => Foreach(x => x.Stop());
}
// Show all effect parameters grouped by the emitter track name // Show all effect parameters grouped by the emitter track name
var groups = layout.Group("Parameters"); var groups = layout.Group("Parameters");
groups.Panel.Open(); groups.Panel.Open();
@@ -99,7 +131,7 @@ namespace FlaxEditor.CustomEditors.Dedicated
base.RefreshRootChild(); base.RefreshRootChild();
return; return;
} }
for (int i = 0; i < ChildrenEditors.Count; i++) for (int i = 0; i < ChildrenEditors.Count; i++)
{ {
if (_isActive != effect.IsActive || _parametersVersion != effect.ParametersVersion) if (_isActive != effect.IsActive || _parametersVersion != effect.ParametersVersion)

View File

@@ -263,6 +263,37 @@ API_ENUM() enum class InputActionMode
Release = 2, Release = 2,
}; };
/// <summary>
/// The input action event phases.
/// </summary>
API_ENUM() enum class InputActionState
{
/// <summary>
/// The key/button is not assigned.
/// </summary>
None = 0,
/// <summary>
/// The key/button is waiting for input.
/// </summary>
Waiting = 1,
/// <summary>
/// User is pressing the key/button.
/// </summary>
Pressing = 2,
/// <summary>
/// User pressed the key/button (but wasn't pressing it in the previous frame).
/// </summary>
Press = 3,
/// <summary>
/// User released the key/button (was pressing it in the previous frame).
/// </summary>
Release = 4,
};
/// <summary> /// <summary>
/// The input gamepad index. /// The input gamepad index.
/// </summary> /// </summary>

View File

@@ -29,11 +29,13 @@ struct ActionData
{ {
bool Active; bool Active;
uint64 FrameIndex; uint64 FrameIndex;
InputActionState State;
ActionData() ActionData()
{ {
Active = false; Active = false;
FrameIndex = 0; FrameIndex = 0;
State = InputActionState::Waiting;
} }
}; };
@@ -597,6 +599,16 @@ bool Input::GetAction(const StringView& name)
return e ? e->Active : false; return e ? e->Active : false;
} }
InputActionState Input::GetActionState(const StringView& name)
{
const auto e = Actions.TryGet(name);
if (e != nullptr)
{
return e->State;
}
return InputActionState::None;
}
float Input::GetAxis(const StringView& name) float Input::GetAxis(const StringView& name)
{ {
const auto e = Axes.TryGet(name); const auto e = Axes.TryGet(name);
@@ -806,6 +818,7 @@ void InputService::Update()
ActionData& data = Actions[name]; ActionData& data = Actions[name];
data.Active = false; data.Active = false;
data.State = InputActionState::Waiting;
// Mark as updated in this frame // Mark as updated in this frame
data.FrameIndex = frame; data.FrameIndex = frame;
@@ -830,6 +843,19 @@ void InputService::Update()
isActive = Input::GetKeyUp(config.Key) || Input::GetMouseButtonUp(config.MouseButton) || Input::GetGamepadButtonUp(config.Gamepad, config.GamepadButton); isActive = Input::GetKeyUp(config.Key) || Input::GetMouseButtonUp(config.MouseButton) || Input::GetGamepadButtonUp(config.Gamepad, config.GamepadButton);
} }
if (Input::GetKeyDown(config.Key) || Input::GetMouseButtonDown(config.MouseButton) || Input::GetGamepadButtonDown(config.Gamepad, config.GamepadButton))
{
data.State = InputActionState::Press;
}
else if (Input::GetKey(config.Key) || Input::GetMouseButton(config.MouseButton) || Input::GetGamepadButton(config.Gamepad, config.GamepadButton))
{
data.State = InputActionState::Pressing;
}
else if (Input::GetKeyUp(config.Key) || Input::GetMouseButtonUp(config.MouseButton) || Input::GetGamepadButtonUp(config.Gamepad, config.GamepadButton))
{
data.State = InputActionState::Release;
}
data.Active |= isActive; data.Active |= isActive;
} }

View File

@@ -309,6 +309,14 @@ public:
/// <seealso cref="ActionMappings"/> /// <seealso cref="ActionMappings"/>
API_FUNCTION() static bool GetAction(const StringView& name); API_FUNCTION() static bool GetAction(const StringView& name);
/// <summary>
/// Gets the value of the virtual action identified by name. Use <see cref="ActionMappings"/> to get the current config.
/// </summary>
/// <param name="name">The action name.</param>
/// <returns>A InputActionPhase determining the current phase of the Action (e.g If it was just pressed, is being held or just released).</returns>
/// <seealso cref="ActionMappings"/>
API_FUNCTION() static InputActionState GetActionState(const StringView& name);
/// <summary> /// <summary>
/// Gets the value of the virtual axis identified by name. Use <see cref="AxisMappings"/> to get the current config. /// Gets the value of the virtual axis identified by name. Use <see cref="AxisMappings"/> to get the current config.
/// </summary> /// </summary>

View File

@@ -253,6 +253,11 @@ int32 ParticleEffect::GetParticlesCount() const
return Instance.GetParticlesCount(); return Instance.GetParticlesCount();
} }
bool ParticleEffect::GetIsPlaying() const
{
return _isPlaying;
}
void ParticleEffect::ResetSimulation() void ParticleEffect::ResetSimulation()
{ {
Instance.ClearState(); Instance.ClearState();
@@ -275,6 +280,22 @@ void ParticleEffect::UpdateSimulation(bool singleFrame)
Particles::UpdateEffect(this); Particles::UpdateEffect(this);
} }
void ParticleEffect::Play()
{
_isPlaying = true;
}
void ParticleEffect::Pause()
{
_isPlaying = false;
}
void ParticleEffect::Stop()
{
_isPlaying = false;
ResetSimulation();
}
void ParticleEffect::UpdateBounds() void ParticleEffect::UpdateBounds()
{ {
BoundingBox bounds = BoundingBox::Empty; BoundingBox bounds = BoundingBox::Empty;
@@ -395,6 +416,13 @@ void ParticleEffect::SetParametersOverrides(const Array<ParameterOverride>& valu
void ParticleEffect::Update() void ParticleEffect::Update()
{ {
if (!_isPlaying)
{
// Move update timer forward while paused for correct delta time after unpause
Instance.LastUpdateTime = (UseTimeScale ? Time::Update.Time : Time::Update.UnscaledTime).GetTotalSeconds();
return;
}
// Skip if off-screen // Skip if off-screen
if (!UpdateWhenOffscreen && _lastMinDstSqr >= MAX_Real) if (!UpdateWhenOffscreen && _lastMinDstSqr >= MAX_Real)
return; return;
@@ -416,8 +444,12 @@ void ParticleEffect::Update()
void ParticleEffect::UpdateExecuteInEditor() void ParticleEffect::UpdateExecuteInEditor()
{ {
// Auto-play in Editor
if (!Editor::IsPlayMode) if (!Editor::IsPlayMode)
{
_isPlaying = true;
Update(); Update();
}
} }
#endif #endif
@@ -576,6 +608,7 @@ void ParticleEffect::Serialize(SerializeStream& stream, const void* otherObj)
SERIALIZE(SimulationSpeed); SERIALIZE(SimulationSpeed);
SERIALIZE(UseTimeScale); SERIALIZE(UseTimeScale);
SERIALIZE(IsLooping); SERIALIZE(IsLooping);
SERIALIZE(PlayOnStart);
SERIALIZE(UpdateWhenOffscreen); SERIALIZE(UpdateWhenOffscreen);
SERIALIZE(DrawModes); SERIALIZE(DrawModes);
SERIALIZE(SortOrder); SERIALIZE(SortOrder);
@@ -589,6 +622,7 @@ void ParticleEffect::Deserialize(DeserializeStream& stream, ISerializeModifier*
const auto overridesMember = stream.FindMember("Overrides"); const auto overridesMember = stream.FindMember("Overrides");
if (overridesMember != stream.MemberEnd()) if (overridesMember != stream.MemberEnd())
{ {
// [Deprecated on 25.11.2018, expires on 25.11.2022]
if (modifier->EngineBuild < 6197) if (modifier->EngineBuild < 6197)
{ {
const auto& overrides = overridesMember->value; const auto& overrides = overridesMember->value;
@@ -675,6 +709,7 @@ void ParticleEffect::Deserialize(DeserializeStream& stream, ISerializeModifier*
DESERIALIZE(SimulationSpeed); DESERIALIZE(SimulationSpeed);
DESERIALIZE(UseTimeScale); DESERIALIZE(UseTimeScale);
DESERIALIZE(IsLooping); DESERIALIZE(IsLooping);
DESERIALIZE(PlayOnStart);
DESERIALIZE(UpdateWhenOffscreen); DESERIALIZE(UpdateWhenOffscreen);
DESERIALIZE(DrawModes); DESERIALIZE(DrawModes);
DESERIALIZE(SortOrder); DESERIALIZE(SortOrder);
@@ -706,6 +741,9 @@ void ParticleEffect::OnEnable()
GetScene()->Ticking.Update.AddTickExecuteInEditor<ParticleEffect, &ParticleEffect::UpdateExecuteInEditor>(this); GetScene()->Ticking.Update.AddTickExecuteInEditor<ParticleEffect, &ParticleEffect::UpdateExecuteInEditor>(this);
#endif #endif
if (PlayOnStart)
Play();
// Base // Base
Actor::OnEnable(); Actor::OnEnable();
} }

View File

@@ -184,6 +184,7 @@ private:
uint32 _parametersVersion = 0; // Version number for _parameters to be in sync with Instance.ParametersVersion uint32 _parametersVersion = 0; // Version number for _parameters to be in sync with Instance.ParametersVersion
Array<ParticleEffectParameter> _parameters; // Cached for scripting API Array<ParticleEffectParameter> _parameters; // Cached for scripting API
Array<ParameterOverride> _parametersOverrides; // Cached parameter modifications to be applied to the parameters Array<ParameterOverride> _parametersOverrides; // Cached parameter modifications to be applied to the parameters
bool _isPlaying = false;
public: public:
/// <summary> /// <summary>
@@ -235,9 +236,15 @@ public:
bool IsLooping = true; bool IsLooping = true;
/// <summary> /// <summary>
/// If true, the particle simulation will be updated even when an actor cannot be seen by any camera. Otherwise, the simulation will stop running when the actor is off-screen. /// Determines whether the particle effect should play on start.
/// </summary> /// </summary>
API_FIELD(Attributes="EditorDisplay(\"Particle Effect\"), DefaultValue(true), EditorOrder(60)") API_FIELD(Attributes="EditorDisplay(\"Particle Effect\"), DefaultValue(true), EditorOrder(60)")
bool PlayOnStart = true;
/// <summary>
/// If true, the particle simulation will be updated even when an actor cannot be seen by any camera. Otherwise, the simulation will stop running when the actor is off-screen.
/// </summary>
API_FIELD(Attributes="EditorDisplay(\"Particle Effect\"), DefaultValue(true), EditorOrder(70)")
bool UpdateWhenOffscreen = true; bool UpdateWhenOffscreen = true;
/// <summary> /// <summary>
@@ -326,6 +333,11 @@ public:
/// </summary> /// </summary>
API_PROPERTY() int32 GetParticlesCount() const; API_PROPERTY() int32 GetParticlesCount() const;
/// <summary>
/// Gets whether or not the particle effect is playing.
/// </summary>
API_PROPERTY(Attributes="NoSerialize, HideInEditor") bool GetIsPlaying() const;
/// <summary> /// <summary>
/// Resets the particles simulation state (clears the instance state data but preserves the instance parameters values). /// Resets the particles simulation state (clears the instance state data but preserves the instance parameters values).
/// </summary> /// </summary>
@@ -337,6 +349,21 @@ public:
/// <param name="singleFrame">True if update animation by a single frame only (time time since last engine update), otherwise will update simulation with delta time since last update.</param> /// <param name="singleFrame">True if update animation by a single frame only (time time since last engine update), otherwise will update simulation with delta time since last update.</param>
API_FUNCTION() void UpdateSimulation(bool singleFrame = false); API_FUNCTION() void UpdateSimulation(bool singleFrame = false);
/// <summary>
/// Plays the simulation.
/// </summary>
API_FUNCTION() void Play();
/// <summary>
/// Pauses the simulation.
/// </summary>
API_FUNCTION() void Pause();
/// <summary>
/// Stops and resets the simulation.
/// </summary>
API_FUNCTION() void Stop();
/// <summary> /// <summary>
/// Updates the actor bounds. /// Updates the actor bounds.
/// </summary> /// </summary>

View File

@@ -42,7 +42,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the font used to draw button text. /// Gets or sets the font used to draw button text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2022), ExpandGroups]
public FontReference Font public FontReference Font
{ {
get => _font; get => _font;
@@ -52,15 +52,51 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data. /// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")] [EditorDisplay("Text Style"), EditorOrder(2021), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")]
public MaterialBase TextMaterial { get; set; } public MaterialBase TextMaterial { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color used to draw button text. /// Gets or sets the color used to draw button text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2020)]
public Color TextColor; public Color TextColor;
/// <summary>
/// Gets or sets the brush used for background drawing.
/// </summary>
[EditorDisplay("Background Style"), EditorOrder(1999), Tooltip("The brush used for background drawing."), ExpandGroups]
public IBrush BackgroundBrush { get; set; }
/// <summary>
/// Gets or sets the background color when button is highlighted.
/// </summary>
[EditorDisplay("Background Style"), EditorOrder(2001)]
public Color BackgroundColorHighlighted { get; set; }
/// <summary>
/// Gets or sets the background color when button is selected.
/// </summary>
[EditorDisplay("Background Style"), EditorOrder(2002)]
public Color BackgroundColorSelected { get; set; }
/// <summary>
/// Gets or sets the color of the border.
/// </summary>
[EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups]
public Color BorderColor { get; set; }
/// <summary>
/// Gets or sets the border color when button is highlighted.
/// </summary>
[EditorDisplay("Border Style"), EditorOrder(2011)]
public Color BorderColorHighlighted { get; set; }
/// <summary>
/// Gets or sets the border color when button is selected.
/// </summary>
[EditorDisplay("Border Style"), EditorOrder(2012)]
public Color BorderColorSelected { get; set; }
/// <summary> /// <summary>
/// Event fired when user clicks on the button. /// Event fired when user clicks on the button.
/// </summary> /// </summary>
@@ -81,42 +117,6 @@ namespace FlaxEngine.GUI
/// </summary> /// </summary>
public event Action HoverEnd; public event Action HoverEnd;
/// <summary>
/// Gets or sets the brush used for background drawing.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The brush used for background drawing.")]
public IBrush BackgroundBrush { get; set; }
/// <summary>
/// Gets or sets the color of the border.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color BorderColor { get; set; }
/// <summary>
/// Gets or sets the background color when button is selected.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2010)]
public Color BackgroundColorSelected { get; set; }
/// <summary>
/// Gets or sets the border color when button is selected.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2020)]
public Color BorderColorSelected { get; set; }
/// <summary>
/// Gets or sets the background color when button is highlighted.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color BackgroundColorHighlighted { get; set; }
/// <summary>
/// Gets or sets the border color when button is highlighted.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color BorderColorHighlighted { get; set; }
/// <summary> /// <summary>
/// Gets a value indicating whether this button is being pressed (by mouse or touch). /// Gets a value indicating whether this button is being pressed (by mouse or touch).
/// </summary> /// </summary>
@@ -209,7 +209,7 @@ namespace FlaxEngine.GUI
public override void ClearState() public override void ClearState()
{ {
base.ClearState(); base.ClearState();
if (_isPressed) if (_isPressed)
OnPressEnd(); OnPressEnd();
} }

View File

@@ -97,6 +97,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the size of the box. /// Gets or sets the size of the box.
/// </summary> /// </summary>
[EditorOrder(20)]
public float BoxSize public float BoxSize
{ {
get => _boxSize; get => _boxSize;
@@ -107,34 +108,34 @@ namespace FlaxEngine.GUI
} }
} }
/// <summary>
/// Gets or sets the color of the checkbox icon.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color ImageColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the border. /// Gets or sets the color of the border.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups]
public Color BorderColor { get; set; } public Color BorderColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the border color when checkbox is hovered. /// Gets or sets the border color when checkbox is hovered.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Border Style"), EditorOrder(2011)]
public Color BorderColorHighlighted { get; set; } public Color BorderColorHighlighted { get; set; }
/// <summary>
/// Gets or sets the color of the checkbox icon.
/// </summary>
[EditorDisplay("Image Style"), EditorOrder(2020), ExpandGroups]
public Color ImageColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image used to render checkbox checked state. /// Gets or sets the image used to render checkbox checked state.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render checkbox checked state.")] [EditorDisplay("Image Style"), EditorOrder(2021), Tooltip("The image used to render checkbox checked state.")]
public IBrush CheckedImage { get; set; } public IBrush CheckedImage { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image used to render checkbox intermediate state. /// Gets or sets the image used to render checkbox intermediate state.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render checkbox intermediate state.")] [EditorDisplay("Image Style"), EditorOrder(2022), Tooltip("The image used to render checkbox intermediate state.")]
public IBrush IntermediateImage { get; set; } public IBrush IntermediateImage { get; set; }
/// <summary> /// <summary>

View File

@@ -246,79 +246,79 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the font used to draw text. /// Gets or sets the font used to draw text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2021)]
public FontReference Font { get; set; } public FontReference Font { get; set; }
/// <summary> /// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data. /// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")] [EditorDisplay("Text Style"), EditorOrder(2022), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")]
public MaterialBase FontMaterial { get; set; } public MaterialBase FontMaterial { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the text. /// Gets or sets the color of the text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2020), ExpandGroups]
public Color TextColor { get; set; } public Color TextColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the border. /// Gets or sets the color of the border.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups]
public Color BorderColor { get; set; } public Color BorderColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the background color when dropdown popup is opened. /// Gets or sets the background color when dropdown popup is opened.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2010)] [EditorDisplay("Background Style"), EditorOrder(2002)]
public Color BackgroundColorSelected { get; set; } public Color BackgroundColorSelected { get; set; }
/// <summary> /// <summary>
/// Gets or sets the border color when dropdown popup is opened. /// Gets or sets the border color when dropdown popup is opened.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2020)] [EditorDisplay("Border Style"), EditorOrder(2012)]
public Color BorderColorSelected { get; set; } public Color BorderColorSelected { get; set; }
/// <summary> /// <summary>
/// Gets or sets the background color when dropdown is highlighted. /// Gets or sets the background color when dropdown is highlighted.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Background Style"), EditorOrder(2001), ExpandGroups]
public Color BackgroundColorHighlighted { get; set; } public Color BackgroundColorHighlighted { get; set; }
/// <summary> /// <summary>
/// Gets or sets the border color when dropdown is highlighted. /// Gets or sets the border color when dropdown is highlighted.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Border Style"), EditorOrder(2011)]
public Color BorderColorHighlighted { get; set; } public Color BorderColorHighlighted { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image used to render dropdown drop arrow icon. /// Gets or sets the image used to render dropdown drop arrow icon.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render dropdown drop arrow icon.")] [EditorDisplay("Icon Style"), EditorOrder(2033), Tooltip("The image used to render dropdown drop arrow icon.")]
public IBrush ArrowImage { get; set; } public IBrush ArrowImage { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color used to render dropdown drop arrow icon. /// Gets or sets the color used to render dropdown drop arrow icon.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color used to render dropdown drop arrow icon.")] [EditorDisplay("Icon Style"), EditorOrder(2030), Tooltip("The color used to render dropdown drop arrow icon."), ExpandGroups]
public Color ArrowColor { get; set; } public Color ArrowColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color used to render dropdown drop arrow icon (menu is opened). /// Gets or sets the color used to render dropdown drop arrow icon (menu is opened).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color used to render dropdown drop arrow icon (menu is opened).")] [EditorDisplay("Icon Style"), EditorOrder(2032), Tooltip("The color used to render dropdown drop arrow icon (menu is opened).")]
public Color ArrowColorSelected { get; set; } public Color ArrowColorSelected { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color used to render dropdown drop arrow icon (menu is highlighted). /// Gets or sets the color used to render dropdown drop arrow icon (menu is highlighted).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color used to render dropdown drop arrow icon (menu is highlighted).")] [EditorDisplay("Icon Style"), EditorOrder(2031), Tooltip("The color used to render dropdown drop arrow icon (menu is highlighted).")]
public Color ArrowColorHighlighted { get; set; } public Color ArrowColorHighlighted { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image used to render dropdown checked item icon. /// Gets or sets the image used to render dropdown checked item icon.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render dropdown checked item icon.")] [EditorDisplay("Icon Style"), EditorOrder(2034), Tooltip("The image used to render dropdown checked item icon.")]
public IBrush CheckedImage { get; set; } public IBrush CheckedImage { get; set; }
/// <summary> /// <summary>

View File

@@ -25,19 +25,19 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the color used to multiply the image pixels. /// Gets or sets the color used to multiply the image pixels.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Image Style"), EditorOrder(2010), ExpandGroups]
public Color Color { get; set; } = Color.White; public Color Color { get; set; } = Color.White;
/// <summary> /// <summary>
/// Gets or sets the color used to multiply the image pixels when mouse is over the image. /// Gets or sets the color used to multiply the image pixels when mouse is over the image.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Image Style"), EditorOrder(2011)]
public Color MouseOverColor { get; set; } = Color.White; public Color MouseOverColor { get; set; } = Color.White;
/// <summary> /// <summary>
/// Gets or sets the color used to multiply the image pixels when control is disabled. /// Gets or sets the color used to multiply the image pixels when control is disabled.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Image Style"), EditorOrder(2012)]
public Color DisabledTint { get; set; } = Color.Gray; public Color DisabledTint { get; set; } = Color.Gray;
/// <summary> /// <summary>

View File

@@ -47,37 +47,37 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the color of the text. /// Gets or sets the color of the text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the text.")] [EditorDisplay("Text Style"), EditorOrder(2010), Tooltip("The color of the text."), ExpandGroups]
public Color TextColor { get; set; } public Color TextColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the text when it is highlighted (mouse is over). /// Gets or sets the color of the text when it is highlighted (mouse is over).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the text when it is highlighted (mouse is over).")] [EditorDisplay("Text Style"), EditorOrder(2011), Tooltip("The color of the text when it is highlighted (mouse is over).")]
public Color TextColorHighlighted { get; set; } public Color TextColorHighlighted { get; set; }
/// <summary> /// <summary>
/// Gets or sets the horizontal text alignment within the control bounds. /// Gets or sets the horizontal text alignment within the control bounds.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2010), Tooltip("The horizontal text alignment within the control bounds.")] [EditorDisplay("Text Style"), EditorOrder(2020), Tooltip("The horizontal text alignment within the control bounds.")]
public TextAlignment HorizontalAlignment { get; set; } = TextAlignment.Center; public TextAlignment HorizontalAlignment { get; set; } = TextAlignment.Center;
/// <summary> /// <summary>
/// Gets or sets the vertical text alignment within the control bounds. /// Gets or sets the vertical text alignment within the control bounds.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2020), Tooltip("The vertical text alignment within the control bounds.")] [EditorDisplay("Text Style"), EditorOrder(2021), Tooltip("The vertical text alignment within the control bounds.")]
public TextAlignment VerticalAlignment { get; set; } = TextAlignment.Center; public TextAlignment VerticalAlignment { get; set; } = TextAlignment.Center;
/// <summary> /// <summary>
/// Gets or sets the text wrapping within the control bounds. /// Gets or sets the text wrapping within the control bounds.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2030), Tooltip("The text wrapping within the control bounds.")] [EditorDisplay("Text Style"), EditorOrder(2022), Tooltip("The text wrapping within the control bounds.")]
public TextWrapping Wrapping { get; set; } = TextWrapping.NoWrap; public TextWrapping Wrapping { get; set; } = TextWrapping.NoWrap;
/// <summary> /// <summary>
/// Gets or sets the font. /// Gets or sets the font.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2023)]
public FontReference Font public FontReference Font
{ {
get => _font; get => _font;
@@ -99,7 +99,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data. /// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2024)]
public MaterialBase Material { get; set; } public MaterialBase Material { get; set; }
/// <summary> /// <summary>

View File

@@ -99,19 +99,19 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the margin for the progress bar rectangle within the control bounds. /// Gets or sets the margin for the progress bar rectangle within the control bounds.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The margin for the progress bar rectangle within the control bounds.")] [EditorDisplay("Bar Style"), EditorOrder(2011), Tooltip("The margin for the progress bar rectangle within the control bounds.")]
public Margin BarMargin { get; set; } public Margin BarMargin { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the progress bar rectangle. /// Gets or sets the color of the progress bar rectangle.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the progress bar rectangle.")] [EditorDisplay("Bar Style"), EditorOrder(2010), Tooltip("The color of the progress bar rectangle."), ExpandGroups]
public Color BarColor { get; set; } public Color BarColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the brush used for progress bar drawing. /// Gets or sets the brush used for progress bar drawing.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The brush used for progress bar drawing.")] [EditorDisplay("Bar Style"), EditorOrder(2012), Tooltip("The brush used for progress bar drawing.")]
public IBrush BarBrush { get; set; } public IBrush BarBrush { get; set; }
/// <summary> /// <summary>

View File

@@ -27,7 +27,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the text wrapping within the control bounds. /// Gets or sets the text wrapping within the control bounds.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The text wrapping within the control bounds.")] [EditorDisplay("Text Style"), EditorOrder(2023), Tooltip("The text wrapping within the control bounds.")]
public TextWrapping Wrapping public TextWrapping Wrapping
{ {
get => _layout.TextWrapping; get => _layout.TextWrapping;
@@ -37,31 +37,31 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the font. /// Gets or sets the font.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorDisplay("Text Style"), EditorOrder(2024)]
public FontReference Font { get; set; } public FontReference Font { get; set; }
/// <summary> /// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data. /// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")] [EditorDisplay("Text Style"), EditorOrder(2025), Tooltip("Custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")]
public MaterialBase TextMaterial { get; set; } public MaterialBase TextMaterial { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the text. /// Gets or sets the color of the text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the text.")] [EditorDisplay("Text Style"), EditorOrder(2020), Tooltip("The color of the text."), ExpandGroups]
public Color TextColor { get; set; } public Color TextColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the text. /// Gets or sets the color of the text.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the watermark text.")] [EditorDisplay("Text Style"), EditorOrder(2021), Tooltip("The color of the watermark text.")]
public Color WatermarkTextColor { get; set; } public Color WatermarkTextColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the selection (Transparent if not used). /// Gets or sets the color of the selection (Transparent if not used).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the selection (Transparent if not used).")] [EditorDisplay("Text Style"), EditorOrder(2022), Tooltip("The color of the selection (Transparent if not used).")]
public Color SelectionColor { get; set; } public Color SelectionColor { get; set; }
/// <summary> /// <summary>

View File

@@ -243,42 +243,43 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets a value indicating whether you can scroll the text in the text box (eg. with a mouse wheel). /// Gets or sets a value indicating whether you can scroll the text in the text box (eg. with a mouse wheel).
/// </summary> /// </summary>
[EditorOrder(41)]
public bool IsMultilineScrollable { get; set; } = true; public bool IsMultilineScrollable { get; set; } = true;
/// <summary> /// <summary>
/// Gets or sets textbox background color when the control is selected (has focus). /// Gets or sets textbox background color when the control is selected (has focus).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The textbox background color when the control is selected (has focus).")] [EditorDisplay("Background Style"), EditorOrder(2001), Tooltip("The textbox background color when the control is selected (has focus)."), ExpandGroups]
public Color BackgroundSelectedColor { get; set; } public Color BackgroundSelectedColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the caret (Transparent if not used). /// Gets or sets the color of the caret (Transparent if not used).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the caret (Transparent if not used).")] [EditorDisplay("Caret Style"), EditorOrder(2020), Tooltip("The color of the caret (Transparent if not used)."), ExpandGroups]
public Color CaretColor { get; set; } public Color CaretColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the speed of the caret flashing animation. /// Gets or sets the speed of the caret flashing animation.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The speed of the caret flashing animation.")] [EditorDisplay("Caret Style"), EditorOrder(2021), Tooltip("The speed of the caret flashing animation.")]
public float CaretFlashSpeed { get; set; } = 6.0f; public float CaretFlashSpeed { get; set; } = 6.0f;
/// <summary> /// <summary>
/// Gets or sets the speed of the selection background flashing animation. /// Gets or sets the speed of the selection background flashing animation.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The speed of the selection background flashing animation.")] [EditorDisplay("Background Style"), EditorOrder(2002), Tooltip("The speed of the selection background flashing animation.")]
public float BackgroundSelectedFlashSpeed { get; set; } = 6.0f; public float BackgroundSelectedFlashSpeed { get; set; } = 6.0f;
/// <summary> /// <summary>
/// Gets or sets the color of the border (Transparent if not used). /// Gets or sets the color of the border (Transparent if not used).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the border (Transparent if not used).")] [EditorDisplay("Border Style"), EditorOrder(2010), Tooltip("The color of the border (Transparent if not used)."), ExpandGroups]
public Color BorderColor { get; set; } public Color BorderColor { get; set; }
/// <summary> /// <summary>
/// Gets or sets the color of the border when control is focused (Transparent if not used). /// Gets or sets the color of the border when control is focused (Transparent if not used).
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The color of the border when control is focused (Transparent if not used)")] [EditorDisplay("Border Style"), EditorOrder(2011), Tooltip("The color of the border when control is focused (Transparent if not used)")]
public Color BorderSelectedColor { get; set; } public Color BorderSelectedColor { get; set; }
/// <summary> /// <summary>
@@ -409,6 +410,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the selection range. /// Gets or sets the selection range.
/// </summary> /// </summary>
[EditorOrder(50)]
public TextRange SelectionRange public TextRange SelectionRange
{ {
get => new TextRange(SelectionLeft, SelectionRight); get => new TextRange(SelectionLeft, SelectionRight);
@@ -1195,7 +1197,7 @@ namespace FlaxEngine.GUI
{ {
SetSelection(hitPos); SetSelection(hitPos);
} }
if (Cursor == CursorType.Default && _changeCursor) if (Cursor == CursorType.Default && _changeCursor)
Cursor = CursorType.IBeam; Cursor = CursorType.IBeam;

View File

@@ -166,7 +166,7 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets control background color (transparent color (alpha=0) means no background rendering) /// Gets or sets control background color (transparent color (alpha=0) means no background rendering)
/// </summary> /// </summary>
[ExpandGroups, EditorDisplay("Style"), EditorOrder(2000), Tooltip("The control background color. Use transparent color (alpha=0) to hide background.")] [ExpandGroups, EditorDisplay("Background Style"), EditorOrder(2000), Tooltip("The control background color. Use transparent color (alpha=0) to hide background.")]
public Color BackgroundColor public Color BackgroundColor
{ {
get => _backgroundColor; get => _backgroundColor;

View File

@@ -95,48 +95,48 @@ namespace FlaxEngine.GUI
} }
} }
/// <summary>
/// Gets or sets the color used to draw header text.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color HeaderTextColor;
/// <summary>
/// Gets or sets the color of the header.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color HeaderColor { get; set; }
/// <summary>
/// Gets or sets the color of the header when mouse is over.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public Color HeaderColorMouseOver { get; set; }
/// <summary>
/// Gets or sets the font used to render panel header text.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000)]
public FontReference HeaderTextFont { get; set; }
/// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("Custom material used to render the header text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")]
public MaterialBase HeaderTextMaterial { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether enable drop down icon drawing. /// Gets or sets a value indicating whether enable drop down icon drawing.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorOrder(1)]
public bool EnableDropDownIcon { get; set; } public bool EnableDropDownIcon { get; set; }
/// <summary> /// <summary>
/// Gets or sets a value indicating whether to enable containment line drawing, /// Gets or sets a value indicating whether to enable containment line drawing,
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000)] [EditorOrder(2)]
public bool EnableContainmentLines { get; set; } = false; public bool EnableContainmentLines { get; set; } = false;
/// <summary>
/// Gets or sets the color used to draw header text.
/// </summary>
[EditorDisplay("Header Style"), EditorOrder(2010), ExpandGroups]
public Color HeaderTextColor;
/// <summary>
/// Gets or sets the color of the header.
/// </summary>
[EditorDisplay("Header Style"), EditorOrder(2011)]
public Color HeaderColor { get; set; }
/// <summary>
/// Gets or sets the color of the header when mouse is over.
/// </summary>
[EditorDisplay("Header Style"), EditorOrder(2012)]
public Color HeaderColorMouseOver { get; set; }
/// <summary>
/// Gets or sets the font used to render panel header text.
/// </summary>
[EditorDisplay("Header Text Style"), EditorOrder(2020), ExpandGroups]
public FontReference HeaderTextFont { get; set; }
/// <summary>
/// Gets or sets the custom material used to render the text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.
/// </summary>
[EditorDisplay("Header Text Style"), EditorOrder(2021), Tooltip("Custom material used to render the header text. It must has domain set to GUI and have a public texture parameter named Font used to sample font atlas texture with font characters data.")]
public MaterialBase HeaderTextMaterial { get; set; }
/// <summary> /// <summary>
/// Occurs when mouse right-clicks over the header. /// Occurs when mouse right-clicks over the header.
/// </summary> /// </summary>
@@ -192,13 +192,13 @@ namespace FlaxEngine.GUI
/// <summary> /// <summary>
/// Gets or sets the image used to render drop panel drop arrow icon when panel is opened. /// Gets or sets the image used to render drop panel drop arrow icon when panel is opened.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render drop panel drop arrow icon when panel is opened.")] [EditorDisplay("Icon Style"), EditorOrder(2030), Tooltip("The image used to render drop panel drop arrow icon when panel is opened."), ExpandGroups]
public IBrush ArrowImageOpened { get; set; } public IBrush ArrowImageOpened { get; set; }
/// <summary> /// <summary>
/// Gets or sets the image used to render drop panel drop arrow icon when panel is closed. /// Gets or sets the image used to render drop panel drop arrow icon when panel is closed.
/// </summary> /// </summary>
[EditorDisplay("Style"), EditorOrder(2000), Tooltip("The image used to render drop panel drop arrow icon when panel is closed.")] [EditorDisplay("Icon Style"), EditorOrder(2031), Tooltip("The image used to render drop panel drop arrow icon when panel is closed.")]
public IBrush ArrowImageClosed { get; set; } public IBrush ArrowImageClosed { get; set; }
/// <summary> /// <summary>
@@ -376,7 +376,6 @@ namespace FlaxEngine.GUI
Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center); Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center);
if (!_isClosed && EnableContainmentLines) if (!_isClosed && EnableContainmentLines)
{ {
Color lineColor = Style.Current.ForegroundGrey - new Color(0, 0, 0, 100); Color lineColor = Style.Current.ForegroundGrey - new Color(0, 0, 0, 100);
@@ -385,7 +384,7 @@ namespace FlaxEngine.GUI
Render2D.DrawLine(new Float2(1, Height), new Float2(Width, Height), lineColor, lineThickness); Render2D.DrawLine(new Float2(1, Height), new Float2(Width, Height), lineColor, lineThickness);
Render2D.DrawLine(new Float2(Width, HeaderHeight), new Float2(Width, Height), lineColor, lineThickness); Render2D.DrawLine(new Float2(Width, HeaderHeight), new Float2(Width, Height), lineColor, lineThickness);
} }
// Children // Children
DrawChildren(); DrawChildren();
} }