diff --git a/Source/Editor/Viewport/PrefabWindowViewport.cs b/Source/Editor/Viewport/PrefabWindowViewport.cs index dd6f8fce3..db5e0bc3c 100644 --- a/Source/Editor/Viewport/PrefabWindowViewport.cs +++ b/Source/Editor/Viewport/PrefabWindowViewport.cs @@ -108,9 +108,13 @@ namespace FlaxEditor.Viewport Parent = scaleSnappingWidget }; enableScaleSnapping.Toggled += OnScaleSnappingToggle; + var scaleSnappingCM = new ContextMenu(); - _scaleSnapping = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM); - _scaleSnapping.TooltipText = "Scale snapping values"; + _scaleSnapping = new ViewportWidgetButton(TransformGizmo.ScaleSnapValue.ToString(), SpriteHandle.Invalid, scaleSnappingCM) + { + TooltipText = "Scale snapping values" + }; + for (int i = 0; i < EditorViewportScaleSnapValues.Length; i++) { var v = EditorViewportScaleSnapValues[i]; @@ -131,9 +135,13 @@ namespace FlaxEditor.Viewport Parent = rotateSnappingWidget }; enableRotateSnapping.Toggled += OnRotateSnappingToggle; + var rotateSnappingCM = new ContextMenu(); - _rotateSnapping = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM); - _rotateSnapping.TooltipText = "Rotation snapping values"; + _rotateSnapping = new ViewportWidgetButton(TransformGizmo.RotationSnapValue.ToString(), SpriteHandle.Invalid, rotateSnappingCM) + { + TooltipText = "Rotation snapping values" + }; + for (int i = 0; i < EditorViewportRotateSnapValues.Length; i++) { var v = EditorViewportRotateSnapValues[i]; @@ -154,9 +162,13 @@ namespace FlaxEditor.Viewport Parent = translateSnappingWidget }; enableTranslateSnapping.Toggled += OnTranslateSnappingToggle; + var translateSnappingCM = new ContextMenu(); - _translateSnappng = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM); - _translateSnappng.TooltipText = "Position snapping values"; + _translateSnappng = new ViewportWidgetButton(TransformGizmo.TranslationSnapValue.ToString(), SpriteHandle.Invalid, translateSnappingCM) + { + TooltipText = "Position snapping values" + }; + for (int i = 0; i < EditorViewportTranslateSnapValues.Length; i++) { var v = EditorViewportTranslateSnapValues[i]; @@ -659,9 +671,11 @@ namespace FlaxEditor.Viewport if (binaryAssetItem.Type == typeof(ParticleSystem)) { var particleSystem = FlaxEngine.Content.LoadAsync(item.ID); - var actor = new ParticleEffect(); - actor.Name = item.ShortName; - actor.ParticleSystem = particleSystem; + var actor = new ParticleEffect + { + Name = item.ShortName, + ParticleSystem = particleSystem + }; actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation); Spawn(actor); return; @@ -684,9 +698,11 @@ namespace FlaxEditor.Viewport if (typeof(SkinnedModel).IsAssignableFrom(binaryAssetItem.Type)) { var model = FlaxEngine.Content.LoadAsync(item.ID); - var actor = new AnimatedModel(); - actor.Name = item.ShortName; - actor.SkinnedModel = model; + var actor = new AnimatedModel + { + Name = item.ShortName, + SkinnedModel = model + }; actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation); Spawn(actor); return; @@ -694,9 +710,11 @@ namespace FlaxEditor.Viewport if (typeof(Model).IsAssignableFrom(binaryAssetItem.Type)) { var model = FlaxEngine.Content.LoadAsync(item.ID); - var actor = new StaticModel(); - actor.Name = item.ShortName; - actor.Model = model; + var actor = new StaticModel + { + Name = item.ShortName, + Model = model + }; actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation); Spawn(actor); return; @@ -704,9 +722,11 @@ namespace FlaxEditor.Viewport if (typeof(AudioClip).IsAssignableFrom(binaryAssetItem.Type)) { var clip = FlaxEngine.Content.LoadAsync(item.ID); - var actor = new AudioSource(); - actor.Name = item.ShortName; - actor.Clip = clip; + var actor = new AudioSource + { + Name = item.ShortName, + Clip = clip + }; actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation); Spawn(actor); return; diff --git a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs index b85895528..6f6103a5d 100644 --- a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs +++ b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs @@ -64,15 +64,20 @@ namespace FlaxEditor.Viewport.Previews Task.Begin += OnBegin; // Setup preview scene - _previewModel = new AnimatedModel(); - _previewModel.UseTimeScale = false; - _previewModel.UpdateWhenOffscreen = true; - //_previewModel.BoundsScale = 1000.0f; - _previewModel.UpdateMode = AnimatedModel.AnimationUpdateMode.Manual; + _previewModel = new AnimatedModel + { + UseTimeScale = false, + UpdateWhenOffscreen = true, + //_previewModel.BoundsScale = 1000.0f; + UpdateMode = AnimatedModel.AnimationUpdateMode.Manual + }; + _previewNodesModel = FlaxEngine.Content.CreateVirtualAsset(); _previewNodesModel.SetupLODs(new[] { 1 }); - _previewNodesActor = new StaticModel(); - _previewNodesActor.Model = _previewNodesModel; + _previewNodesActor = new StaticModel + { + Model = _previewNodesModel + }; _previewNodesActor.SetMaterial(0, FlaxEngine.Content.LoadAsyncInternal(EditorAssets.WiresDebugMaterial)); // Link actors for rendering @@ -84,8 +89,10 @@ namespace FlaxEditor.Viewport.Previews // Preview LOD { var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD"); - var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f); - previewLODValue.Parent = previewLOD; + var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f) + { + Parent = previewLOD + }; previewLODValue.ValueChanged += () => _previewModel.ForcedLOD = previewLODValue.Value; ViewWidgetButtonMenu.VisibleChanged += control => previewLODValue.Value = _previewModel.ForcedLOD; } diff --git a/Source/Editor/Viewport/Previews/AssetPreview.cs b/Source/Editor/Viewport/Previews/AssetPreview.cs index 9bf3573a1..791e98143 100644 --- a/Source/Editor/Viewport/Previews/AssetPreview.cs +++ b/Source/Editor/Viewport/Previews/AssetPreview.cs @@ -95,26 +95,36 @@ namespace FlaxEditor.Viewport.Previews } // Setup preview scene - PreviewLight = new DirectionalLight(); - PreviewLight.Brightness = 8.0f; - PreviewLight.ShadowsMode = ShadowsCastingMode.None; - PreviewLight.Orientation = Quaternion.Euler(new Vector3(52.1477f, -109.109f, -111.739f)); + PreviewLight = new DirectionalLight + { + Brightness = 8.0f, + ShadowsMode = ShadowsCastingMode.None, + Orientation = Quaternion.Euler(new Vector3(52.1477f, -109.109f, -111.739f)) + }; // - EnvProbe = new EnvironmentProbe(); - EnvProbe.AutoUpdate = false; - EnvProbe.CustomProbe = FlaxEngine.Content.LoadAsyncInternal(EditorAssets.DefaultSkyCubeTexture); + EnvProbe = new EnvironmentProbe + { + AutoUpdate = false, + CustomProbe = FlaxEngine.Content.LoadAsyncInternal(EditorAssets.DefaultSkyCubeTexture) + }; // - Sky = new Sky(); - Sky.SunLight = PreviewLight; - Sky.SunPower = 9.0f; + Sky = new Sky + { + SunLight = PreviewLight, + SunPower = 9.0f + }; // - SkyLight = new SkyLight(); - SkyLight.Mode = SkyLight.Modes.CustomTexture; - SkyLight.Brightness = 2.1f; - SkyLight.CustomTexture = EnvProbe.CustomProbe; + SkyLight = new SkyLight() + { + Mode = SkyLight.Modes.CustomTexture, + Brightness = 2.1f, + CustomTexture = EnvProbe.CustomProbe + }; // - PostFxVolume = new PostFxVolume(); - PostFxVolume.IsBounded = false; + PostFxVolume = new PostFxVolume + { + IsBounded = false + }; // Link actors for rendering Task.ActorsSource = ActorsSources.CustomActors; diff --git a/Source/Editor/Viewport/Previews/MaterialPreview.cs b/Source/Editor/Viewport/Previews/MaterialPreview.cs index 6ff695b69..0b2591b26 100644 --- a/Source/Editor/Viewport/Previews/MaterialPreview.cs +++ b/Source/Editor/Viewport/Previews/MaterialPreview.cs @@ -195,9 +195,11 @@ namespace FlaxEditor.Viewport.Previews // Decal if (decalMaterial && _decal == null) { - _decal = new Decal(); - _decal.Size = new Vector3(100.0f); - _decal.LocalOrientation = Quaternion.RotationZ(Mathf.PiOverTwo); + _decal = new Decal + { + Size = new Vector3(100.0f), + LocalOrientation = Quaternion.RotationZ(Mathf.PiOverTwo) + }; Task.AddCustomActor(_decal); } if (_decal) @@ -247,9 +249,11 @@ namespace FlaxEditor.Viewport.Previews // Particle if (particleMaterial && _particleEffect == null) { - _particleEffect = new ParticleEffect(); - _particleEffect.IsLooping = true; - _particleEffect.UseTimeScale = false; + _particleEffect = new ParticleEffect + { + IsLooping = true, + UseTimeScale = false + }; Task.AddCustomActor(_particleEffect); } if (_particleEffect != null) diff --git a/Source/Editor/Viewport/Previews/ModelPreview.cs b/Source/Editor/Viewport/Previews/ModelPreview.cs index aa03d0ee2..7055edbe9 100644 --- a/Source/Editor/Viewport/Previews/ModelPreview.cs +++ b/Source/Editor/Viewport/Previews/ModelPreview.cs @@ -53,8 +53,10 @@ namespace FlaxEditor.Viewport.Previews // Preview LOD { var previewLOD = ViewWidgetButtonMenu.AddButton("Preview LOD"); - var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f); - previewLODValue.Parent = previewLOD; + var previewLODValue = new IntValueBox(-1, 90, 2, 70.0f, -1, 10, 0.02f) + { + Parent = previewLOD + }; previewLODValue.ValueChanged += () => _previewModel.ForcedLOD = previewLODValue.Value; ViewWidgetButtonMenu.VisibleChanged += control => previewLODValue.Value = _previewModel.ForcedLOD; } diff --git a/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs b/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs index 638c8324c..f9644493f 100644 --- a/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs +++ b/Source/Editor/Viewport/Previews/ParticleEmitterPreview.cs @@ -67,8 +67,10 @@ namespace FlaxEditor.Viewport.Previews if (useWidgets) { var playbackDuration = ViewWidgetButtonMenu.AddButton("Duration"); - var playbackDurationValue = new FloatValueBox(_playbackDuration, 90, 2, 70.0f, 0.1f, 1000000.0f, 0.1f); - playbackDurationValue.Parent = playbackDuration; + var playbackDurationValue = new FloatValueBox(_playbackDuration, 90, 2, 70.0f, 0.1f, 1000000.0f, 0.1f) + { + Parent = playbackDuration + }; playbackDurationValue.ValueChanged += () => PlaybackDuration = playbackDurationValue.Value; ViewWidgetButtonMenu.VisibleChanged += control => playbackDurationValue.Value = PlaybackDuration; } diff --git a/Source/Editor/Viewport/Previews/ParticleSystemPreview.cs b/Source/Editor/Viewport/Previews/ParticleSystemPreview.cs index ad2502b23..8b4589271 100644 --- a/Source/Editor/Viewport/Previews/ParticleSystemPreview.cs +++ b/Source/Editor/Viewport/Previews/ParticleSystemPreview.cs @@ -56,8 +56,10 @@ namespace FlaxEditor.Viewport.Previews { if (!_boundsModel) { - _boundsModel = new StaticModel(); - _boundsModel.Model = FlaxEngine.Content.LoadAsyncInternal("Editor/Gizmo/WireBox"); + _boundsModel = new StaticModel + { + Model = FlaxEngine.Content.LoadAsyncInternal("Editor/Gizmo/WireBox") + }; _boundsModel.Model.WaitForLoaded(); _boundsModel.SetMaterial(0, FlaxEngine.Content.LoadAsyncInternal("Editor/Gizmo/MaterialWireFocus")); Task.AddCustomActor(_boundsModel); @@ -96,12 +98,14 @@ namespace FlaxEditor.Viewport.Previews { if (!_originModel) { - _originModel = new StaticModel(); - _originModel.Model = FlaxEngine.Content.LoadAsyncInternal("Editor/Primitives/Sphere"); + _originModel = new StaticModel + { + Model = FlaxEngine.Content.LoadAsyncInternal("Editor/Primitives/Sphere"), + Position = _previewEffect.Position, + Scale = new Vector3(0.1f) + }; _originModel.Model.WaitForLoaded(); _originModel.SetMaterial(0, FlaxEngine.Content.LoadAsyncInternal("Editor/Gizmo/MaterialAxisFocus")); - _originModel.Position = _previewEffect.Position; - _originModel.Scale = new Vector3(0.1f); Task.AddCustomActor(_originModel); } else if (!_originModel.IsActive) @@ -147,10 +151,12 @@ namespace FlaxEditor.Viewport.Previews : base(useWidgets, new FPSCamera()) { // Setup preview scene - _previewEffect = new ParticleEffect(); - _previewEffect.UseTimeScale = false; - _previewEffect.IsLooping = true; - _previewEffect.CustomViewRenderTask = Task; + _previewEffect = new ParticleEffect + { + UseTimeScale = false, + IsLooping = true, + CustomViewRenderTask = Task + }; // Link actors for rendering Task.AddCustomActor(_previewEffect); diff --git a/Source/Editor/Windows/Assets/AnimationGraphWindow.cs b/Source/Editor/Windows/Assets/AnimationGraphWindow.cs index a728e9281..f25b51612 100644 --- a/Source/Editor/Windows/Assets/AnimationGraphWindow.cs +++ b/Source/Editor/Windows/Assets/AnimationGraphWindow.cs @@ -62,10 +62,12 @@ namespace FlaxEditor.Windows.Assets _showFloorButton.IndexInParent = 1; // Floor model - _floorModel = new StaticModel(); - _floorModel.Position = new Vector3(0, -25, 0); - _floorModel.Scale = new Vector3(5, 0.5f, 5); - _floorModel.Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")); + _floorModel = new StaticModel + { + Position = new Vector3(0, -25, 0), + Scale = new Vector3(5, 0.5f, 5), + Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")) + }; Task.AddCustomActor(_floorModel); // Enable shadows diff --git a/Source/Editor/Windows/Assets/FontWindow.cs b/Source/Editor/Windows/Assets/FontWindow.cs index d0bd3aa8b..e33076606 100644 --- a/Source/Editor/Windows/Assets/FontWindow.cs +++ b/Source/Editor/Windows/Assets/FontWindow.cs @@ -39,8 +39,10 @@ namespace FlaxEditor.Windows.Assets public void Get(out FontOptions options) { - options = new FontOptions(); - options.Hinting = Hinting; + options = new FontOptions + { + Hinting = Hinting + }; if (AntiAliasing) options.Flags |= FontFlags.AntiAliasing; if (Bold) diff --git a/Source/Editor/Windows/Assets/ModelWindow.cs b/Source/Editor/Windows/Assets/ModelWindow.cs index 533c9694c..e8a054222 100644 --- a/Source/Editor/Windows/Assets/ModelWindow.cs +++ b/Source/Editor/Windows/Assets/ModelWindow.cs @@ -59,11 +59,13 @@ namespace FlaxEditor.Windows.Assets _showCurrentLODButton.IndexInParent = 2; // Floor model - _floorModel = new StaticModel(); - _floorModel.Position = new Vector3(0, -25, 0); - _floorModel.Scale = new Vector3(5, 0.5f, 5); - _floorModel.Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")); - _floorModel.IsActive = false; + _floorModel = new StaticModel + { + Position = new Vector3(0, -25, 0), + Scale = new Vector3(5, 0.5f, 5), + Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")), + IsActive = false + }; Task.AddCustomActor(_floorModel); // Enable shadows @@ -831,8 +833,10 @@ namespace FlaxEditor.Windows.Assets _tabs.AddTab(new ImportTab(this)); // Highlight actor (used to highlight selected material slot, see UpdateEffectsOnAsset) - _highlightActor = new StaticModel(); - _highlightActor.IsActive = false; + _highlightActor = new StaticModel + { + IsActive = false + }; _preview.Task.AddCustomActor(_highlightActor); } diff --git a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs index c599e7e2a..b002aa0fe 100644 --- a/Source/Editor/Windows/Assets/SkinnedModelWindow.cs +++ b/Source/Editor/Windows/Assets/SkinnedModelWindow.cs @@ -59,11 +59,13 @@ namespace FlaxEditor.Windows.Assets _showCurrentLODButton.IndexInParent = 2; // Floor model - _floorModel = new StaticModel(); - _floorModel.Position = new Vector3(0, -25, 0); - _floorModel.Scale = new Vector3(5, 0.5f, 5); - _floorModel.Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")); - _floorModel.IsActive = false; + _floorModel = new StaticModel + { + Position = new Vector3(0, -25, 0), + Scale = new Vector3(5, 0.5f, 5), + Model = FlaxEngine.Content.LoadAsync(StringUtils.CombinePaths(Globals.EngineContentFolder, "Editor/Primitives/Cube.flax")), + IsActive = false + }; Task.AddCustomActor(_floorModel); // Enable shadows @@ -929,8 +931,10 @@ namespace FlaxEditor.Windows.Assets _tabs.AddTab(new ImportTab(this)); // Highlight actor (used to highlight selected material slot, see UpdateEffectsOnAsset) - _highlightActor = new AnimatedModel(); - _highlightActor.IsActive = false; + _highlightActor = new AnimatedModel + { + IsActive = false + }; _preview.Task.AddCustomActor(_highlightActor); } diff --git a/Source/Editor/Windows/ContentWindow.ContextMenu.cs b/Source/Editor/Windows/ContentWindow.ContextMenu.cs index f81220ac4..f8dc37f0b 100644 --- a/Source/Editor/Windows/ContentWindow.ContextMenu.cs +++ b/Source/Editor/Windows/ContentWindow.ContextMenu.cs @@ -40,8 +40,11 @@ namespace FlaxEditor.Windows // Create context menu ContextMenuButton b; ContextMenuChildMenu c; - ContextMenu cm = new ContextMenu(); - cm.Tag = item; + ContextMenu cm = new ContextMenu + { + Tag = item + }; + if (isTreeNode) { b = cm.AddButton("Expand All", OnExpandAllClicked); @@ -52,6 +55,7 @@ namespace FlaxEditor.Windows cm.AddSeparator(); } + if (item is ContentFolder contentFolder && contentFolder.Node is ProjectTreeNode) { cm.AddButton("Show in explorer", () => FileSystem.ShowFileExplorer(CurrentViewFolder.Path)); diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 145c0d972..149ab064c 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -177,8 +177,10 @@ namespace FlaxEditor.Windows showFileExtensionsButton.AutoCheck = true; var viewScale = menu.AddButton("View Scale"); - var scaleValue = new FloatValueBox(1, 75, 2, 50.0f, 0.3f, 3.0f, 0.01f); - scaleValue.Parent = viewScale; + var scaleValue = new FloatValueBox(1, 75, 2, 50.0f, 0.3f, 3.0f, 0.01f) + { + Parent = viewScale + }; scaleValue.ValueChanged += () => View.ViewScale = scaleValue.Value; menu.VisibleChanged += control => { scaleValue.Value = View.ViewScale; }; @@ -742,11 +744,15 @@ namespace FlaxEditor.Windows public override void OnInit() { // Setup content root node - _root = new RootContentTreeNode(); - _root.ChildrenIndent = 0; + _root = new RootContentTreeNode + { + ChildrenIndent = 0 + }; _root.Expand(true); + foreach (var project in Editor.ContentDatabase.Projects) AddFolder2Root(project); + Editor.ContentDatabase.Game?.Expand(true); _tree.Margin = new Margin(0.0f, 0.0f, -16.0f, 2.0f); // Hide root node _tree.AddChild(_root); diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index 858f0e0ba..2968b0645 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -255,16 +255,20 @@ namespace FlaxEditor.Windows // Viewport Brightness { var brightness = menu.AddButton("Viewport Brightness"); - var brightnessValue = new FloatValueBox(_viewport.Brightness, 140, 2, 50.0f, 0.001f, 10.0f, 0.001f); - brightnessValue.Parent = brightness; + var brightnessValue = new FloatValueBox(_viewport.Brightness, 140, 2, 50.0f, 0.001f, 10.0f, 0.001f) + { + Parent = brightness + }; brightnessValue.ValueChanged += () => _viewport.Brightness = brightnessValue.Value; } // Viewport Resolution { var resolution = menu.AddButton("Viewport Resolution"); - var resolutionValue = new FloatValueBox(_viewport.ResolutionScale, 140, 2, 50.0f, 0.1f, 4.0f, 0.001f); - resolutionValue.Parent = resolution; + var resolutionValue = new FloatValueBox(_viewport.ResolutionScale, 140, 2, 50.0f, 0.1f, 4.0f, 0.001f) + { + Parent = resolution + }; resolutionValue.ValueChanged += () => _viewport.ResolutionScale = resolutionValue.Value; } diff --git a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs index b6756b438..4327173bc 100644 --- a/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs +++ b/Source/Editor/Windows/SceneTreeWindow.ContextMenu.cs @@ -29,8 +29,10 @@ namespace FlaxEditor.Windows // Create popup - var contextMenu = new ContextMenu(); - contextMenu.MinimumWidth = 120; + var contextMenu = new ContextMenu + { + MinimumWidth = 120 + }; // Expand/collapse diff --git a/Source/Editor/Windows/VisualScriptDebuggerWindow.cs b/Source/Editor/Windows/VisualScriptDebuggerWindow.cs index 897f30552..b9f20ff2f 100644 --- a/Source/Editor/Windows/VisualScriptDebuggerWindow.cs +++ b/Source/Editor/Windows/VisualScriptDebuggerWindow.cs @@ -119,8 +119,11 @@ namespace FlaxEditor.Windows private void OnTreeRightClick(TreeNode treeNode, Vector2 location) { - var menu = new ContextMenu(); - menu.Tag = treeNode.Tag; + var menu = new ContextMenu + { + Tag = treeNode.Tag + }; + menu.AddButton("Show node", button => { var node = Node.GetNode(button.ParentContextMenu.Tag); diff --git a/Source/Engine/Core/Math/Int3.cs b/Source/Engine/Core/Math/Int3.cs index 432614e40..7b04cf094 100644 --- a/Source/Engine/Core/Math/Int3.cs +++ b/Source/Engine/Core/Math/Int3.cs @@ -519,8 +519,7 @@ namespace FlaxEngine /// The clamped value. public static Int3 Clamp(Int3 value, Int3 min, Int3 max) { - Int3 result; - Clamp(ref value, ref min, ref max, out result); + Clamp(ref value, ref min, ref max, out Int3 result); return result; } @@ -718,8 +717,7 @@ namespace FlaxEngine /// A vector containing the smallest components of the source vectors. public static Int3 Min(Int3 left, Int3 right) { - Int3 result; - Min(ref left, ref right, out result); + Min(ref left, ref right, out Int3 result); return result; } diff --git a/Source/Engine/Core/Math/Int4.cs b/Source/Engine/Core/Math/Int4.cs index 1a09eaebb..0617f7b71 100644 --- a/Source/Engine/Core/Math/Int4.cs +++ b/Source/Engine/Core/Math/Int4.cs @@ -504,8 +504,7 @@ namespace FlaxEngine /// The clamped value. public static Int4 Clamp(Int4 value, Int4 min, Int4 max) { - Int4 result; - Clamp(ref value, ref min, ref max, out result); + Clamp(ref value, ref min, ref max, out Int4 result); return result; } @@ -534,8 +533,7 @@ namespace FlaxEngine /// A vector containing the largest components of the source vectors. public static Int4 Max(Int4 left, Int4 right) { - Int4 result; - Max(ref left, ref right, out result); + Max(ref left, ref right, out Int4 result); return result; } @@ -564,8 +562,7 @@ namespace FlaxEngine /// A vector containing the smallest components of the source vectors. public static Int4 Min(Int4 left, Int4 right) { - Int4 result; - Min(ref left, ref right, out result); + Min(ref left, ref right, out Int4 result); return result; } diff --git a/Source/Engine/Core/Math/Matrix3x3.cs b/Source/Engine/Core/Math/Matrix3x3.cs index c18edc31e..52775c229 100644 --- a/Source/Engine/Core/Math/Matrix3x3.cs +++ b/Source/Engine/Core/Math/Matrix3x3.cs @@ -697,8 +697,7 @@ namespace FlaxEngine /// The sum of the two matrices. public static Matrix3x3 Add(Matrix3x3 left, Matrix3x3 right) { - Matrix3x3 result; - Add(ref left, ref right, out result); + Add(ref left, ref right, out Matrix3x3 result); return result; } @@ -729,8 +728,7 @@ namespace FlaxEngine /// The difference between the two matrices. public static Matrix3x3 Subtract(Matrix3x3 left, Matrix3x3 right) { - Matrix3x3 result; - Subtract(ref left, ref right, out result); + Subtract(ref left, ref right, out Matrix3x3 result); return result; } @@ -761,8 +759,7 @@ namespace FlaxEngine /// The scaled Matrix3x3. public static Matrix3x3 Multiply(Matrix3x3 left, float right) { - Matrix3x3 result; - Multiply(ref left, right, out result); + Multiply(ref left, right, out Matrix3x3 result); return result; } @@ -797,8 +794,7 @@ namespace FlaxEngine /// The product of the two matrices. public static Matrix3x3 Multiply(Matrix3x3 left, Matrix3x3 right) { - Matrix3x3 result; - Multiply(ref left, ref right, out result); + Multiply(ref left, ref right, out Matrix3x3 result); return result; } @@ -831,8 +827,7 @@ namespace FlaxEngine /// The scaled Matrix3x3. public static Matrix3x3 Divide(Matrix3x3 left, float right) { - Matrix3x3 result; - Divide(ref left, right, out result); + Divide(ref left, right, out Matrix3x3 result); return result; } @@ -863,8 +858,7 @@ namespace FlaxEngine /// The quotient of the two matrices. public static Matrix3x3 Divide(Matrix3x3 left, Matrix3x3 right) { - Matrix3x3 result; - Divide(ref left, ref right, out result); + Divide(ref left, ref right, out Matrix3x3 result); return result; } @@ -923,8 +917,7 @@ namespace FlaxEngine /// Thrown when the is negative. public static Matrix3x3 Exponent(Matrix3x3 value, int exponent) { - Matrix3x3 result; - Exponent(ref value, exponent, out result); + Exponent(ref value, exponent, out Matrix3x3 result); return result; } @@ -953,8 +946,7 @@ namespace FlaxEngine /// The negated Matrix3x3. public static Matrix3x3 Negate(Matrix3x3 value) { - Matrix3x3 result; - Negate(ref value, out result); + Negate(ref value, out Matrix3x3 result); return result; } @@ -993,8 +985,7 @@ namespace FlaxEngine /// public static Matrix3x3 Lerp(Matrix3x3 start, Matrix3x3 end, float amount) { - Matrix3x3 result; - Lerp(ref start, ref end, amount, out result); + Lerp(ref start, ref end, amount, out Matrix3x3 result); return result; } @@ -1020,8 +1011,7 @@ namespace FlaxEngine /// The cubic interpolation of the two matrices. public static Matrix3x3 SmoothStep(Matrix3x3 start, Matrix3x3 end, float amount) { - Matrix3x3 result; - SmoothStep(ref start, ref end, amount, out result); + SmoothStep(ref start, ref end, amount, out Matrix3x3 result); return result; }