Example #1
0
        private void OnGUI()
        {
            using (var scope = new GUILayout.ScrollViewScope(scroll))
            {
                scroll = scope.scrollPosition;

                GUILayout.Space(10);
                HeaderGUI();
                GUILayout.Space(10);
                if (!FolderGUI())
                {
                    return;
                }
                GUILayout.Space(5);
                TextureGUI();
                GUILayout.Space(5);
                if (!PrefabBakerGUI())
                {
                    return;
                }
                GUILayout.Space(5);
                EditorUtils.BoxGUI(() =>
                {
                    BakeSettingsGUI();

                    GUILayout.Space(5);

                    var h = GUILayout.Height(30);

                    if (GUILayout.Button("Bake", h))
                    {
                        Baker.Start();
                    }
                });

                GUILayout.Space(5);
                SceneLightmapsGUI();
            }
        }
Example #2
0
        public override void OnInspectorGUI()
        {
            GUILayout.Space(15);

            if (Window.instance == null)
            {
                if (GUILayout.Button("Open Baker", GUILayout.Height(30)))
                {
                    Window.OpenWindow();
                }

                GUILayout.Space(5);
            }

            bool hasData = instance.HasBakeData;

            if (hasData)
            {
                using (new GUILayout.HorizontalScope())
                {
                    EditorGUI.BeginDisabledGroup(instance.BakeApplied);

                    if (GUILayout.Button("Apply", GUILayout.Height(25)))
                    {
                        instance.BakeApply();
                    }

                    EditorGUI.EndDisabledGroup();

                    GUILayout.Space(5);

                    GUI.color = new Color(1f, 0.5f, 0.5f);

                    if (GUILayout.Button("Clear", GUILayout.Height(25), GUILayout.Width(70)))
                    {
                        EditorUtils.Reset(instance);
                    }

                    GUI.color = Color.white;
                }

                GUILayout.Space(5);

                GUILayout.Label("", GUI.skin.horizontalSlider);
            }

            GUILayout.Space(5);

            EditorUtils.BoxGUI(() =>
            {
                using (new GUILayout.HorizontalScope())
                {
                    GUILayout.Space(10);
                    EditComponents = EditorGUILayout.Foldout(EditComponents, " Override Nested Components", true);
                }

                //EditComponents = EditorGUILayout.ToggleLeft( " Override Nested Components", EditComponents );

                if (!EditComponents)
                {
                    return;
                }

                GUILayout.Space(5);

                PanelComponentsOverride.Draw();

                GUILayout.Space(5);

                if (GUILayout.Button("Apply"))
                {
                    PanelComponentsOverride.Apply(instance.gameObject);
                }
            });

            GUILayout.Space(5);

            if (!hasData)
            {
                return;
            }

            PreviewData = EditorGUILayout.Foldout(PreviewData, "Show data", true);

            GUILayout.Space(5);

            if (!PreviewData)
            {
                return;               //base.OnInspectorGUI( );
            }
            var ln = instance.lights?.Length;

            string info = $"{ instance.lights?.Length ?? 0 } Lights | " +
                          $" {instance.renderers?.Length ?? 0} Renderers\n" +
                          $"{instance.texturesColor?.Length ?? 0} Color Textures";

            if ((instance.texturesDir?.Length ?? 0) > 0)
            {
                info += $"\n{ instance.texturesDir?.Length ?? 0} Directional Textures";
            }

            if ((instance.texturesShadow?.Length ?? 0) > 0)
            {
                info += $"\n{ instance.texturesShadow?.Length ?? 0} Shadow Textures";
            }

            GUILayout.Label("Info", EditorStyles.boldLabel);
            EditorGUILayout.HelpBox(info, MessageType.None);

            GUILayout.Space(5);

            GUILayout.Label("Textures", EditorStyles.boldLabel);

            DrawTextures(instance.texturesColor, ref scroll_color);
            DrawTextures(instance.texturesDir, ref scroll_dir);
            DrawTextures(instance.texturesShadow, ref scroll_shadow);
            // Apply changes to the serializedProperty - always do this at the end of OnInspectorGUI.
            serializedObject.ApplyModifiedProperties();
        }