/// <summary> /// Set IES Object for Point, Spot or Rectangular light. /// </summary> /// <param name="light">The light to modify.</param> /// <param name="profile">The IES profile to set.</param> public static void SetIESProfile(Light light, IESObject profile) { if (!light.TryGetComponent <HDAdditionalLightData>(out var additionalData)) { return; } string guid; long localID; AssetDatabase.TryGetGUIDAndLocalFileIdentifier(profile, out guid, out localID); string path = AssetDatabase.GUIDToAssetPath(guid); UnityEngine.Object[] textures = AssetDatabase.LoadAllAssetRepresentationsAtPath(path); foreach (var subAsset in textures) { if (AssetDatabase.IsSubAsset(subAsset) && subAsset.name.EndsWith("-Cube-IES")) { additionalData.IESPoint = subAsset as Texture; } else if (AssetDatabase.IsSubAsset(subAsset) && subAsset.name.EndsWith("-2D-IES")) { additionalData.IESSpot = subAsset as Texture; } } }
public static T Cast <T>(this IESObject obj) { try { return((T)obj); } catch (Exception e) { throw new InvalidOperationException(obj.ToString(), e); } }
public static IESObject[] ToVirtuals(object[] objs, int count) { if (count == 0) { return(_0Vtrs); } var arr = new IESObject[count]; if (objs == null || objs.Length == 0) { return(arr); } var len = Math.Min(objs.Length, count); for (var i = 0; i < len; i++) { arr[i] = ToVirtual(objs[i]); } return(arr); }
public void SetValue(IESObject value) { _table[_key] = value; }
IESObject IESIndex.this[IESObject index] { get { return(GetValue <IESIndex>()[index]); } set { GetValue <IESIndex>()[index] = value; } }
public void SetValue(ESDomain domain, IESObject value) { GetProperty(domain).SetValue(value); }
public static float GetNumber(this IESObject obj) { return(obj.Cast <IESNumber>().Value); }
public static int GetInteger(this IESObject obj) { return(obj.Cast <IESInteger>().Value); }
public EIL(ILType type, IESObject target) { this.type = type; this.target = target; }
public void SetValue(ESDomain domain, IESObject value) { domain.SetValue(_value, value); }
public void SetValue(IESObject value) { _value = value.ToObject(); }
public void SetValue(ESDomain domain, IESObject value) { _target.GetValue <IESIndex>(domain)[_value.GetValue(domain)] = value; }
public void SetValue(ESContext context, IESObject value) { _target.GetValue <IESIndex>(context)[_value.GetValue(context)] = value; }
public void SetValue(ESContext context, IESObject value) { context.SetValue(_value, value); }
public void SetValue(IESObject value) { SetValue(value.ToObject()); }
public void SetValue(ESContext context, IESObject value) { GetProperty(context).SetValue(value); }
public static T Cast <T>(this IESObject obj) { return((T)obj); }
public static string GetString(this IESObject obj) { return(obj.Cast <IESString>().Value); }
public EIL(string name, ILType type, IESObject target) { this.name = name; this.type = type; this.target = target; }