예제 #1
0
 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);
 }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
        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);
        }
예제 #6
0
 void OnDisable()
 {
     // Update emissive mesh and light intensity when undo/redo
     Undo.undoRedoPerformed -= OnUndoRedo;
     HDLightUI.UnregisterEditor(this);
 }