protected override SerializedHDReflectionProbe NewSerializedObject(SerializedObject so) { var additionalData = CoreEditorUtils.GetAdditionalData <HDAdditionalReflectionData>(so.targetObjects); var addSO = new SerializedObject(additionalData); return(new SerializedHDReflectionProbe(so, addSO)); }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); m_SerializedHDLight = new SerializedHDLight(m_AdditionalLightDatas, settings); // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed += () => { // Serialized object is lossing references after an undo if (m_SerializedHDLight.serializedObject.targetObject != null) { m_SerializedHDLight.serializedObject.ApplyModifiedProperties(); foreach (var hdLightData in m_AdditionalLightDatas) { if (hdLightData != null) { hdLightData.UpdateAreaLightEmissiveMesh(); } } } }; }
protected override void OnEnable() { var additionalData = CoreEditorUtils.GetAdditionalData <HDAdditionalReflectionData>(targets); m_AdditionalDataSerializedObject = new SerializedObject(additionalData); m_SerializedHDProbe = new SerializedHDReflectionProbe(serializedObject, m_AdditionalDataSerializedObject); foreach (var t in targets) { var p = (ReflectionProbe)t; s_ReflectionProbeEditors[p] = this; } base.OnEnable(); m_UIState.owner = this; m_UIState.Reset(m_SerializedHDProbe, Repaint); InitializeTargetProbe(); HDAdditionalReflectionData probe = (HDAdditionalReflectionData)m_AdditionalDataSerializedObject.targetObject; probe.influenceVolume.Init(probe); //unhide previously hidden components probe.hideFlags = HideFlags.None; }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); m_AdditionalShadowDatas = CoreEditorUtils.GetAdditionalData <AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData); m_SerializedHDLight = new SerializedHDLight(m_AdditionalLightDatas, m_AdditionalShadowDatas, settings); // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed += () => { m_SerializedHDLight.serializedLightDatas.ApplyModifiedProperties(); foreach (var hdLightData in m_AdditionalLightDatas) { if (hdLightData != null) { hdLightData.UpdateAreaLightEmissiveMesh(); } } }; // If the light is disabled in the editor we force the light upgrade from his inspector foreach (var additionalLightData in m_AdditionalLightDatas) { additionalLightData.UpgradeLight(); } }
public UniversalRenderPipelineSerializedCamera(SerializedObject serializedObject, CameraEditor.Settings settings) { this.serializedObject = serializedObject; projectionMatrixMode = serializedObject.FindProperty("m_projectionMatrixMode"); baseCameraSettings = settings; camerasAdditionalData = CoreEditorUtils .GetAdditionalData <UniversalAdditionalCameraData>(serializedObject.targetObjects); serializedAdditionalDataObject = new SerializedObject(camerasAdditionalData); // Common properties stopNaNs = serializedAdditionalDataObject.FindProperty("m_StopNaN"); dithering = serializedAdditionalDataObject.FindProperty("m_Dithering"); antialiasing = serializedAdditionalDataObject.FindProperty("m_Antialiasing"); volumeLayerMask = serializedAdditionalDataObject.FindProperty("m_VolumeLayerMask"); clearDepth = serializedAdditionalDataObject.FindProperty("m_ClearDepth"); // URP specific properties renderShadows = serializedAdditionalDataObject.FindProperty("m_RenderShadows"); renderDepth = serializedAdditionalDataObject.FindProperty("m_RequiresDepthTextureOption"); renderOpaque = serializedAdditionalDataObject.FindProperty("m_RequiresOpaqueTextureOption"); renderer = serializedAdditionalDataObject.FindProperty("m_RendererIndex"); volumeLayerMask = serializedAdditionalDataObject.FindProperty("m_VolumeLayerMask"); volumeTrigger = serializedAdditionalDataObject.FindProperty("m_VolumeTrigger"); renderPostProcessing = serializedAdditionalDataObject.FindProperty("m_RenderPostProcessing"); antialiasingQuality = serializedAdditionalDataObject.FindProperty("m_AntialiasingQuality"); cameraType = serializedAdditionalDataObject.FindProperty("m_CameraType"); cameras = serializedAdditionalDataObject.FindProperty("m_Cameras"); #if ENABLE_VR && ENABLE_XR_MODULE allowXRRendering = serializedAdditionalDataObject.FindProperty("m_AllowXRRendering"); #endif }
public SerializedHDCamera(SerializedObject serializedObject) { this.serializedObject = serializedObject; var additionals = CoreEditorUtils.GetAdditionalData <HDAdditionalCameraData>(serializedObject.targetObjects, HDAdditionalCameraData.InitDefaultHDAdditionalCameraData); serializedAdditionalDataObject = new SerializedObject(additionals); var hideFlags = serializedAdditionalDataObject.FindProperty("m_ObjectHideFlags"); // We don't hide additional camera data anymore on UX team request. To be compatible with already author scene we force to be visible //hideFlags.intValue = (int)HideFlags.HideInInspector; hideFlags.intValue = (int)HideFlags.None; serializedAdditionalDataObject.ApplyModifiedProperties(); //backgroundColor = serializedObject.FindProperty("m_BackGroundColor"); aperture = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.aperture); shutterSpeed = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.shutterSpeed); iso = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.iso); clearColorMode = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearColorMode); backgroundColorHDR = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.backgroundColorHDR); passThrough = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.fullscreenPassthrough); customRenderingSettings = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.customRenderingSettings); clearDepth = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearDepth); volumeLayerMask = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeLayerMask); volumeAnchorOverride = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeAnchorOverride); frameSettings = new SerializedFrameSettings(serializedAdditionalDataObject.FindProperty("m_FrameSettings")); baseCameraSettings = new CameraEditor.Settings(serializedObject); baseCameraSettings.OnEnable(); }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present var lightData = CoreEditorUtils.GetAdditionalData<HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); var shadowData = CoreEditorUtils.GetAdditionalData<AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData); m_SerializedAdditionalLightData = new SerializedObject(lightData); m_SerializedAdditionalShadowData = new SerializedObject(shadowData); using (var o = new PropertyFetcher<HDAdditionalLightData>(m_SerializedAdditionalLightData)) m_AdditionalLightData = new SerializedLightData { directionalIntensity = o.Find(x => x.directionalIntensity), punctualIntensity = o.Find(x => x.punctualIntensity), areaIntensity = o.Find(x => x.areaIntensity), enableSpotReflector = o.Find(x => x.enableSpotReflector), spotInnerPercent = o.Find(x => x.m_InnerSpotPercent), lightDimmer = o.Find(x => x.lightDimmer), volumetricDimmer = o.Find(x => x.volumetricDimmer), fadeDistance = o.Find(x => x.fadeDistance), affectDiffuse = o.Find(x => x.affectDiffuse), affectSpecular = o.Find(x => x.affectSpecular), nonLightmappedOnly = o.Find(x => x.nonLightmappedOnly), lightTypeExtent = o.Find(x => x.lightTypeExtent), spotLightShape = o.Find(x => x.spotLightShape), shapeWidth = o.Find(x => x.shapeWidth), shapeHeight = o.Find(x => x.shapeHeight), aspectRatio = o.Find(x => x.aspectRatio), shapeRadius = o.Find(x => x.shapeRadius), maxSmoothness = o.Find(x => x.maxSmoothness), applyRangeAttenuation = o.Find(x => x.applyRangeAttenuation), // Editor stuff useOldInspector = o.Find(x => x.useOldInspector), showFeatures = o.Find(x => x.featuresFoldout), showAdditionalSettings = o.Find(x => x.showAdditionalSettings) }; // TODO: Review this once AdditionalShadowData is refactored using (var o = new PropertyFetcher<AdditionalShadowData>(m_SerializedAdditionalShadowData)) m_AdditionalShadowData = new SerializedShadowData { dimmer = o.Find(x => x.shadowDimmer), fadeDistance = o.Find(x => x.shadowFadeDistance), resolution = o.Find(x => x.shadowResolution), viewBiasMin = o.Find(x => x.viewBiasMin), viewBiasMax = o.Find(x => x.viewBiasMax), viewBiasScale = o.Find(x => x.viewBiasScale), normalBiasMin = o.Find(x => x.normalBiasMin), normalBiasMax = o.Find(x => x.normalBiasMax), normalBiasScale = o.Find(x => x.normalBiasScale), sampleBiasScale = o.Find(x => x.sampleBiasScale), edgeLeakFixup = o.Find(x => x.edgeLeakFixup), edgeToleranceNormal = o.Find(x => x.edgeToleranceNormal), edgeTolerance = o.Find(x => x.edgeTolerance) }; }
public SerializedHDCamera(SerializedObject serializedObject) { this.serializedObject = serializedObject; projectionMatrixMode = serializedObject.FindProperty("m_projectionMatrixMode"); var additionals = CoreEditorUtils.GetAdditionalData <HDAdditionalCameraData>(serializedObject.targetObjects, HDAdditionalCameraData.InitDefaultHDAdditionalCameraData); serializedAdditionalDataObject = new SerializedObject(additionals); var hideFlags = serializedAdditionalDataObject.FindProperty("m_ObjectHideFlags"); // We don't hide additional camera data anymore on UX team request. To be compatible with already author scene we force to be visible if ((hideFlags.intValue & (int)HideFlags.HideInInspector) > 0) { hideFlags.intValue = (int)HideFlags.None; } serializedAdditionalDataObject.ApplyModifiedProperties(); //backgroundColor = serializedObject.FindProperty("m_BackGroundColor"); iso = serializedAdditionalDataObject.FindProperty("physicalParameters.m_Iso"); shutterSpeed = serializedAdditionalDataObject.FindProperty("physicalParameters.m_ShutterSpeed"); aperture = serializedAdditionalDataObject.FindProperty("physicalParameters.m_Aperture"); bladeCount = serializedAdditionalDataObject.FindProperty("physicalParameters.m_BladeCount"); curvature = serializedAdditionalDataObject.FindProperty("physicalParameters.m_Curvature"); barrelClipping = serializedAdditionalDataObject.FindProperty("physicalParameters.m_BarrelClipping"); anamorphism = serializedAdditionalDataObject.FindProperty("physicalParameters.m_Anamorphism"); antialiasing = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.antialiasing); SMAAQuality = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.SMAAQuality); taaSharpenStrength = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaSharpenStrength); taaQualityLevel = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.TAAQuality); taaHistorySharpening = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaHistorySharpening); taaAntiFlicker = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaAntiFlicker); taaMotionVectorRejection = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaMotionVectorRejection); taaAntiRinging = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.taaAntiHistoryRinging); taaQualityLevel = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.TAAQuality); dithering = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.dithering); stopNaNs = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.stopNaNs); clearColorMode = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearColorMode); backgroundColorHDR = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.backgroundColorHDR); xrRendering = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.xrRendering); passThrough = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.fullscreenPassthrough); customRenderingSettings = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.customRenderingSettings); clearDepth = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearDepth); volumeLayerMask = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeLayerMask); volumeAnchorOverride = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeAnchorOverride); frameSettings = new SerializedFrameSettings( serializedAdditionalDataObject.FindProperty("m_RenderingPathCustomFrameSettings"), serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.renderingPathCustomFrameSettingsOverrideMask) ); probeLayerMask = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.probeLayerMask); allowDynamicResolution = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.allowDynamicResolution); baseCameraSettings = new CameraEditor.Settings(serializedObject); baseCameraSettings.OnEnable(); }
public new void OnEnable() { m_LightweightRenderPipeline = GraphicsSettings.renderPipelineAsset as LightweightRenderPipelineAsset; CoreEditorUtils.GetAdditionalData <LWRPAdditionalCameraData>(targets); m_AdditionalCameraData = camera.gameObject.GetComponent <LWRPAdditionalCameraData>(); settings.OnEnable(); init(m_AdditionalCameraData); UpdateAnimationValues(true); }
void HideAdditionalComponents(bool visible) { var adds = CoreEditorUtils.GetAdditionalData <HDAdditionalReflectionData>(targets); var flags = visible ? HideFlags.None : HideFlags.HideInInspector; for (var i = 0; i < targets.Length; ++i) { var addData = adds[i]; addData.hideFlags = flags; } }
protected override void OnEnable() { if (lightProperty.type == LightType.Directional) { CoreEditorUtils.GetAdditionalData <LWRPAdditionalLightData>(targets, LWRPAdditionalLightData.InitDefaultHDAdditionalLightData); } m_AdditionalLightData = lightProperty.gameObject.GetComponent <LWRPAdditionalLightData>(); settings.OnEnable(); init(m_AdditionalLightData); UpdateShowOptions(true); }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); m_SerializedHDLight = new SerializedHDLight(m_AdditionalLightDatas, settings); // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed += OnUndoRedo; }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present var lightData = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets); var shadowData = CoreEditorUtils.GetAdditionalData <AdditionalShadowData>(targets); m_SerializedAdditionalLightData = new SerializedObject(lightData); m_SerializedAdditionalShadowData = new SerializedObject(shadowData); using (var o = new PropertyFetcher <HDAdditionalLightData>(m_SerializedAdditionalLightData)) m_AdditionalLightData = new SerializedLightData { spotInnerPercent = o.Find(x => x.m_InnerSpotPercent), lightDimmer = o.Find(x => x.lightDimmer), fadeDistance = o.Find(x => x.fadeDistance), affectDiffuse = o.Find(x => x.affectDiffuse), affectSpecular = o.Find(x => x.affectSpecular), lightTypeExtent = o.Find(x => x.lightTypeExtent), spotLightShape = o.Find(x => x.spotLightShape), shapeWidth = o.Find(x => x.shapeWidth), shapeHeight = o.Find(x => x.shapeHeight), aspectRatio = o.Find(x => x.aspectRatio), shapeRadius = o.Find(x => x.shapeRadius), maxSmoothness = o.Find(x => x.maxSmoothness), applyRangeAttenuation = o.Find(x => x.applyRangeAttenuation), // Editor stuff useOldInspector = o.Find(x => x.useOldInspector), showFeatures = o.Find(x => x.featuresFoldout), showAdditionalSettings = o.Find(x => x.showAdditionalSettings) }; // TODO: Review this once AdditionalShadowData is refactored using (var o = new PropertyFetcher <AdditionalShadowData>(m_SerializedAdditionalShadowData)) m_AdditionalShadowData = new SerializedShadowData { dimmer = o.Find(x => x.shadowDimmer), fadeDistance = o.Find(x => x.shadowFadeDistance), cascadeCount = o.Find("shadowCascadeCount"), cascadeRatios = o.Find("shadowCascadeRatios"), cascadeBorders = o.Find("shadowCascadeBorders"), resolution = o.Find(x => x.shadowResolution), enableContactShadows = o.Find(x => x.enableContactShadows), contactShadowLength = o.Find(x => x.contactShadowLength), contactShadowDistanceScaleFactor = o.Find(x => x.contactShadowDistanceScaleFactor), contactShadowMaxDistance = o.Find(x => x.contactShadowMaxDistance), contactShadowFadeDistance = o.Find(x => x.contactShadowFadeDistance), contactShadowSampleCount = o.Find(x => x.contactShadowSampleCount), }; }
public SerializedHDCamera(SerializedObject serializedObject) { this.serializedObject = serializedObject; var additionals = CoreEditorUtils.GetAdditionalData <HDAdditionalCameraData>(serializedObject.targetObjects, HDAdditionalCameraData.InitDefaultHDAdditionalCameraData); serializedAdditionalDataObject = new SerializedObject(additionals); var hideFlags = serializedAdditionalDataObject.FindProperty("m_ObjectHideFlags"); // We don't hide additional camera data anymore on UX team request. To be compatible with already author scene we force to be visible //hideFlags.intValue = (int)HideFlags.HideInInspector; hideFlags.intValue = (int)HideFlags.None; serializedAdditionalDataObject.ApplyModifiedProperties(); //backgroundColor = serializedObject.FindProperty("m_BackGroundColor"); normalizedViewPortRect = serializedObject.FindProperty("m_NormalizedViewPortRect"); nearClippingPlane = serializedObject.FindProperty("near clip plane"); farClippingPlane = serializedObject.FindProperty("far clip plane"); fieldOfView = serializedObject.FindProperty("field of view"); orthographic = serializedObject.FindProperty("orthographic"); orthographicSize = serializedObject.FindProperty("orthographic size"); depth = serializedObject.FindProperty("m_Depth"); cullingMask = serializedObject.FindProperty("m_CullingMask"); occlusionCulling = serializedObject.FindProperty("m_OcclusionCulling"); targetTexture = serializedObject.FindProperty("m_TargetTexture"); HDR = serializedObject.FindProperty("m_HDR"); stereoConvergence = serializedObject.FindProperty("m_StereoConvergence"); stereoSeparation = serializedObject.FindProperty("m_StereoSeparation"); #if ENABLE_MULTIPLE_DISPLAYS targetDisplay = serializedObject.FindProperty("m_TargetDisplay"); #endif targetEye = serializedObject.FindProperty("m_TargetEye"); aperture = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.aperture); shutterSpeed = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.shutterSpeed); iso = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.iso); clearColorMode = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearColorMode); backgroundColorHDR = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.backgroundColorHDR); renderingPath = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.renderingPath); clearDepth = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.clearDepth); volumeLayerMask = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeLayerMask); volumeAnchorOverride = serializedAdditionalDataObject.Find((HDAdditionalCameraData d) => d.volumeAnchorOverride); frameSettings = new SerializedFrameSettings(serializedAdditionalDataObject.FindProperty("m_FrameSettings")); }
void OnEnable() { var additionalData = CoreEditorUtils.GetAdditionalData <HDAdditionalReflectionData>(targets); m_AdditionalDataSerializedObject = new SerializedObject(additionalData); m_SerializedHdReflectionProbe = new SerializedHDReflectionProbe(serializedObject, m_AdditionalDataSerializedObject); m_UIState.owner = this; m_UIState.Reset(m_SerializedHdReflectionProbe, Repaint); foreach (var t in targets) { var p = (ReflectionProbe)t; s_ReflectionProbeEditors[p] = this; } InitializeAllTargetProbes(); }
/// <summary>Constructor</summary> /// <param name="serializedObject"><see cref="SerializedObject"/> with the light</param> /// <param name="settings"><see cref="LightEditor.Settings"/>with the settings</param> public UniversalRenderPipelineSerializedLight(SerializedObject serializedObject, LightEditor.Settings settings) { this.settings = settings; settings.OnEnable(); this.serializedObject = serializedObject; lightsAdditionalData = CoreEditorUtils .GetAdditionalData <UniversalAdditionalLightData>(serializedObject.targetObjects); serializedAdditionalDataObject = new SerializedObject(lightsAdditionalData); intensity = serializedObject.FindProperty("m_Intensity"); useAdditionalDataProp = serializedAdditionalDataObject.FindProperty("m_UsePipelineSettings"); additionalLightsShadowResolutionTierProp = serializedAdditionalDataObject.FindProperty("m_AdditionalLightsShadowResolutionTier"); lightLayerMask = serializedAdditionalDataObject.FindProperty("m_LightLayerMask"); customShadowLayers = serializedAdditionalDataObject.FindProperty("m_CustomShadowLayers"); shadowLayerMask = serializedAdditionalDataObject.FindProperty("m_ShadowLayerMask"); settings.ApplyModifiedProperties(); }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); m_AdditionalShadowDatas = CoreEditorUtils.GetAdditionalData <AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData); m_SerializedAdditionalLightData = new SerializedObject(m_AdditionalLightDatas); m_SerializedAdditionalShadowData = new SerializedObject(m_AdditionalShadowDatas); using (var o = new PropertyFetcher <HDAdditionalLightData>(m_SerializedAdditionalLightData)) m_AdditionalLightData = new SerializedLightData { intensity = o.Find(x => x.displayLightIntensity), enableSpotReflector = o.Find(x => x.enableSpotReflector), spotInnerPercent = o.Find(x => x.m_InnerSpotPercent), lightDimmer = o.Find(x => x.lightDimmer), volumetricDimmer = o.Find(x => x.volumetricDimmer), lightUnit = o.Find(x => x.lightUnit), displayAreaLightEmissiveMesh = o.Find(x => x.displayAreaLightEmissiveMesh), fadeDistance = o.Find(x => x.fadeDistance), affectDiffuse = o.Find(x => x.affectDiffuse), affectSpecular = o.Find(x => x.affectSpecular), nonLightmappedOnly = o.Find(x => x.nonLightmappedOnly), lightTypeExtent = o.Find(x => x.lightTypeExtent), spotLightShape = o.Find(x => x.spotLightShape), shapeWidth = o.Find(x => x.shapeWidth), shapeHeight = o.Find(x => x.shapeHeight), aspectRatio = o.Find(x => x.aspectRatio), shapeRadius = o.Find(x => x.shapeRadius), maxSmoothness = o.Find(x => x.maxSmoothness), applyRangeAttenuation = o.Find(x => x.applyRangeAttenuation), // Editor stuff useOldInspector = o.Find(x => x.useOldInspector), showFeatures = o.Find(x => x.featuresFoldout), showAdditionalSettings = o.Find(x => x.showAdditionalSettings) }; // TODO: Review this once AdditionalShadowData is refactored using (var o = new PropertyFetcher <AdditionalShadowData>(m_SerializedAdditionalShadowData)) m_AdditionalShadowData = new SerializedShadowData { dimmer = o.Find(x => x.shadowDimmer), fadeDistance = o.Find(x => x.shadowFadeDistance), resolution = o.Find(x => x.shadowResolution), contactShadows = o.Find(x => x.contactShadows), viewBiasMin = o.Find(x => x.viewBiasMin), viewBiasMax = o.Find(x => x.viewBiasMax), viewBiasScale = o.Find(x => x.viewBiasScale), normalBiasMin = o.Find(x => x.normalBiasMin), normalBiasMax = o.Find(x => x.normalBiasMax), normalBiasScale = o.Find(x => x.normalBiasScale), sampleBiasScale = o.Find(x => x.sampleBiasScale), edgeLeakFixup = o.Find(x => x.edgeLeakFixup), edgeToleranceNormal = o.Find(x => x.edgeToleranceNormal), edgeTolerance = o.Find(x => x.edgeTolerance) }; // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed += () => { m_SerializedAdditionalLightData.ApplyModifiedProperties(); foreach (var hdLightData in m_AdditionalLightDatas) { if (hdLightData != null) { hdLightData.UpdateAreaLightEmissiveMesh(); } } }; }
protected override void OnEnable() { base.OnEnable(); // Get & automatically add additional HD data if not present m_AdditionalLightDatas = CoreEditorUtils.GetAdditionalData <HDAdditionalLightData>(targets, HDAdditionalLightData.InitDefaultHDAdditionalLightData); m_AdditionalShadowDatas = CoreEditorUtils.GetAdditionalData <AdditionalShadowData>(targets, HDAdditionalShadowData.InitDefaultHDAdditionalShadowData); m_SerializedAdditionalLightData = new SerializedObject(m_AdditionalLightDatas); m_SerializedAdditionalShadowData = new SerializedObject(m_AdditionalShadowDatas); using (var o = new PropertyFetcher <HDAdditionalLightData>(m_SerializedAdditionalLightData)) m_AdditionalLightData = new SerializedLightData { intensity = o.Find(x => x.displayLightIntensity), enableSpotReflector = o.Find(x => x.enableSpotReflector), spotInnerPercent = o.Find(x => x.m_InnerSpotPercent), lightDimmer = o.Find(x => x.lightDimmer), volumetricDimmer = o.Find(x => x.volumetricDimmer), lightUnit = o.Find(x => x.lightUnit), displayAreaLightEmissiveMesh = o.Find(x => x.displayAreaLightEmissiveMesh), lightLayers = o.Find(x => x.lightLayers), fadeDistance = o.Find(x => x.fadeDistance), affectDiffuse = o.Find(x => x.affectDiffuse), affectSpecular = o.Find(x => x.affectSpecular), nonLightmappedOnly = o.Find(x => x.nonLightmappedOnly), lightTypeExtent = o.Find(x => x.lightTypeExtent), spotLightShape = o.Find(x => x.spotLightShape), shapeWidth = o.Find(x => x.shapeWidth), shapeHeight = o.Find(x => x.shapeHeight), aspectRatio = o.Find(x => x.aspectRatio), shapeRadius = o.Find(x => x.shapeRadius), maxSmoothness = o.Find(x => x.maxSmoothness), applyRangeAttenuation = o.Find(x => x.applyRangeAttenuation), shadowSoftness = o.Find(x => x.shadowSoftness), blockerSampleCount = o.Find(x => x.blockerSampleCount), filterSampleCount = o.Find(x => x.filterSampleCount), sunDiskSize = o.Find(x => x.sunDiskSize), sunHaloSize = o.Find(x => x.sunHaloSize), // Editor stuff useOldInspector = o.Find(x => x.useOldInspector), showFeatures = o.Find(x => x.featuresFoldout), showAdditionalSettings = o.Find(x => x.showAdditionalSettings) }; // TODO: Review this once AdditionalShadowData is refactored using (var o = new PropertyFetcher <AdditionalShadowData>(m_SerializedAdditionalShadowData)) m_AdditionalShadowData = new SerializedShadowData { dimmer = o.Find(x => x.shadowDimmer), fadeDistance = o.Find(x => x.shadowFadeDistance), resolution = o.Find(x => x.shadowResolution), contactShadows = o.Find(x => x.contactShadows), viewBiasMin = o.Find(x => x.viewBiasMin), viewBiasMax = o.Find(x => x.viewBiasMax), viewBiasScale = o.Find(x => x.viewBiasScale), normalBiasMin = o.Find(x => x.normalBiasMin), normalBiasMax = o.Find(x => x.normalBiasMax), normalBiasScale = o.Find(x => x.normalBiasScale), sampleBiasScale = o.Find(x => x.sampleBiasScale), edgeLeakFixup = o.Find(x => x.edgeLeakFixup), edgeToleranceNormal = o.Find(x => x.edgeToleranceNormal), edgeTolerance = o.Find(x => x.edgeTolerance) }; // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed += () => { m_SerializedAdditionalLightData.ApplyModifiedProperties(); foreach (var hdLightData in m_AdditionalLightDatas) { if (hdLightData != null) { hdLightData.UpdateAreaLightEmissiveMesh(); } } }; // If the light is disabled in the editor we force the light upgrade from his inspector foreach (var additionalLightData in m_AdditionalLightDatas) { additionalLightData.UpgradeLight(); } m_HDShadowInitParameters = (GraphicsSettings.renderPipelineAsset as HDRenderPipelineAsset).renderPipelineSettings.hdShadowInitParams; m_ShadowAlgorithmUIs = new Dictionary <HDShadowQuality, Action> { { HDShadowQuality.Low, DrawLowShadowSettings }, { HDShadowQuality.Medium, DrawMediumShadowSettings }, { HDShadowQuality.High, DrawHighShadowSettings } }; }