Ejemplo n.º 1
0
        static public bool LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Scene Default Parameters");

            string label = "Edit...";

            if (isBuiltIn(prop))
            {
                label = "View";
            }

            bool editClicked = false;

            // If object is null, then get the scene parameter setting and view this instead.
            if (prop.objectReferenceValue == null)
            {
                SerializedObject   so = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
                SerializedProperty lightmapParameters = so.FindProperty("m_LightmapEditorSettings.m_LightmapParameters");

                using (new EditorGUI.DisabledScope(lightmapParameters == null))
                {
                    if (isBuiltIn(lightmapParameters))
                    {
                        label = "View";
                    }
                    else
                    {
                        label = "Edit...";
                    }

                    if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        Selection.activeObject = lightmapParameters.objectReferenceValue;
                        editClicked            = true;
                    }
                }
            }
            else
            {
                if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                {
                    Selection.activeObject = prop.objectReferenceValue;
                    editClicked            = true;
                }
            }

            EditorGUILayout.EndHorizontal();

            return(editClicked);
        }
Ejemplo n.º 2
0
        public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Scene Default Parameters");
            string text = "Edit...";

            if (LightingSettingsInspector.isBuiltIn(prop))
            {
                text = "View";
            }
            bool result = false;

            if (prop.objectReferenceValue == null)
            {
                SerializedObject   serializedObject   = new SerializedObject(LightmapEditorSettings.GetLightmapSettings());
                SerializedProperty serializedProperty = serializedObject.FindProperty("m_LightmapEditorSettings.m_LightmapParameters");
                using (new EditorGUI.DisabledScope(serializedProperty == null))
                {
                    if (LightingSettingsInspector.isBuiltIn(serializedProperty))
                    {
                        text = "View";
                    }
                    else
                    {
                        text = "Edit...";
                    }
                    if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
                    {
                        GUILayout.ExpandWidth(false)
                    }))
                    {
                        Selection.activeObject = serializedProperty.objectReferenceValue;
                        result = true;
                    }
                }
            }
            else if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            }))
            {
                Selection.activeObject = prop.objectReferenceValue;
                result = true;
            }
            EditorGUILayout.EndHorizontal();
            return(result);
        }
Ejemplo n.º 3
0
        public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams");
            EditorGUI.BeginDisabledGroup(prop.objectReferenceValue == null);
            bool flag = false;

            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
            if (GUILayout.Button("Edit...", EditorStyles.miniButton, options))
            {
                Selection.activeObject = prop.objectReferenceValue;
                flag = true;
            }
            EditorGUI.EndDisabledGroup();
            EditorGUILayout.EndHorizontal();
            return(flag);
        }
Ejemplo n.º 4
0
        public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content, bool advancedParameters)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (advancedParameters)
            {
                EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default scene parameter");
            }
            else
            {
                EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default-Medium");
            }
            string text = "Edit...";

            if (LightingWindowObjectTab.isBuiltIn(prop))
            {
                text = "View";
            }
            bool result = false;

            if (prop.objectReferenceValue == null)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
                    {
                        GUILayout.ExpandWidth(false)
                    }))
                    {
                        Selection.activeObject = null;
                        result = true;
                    }
                }
            }
            else if (GUILayout.Button(text, EditorStyles.miniButton, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            }))
            {
                Selection.activeObject = prop.objectReferenceValue;
                result = true;
            }
            EditorGUILayout.EndHorizontal();
            return(result);
        }
        public static bool LightmapParametersGUI(SerializedProperty prop, GUIContent content, bool advancedParameters)
        {
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            if (advancedParameters)
            {
                EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default scene parameter");
            }
            else
            {
                EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default-Medium");
            }
            string text = "Edit...";

            if (isBuiltIn(prop))
            {
                text = "View";
            }
            bool flag = false;

            if (prop.objectReferenceValue == null)
            {
                SerializedProperty property = new SerializedObject(LightmapEditorSettings.GetLightmapSettings()).FindProperty("m_LightmapEditorSettings.m_LightmapParameters");
                using (new EditorGUI.DisabledScope(property == null))
                {
                    GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                    if (GUILayout.Button(text, EditorStyles.miniButton, options))
                    {
                        Selection.activeObject = property.objectReferenceValue;
                        flag = true;
                    }
                }
            }
            else
            {
                GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.ExpandWidth(false) };
                if (GUILayout.Button(text, EditorStyles.miniButton, optionArray2))
                {
                    Selection.activeObject = prop.objectReferenceValue;
                    flag = true;
                }
            }
            EditorGUILayout.EndHorizontal();
            return(flag);
        }
Ejemplo n.º 6
0
        static private bool LightmapParametersGUI(SerializedProperty prop, GUIContent content)
        {
            EditorGUILayout.BeginHorizontal();

            EditorGUIInternal.AssetPopup <LightmapParameters>(prop, content, "giparams", "Default-Medium");

            string label = "Edit...";

            if (isBuiltIn(prop))
            {
                label = "View";
            }

            bool editClicked = false;

            if (prop.objectReferenceValue == null)
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                    {
                        Selection.activeObject = null;
                        editClicked            = true;
                    }
                }
            }
            else
            {
                if (GUILayout.Button(label, EditorStyles.miniButton, GUILayout.ExpandWidth(false)))
                {
                    Selection.activeObject = prop.objectReferenceValue;
                    editClicked            = true;
                }
            }

            EditorGUILayout.EndHorizontal();

            return(editClicked);
        }
Ejemplo n.º 7
0
 internal static void AssetPopup <T>(SerializedProperty serializedProperty, GUIContent content, string fileExtension) where T : UnityEngine.Object, new()
 {
     EditorGUIInternal.AssetPopup <T>(serializedProperty, content, fileExtension, "Default");
 }