public LightsSerializationData LightsSerializ() { LightsSerializationData lightsSerializationData = new LightsSerializationData(); Light[] allLights = UnityEngine.Object.FindObjectsOfType <Light>(); foreach (Light light in allLights) { lightsSerializationData.Serializ(light); } Dictionary <TreeNodeObject, ObjectCtrlInfo> dicInfo = Singleton <Studio.Studio> .Instance.dicInfo; foreach (KeyValuePair <TreeNodeObject, ObjectCtrlInfo> kvp in dicInfo) { if (kvp.Value != null && kvp.Key != null) { if (kvp.Value is OCILight) { OCILight value = kvp.Value as OCILight; lightsSerializationData.Serializ(value.light, value); } } } return(lightsSerializationData); }
static bool Prefix(OCILight __instance, Color _color) { __instance.lightInfo.color = _color; __instance.light.GetComponent <AlloyAreaLight>().Color = __instance.lightInfo.color; if (__instance.lightColor) { __instance.lightColor.color = __instance.lightInfo.color; } return(false); }
public static void AddToTrack(OCILight objctrl) { var l = new Light(objctrl); var newid = ResolveID("light", l, AllProps); if (newid != null) { var tagfld = Folder.add(SceneFolders.light_folder_prefix + newid); l.set_parent(tagfld); } }
static bool Prefix(OCILight __instance, ref bool __result, float _value, bool _force = false) { if (!Utility.SetStruct(ref __instance.lightInfo.intensity, _value) && !_force) { __result = false; return(false); } if (__instance.light) { __instance.light.GetComponent <AlloyAreaLight>().Intensity = __instance.lightInfo.intensity; } __result = true; return(false); }
static bool Studio_AddLight_Prefix(Studio.Studio __instance, int _no) { var instance = Traverse.Create(__instance); OCILight ocilight = Studio.AddObjectLight.Add(_no); Singleton <UndoRedoManager> .Instance.Clear(); if (Studio.Studio.optionSystem.autoHide) { RootButtonCtrl ctrl = instance.Property <RootButtonCtrl>("rootButtonCtrl").Value; ctrl.OnClick(-1); } if (Studio.Studio.optionSystem.autoSelect && ocilight != null) { TreeNodeCtrl ctrl = instance.Field("m_TreeNodeCtrl").GetValue <TreeNodeCtrl>(); ctrl.SelectSingle(ocilight.treeNodeObject, true); } Graphics.Instance?.LightManager?.Light(); return(false); }
public static void AddLightCullingMask(OCILight __result) { __result.light.cullingMask |= charaLayer; }
public static Light create_from(OCILight objctrl) { return(new Light(objctrl)); }
public void Deserializ(Light light, int index, OCILight ocLight = null) { light.transform.localPosition = ToVector3(transform_localPosition[index]); light.transform.eulerAngles = ToVector3(transform_eulerAngles[index]); light.transform.localEulerAngles = ToVector3(transform_localEulerAngles[index]); light.transform.right = ToVector3(transform_right[index]); light.transform.up = ToVector3(transform_up[index]); light.transform.forward = ToVector3(transform_forward[index]); light.transform.rotation = ToQuaternion(transform_rotation[index]); light.transform.position = ToVector3(transform_position[index]); light.transform.localRotation = ToQuaternion(transform_localRotation[index]); light.transform.localScale = ToVector3(transform_localScale[index]); light.enabled = (int.Parse(enabled[index]) == 1); light.name = name[index]; light.range = float.Parse(range[index]); light.spotAngle = float.Parse(spotAngle[index]); light.cookieSize = float.Parse(cookieSize[index]); light.renderMode = (LightRenderMode)(int.Parse(renderMode[index])); light.bakedIndex = int.Parse(bakedIndex[index]); light.cullingMask = int.Parse(cullingMask[index]); light.shadowNearPlane = float.Parse(shadowNearPlane[index]); light.shadowBias = float.Parse(shadowBias[index]); light.shadowNormalBias = float.Parse(shadowNormalBias[index]); light.color = ToColor(color[index]); light.intensity = float.Parse(intensity[index]); light.bounceIntensity = float.Parse(bounceIntensity[index]); light.type = (LightType)(int.Parse(type[index])); light.shadowStrength = float.Parse(shadowStrength[index]); light.shadowResolution = (LightShadowResolution)(int.Parse(shadowResolution[index])); light.shadowCustomResolution = int.Parse(shadowCustomResolution[index]); light.shadows = (LightShadows)(int.Parse(shadows[index])); AlloyAreaLight alloyAreaLight = light.GetComponent <AlloyAreaLight>(); if (alloyAreaLight != null) { alloyAreaLight.transform.localPosition = ToVector3(alloy_transform_localPosition[index]); alloyAreaLight.transform.eulerAngles = ToVector3(alloy_transform_eulerAngles[index]); alloyAreaLight.transform.localEulerAngles = ToVector3(alloy_transform_localEulerAngles[index]); alloyAreaLight.transform.right = ToVector3(alloy_transform_right[index]); alloyAreaLight.transform.up = ToVector3(alloy_transform_up[index]); alloyAreaLight.transform.forward = ToVector3(alloy_transform_forward[index]); alloyAreaLight.transform.rotation = ToQuaternion(alloy_transform_rotation[index]); alloyAreaLight.transform.position = ToVector3(alloy_transform_position[index]); alloyAreaLight.transform.localRotation = ToQuaternion(alloy_transform_localRotation[index]); alloyAreaLight.transform.localScale = ToVector3(alloy_transform_localScale[index]); alloyAreaLight.enabled = (int.Parse(alloy_enabled[index]) == 1); alloyAreaLight.Radius = float.Parse(alloy_Radius[index]); alloyAreaLight.Length = float.Parse(alloy_Length[index]); alloyAreaLight.Intensity = float.Parse(alloy_Intensity[index]); alloyAreaLight.Color = ToColor(alloy_Color[index]); alloyAreaLight.HasSpecularHighlight = (int.Parse(alloy_HasSpecularHighlight[index]) == 1); alloyAreaLight.IsAnimatedByClip = (int.Parse(alloy_IsAnimatedByClip[index]) == 1); } if (ocLight != null) { ocLight.lightTarget = (Info.LightLoadInfo.Target)(int.Parse(oc_lightTarget[index])); ocLight.lightInfo.color = ToColor(ocinfo_color[index]); ocLight.lightInfo.intensity = float.Parse(ocinfo_intensity[index]); ocLight.lightInfo.range = float.Parse(ocinfo_range[index]); ocLight.lightInfo.spotAngle = float.Parse(ocinfo_spotAngle[index]); ocLight.lightInfo.shadow = (int.Parse(ocinfo_shadow[index]) == 1); ocLight.lightInfo.enable = (int.Parse(ocinfo_enable[index]) == 1); ocLight.lightInfo.drawTarget = (int.Parse(ocinfo_drawTarget[index]) == 1); } }
public void Serializ(Light light, OCILight ocLight = null) { hierarchyPath.Add(GetHierarchyPath(light)); transform_localPosition.Add(ToString(light.transform.localPosition)); transform_eulerAngles.Add(ToString(light.transform.eulerAngles)); transform_localEulerAngles.Add(ToString(light.transform.localEulerAngles)); transform_right.Add(ToString(light.transform.right)); transform_up.Add(ToString(light.transform.up)); transform_forward.Add(ToString(light.transform.forward)); transform_rotation.Add(ToString(light.transform.rotation)); transform_position.Add(ToString(light.transform.position)); transform_localRotation.Add(ToString(light.transform.localRotation)); transform_localScale.Add(ToString(light.transform.localScale)); enabled.Add(Convert.ToInt32(light.enabled).ToString()); hashCode.Add(light.GetHashCode().ToString()); instanceId.Add(light.GetInstanceID().ToString()); name.Add(light.name); range.Add(light.range.ToString()); spotAngle.Add(light.spotAngle.ToString()); cookieSize.Add(light.cookieSize.ToString()); renderMode.Add(((int)(light.renderMode)).ToString()); bakedIndex.Add(light.bakedIndex.ToString()); cullingMask.Add(light.cullingMask.ToString()); shadowNearPlane.Add(light.shadowNearPlane.ToString()); shadowBias.Add(light.shadowBias.ToString()); shadowNormalBias.Add(light.shadowNormalBias.ToString()); color.Add(ToString(light.color)); intensity.Add(light.intensity.ToString()); bounceIntensity.Add(light.bounceIntensity.ToString()); type.Add(((int)(light.type)).ToString()); shadowStrength.Add(light.shadowStrength.ToString()); shadowResolution.Add(((int)(light.shadowResolution)).ToString()); shadowCustomResolution.Add(light.shadowCustomResolution.ToString()); shadows.Add(((int)(light.shadows)).ToString()); AlloyAreaLight alloyAreaLight = light.GetComponent <AlloyAreaLight>(); if (alloyAreaLight != null) { alloy_transform_localPosition.Add(ToString(alloyAreaLight.transform.localPosition)); alloy_transform_eulerAngles.Add(ToString(alloyAreaLight.transform.eulerAngles)); alloy_transform_localEulerAngles.Add(ToString(alloyAreaLight.transform.localEulerAngles)); alloy_transform_right.Add(ToString(alloyAreaLight.transform.right)); alloy_transform_up.Add(ToString(alloyAreaLight.transform.up)); alloy_transform_forward.Add(ToString(alloyAreaLight.transform.forward)); alloy_transform_rotation.Add(ToString(alloyAreaLight.transform.rotation)); alloy_transform_position.Add(ToString(alloyAreaLight.transform.position)); alloy_transform_localRotation.Add(ToString(alloyAreaLight.transform.localRotation)); alloy_transform_localScale.Add(ToString(alloyAreaLight.transform.localScale)); alloy_enabled.Add(Convert.ToInt32(alloyAreaLight.enabled).ToString()); alloy_Radius.Add(alloyAreaLight.Radius.ToString()); alloy_Length.Add(alloyAreaLight.Length.ToString()); alloy_Intensity.Add(alloyAreaLight.Intensity.ToString()); alloy_Color.Add(ToString(alloyAreaLight.Color)); alloy_HasSpecularHighlight.Add(Convert.ToInt32(alloyAreaLight.HasSpecularHighlight).ToString()); alloy_IsAnimatedByClip.Add(Convert.ToInt32(alloyAreaLight.IsAnimatedByClip).ToString()); } else { alloy_transform_localPosition.Add(""); alloy_transform_eulerAngles.Add(""); alloy_transform_localEulerAngles.Add(""); alloy_transform_right.Add(""); alloy_transform_up.Add(""); alloy_transform_forward.Add(""); alloy_transform_rotation.Add(""); alloy_transform_position.Add(""); alloy_transform_localRotation.Add(""); alloy_transform_localScale.Add(""); alloy_enabled.Add(""); alloy_Radius.Add(""); alloy_Length.Add(""); alloy_Intensity.Add(""); alloy_Color.Add(""); alloy_HasSpecularHighlight.Add(""); alloy_IsAnimatedByClip.Add(""); } if (ocLight != null) { hasStudio.Add(Convert.ToInt32(true).ToString()); oc_lightTarget.Add(((int)(ocLight.lightTarget)).ToString()); ocinfo_color.Add(ToString(ocLight.lightInfo.color)); ocinfo_intensity.Add(ocLight.lightInfo.intensity.ToString()); ocinfo_range.Add(ocLight.lightInfo.range.ToString()); ocinfo_spotAngle.Add(ocLight.lightInfo.spotAngle.ToString()); ocinfo_shadow.Add(Convert.ToInt32(ocLight.lightInfo.shadow).ToString()); ocinfo_enable.Add(Convert.ToInt32(ocLight.lightInfo.enable).ToString()); ocinfo_drawTarget.Add(Convert.ToInt32(ocLight.lightInfo.drawTarget).ToString()); } else { hasStudio.Add(Convert.ToInt32(false).ToString()); oc_lightTarget.Add(""); ocinfo_color.Add(""); ocinfo_intensity.Add(""); ocinfo_range.Add(""); ocinfo_spotAngle.Add(""); ocinfo_shadow.Add(""); ocinfo_enable.Add(""); ocinfo_drawTarget.Add(""); } }
public Light(OCILight objctrl) : base(objctrl) { this.objctrl = objctrl; }
public IEnumerator LightsDeserializ(LightsSerializationData lightsSerializationData) { yield return(new WaitForSeconds(2f)); var scene = Singleton <Studio.Scene> .Instance; var phibl = UnityEngine.Object.FindObjectOfType <PHIBL.PHIBL>(); Type type = phibl.GetType(); FieldInfo field = type.GetField("IsLoading", BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); bool IsLoading = (bool)(field.GetValue(phibl)); while (scene.isNowLoading || IsLoading) { yield return(new WaitForEndOfFrame()); } Light[] allLights = UnityEngine.Object.FindObjectsOfType <Light>(); Dictionary <TreeNodeObject, ObjectCtrlInfo> dicInfo = Singleton <Studio.Studio> .Instance.dicInfo; List <Light> deserialized = new List <Light>(); for (int i = 0; i < lightsSerializationData.name.Count(); i++) { if (int.Parse(lightsSerializationData.hasStudio[i]) == 1) { foreach (KeyValuePair <TreeNodeObject, ObjectCtrlInfo> kvp in dicInfo) { if (kvp.Value != null && kvp.Key != null) { if (kvp.Value is OCILight) { OCILight value = kvp.Value as OCILight; if (deserialized.Contains(value.light) == false && lightsSerializationData.name[i] == value.light.name && (LightType)(int.Parse(lightsSerializationData.type[i])) == value.light.type && lightsSerializationData.hierarchyPath[i] == LightsSerializationData.GetHierarchyPath(value.light) && LightsSerializationData.ToVector3(lightsSerializationData.transform_position[i]) == value.light.transform.position && LightsSerializationData.ToVector3(lightsSerializationData.transform_localPosition[i]) == value.light.transform.localPosition ) { lightsSerializationData.Deserializ(value.light, i, value); deserialized.Add(value.light); break; } } } } } else { for (int j = 0; j < allLights.Length; j++) { if (deserialized.Contains(allLights[j]) == false && lightsSerializationData.name[i] == allLights[j].name && (LightType)(int.Parse(lightsSerializationData.type[i])) == allLights[j].type && lightsSerializationData.hierarchyPath[i] == LightsSerializationData.GetHierarchyPath(allLights[j]) && LightsSerializationData.ToVector3(lightsSerializationData.transform_position[i]) == allLights[j].transform.position && LightsSerializationData.ToVector3(lightsSerializationData.transform_localPosition[i]) == allLights[j].transform.localPosition ) { lightsSerializationData.Deserializ(allLights[j], i); deserialized.Add(allLights[j]); break; } } } } }
internal LightObject(OCILight ociLight) { _ociLight = ociLight; }
public static void PCSSInitialization(ref OCILight __result, OILightInfo _info, ObjectCtrlInfo _parent, TreeNodeObject _parentNode, bool _addInfo, int _initialPosition) { Graphics.Instance?.LightManager?.Light(); }
public void Do() { OCILight ociLight = AddObjectLight.Load(new OILightInfo(this.no, this.dicKey), (ObjectCtrlInfo)null, (TreeNodeObject)null, true, this.initialPosition); this.tno = ociLight == null ? (TreeNodeObject)null : ociLight.treeNodeObject; }