Пример #1
0
        static void UnwrapSettingDefaults(string searchContext)
        {
            Styles.Init();
            var isSearching = !string.IsNullOrEmpty(searchContext);

            if (!isSearching)
            {
                Styles.unwrapSettingsFoldout = EditorGUILayout.Foldout(Styles.unwrapSettingsFoldout, "Lightmap UVs Settings");
            }

            if (isSearching || Styles.unwrapSettingsFoldout)
            {
                EditorGUI.BeginChangeCheck();

                var unwrap = (UnwrapParameters)s_UnwrapParameters;

                using (new SettingsGUILayout.IndentedGroup())
                {
                    unwrap.hardAngle  = SettingsGUILayout.SearchableSlider(Styles.hardAngle, unwrap.hardAngle, 1f, 180f, searchContext);
                    unwrap.packMargin = SettingsGUILayout.SearchableSlider(Styles.packMargin, unwrap.packMargin, 1f, 64f, searchContext);
                    unwrap.angleError = SettingsGUILayout.SearchableSlider(Styles.angleError, unwrap.angleError, 1f, 75f, searchContext);
                    unwrap.areaError  = SettingsGUILayout.SearchableSlider(Styles.areaError, unwrap.areaError, 1f, 75f, searchContext);

                    if (!isSearching)
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("Reset", Styles.miniButton))
                        {
                            unwrap.Reset();
                        }
                        GUILayout.EndHorizontal();
                    }
                }

                SettingsGUILayout.DoResetContextMenuForLastRect(s_UnwrapParameters);

                if (EditorGUI.EndChangeCheck())
                {
                    s_UnwrapParameters.value = unwrap;
                }
            }
        }
        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;
            }
        }
Пример #3
0
 static void PickingPreferences(string searchContext)
 {
     s_PickingDistance.value = SettingsGUILayout.SearchableSlider(
         new GUIContent("Picking Distance", "Distance to an object before it's considered hovered."),
         s_PickingDistance.value, 1, 150, searchContext);
 }