Add ability to not inherit properties

This commit is contained in:
Jarrod Doyle 2024-09-29 10:09:09 +01:00
parent 46fe99bbfc
commit bd72554b9a
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
2 changed files with 6 additions and 4 deletions

View File

@ -106,7 +106,8 @@ public class ObjectHierarchy
AddProp<PropSpotlight>("P$Spotlight");
}
public T GetProperty<T>(int objectId, string propName) where T : Property
// TODO: Work out if there's some nice way to automatically decide if we inherit
public T GetProperty<T>(int objectId, string propName, bool inherit = true) where T : Property
{
if (!_objects.ContainsKey(objectId))
{
@ -122,7 +123,7 @@ public class ObjectHierarchy
}
var prop = obj.GetProperty<T>(propName);
if (prop != null)
if (prop != null || !inherit)
{
return prop;
}

View File

@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Numerics;
using KeepersCompound.LGS;
using KeepersCompound.LGS.Database;
@ -132,7 +132,8 @@ class Program
{
// TODO: Handle PropSpotlightAndAmbient
var id = (int)brush.brushInfo;
var propLight = hierarchy.GetProperty<PropLight>(id, "P$Light");
var propAnimLight = hierarchy.GetProperty<PropAnimLight>(id, "P$AnimLight", false);
var propLight = hierarchy.GetProperty<PropLight>(id, "P$Light", false);
var propLightColor = hierarchy.GetProperty<PropLightColor>(id, "P$LightColo");
var propSpotlight = hierarchy.GetProperty<PropSpotlight>(id, "P$Spotlight");
var propModelname = hierarchy.GetProperty<PropLabel>(id, "P$ModelName");