static SettingsProvider CreateSettingsProvider()
        {
            var provider = new UserSettingsProvider(k_PreferencesPath,
                                                    ProBuilderSettings.instance,
                                                    new[] { typeof(ProBuilderSettingsProvider).Assembly });

            ProBuilderSettings.instance.afterSettingsSaved += () =>
            {
                if (ProBuilderEditor.instance != null)
                {
                    ProBuilderEditor.ReloadSettings();
                }
            };

            return(provider);
        }
예제 #2
0
        public static void SetPrefs()
        {
            PreferencesInternal.SetBool(PreferenceKeys.pbStripProBuilderOnBuild, pbStripProBuilderOnBuild);
            PreferencesInternal.SetBool(PreferenceKeys.pbDisableAutoUV2Generation, pbDisableAutoUV2Generation);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowSceneInfo, pbShowSceneInfo, PreferenceLocation.Global);
            PreferencesInternal.SetInt(PreferenceKeys.pbToolbarLocation, (int)pbToolbarLocation, PreferenceLocation.Global);

            PreferencesInternal.SetBool(PreferenceKeys.pbUseUnityColors, pbUseUnityColors, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbSelectedFaceDither, pbSelectedFaceDither, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbLineHandleSize, pbLineHandleSize, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbVertexHandleSize, pbVertexHandleSize, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbWireframeSize, pbWireframeSize, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedFaceColor, faceSelectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbWireframeColor, pbWireframeColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbPreselectionColor, pbPreselectionColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedVertexColor, vertexSelectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbUnselectedVertexColor, vertexUnselectedColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbSelectedEdgeColor, pbSelectedEdgeColor, PreferenceLocation.Global);
            PreferencesInternal.SetColor(PreferenceKeys.pbUnselectedEdgeColor, pbUnselectedEdgeColor, PreferenceLocation.Global);

            PreferencesInternal.SetString(PreferenceKeys.pbDefaultShortcuts, Shortcut.ShortcutsToString(defaultShortcuts), PreferenceLocation.Global);
//          PreferencesInternal.SetMaterial(PreferenceKeys.pbDefaultMaterial, pbDefaultMaterial);
            PreferencesInternal.SetInt(PreferenceKeys.pbDefaultCollider, (int)defaultColliderType);
            PreferencesInternal.SetInt(PreferenceKeys.pbShadowCastingMode, (int)pbShadowCastingMode);
            PreferencesInternal.SetInt(PreferenceKeys.pbDefaultStaticFlags, (int)pbDefaultStaticFlags);
            PreferencesInternal.SetBool(PreferenceKeys.pbDefaultOpenInDockableWindow, defaultOpenInDockableWindow, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowEditorNotifications, pbShowEditorNotifications, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceConvex, pbForceConvex);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceVertexPivot, pbForceVertexPivot, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbForceGridPivot, pbForceGridPivot, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbPerimeterEdgeBridgeOnly, pbPerimeterEdgeBridgeOnly, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbPBOSelectionOnly, pbPBOSelectionOnly, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbCloseShapeWindow, pbCloseShapeWindow, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbUVEditorFloating, pbUVEditorFloating, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbUniqueModeShortcuts, pbUniqueModeShortcuts, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbIconGUI, pbIconGUI, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShiftOnlyTooltips, pbShiftOnlyTooltips, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbMeshesAreAssets, pbMeshesAreAssets);
            PreferencesInternal.SetBool(PreferenceKeys.pbEnableExperimental, pbEnableExperimental, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowMissingLightmapUvWarning, showMissingLightmapUvWarning, PreferenceLocation.Global);
            PreferencesInternal.SetBool(PreferenceKeys.pbShowPreselectionHighlight, pbShowPreselectionHighlight, PreferenceLocation.Global);
            PreferencesInternal.SetFloat(PreferenceKeys.pbUVGridSnapValue, pbUVGridSnapValue, PreferenceLocation.Global);

            ProBuilderEditor.ReloadSettings();
            SceneView.RepaintAll();
        }
        static void ProBuilderPreferencesGUI()
        {
            if (s_SettingsProvider == null)
            {
                s_SettingsProvider = new UserSettingsProvider(ProBuilderSettings.instance, new[] { typeof(ProBuilderSettingsProvider).Assembly });

                ProBuilderSettings.instance.afterSettingsSaved += () =>
                {
                    if (ProBuilderEditor.instance != null)
                    {
                        ProBuilderEditor.ReloadSettings();
                    }
                };
            }

            s_SettingsProvider.OnGUI(null);
        }