Texture inheritance for materials, also script access

This commit is contained in:
Simon Lübeß
2025-03-01 00:03:38 +01:00
parent 824c19c0b2
commit b5088329f5
13 changed files with 470 additions and 82 deletions
@@ -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>