Add ability to not inherit properties
This commit is contained in:
parent
46fe99bbfc
commit
bd72554b9a
|
@ -106,7 +106,8 @@ public class ObjectHierarchy
|
||||||
AddProp<PropSpotlight>("P$Spotlight");
|
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))
|
if (!_objects.ContainsKey(objectId))
|
||||||
{
|
{
|
||||||
|
@ -122,7 +123,7 @@ public class ObjectHierarchy
|
||||||
}
|
}
|
||||||
|
|
||||||
var prop = obj.GetProperty<T>(propName);
|
var prop = obj.GetProperty<T>(propName);
|
||||||
if (prop != null)
|
if (prop != null || !inherit)
|
||||||
{
|
{
|
||||||
return prop;
|
return prop;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
using KeepersCompound.LGS;
|
using KeepersCompound.LGS;
|
||||||
using KeepersCompound.LGS.Database;
|
using KeepersCompound.LGS.Database;
|
||||||
|
@ -132,7 +132,8 @@ class Program
|
||||||
{
|
{
|
||||||
// TODO: Handle PropSpotlightAndAmbient
|
// TODO: Handle PropSpotlightAndAmbient
|
||||||
var id = (int)brush.brushInfo;
|
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 propLightColor = hierarchy.GetProperty<PropLightColor>(id, "P$LightColo");
|
||||||
var propSpotlight = hierarchy.GetProperty<PropSpotlight>(id, "P$Spotlight");
|
var propSpotlight = hierarchy.GetProperty<PropSpotlight>(id, "P$Spotlight");
|
||||||
var propModelname = hierarchy.GetProperty<PropLabel>(id, "P$ModelName");
|
var propModelname = hierarchy.GetProperty<PropLabel>(id, "P$ModelName");
|
||||||
|
|
Loading…
Reference in New Issue