public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            LightUIUtilities.DrawSplitter();

            property.FindPropertyRelative("orientationParameters.yAxis").isExpanded = LightUIUtilities.DrawHeaderFoldout("Orientation", property.FindPropertyRelative("orientationParameters.yAxis").isExpanded);
            EditorGUI.indentLevel++;

            if (property.FindPropertyRelative("orientationParameters.yAxis").isExpanded)
            {
                EditorGUILayout.PropertyField(property.FindPropertyRelative("orientationParameters.yAxis"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("orientationParameters.lattitude"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("orientationParameters.timeOfDay"), GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 250 + EditorGUIUtility.fieldWidth));
                if (property.FindPropertyRelative("lightParameters.lightCookie").objectReferenceValue != null)
                {
                    EditorGUILayout.PropertyField(property.FindPropertyRelative("orientationParameters.Roll"));
                }
            }

            EditorGUI.indentLevel--;
            LightUIUtilities.DrawSplitter();
            property.FindPropertyRelative("lightParameters.intensity").isExpanded = LightUIUtilities.DrawHeaderFoldout("Light", property.FindPropertyRelative("lightParameters.intensity").isExpanded);
            EditorGUI.indentLevel++;

            if (property.FindPropertyRelative("lightParameters.intensity").isExpanded)
            {
                EditorGUILayout.PropertyField(property.FindPropertyRelative("intensityCurve"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("colorGradient"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.useColorTemperature"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.colorTemperature"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.intensity"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.mode"), new GUIContent("Light mode / Indirect Intensity"), GUILayout.MaxWidth(EditorGUIUtility.labelWidth + 80));
                var modeRect     = GUILayoutUtility.GetLastRect();
                var indirectRect = new Rect(modeRect.x + EditorGUIUtility.labelWidth + 100, modeRect.y, position.xMax * 0.3f, EditorGUIUtility.singleLineHeight);
                EditorGUI.PropertyField(indirectRect, property.FindPropertyRelative("lightParameters.indirectIntensity"), GUIContent.none);
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.lightCookie"));
                if (property.FindPropertyRelative("lightParameters.lightCookie").objectReferenceValue != null)
                {
                    EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.cookieSize"));
                }
                LightUIUtilities.LightLayerMaskDrawer(new GUIContent("Light Layers"), property.FindPropertyRelative("lightParameters.lightLayers"));
            }


            EditorGUI.indentLevel--;
            LightUIUtilities.DrawSplitter();
            property.FindPropertyRelative("lightParameters.shadows").boolValue = LightUIUtilities.DrawHeader("Shadows", property.FindPropertyRelative("lightParameters.shadows").boolValue);
            EditorGUI.indentLevel++;

            if (property.FindPropertyRelative("lightParameters.shadows").boolValue)
            {
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.shadowResolution"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.viewBiasScale"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.normalBias"));
                EditorGUILayout.PropertyField(property.FindPropertyRelative("lightParameters.contactShadows"));
            }
            EditorGUI.indentLevel--;
            EditorGUI.EndProperty();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(EditorGUIUtility.singleLineHeight);
            EditorGUILayout.LabelField("Default Values", EditorStyles.boldLabel);

            EditorGUILayout.PropertyField(sunlightParameters, true);

            LightUIUtilities.DrawSplitter();
            LightUIUtilities.DrawHeader("Visualization");
            EditorGUI.indentLevel = 1;

            EditorGUILayout.PropertyField(drawGizmo);
            EditorGUILayout.PropertyField(gizmoSize);

            serializedObject.ApplyModifiedProperties();
        }
示例#3
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        LightUIUtilities.DrawSplitter();

        EditorGUI.indentLevel--;
        property.FindPropertyRelative("useShadowCaster").boolValue = LightUIUtilities.DrawHeader("Shadowcaster", property.FindPropertyRelative("useShadowCaster").boolValue);
        EditorGUI.indentLevel++;

        if (property.FindPropertyRelative("useShadowCaster").boolValue)
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("shadowCasterSize"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("shadowCasterDistance"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("shadowCasterOffset"));
        }
        EditorGUI.EndProperty();
    }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        EditorGUI.BeginProperty(position, label, property);

        EditorGUILayout.PropertyField(property.FindPropertyRelative("displayName"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("drawGizmo"));
        LightUIUtilities.DrawSplitter();

        EditorGUI.indentLevel--;
        LightUIUtilities.DrawHeader("Rig");
        EditorGUI.indentLevel++;

        EditorGUILayout.PropertyField(property.FindPropertyRelative("linkToCameraRotation"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("Yaw"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("Pitch"));
        if (property.serializedObject.FindProperty("lightCookie") != null && property.serializedObject.FindProperty("lightCookie").objectReferenceValue != null)
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("Roll"));
        }
        EditorGUILayout.PropertyField(property.FindPropertyRelative("distance"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("offset"));

        EditorGUI.EndProperty();
    }
    // Draw the property inside the given rect
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        // Using BeginProperty / EndProperty on the parent property means that
        // prefab override logic works on the entire property.
        EditorGUI.BeginProperty(position, label, property);

        EditorGUI.indentLevel--;
        LightUIUtilities.DrawSplitter();
        LightUIUtilities.DrawHeader("Light");
        EditorGUI.indentLevel++;

        EditorGUILayout.PropertyField(property.FindPropertyRelative("intensity"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("colorFilter"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("type"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("mode"), new GUIContent("Light mode"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("range"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("indirectIntensity"));
        EditorGUILayout.PropertyField(property.FindPropertyRelative("lightCookie"));

        if (property.FindPropertyRelative("lightCookie").objectReferenceValue != null)
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("cookieSize"));
        }

        // Draw label
        EditorGUILayout.Space();
        EditorGUI.indentLevel--;
        LightUIUtilities.DrawSplitter();
        LightUIUtilities.DrawHeader("Shape");
        EditorGUI.indentLevel++;
        if (property.FindPropertyRelative("type").enumValueIndex == 0) //if spotlight
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("lightAngle"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("innerSpotPercent"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("maxSmoothness"));
        }

        // Draw label
        EditorGUILayout.Space();
        EditorGUI.indentLevel--;
        LightUIUtilities.DrawSplitter();
        property.FindPropertyRelative("shadows").boolValue = LightUIUtilities.DrawHeader("Shadows", property.FindPropertyRelative("shadows").boolValue);
        EditorGUI.indentLevel++;
        // Draw fields
        if (property.FindPropertyRelative("shadows").boolValue != false)
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("ShadowNearClip"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("shadowResolution"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("shadowStrength"), new GUIContent("Shadow Dimmer"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("viewBiasMin"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("viewBiasScale"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("normalBias"));
        }
        cullingMask = property.FindPropertyRelative("cullingMask");

        // Draw label
        EditorGUILayout.Space();
        EditorGUI.indentLevel--;
        LightUIUtilities.DrawSplitter();
        cullingMask.isExpanded = LightUIUtilities.DrawHeaderFoldout("Additional settings", cullingMask.isExpanded);
        EditorGUI.indentLevel++;

        if (cullingMask.isExpanded)
        {
            EditorGUILayout.PropertyField(property.FindPropertyRelative("affectDiffuse"));
            EditorGUILayout.PropertyField(property.FindPropertyRelative("affectSpecular"));
        }
        EditorGUI.EndProperty();
    }