Added EditorFlags: Hide entities in hierarchy and editor scene

- Also some Style changes
This commit is contained in:
Simon Lübeß
2024-03-10 12:21:20 +01:00
parent 5ca5404f72
commit 8d92822845
15 changed files with 242 additions and 40 deletions
+20
View File
@@ -0,0 +1,20 @@
namespace GlitchyEngine.Editor;
/// <summary>
/// Flags to controls the visibility of the entity in the editor and how it can be interacted with for editing.
/// </summary>
public enum EditorFlags : byte
{
/// <summary>
/// The default behaviour: The entity is visible in the hierarchy and in the scene, and can be interacted with.
/// </summary>
Default = 0,
/// <summary>
/// The entity is hidden in the hierarchy.
/// </summary>
HideInHierarchy = 1,
/// <summary>
/// The entity is hidden in the scene.
/// </summary>
HideInScene = 2,
}
+14
View File
@@ -7,6 +7,7 @@ using GlitchyEngine.Core;
using GlitchyEngine.Extensions;
using GlitchyEngine.Physics;
using System.Diagnostics.CodeAnalysis;
using GlitchyEngine.Editor;
namespace GlitchyEngine;
@@ -23,6 +24,19 @@ public class Entity : EngineObject
get => ScriptGlue.Entity_GetName(_uuid);
set => ScriptGlue.Entity_SetName(_uuid, value);
}
/// <summary>
/// Gets or sets the <see cref="EditorFlags"/> of the <see cref="Entity"/>, which specify how the <see cref="Entity"/> is displayed and interacted with in the editor.
/// </summary>
public EditorFlags EditorFlags
{
get
{
ScriptGlue.Entity_GetEditorFlags(_uuid, out EditorFlags flags);
return flags;
}
set => ScriptGlue.Entity_SetEditorFlags(_uuid, value);
}
/// <summary>
/// Only to be called by the engine. Don't call this constructor yourself, it will not result in a valid <see cref="Entity"/>.
+7
View File
@@ -2,6 +2,7 @@ using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using GlitchyEngine.Core;
using GlitchyEngine.Editor;
using GlitchyEngine.Math;
using GlitchyEngine.Physics;
using GlitchyEngine.Serialization;
@@ -64,6 +65,12 @@ internal static class ScriptGlue
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern string Entity_SetName(UUID entityId, string name);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void Entity_GetEditorFlags(UUID uuid, out EditorFlags flags);
[MethodImpl(MethodImplOptions.InternalCall)]
public static extern void Entity_SetEditorFlags(UUID uuid, EditorFlags editorFlags);
#endregion Entity