From d111b2ba03f9184e09e6e6b4ae095c933f5216cb Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Tue, 1 Jun 2021 21:20:00 +0200 Subject: [PATCH] Tweaks --- .../Editor/Windows/SceneTreeWindow.Actors.cs | 118 ------------------ Source/Editor/Windows/SceneTreeWindow.cs | 107 ++++++++++++++++ Source/Engine/Audio/Audio.cpp | 6 +- 3 files changed, 110 insertions(+), 121 deletions(-) delete mode 100644 Source/Editor/Windows/SceneTreeWindow.Actors.cs diff --git a/Source/Editor/Windows/SceneTreeWindow.Actors.cs b/Source/Editor/Windows/SceneTreeWindow.Actors.cs deleted file mode 100644 index 04d5a3ced..000000000 --- a/Source/Editor/Windows/SceneTreeWindow.Actors.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. - -using System; -using System.Collections.Generic; -using FlaxEngine; - -namespace FlaxEditor.Windows -{ - public partial class SceneTreeWindow - { - /// - /// The spawnable actors group. - /// - public struct ActorsGroup - { - /// - /// The group name. - /// - public string Name; - - /// - /// The types to spawn (name and type). - /// - public KeyValuePair[] Types; - } - - /// - /// The Spawnable actors (groups with single entry are inlined without a child menu) - /// - public static readonly ActorsGroup[] SpawnActorsGroups = - { - new ActorsGroup - { - Types = new[] { new KeyValuePair("Actor", typeof(EmptyActor)) } - }, - new ActorsGroup - { - Types = new[] { new KeyValuePair("Model", typeof(StaticModel)) } - }, - new ActorsGroup - { - Types = new[] { new KeyValuePair("Camera", typeof(Camera)) } - }, - new ActorsGroup - { - Name = "Lights", - Types = new[] - { - new KeyValuePair("Directional Light", typeof(DirectionalLight)), - new KeyValuePair("Point Light", typeof(PointLight)), - new KeyValuePair("Spot Light", typeof(SpotLight)), - new KeyValuePair("Sky Light", typeof(SkyLight)), - } - }, - new ActorsGroup - { - Name = "Visuals", - Types = new[] - { - new KeyValuePair("Environment Probe", typeof(EnvironmentProbe)), - new KeyValuePair("Sky", typeof(Sky)), - new KeyValuePair("Skybox", typeof(Skybox)), - new KeyValuePair("Exponential Height Fog", typeof(ExponentialHeightFog)), - new KeyValuePair("PostFx Volume", typeof(PostFxVolume)), - new KeyValuePair("Decal", typeof(Decal)), - new KeyValuePair("Particle Effect", typeof(ParticleEffect)), - } - }, - new ActorsGroup - { - Name = "Physics", - Types = new[] - { - new KeyValuePair("Rigid Body", typeof(RigidBody)), - new KeyValuePair("Character Controller", typeof(CharacterController)), - new KeyValuePair("Box Collider", typeof(BoxCollider)), - new KeyValuePair("Sphere Collider", typeof(SphereCollider)), - new KeyValuePair("Capsule Collider", typeof(CapsuleCollider)), - new KeyValuePair("Mesh Collider", typeof(MeshCollider)), - new KeyValuePair("Fixed Joint", typeof(FixedJoint)), - new KeyValuePair("Distance Joint", typeof(DistanceJoint)), - new KeyValuePair("Slider Joint", typeof(SliderJoint)), - new KeyValuePair("Spherical Joint", typeof(SphericalJoint)), - new KeyValuePair("Hinge Joint", typeof(HingeJoint)), - new KeyValuePair("D6 Joint", typeof(D6Joint)), - } - }, - new ActorsGroup - { - Name = "Other", - Types = new[] - { - new KeyValuePair("Animated Model", typeof(AnimatedModel)), - new KeyValuePair("Bone Socket", typeof(BoneSocket)), - new KeyValuePair("CSG Box Brush", typeof(BoxBrush)), - new KeyValuePair("Audio Source", typeof(AudioSource)), - new KeyValuePair("Audio Listener", typeof(AudioListener)), - new KeyValuePair("Scene Animation", typeof(SceneAnimationPlayer)), - new KeyValuePair("Nav Mesh Bounds Volume", typeof(NavMeshBoundsVolume)), - new KeyValuePair("Nav Link", typeof(NavLink)), - new KeyValuePair("Nav Modifier Volume", typeof(NavModifierVolume)), - new KeyValuePair("Spline", typeof(Spline)), - } - }, - new ActorsGroup - { - Name = "GUI", - Types = new[] - { - new KeyValuePair("UI Control", typeof(UIControl)), - new KeyValuePair("UI Canvas", typeof(UICanvas)), - new KeyValuePair("Text Render", typeof(TextRender)), - new KeyValuePair("Sprite Render", typeof(SpriteRender)), - } - }, - }; - } -} diff --git a/Source/Editor/Windows/SceneTreeWindow.cs b/Source/Editor/Windows/SceneTreeWindow.cs index e930ff053..abe67190e 100644 --- a/Source/Editor/Windows/SceneTreeWindow.cs +++ b/Source/Editor/Windows/SceneTreeWindow.cs @@ -18,6 +18,113 @@ namespace FlaxEditor.Windows /// public partial class SceneTreeWindow : SceneEditorWindow { + /// + /// The spawnable actors group. + /// + public struct ActorsGroup + { + /// + /// The group name. + /// + public string Name; + + /// + /// The types to spawn (name and type). + /// + public KeyValuePair[] Types; + } + + /// + /// The Spawnable actors (groups with single entry are inlined without a child menu) + /// + public static readonly ActorsGroup[] SpawnActorsGroups = + { + new ActorsGroup + { + Types = new[] { new KeyValuePair("Actor", typeof(EmptyActor)) } + }, + new ActorsGroup + { + Types = new[] { new KeyValuePair("Model", typeof(StaticModel)) } + }, + new ActorsGroup + { + Types = new[] { new KeyValuePair("Camera", typeof(Camera)) } + }, + new ActorsGroup + { + Name = "Lights", + Types = new[] + { + new KeyValuePair("Directional Light", typeof(DirectionalLight)), + new KeyValuePair("Point Light", typeof(PointLight)), + new KeyValuePair("Spot Light", typeof(SpotLight)), + new KeyValuePair("Sky Light", typeof(SkyLight)), + } + }, + new ActorsGroup + { + Name = "Visuals", + Types = new[] + { + new KeyValuePair("Environment Probe", typeof(EnvironmentProbe)), + new KeyValuePair("Sky", typeof(Sky)), + new KeyValuePair("Skybox", typeof(Skybox)), + new KeyValuePair("Exponential Height Fog", typeof(ExponentialHeightFog)), + new KeyValuePair("PostFx Volume", typeof(PostFxVolume)), + new KeyValuePair("Decal", typeof(Decal)), + new KeyValuePair("Particle Effect", typeof(ParticleEffect)), + } + }, + new ActorsGroup + { + Name = "Physics", + Types = new[] + { + new KeyValuePair("Rigid Body", typeof(RigidBody)), + new KeyValuePair("Character Controller", typeof(CharacterController)), + new KeyValuePair("Box Collider", typeof(BoxCollider)), + new KeyValuePair("Sphere Collider", typeof(SphereCollider)), + new KeyValuePair("Capsule Collider", typeof(CapsuleCollider)), + new KeyValuePair("Mesh Collider", typeof(MeshCollider)), + new KeyValuePair("Fixed Joint", typeof(FixedJoint)), + new KeyValuePair("Distance Joint", typeof(DistanceJoint)), + new KeyValuePair("Slider Joint", typeof(SliderJoint)), + new KeyValuePair("Spherical Joint", typeof(SphericalJoint)), + new KeyValuePair("Hinge Joint", typeof(HingeJoint)), + new KeyValuePair("D6 Joint", typeof(D6Joint)), + } + }, + new ActorsGroup + { + Name = "Other", + Types = new[] + { + new KeyValuePair("Animated Model", typeof(AnimatedModel)), + new KeyValuePair("Bone Socket", typeof(BoneSocket)), + new KeyValuePair("CSG Box Brush", typeof(BoxBrush)), + new KeyValuePair("Audio Source", typeof(AudioSource)), + new KeyValuePair("Audio Listener", typeof(AudioListener)), + new KeyValuePair("Scene Animation", typeof(SceneAnimationPlayer)), + new KeyValuePair("Nav Mesh Bounds Volume", typeof(NavMeshBoundsVolume)), + new KeyValuePair("Nav Link", typeof(NavLink)), + new KeyValuePair("Nav Modifier Volume", typeof(NavModifierVolume)), + new KeyValuePair("Spline", typeof(Spline)), + } + }, + new ActorsGroup + { + Name = "GUI", + Types = new[] + { + new KeyValuePair("UI Control", typeof(UIControl)), + new KeyValuePair("UI Canvas", typeof(UICanvas)), + new KeyValuePair("Text Render", typeof(TextRender)), + new KeyValuePair("Sprite Render", typeof(SpriteRender)), + } + }, + }; + private TextBox _searchBox; private Tree _tree; private bool _isUpdatingSelection; diff --git a/Source/Engine/Audio/Audio.cpp b/Source/Engine/Audio/Audio.cpp index 51f674e73..913ffe87a 100644 --- a/Source/Engine/Audio/Audio.cpp +++ b/Source/Engine/Audio/Audio.cpp @@ -171,6 +171,7 @@ void Audio::OnRemoveSource(AudioSource* source) bool AudioService::Init() { + PROFILE_CPU_NAMED("Audio.Init"); const auto settings = AudioSettings::Get(); const bool mute = CommandLine::Options.Mute.IsTrue() || settings->DisableAudio; @@ -233,7 +234,7 @@ bool AudioService::Init() void AudioService::Update() { - PROFILE_CPU(); + PROFILE_CPU_NAMED("Audio.Update"); // Update the master volume float masterVolume = MasterVolume; @@ -242,10 +243,9 @@ void AudioService::Update() // Mute audio if app has no user focus masterVolume = 0.0f; } - if (Volume != masterVolume) + if (Math::NotNearEqual(Volume, masterVolume)) { Volume = masterVolume; - AudioBackend::SetVolume(masterVolume); }