Exemplo n.º 1
0
        static void HandleColorPreferences(string searchContext)
        {
            EditorGUI.BeginChangeCheck();

            s_UseUnityColors.value = SettingsGUILayout.SettingsToggle("Use Unity Colors", s_UseUnityColors, searchContext);

            if (!s_UseUnityColors.value)
            {
                using (new SettingsGUILayout.IndentedGroup())
                {
                    s_DitherFaceHandle.value          = SettingsGUILayout.SettingsToggle("Dither Face Overlay", s_DitherFaceHandle, searchContext);
                    s_WireframeColorPref.value        = SettingsGUILayout.SettingsColorField("Wireframe", s_WireframeColorPref, searchContext);
                    s_PreselectionColorPref.value     = SettingsGUILayout.SettingsColorField("Preselection", s_PreselectionColorPref, searchContext);
                    s_SelectedFaceColorPref.value     = SettingsGUILayout.SettingsColorField("Selected Face Color", s_SelectedFaceColorPref, searchContext);
                    s_UnselectedEdgeColorPref.value   = SettingsGUILayout.SettingsColorField("Unselected Edge Color", s_UnselectedEdgeColorPref, searchContext);
                    s_SelectedEdgeColorPref.value     = SettingsGUILayout.SettingsColorField("Selected Edge Color", s_SelectedEdgeColorPref, searchContext);
                    s_UnselectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Vertex Color", s_UnselectedVertexColorPref, searchContext);
                    s_SelectedVertexColorPref.value   = SettingsGUILayout.SettingsColorField("Selected Vertex Color", s_SelectedVertexColorPref, searchContext);
                }
            }

            s_DepthTestHandles.value  = SettingsGUILayout.SettingsToggle("Depth Test", s_DepthTestHandles, searchContext);
            s_VertexPointSize.value   = SettingsGUILayout.SettingsSlider("Vertex Size", s_VertexPointSize, 1f, 10f, searchContext);
            s_EdgeLineSize.value      = SettingsGUILayout.SettingsSlider("Line Size", s_EdgeLineSize, 0f, 10f, searchContext);
            s_WireframeLineSize.value = SettingsGUILayout.SettingsSlider("Wireframe Size", s_WireframeLineSize, 0f, 10f, searchContext);

            if (EditorGUI.EndChangeCheck())
            {
                ProBuilderEditor.UpdateMeshHandles(true);
            }
        }
        static void HandleColorPreferences(string searchContext)
        {
            s_UseUnityColors.value = SettingsGUILayout.SettingsToggle("Use Unity Colors", s_UseUnityColors, searchContext);

            if (!s_UseUnityColors.value)
            {
                using (new SettingsGUILayout.IndentedGroup())
                {
                    s_DitherFaceHandle.value          = SettingsGUILayout.SettingsToggle("Dither Face Overlay", s_DitherFaceHandle, searchContext);
                    s_WireframeColorPref.value        = SettingsGUILayout.SettingsColorField("Wireframe", s_WireframeColorPref, searchContext);
                    s_PreselectionColorPref.value     = SettingsGUILayout.SettingsColorField("Preselection", s_PreselectionColorPref, searchContext);
                    s_SelectedFaceColorPref.value     = SettingsGUILayout.SettingsColorField("Selected Face Color", s_SelectedFaceColorPref, searchContext);
                    s_UnselectedEdgeColorPref.value   = SettingsGUILayout.SettingsColorField("Unselected Edge Color", s_UnselectedEdgeColorPref, searchContext);
                    s_SelectedEdgeColorPref.value     = SettingsGUILayout.SettingsColorField("Selected Edge Color", s_SelectedEdgeColorPref, searchContext);
                    s_UnselectedVertexColorPref.value = SettingsGUILayout.SettingsColorField("Unselected Vertex Color", s_UnselectedVertexColorPref, searchContext);
                    s_SelectedVertexColorPref.value   = SettingsGUILayout.SettingsColorField("Selected Vertex Color", s_SelectedVertexColorPref, searchContext);
                }
            }

            s_DepthTestHandles.value = SettingsGUILayout.SettingsToggle("Depth Test", s_DepthTestHandles, searchContext);

            s_VertexPointSize.value = SettingsGUILayout.SettingsSlider("Vertex Size", s_VertexPointSize, 1f, 10f, searchContext);

            bool geoLine = BuiltinMaterials.geometryShadersSupported;

            if (geoLine)
            {
                s_EdgeLineSize.value      = SettingsGUILayout.SettingsSlider("Line Size", s_EdgeLineSize, 0f, 3f, searchContext);
                s_WireframeLineSize.value = SettingsGUILayout.SettingsSlider("Wireframe Size", s_WireframeLineSize, 0f, 3f, searchContext);
            }
            else
            {
                GUI.enabled = false;
                SettingsGUILayout.SearchableSlider("Line Size", 0f, 0f, 3f, searchContext);
                SettingsGUILayout.SearchableSlider("Wireframe Size", 0f, 0f, 3f, searchContext);
                GUI.enabled = true;
            }
        }