コード例 #1
0
            public void DrawSettingsGUI()
            {
                GetOrCreateSyncedSettings();
                m_editorSyncedSettings.Update();

                DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive(
                                   "m_gridWindowLayout",
                                   "m_showScrollBars",
                                   "m_showDataManagementOptions",
                                   "m_showGlobalSnappingOptions",
                                   "m_showXAxisOptions",
                                   "m_showYAxisOptions",
                                   "m_showZAxisOptions",
                                   "m_showGridMovementOptions",
                                   "m_showGridFollowOptions",
                                   "m_xAxisColor",
                                   "m_yAxisColor",
                                   "m_zAxisColor",
                                   "m_majorLineSpacing",
                                   "m_majorLineOpacity"
                                   ));


                SerializedProperty unfocusedStyle = m_editorSyncedSettings.GetProperty("m_unfocusedStyle");

                EditorGUILayout.PropertyField(unfocusedStyle);
                EditorGUI.BeginDisabledGroup((GridSettings.VisualStyle)unfocusedStyle.enumValueIndex == GridSettings.VisualStyle.Off);
                {
                    DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive(
                                       "m_unfocusedColor"
                                       ));
                }
                EditorGUI.EndDisabledGroup();

                DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive(
                                   "m_measurementUnit"
                                   ));

                SerializedProperty coordinateDisplay = m_editorSyncedSettings.GetProperty("m_coordinateDisplay");

                EditorGUILayout.PropertyField(coordinateDisplay);
                EditorGUI.BeginDisabledGroup((CoordinateDisplay)coordinateDisplay.enumValueIndex == CoordinateDisplay.Off);
                {
                    DrawProperties(m_editorSyncedSettings.GetPropertiesInclusive(
                                       "m_coordinateAnchor",
                                       "m_coordinateColor",
                                       "m_coordinateSize",
                                       "m_useAxisColorForComponents"
                                       ));
                }
                EditorGUI.EndDisabledGroup();

                SerializedProperty majorLineSpacing = m_editorSyncedSettings.GetProperty("m_majorLineSpacing");
                SerializedProperty majorLineOpacity = m_editorSyncedSettings.GetProperty("m_majorLineOpacity");
                SerializedProperty coordinateSize   = m_editorSyncedSettings.GetProperty("m_coordinateSize");

                majorLineSpacing.intValue   = Mathf.Clamp(majorLineSpacing.intValue, 1, int.MaxValue);
                majorLineOpacity.floatValue = Mathf.Clamp(majorLineOpacity.floatValue, 0f, 1f);
                coordinateSize.intValue     = Mathf.Clamp(coordinateSize.intValue, 1, int.MaxValue);

                DrawReferenceLineProperties("m_planeReferenceDisplay", "m_planeReferenceStyle", "m_planeReferenceColor");
                DrawReferenceLineProperties("m_axisReferenceDisplay", "m_axisReferenceStyle", "m_axisReferenceColor");

                if (GUI.changed)
                {
                    m_editorSyncedSettings.ApplyModifiedProperties();
                    GridWindow.RepaintIfOpen();
                    GridWindow.ResetSceneGrid();
                }

                if (GUILayout.Button("Reset to Defaults"))
                {
                    Reset();
                }

                if (GUILayout.Button("Open Grids MX Toolbar"))
                {
                    GridWindow.Open();
                }
            }