public static void SavePreset(bool[] pScenes = null, string name = "preset name") { Traverse trav = Traverse.Create(phIBL); ReflectionProbe probe = trav.Field("probeComponent").GetValue <ReflectionProbe>(); int selectedUserLut = trav.Field("selectedUserLut").GetValue <int>(); PHIBL.PostProcessing.Utilities.PostProcessingController PPCtrl_obj = trav.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>(); PresetInfo preset = new PresetInfo { name = name, scenes = pScenes, profile = phIBL.Snapshot(), nipples = trav.Field("nippleSSS").GetValue <float>(), shadowDistance = QualitySettings.shadowDistance, reflectionBounces = RenderSettings.reflectionBounces, probeResolution = probe.resolution, probeIntensity = probe.intensity, enabledLUT = PPCtrl_obj.enableUserLut, selectedLUT = selectedUserLut, contributionLUT = PPCtrl_obj.userLut.contribution, enableDithering = PPCtrl_obj.enableDither }; File.WriteAllBytes(Directory.GetCurrentDirectory() + "\\Plugins\\PHIBL_PresetLoad\\presets\\" + name + ".preset", LZ4MessagePackSerializer.Serialize(preset, CustomCompositeResolver.Instance)); SetupPresets(); Console.WriteLine("[PHIBL_PresetLoad] Saved preset: " + name); }
public static void LoadPreset(int presetID = -1) { PresetInfo preset = presets.ElementAtOrDefault(presetID); if (preset == null) { return; } Profile profile = preset.profile; float nipples = preset.nipples; Traverse traverse = Traverse.Create(phIBL); traverse.Method("LoadPostProcessingProfile", profile).GetValue(); DeferredShadingUtils deferredShading = traverse.Field("deferredShading").GetValue <DeferredShadingUtils>(); PHIBL.AlloyDeferredRendererPlus SSSSS = deferredShading.SSSSS; Traverse trav = Traverse.Create(SSSSS); trav.Field("TransmissionSettings").SetValue(profile.TransmissionSettings); trav.Field("SkinSettings").SetValue(profile.SkinSettings); trav.Method("Reset").GetValue(); traverse.Field("phong").SetValue(profile.phong); traverse.Field("edgelength").SetValue(profile.edgeLength); DeferredShadingUtils.SetTessellation(profile.phong, profile.edgeLength); traverse.Field("nippleSSS").SetValue(nipples); Shader.SetGlobalFloat(Shader.PropertyToID("_AlphaSSS"), nipples); QualitySettings.shadowDistance = preset.shadowDistance; RenderSettings.reflectionBounces = preset.reflectionBounces; ReflectionProbe probe = traverse.Field("probeComponent").GetValue <ReflectionProbe>(); probe.resolution = preset.probeResolution; probe.intensity = preset.probeIntensity; PHIBL.PostProcessing.Utilities.PostProcessingController PPCtrl_obj = traverse.Field("PPCtrl").GetValue <PHIBL.PostProcessing.Utilities.PostProcessingController>(); PPCtrl_obj.enableDither = preset.enableDithering; Console.WriteLine("[PHIBL_PresetLoad] Loaded preset: " + presets[presetID].name); }