mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Texture inheritance for materials, also script access
This commit is contained in:
@@ -51,6 +51,43 @@ public static class ActivatorExtension
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the given type inheriting from engine object and sets it's id.
|
||||
/// </summary>
|
||||
/// <param name="engineObjectType">The type of the engine object.</param>
|
||||
/// <param name="objectId">The objects id.</param>
|
||||
/// <returns>An instance of the engine object type; or <see langword="null"/> if the creation failed.</returns>
|
||||
internal static EngineObject? CreateEngineObject(Type engineObjectType, UUID objectId)
|
||||
{
|
||||
EngineObject? engineObject = (EngineObject?)CreateInstanceSafe(engineObjectType);
|
||||
|
||||
if (engineObject != null)
|
||||
engineObject._uuid = objectId;
|
||||
|
||||
return engineObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the given type inheriting from engine object and sets it's id.
|
||||
/// </summary>
|
||||
/// <param name="engineObjectType">The type of the engine object.</param>
|
||||
/// <param name="objectId">The objects id.</param>
|
||||
/// <returns>An instance of the engine object type; or <see langword="null"/> if the creation failed.</returns>
|
||||
internal static T? CreateEngineObject<T>(Type engineObjectType, UUID objectId) where T : EngineObject
|
||||
{
|
||||
if (!typeof(T).IsAssignableFrom(engineObjectType))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
EngineObject? engineObject = (EngineObject?)CreateInstanceSafe(engineObjectType);
|
||||
|
||||
if (engineObject != null)
|
||||
engineObject._uuid = objectId;
|
||||
|
||||
return (T?)engineObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of the given component type and sets it's entities id.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using GlitchyEngine.Core;
|
||||
using GlitchyEngine.Math;
|
||||
using ImGuiNET;
|
||||
|
||||
@@ -74,6 +75,11 @@ public static class ImGuiExtension
|
||||
ScriptGlue.ImGuiExtension_ListElementGrabber();
|
||||
}
|
||||
|
||||
public static bool ShowAssetDropTarget(ref UUID uuid)
|
||||
{
|
||||
return ScriptGlue.ImGuiExtension_ShowAssetDropTarget(ref uuid);
|
||||
}
|
||||
|
||||
public static bool Checkbox2(string label, ref bool2 value) => CheckboxN(2, label, ref value.X);
|
||||
public static bool Checkbox3(string label, ref bool3 value) => CheckboxN(3, label, ref value.X);
|
||||
public static bool Checkbox4(string label, ref bool4 value) => CheckboxN(4, label, ref value.X);
|
||||
|
||||
Reference in New Issue
Block a user