protected override void OnSceneGUI() { // Each handles manipulate only one light // Thus do not rely on serialized properties Light light = target as Light; HDAdditionalLightData additionalLightData = targetAdditionalData; if (additionalLightData.lightTypeExtent == LightTypeExtent.Punctual && (light.type == LightType.Directional || light.type == LightType.Point)) base.OnSceneGUI(); else HDLightUI.DrawHandles(additionalLightData, this); }
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; HDLightUI.RegisterEditor(this); }
float UnitToLumen(float value) { if (m_Unit == LightUnit.Lumen) { return(value); } // Punctual slider currently does not have any regard for spot shape/reflector. // Conversions need to happen as if light is a point, and this is the only setting that influences that. m_Light.enableSpotReflector.boolValue = false; return(HDLightUI.ConvertLightIntensity(m_Unit, LightUnit.Lumen, m_Light, m_Editor, value)); }
protected override void OnSceneGUI() { // Each handles manipulate only one light // Thus do not rely on serialized properties HDLightType lightType = targetAdditionalData.type; if (lightType == HDLightType.Directional || lightType == HDLightType.Point || lightType == HDLightType.Area && targetAdditionalData.areaLightShape == AreaLightShape.Disc) { base.OnSceneGUI(); } else { HDLightUI.DrawHandles(targetAdditionalData, this); } }
float LumenToUnit(float value) { if (m_Unit == LightUnit.Lumen) { return(value); } // Once again temporarily disable reflector in case we called this for tooltip or context menu preset. m_Light.enableSpotReflector.boolValue = false; value = HDLightUI.ConvertLightIntensity(LightUnit.Lumen, m_Unit, m_Light, m_Editor, value); // Restore the state of spot reflector on the light. m_Light.enableSpotReflector.boolValue = m_SpotReflectorEnabled; return(value); }
void OnDisable() { // Update emissive mesh and light intensity when undo/redo Undo.undoRedoPerformed -= OnUndoRedo; HDLightUI.UnregisterEditor(this); }