Beispiel #1
0
        static void LoadPrefs()
        {
            if (s_PrefsLoaded)
            {
                return;
            }
            s_PrefsLoaded               = true;
            pbStripProBuilderOnBuild    = PreferencesInternal.GetBool(PreferenceKeys.pbStripProBuilderOnBuild);
            pbDisableAutoUV2Generation  = PreferencesInternal.GetBool(PreferenceKeys.pbDisableAutoUV2Generation);
            pbShowSceneInfo             = PreferencesInternal.GetBool(PreferenceKeys.pbShowSceneInfo);
            defaultOpenInDockableWindow = PreferencesInternal.GetBool(PreferenceKeys.pbDefaultOpenInDockableWindow);
            pbForceConvex               = PreferencesInternal.GetBool(PreferenceKeys.pbForceConvex);
            pbForceGridPivot            = PreferencesInternal.GetBool(PreferenceKeys.pbForceGridPivot);
            pbForceVertexPivot          = PreferencesInternal.GetBool(PreferenceKeys.pbForceVertexPivot);
            pbPerimeterEdgeBridgeOnly   = PreferencesInternal.GetBool(PreferenceKeys.pbPerimeterEdgeBridgeOnly);
            pbPBOSelectionOnly          = PreferencesInternal.GetBool(PreferenceKeys.pbPBOSelectionOnly);
            pbCloseShapeWindow          = PreferencesInternal.GetBool(PreferenceKeys.pbCloseShapeWindow);
            pbUVEditorFloating          = PreferencesInternal.GetBool(PreferenceKeys.pbUVEditorFloating);
            pbShowEditorNotifications   = PreferencesInternal.GetBool(PreferenceKeys.pbShowEditorNotifications);
            pbUniqueModeShortcuts       = PreferencesInternal.GetBool(PreferenceKeys.pbUniqueModeShortcuts);
            pbIconGUI                    = PreferencesInternal.GetBool(PreferenceKeys.pbIconGUI);
            pbShiftOnlyTooltips          = PreferencesInternal.GetBool(PreferenceKeys.pbShiftOnlyTooltips);
            pbMeshesAreAssets            = PreferencesInternal.GetBool(PreferenceKeys.pbMeshesAreAssets);
            pbEnableExperimental         = PreferencesInternal.GetBool(PreferenceKeys.pbEnableExperimental);
            showMissingLightmapUvWarning = PreferencesInternal.GetBool(PreferenceKeys.pbShowMissingLightmapUvWarning, false);
            pbShowPreselectionHighlight  = PreferencesInternal.GetBool(PreferenceKeys.pbShowPreselectionHighlight);

            pbUseUnityColors      = PreferencesInternal.GetBool(PreferenceKeys.pbUseUnityColors);
            pbLineHandleSize      = PreferencesInternal.GetFloat(PreferenceKeys.pbLineHandleSize);
            pbWireframeSize       = PreferencesInternal.GetFloat(PreferenceKeys.pbWireframeSize);
            faceSelectedColor     = PreferencesInternal.GetColor(PreferenceKeys.pbSelectedFaceColor);
            pbWireframeColor      = PreferencesInternal.GetColor(PreferenceKeys.pbWireframeColor);
            pbPreselectionColor   = PreferencesInternal.GetColor(PreferenceKeys.pbPreselectionColor);
            pbSelectedFaceDither  = PreferencesInternal.GetBool(PreferenceKeys.pbSelectedFaceDither);
            pbSelectedEdgeColor   = PreferencesInternal.GetColor(PreferenceKeys.pbSelectedEdgeColor);
            pbUnselectedEdgeColor = PreferencesInternal.GetColor(PreferenceKeys.pbUnselectedEdgeColor);
            vertexSelectedColor   = PreferencesInternal.GetColor(PreferenceKeys.pbSelectedVertexColor);
            vertexUnselectedColor = PreferencesInternal.GetColor(PreferenceKeys.pbUnselectedVertexColor);

            pbUVGridSnapValue  = PreferencesInternal.GetFloat(PreferenceKeys.pbUVGridSnapValue);
            pbVertexHandleSize = PreferencesInternal.GetFloat(PreferenceKeys.pbVertexHandleSize);

            defaultColliderType  = PreferencesInternal.GetEnum <ColliderType>(PreferenceKeys.pbDefaultCollider);
            pbToolbarLocation    = PreferencesInternal.GetEnum <SceneToolbarLocation>(PreferenceKeys.pbToolbarLocation);
            pbShadowCastingMode  = PreferencesInternal.GetEnum <ShadowCastingMode>(PreferenceKeys.pbShadowCastingMode);
            pbDefaultStaticFlags = PreferencesInternal.GetEnum <StaticEditorFlags>(PreferenceKeys.pbDefaultStaticFlags);

//          pbDefaultMaterial = PreferencesInternal.GetMaterial(PreferenceKeys.pbDefaultMaterial);
            defaultShortcuts = PreferencesInternal.GetShortcuts().ToArray();
        }
    static void LoadPrefs()
    {
        pbStripProBuilderOnBuild    = pb_PreferencesInternal.GetBool(pb_Constant.pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation  = pb_PreferencesInternal.GetBool(pb_Constant.pbDisableAutoUV2Generation);
        pbShowSceneInfo             = pb_PreferencesInternal.GetBool(pb_Constant.pbShowSceneInfo);
        defaultOpenInDockableWindow = pb_PreferencesInternal.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
        pbDragCheckLimit            = pb_PreferencesInternal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex             = pb_PreferencesInternal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot          = pb_PreferencesInternal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot        = pb_PreferencesInternal.GetBool(pb_Constant.pbForceVertexPivot);
        pbPerimeterEdgeBridgeOnly = pb_PreferencesInternal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
        pbPBOSelectionOnly        = pb_PreferencesInternal.GetBool(pb_Constant.pbPBOSelectionOnly);
        pbCloseShapeWindow        = pb_PreferencesInternal.GetBool(pb_Constant.pbCloseShapeWindow);
        pbUVEditorFloating        = pb_PreferencesInternal.GetBool(pb_Constant.pbUVEditorFloating);
        // pbShowSceneToolbar                   = pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
        pbShowEditorNotifications = pb_PreferencesInternal.GetBool(pb_Constant.pbShowEditorNotifications);
        pbUniqueModeShortcuts     = pb_PreferencesInternal.GetBool(pb_Constant.pbUniqueModeShortcuts);
        pbIconGUI                    = pb_PreferencesInternal.GetBool(pb_Constant.pbIconGUI);
        pbShiftOnlyTooltips          = pb_PreferencesInternal.GetBool(pb_Constant.pbShiftOnlyTooltips);
        pbDrawAxisLines              = pb_PreferencesInternal.GetBool(pb_Constant.pbDrawAxisLines);
        pbMeshesAreAssets            = pb_PreferencesInternal.GetBool(pb_Constant.pbMeshesAreAssets);
        pbElementSelectIsHamFisted   = pb_PreferencesInternal.GetBool(pb_Constant.pbElementSelectIsHamFisted);
        pbDragSelectWholeElement     = pb_PreferencesInternal.GetBool(pb_Constant.pbDragSelectWholeElement);
        pbEnableExperimental         = pb_PreferencesInternal.GetBool(pb_Constant.pbEnableExperimental);
        showMissingLightmapUvWarning = pb_PreferencesInternal.GetBool("pb_Lightmapping::showMissingLightmapUvWarning", false);


        pbDefaultFaceColor           = pb_PreferencesInternal.GetColor(pb_Constant.pbDefaultFaceColor);
        pbDefaultEdgeColor           = pb_PreferencesInternal.GetColor(pb_Constant.pbDefaultEdgeColor);
        pbDefaultSelectedVertexColor = pb_PreferencesInternal.GetColor(pb_Constant.pbDefaultSelectedVertexColor);
        pbDefaultVertexColor         = pb_PreferencesInternal.GetColor(pb_Constant.pbDefaultVertexColor);

        pbUVGridSnapValue  = pb_PreferencesInternal.GetFloat(pb_Constant.pbUVGridSnapValue);
        pbVertexHandleSize = pb_PreferencesInternal.GetFloat(pb_Constant.pbVertexHandleSize);

        defaultColliderType = pb_PreferencesInternal.GetEnum <ColliderType>(pb_Constant.pbDefaultCollider);
        pbToolbarLocation   = pb_PreferencesInternal.GetEnum <SceneToolbarLocation>(pb_Constant.pbToolbarLocation);
        pbDefaultEntity     = pb_PreferencesInternal.GetEnum <EntityType>(pb_Constant.pbDefaultEntity);
                #if !UNITY_4_6 && !UNITY_4_7
        pbShadowCastingMode = pb_PreferencesInternal.GetEnum <ShadowCastingMode>(pb_Constant.pbShadowCastingMode);
                #endif

        pbDefaultMaterial = pb_PreferencesInternal.GetMaterial(pb_Constant.pbDefaultMaterial);

        defaultShortcuts = pb_PreferencesInternal.GetShortcuts().ToArray();
    }
Beispiel #3
0
    static void LoadPrefs()
    {
        pbStripProBuilderOnBuild    = pb_Preferences_Internal.GetBool(pb_Constant.pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation  = pb_Preferences_Internal.GetBool(pb_Constant.pbDisableAutoUV2Generation);
        pbShowSceneInfo             = pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneInfo);
        pbEnableBackfaceSelection   = pb_Preferences_Internal.GetBool(pb_Constant.pbEnableBackfaceSelection);
        defaultOpenInDockableWindow = pb_Preferences_Internal.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
        pbDragCheckLimit            = pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex             = pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot          = pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot        = pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);
        pbManifoldEdgeExtrusion   = pb_Preferences_Internal.GetBool(pb_Constant.pbManifoldEdgeExtrusion);
        pbPerimeterEdgeBridgeOnly = pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
        pbPBOSelectionOnly        = pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);
        pbCloseShapeWindow        = pb_Preferences_Internal.GetBool(pb_Constant.pbCloseShapeWindow);
        pbUVEditorFloating        = pb_Preferences_Internal.GetBool(pb_Constant.pbUVEditorFloating);
        // pbShowSceneToolbar                   = pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
        pbShowEditorNotifications = pb_Preferences_Internal.GetBool(pb_Constant.pbShowEditorNotifications);
        pbUniqueModeShortcuts     = pb_Preferences_Internal.GetBool(pb_Constant.pbUniqueModeShortcuts);
        pbIconGUI           = pb_Preferences_Internal.GetBool(pb_Constant.pbIconGUI);
        pbShiftOnlyTooltips = pb_Preferences_Internal.GetBool(pb_Constant.pbShiftOnlyTooltips);
        pbDrawAxisLines     = pb_Preferences_Internal.GetBool(pb_Constant.pbDrawAxisLines);

        pbDefaultFaceColor           = pb_Preferences_Internal.GetColor(pb_Constant.pbDefaultFaceColor);
        pbDefaultEdgeColor           = pb_Preferences_Internal.GetColor(pb_Constant.pbDefaultEdgeColor);
        pbDefaultSelectedVertexColor = pb_Preferences_Internal.GetColor(pb_Constant.pbDefaultSelectedVertexColor);
        pbDefaultVertexColor         = pb_Preferences_Internal.GetColor(pb_Constant.pbDefaultVertexColor);

        pbUVGridSnapValue  = pb_Preferences_Internal.GetFloat(pb_Constant.pbUVGridSnapValue);
        pbVertexHandleSize = pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);

        defaultColliderType = pb_Preferences_Internal.GetEnum <ColliderType>(pb_Constant.pbDefaultCollider);
        pbToolbarLocation   = pb_Preferences_Internal.GetEnum <SceneToolbarLocation>(pb_Constant.pbToolbarLocation);
        pbDefaultEntity     = pb_Preferences_Internal.GetEnum <EntityType>(pb_Constant.pbDefaultEntity);

        pbDefaultMaterial = pb_Preferences_Internal.GetMaterial(pb_Constant.pbDefaultMaterial);

        defaultShortcuts = pb_Preferences_Internal.GetShortcuts().ToArray();
    }
	public static void PreferencesGUI () 
	{
		// Load the preferences
		if (!prefsLoaded) {
			LoadPrefs();
			prefsLoaded = true;
			OnWindowResize();
		}
		
		settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(200));

		EditorGUI.BeginChangeCheck();

		/**
		 * GENERAL SETTINGS
		 */
		GUILayout.Label("General Settings", EditorStyles.boldLabel);

		pbStripProBuilderOnBuild = EditorGUILayout.Toggle(new GUIContent("Strip PB Scripts on Build", "If true, when building an executable all ProBuilder scripts will be stripped from your built product."), pbStripProBuilderOnBuild);
		pbDisableAutoUV2Generation = EditorGUILayout.Toggle(new GUIContent("Disable Auto UV2 Generation", "Disables automatic generation of UV2 channel.  If Unity is sluggish when working with large ProBuilder objects, disabling UV2 generation will improve performance.  Use `Actions/Generate UV2` or `Actions/Generate Scene UV2` to build lightmap UVs prior to baking."), pbDisableAutoUV2Generation);
		pbShowSceneInfo = EditorGUILayout.Toggle(new GUIContent("Show Scene Info", "Displays the selected object vertex and triangle counts in the scene view."), pbShowSceneInfo);
		pbEnableBackfaceSelection = EditorGUILayout.Toggle(new GUIContent("Enable Back-face Selection", "If enabled, you may select faces that have been culled by their back face."), pbEnableBackfaceSelection);

		pbDefaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", pbDefaultMaterial, typeof(Material), false);
		defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

		GUILayout.BeginHorizontal();
			EditorGUILayout.PrefixLabel("Default Collider");
			defaultColliderType = ((ColliderType)EditorGUILayout.EnumPopup( (ColliderType)defaultColliderType ));
		GUILayout.EndHorizontal();

		if((ColliderType)defaultColliderType == ColliderType.MeshCollider)
			pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);
			
		pbShowEditorNotifications = EditorGUILayout.Toggle("Show Editor Notifications", pbShowEditorNotifications);
		pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);
		pbPBOSelectionOnly = EditorGUILayout.Toggle(new GUIContent("Only PBO are Selectable", "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"), pbPBOSelectionOnly);
		pbCloseShapeWindow = EditorGUILayout.Toggle(new GUIContent("Close shape window after building", "If true the shape window will close after hitting the build button"), pbCloseShapeWindow);
		pbShowSceneToolbar = EditorGUILayout.Toggle(new GUIContent("Show Scene Toolbar", "Hide or show the SceneView mode toolbar."), pbShowSceneToolbar);

		GUI.enabled = pbShowSceneToolbar;
		pbToolbarLocation = (SceneToolbarLocation) EditorGUILayout.EnumPopup("Toolbar Location", pbToolbarLocation);
		GUI.enabled = true;

		GUILayout.Space(4);
		
		/**
		 * GEOMETRY EDITING SETTINGS
		 */
		GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

		pbDefaultFaceColor = EditorGUILayout.ColorField("Selected Face Color", pbDefaultFaceColor);
		pbDefaultEdgeColor = EditorGUILayout.ColorField("Edge Wireframe Color", pbDefaultEdgeColor);
		pbDefaultVertexColor = EditorGUILayout.ColorField("Vertex Color", pbDefaultVertexColor);
		pbDefaultSelectedVertexColor = EditorGUILayout.ColorField("Selected Vertex Color", pbDefaultSelectedVertexColor);
		pbVertexHandleSize = EditorGUILayout.Slider("Vertex Handle Size", pbVertexHandleSize, 0f, 1f);
		pbForceVertexPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Vertex Point", "If true, new objects will automatically have their pivot point set to a vertex instead of the center."), pbForceVertexPivot);
		pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."), pbForceGridPivot);
		pbManifoldEdgeExtrusion = EditorGUILayout.Toggle(new GUIContent("Manifold Edge Extrusion", "If false, only edges non-manifold edges may be extruded.  If true, you may extrude any edge you like (for those who like to live dangerously)."), pbManifoldEdgeExtrusion);
		pbPerimeterEdgeBridgeOnly = EditorGUILayout.Toggle(new GUIContent("Bridge Perimeter Edges Only", "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."), pbPerimeterEdgeBridgeOnly);

		GUILayout.Space(4);

		/**
		 * UV EDITOR SETTINGS
		 */
		GUILayout.Label("UV Editing Settings", EditorStyles.boldLabel);
		pbUVGridSnapValue = EditorGUILayout.FloatField("UV Snap Increment", pbUVGridSnapValue);
		pbUVGridSnapValue = Mathf.Clamp(pbUVGridSnapValue, .015625f, 2f);
		pbUVEditorFloating = EditorGUILayout.Toggle(new GUIContent("Editor window floating", "If true UV   Editor window will open as a floating window"), pbUVEditorFloating);
		
		EditorGUILayout.EndScrollView();

		GUILayout.Space(4);

		GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

		if(GUI.Button(resetRect, "Use defaults"))
			ResetToDefaults();

		ShortcutSelectPanel();
		ShortcutEditPanel();

		// Save the preferences
		if (EditorGUI.EndChangeCheck())
			SetPrefs();
	}
	static void LoadPrefs()
	{
		pbStripProBuilderOnBuild 			= pb_Preferences_Internal.GetBool(pb_Constant.pbStripProBuilderOnBuild);
		pbDisableAutoUV2Generation 			= pb_Preferences_Internal.GetBool(pb_Constant.pbDisableAutoUV2Generation);
		pbShowSceneInfo 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneInfo);
		pbEnableBackfaceSelection 			= pb_Preferences_Internal.GetBool(pb_Constant.pbEnableBackfaceSelection);
		defaultOpenInDockableWindow 		= pb_Preferences_Internal.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
		pbDragCheckLimit 					= pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
		pbForceConvex 						= pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
		pbForceGridPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
		pbForceVertexPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);
		pbManifoldEdgeExtrusion 			= pb_Preferences_Internal.GetBool(pb_Constant.pbManifoldEdgeExtrusion);
		pbPerimeterEdgeBridgeOnly 			= pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
		pbPBOSelectionOnly 					= pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);
		pbCloseShapeWindow 					= pb_Preferences_Internal.GetBool(pb_Constant.pbCloseShapeWindow);		
		pbUVEditorFloating 					= pb_Preferences_Internal.GetBool(pb_Constant.pbUVEditorFloating);
		pbShowSceneToolbar 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
		pbShowEditorNotifications 			= pb_Preferences_Internal.GetBool(pb_Constant.pbShowEditorNotifications);

		pbDefaultFaceColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultFaceColor );
		pbDefaultEdgeColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultEdgeColor );
		pbDefaultSelectedVertexColor 		= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultSelectedVertexColor );
		pbDefaultVertexColor 				= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultVertexColor );

		pbUVGridSnapValue 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbUVGridSnapValue);
		pbVertexHandleSize 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);

		defaultColliderType 				= pb_Preferences_Internal.GetEnum<ColliderType>(pb_Constant.pbDefaultCollider);
		pbToolbarLocation	 				= pb_Preferences_Internal.GetEnum<SceneToolbarLocation>(pb_Constant.pbToolbarLocation);

		pbDefaultMaterial 					= pb_Preferences_Internal.GetMaterial(pb_Constant.pbDefaultMaterial);

		defaultShortcuts 					= EditorPrefs.HasKey(pb_Constant.pbDefaultShortcuts) ? 
			pb_Shortcut.ParseShortcuts(EditorPrefs.GetString(pb_Constant.pbDefaultShortcuts)) : 
			pb_Shortcut.DefaultShortcuts();

	}
    public static void PreferencesGUI()
    {
        // Load the preferences
        if (!prefsLoaded) {
            LoadPrefs();
            prefsLoaded = true;
            OnWindowResize();
        }

        settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(200));

        EditorGUI.BeginChangeCheck();

        /**
         * GENERAL SETTINGS
         */
        GUILayout.Label("General Settings", EditorStyles.boldLabel);

        pbStripProBuilderOnBuild = EditorGUILayout.Toggle(new GUIContent("Strip PB Scripts on Build", "If true, when building an executable all ProBuilder scripts will be stripped from your built product."), pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation = EditorGUILayout.Toggle(new GUIContent("Disable Auto UV2 Generation", "Disables automatic generation of UV2 channel.  If Unity is sluggish when working with large ProBuilder objects, disabling UV2 generation will improve performance.  Use `Actions/Generate UV2` or `Actions/Generate Scene UV2` to build lightmap UVs prior to baking."), pbDisableAutoUV2Generation);
        pbShowSceneInfo = EditorGUILayout.Toggle(new GUIContent("Show Scene Info", "Displays the selected object vertex and triangle counts in the scene view."), pbShowSceneInfo);
        pbShowEditorNotifications = EditorGUILayout.Toggle("Show Editor Notifications", pbShowEditorNotifications);

        /**
         * TOOLBAR SETTINGS
         */
        GUILayout.Label("Toolbar Settings", EditorStyles.boldLabel);

        pbIconGUI = EditorGUILayout.Toggle(new GUIContent("Use Icon GUI", "Toggles the ProBuilder window interface between text and icon versions."), pbIconGUI);
        pbShiftOnlyTooltips = EditorGUILayout.Toggle(new GUIContent("Shift Key Tooltips", "Tooltips will only show when the Shift key is held"), pbShiftOnlyTooltips);
        pbToolbarLocation = (SceneToolbarLocation) EditorGUILayout.EnumPopup("Toolbar Location", pbToolbarLocation);

        pbUniqueModeShortcuts = EditorGUILayout.Toggle(new GUIContent("Unique Mode Shortcuts", "When off, the G key toggles between Object and Element modes and H enumerates the element modes.  If on, G, H, J, and K are shortcuts to Object, Vertex, Edge, and Face modes respectively."), pbUniqueModeShortcuts);
        defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

        /**
         * DEFAULT SETTINGS
         */
        GUILayout.Label("Defaults", EditorStyles.boldLabel);

        pbDefaultMaterial = (Material) EditorGUILayout.ObjectField("Default Material", pbDefaultMaterial, typeof(Material), false);

        GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Default Entity");
            pbDefaultEntity = ((EntityType)EditorGUILayout.EnumPopup( (EntityType)pbDefaultEntity ));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Default Collider");
            defaultColliderType = ((ColliderType)EditorGUILayout.EnumPopup( (ColliderType)defaultColliderType ));
        GUILayout.EndHorizontal();

        if((ColliderType)defaultColliderType == ColliderType.MeshCollider)
            pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);

        #if !UNITY_4_7
        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Shadow Casting Mode");
        pbShadowCastingMode = (ShadowCastingMode) EditorGUILayout.EnumPopup(pbShadowCastingMode);
        GUILayout.EndHorizontal();
        #endif

        /**
         * MISC. SETTINGS
         */
        GUILayout.Label("Misc. Settings", EditorStyles.boldLabel);

        pbDragCheckLimit = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);
        pbPBOSelectionOnly = EditorGUILayout.Toggle(new GUIContent("Only PBO are Selectable", "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"), pbPBOSelectionOnly);
        pbCloseShapeWindow = EditorGUILayout.Toggle(new GUIContent("Close shape window after building", "If true the shape window will close after hitting the build button"), pbCloseShapeWindow);
        pbDrawAxisLines = EditorGUILayout.Toggle(new GUIContent("Dimension Overlay Lines", "When the Dimensions Overlay is on, this toggle shows or hides the axis lines."), pbDrawAxisLines);

        GUILayout.Space(4);

        /**
         * GEOMETRY EDITING SETTINGS
         */
        GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

        pbElementSelectIsHamFisted = !EditorGUILayout.Toggle(new GUIContent("Precise Element Selection", "When enabled you will be able to select object faces when in Vertex of Edge mode by clicking the center of a face.  When disabled, edge and vertex selection will always be restricted to the nearest element."), !pbElementSelectIsHamFisted);
        pbDragSelectWholeElement = EditorGUILayout.Toggle("Precise Drag Select", pbDragSelectWholeElement);
        pbDefaultFaceColor = EditorGUILayout.ColorField("Selected Face Color", pbDefaultFaceColor);
        pbDefaultEdgeColor = EditorGUILayout.ColorField("Edge Wireframe Color", pbDefaultEdgeColor);
        pbDefaultVertexColor = EditorGUILayout.ColorField("Vertex Color", pbDefaultVertexColor);
        pbDefaultSelectedVertexColor = EditorGUILayout.ColorField("Selected Vertex Color", pbDefaultSelectedVertexColor);
        pbVertexHandleSize = EditorGUILayout.Slider("Vertex Handle Size", pbVertexHandleSize, 0f, 3f);
        pbForceVertexPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Vertex Point", "If true, new objects will automatically have their pivot point set to a vertex instead of the center."), pbForceVertexPivot);
        pbForceGridPivot = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."), pbForceGridPivot);
        pbPerimeterEdgeBridgeOnly = EditorGUILayout.Toggle(new GUIContent("Bridge Perimeter Edges Only", "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."), pbPerimeterEdgeBridgeOnly);

        GUILayout.Space(4);

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

        pbMeshesAreAssets = EditorGUILayout.Toggle(new GUIContent("Meshes Are Assets", "Experimental!  Instead of storing mesh data in the scene, this toggle creates a Mesh cache in the Project that ProBuilder will use."), pbMeshesAreAssets);

        GUILayout.Space(4);

        /**
         * UV EDITOR SETTINGS
         */
        GUILayout.Label("UV Editing Settings", EditorStyles.boldLabel);
        pbUVGridSnapValue = EditorGUILayout.FloatField("UV Snap Increment", pbUVGridSnapValue);
        pbUVGridSnapValue = Mathf.Clamp(pbUVGridSnapValue, .015625f, 2f);
        pbUVEditorFloating = EditorGUILayout.Toggle(new GUIContent("Editor window floating", "If true UV   Editor window will open as a floating window"), pbUVEditorFloating);

        EditorGUILayout.EndScrollView();

        GUILayout.Space(4);

        GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

        if(GUI.Button(resetRect, "Use defaults"))
            ResetToDefaults();

        ShortcutSelectPanel();
        ShortcutEditPanel();

        // Save the preferences
        if (EditorGUI.EndChangeCheck())
            SetPrefs();
    }
    static void LoadPrefs()
    {
        pbStripProBuilderOnBuild 			= pb_Preferences_Internal.GetBool(pb_Constant.pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation 			= pb_Preferences_Internal.GetBool(pb_Constant.pbDisableAutoUV2Generation);
        pbShowSceneInfo 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneInfo);
        defaultOpenInDockableWindow 		= pb_Preferences_Internal.GetBool(pb_Constant.pbDefaultOpenInDockableWindow);
        pbDragCheckLimit 					= pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);
        pbForceConvex 						= pb_Preferences_Internal.GetBool(pb_Constant.pbForceConvex);
        pbForceGridPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceGridPivot);
        pbForceVertexPivot 					= pb_Preferences_Internal.GetBool(pb_Constant.pbForceVertexPivot);
        pbPerimeterEdgeBridgeOnly 			= pb_Preferences_Internal.GetBool(pb_Constant.pbPerimeterEdgeBridgeOnly);
        pbPBOSelectionOnly 					= pb_Preferences_Internal.GetBool(pb_Constant.pbPBOSelectionOnly);
        pbCloseShapeWindow 					= pb_Preferences_Internal.GetBool(pb_Constant.pbCloseShapeWindow);
        pbUVEditorFloating 					= pb_Preferences_Internal.GetBool(pb_Constant.pbUVEditorFloating);
        // pbShowSceneToolbar 					= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
        pbShowEditorNotifications 			= pb_Preferences_Internal.GetBool(pb_Constant.pbShowEditorNotifications);
        pbUniqueModeShortcuts 				= pb_Preferences_Internal.GetBool(pb_Constant.pbUniqueModeShortcuts);
        pbIconGUI 							= pb_Preferences_Internal.GetBool(pb_Constant.pbIconGUI);
        pbShiftOnlyTooltips 				= pb_Preferences_Internal.GetBool(pb_Constant.pbShiftOnlyTooltips);
        pbDrawAxisLines 					= pb_Preferences_Internal.GetBool(pb_Constant.pbDrawAxisLines);
        pbMeshesAreAssets 					= pb_Preferences_Internal.GetBool(pb_Constant.pbMeshesAreAssets);
        pbElementSelectIsHamFisted			= pb_Preferences_Internal.GetBool(pb_Constant.pbElementSelectIsHamFisted);
        pbDragSelectWholeElement			= pb_Preferences_Internal.GetBool(pb_Constant.pbDragSelectWholeElement);

        pbDefaultFaceColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultFaceColor );
        pbDefaultEdgeColor 					= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultEdgeColor );
        pbDefaultSelectedVertexColor 		= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultSelectedVertexColor );
        pbDefaultVertexColor 				= pb_Preferences_Internal.GetColor( pb_Constant.pbDefaultVertexColor );

        pbUVGridSnapValue 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbUVGridSnapValue);
        pbVertexHandleSize 					= pb_Preferences_Internal.GetFloat(pb_Constant.pbVertexHandleSize);

        defaultColliderType 				= pb_Preferences_Internal.GetEnum<ColliderType>(pb_Constant.pbDefaultCollider);
        pbToolbarLocation	 				= pb_Preferences_Internal.GetEnum<SceneToolbarLocation>(pb_Constant.pbToolbarLocation);
        pbDefaultEntity	 					= pb_Preferences_Internal.GetEnum<EntityType>(pb_Constant.pbDefaultEntity);
        #if !UNITY_4_7
        pbShadowCastingMode					= pb_Preferences_Internal.GetEnum<ShadowCastingMode>(pb_Constant.pbShadowCastingMode);
        #endif

        pbDefaultMaterial 					= pb_Preferences_Internal.GetMaterial(pb_Constant.pbDefaultMaterial);

        defaultShortcuts 					= pb_Preferences_Internal.GetShortcuts().ToArray();
    }
Beispiel #8
0
    public static void PreferencesGUI()
    {
        // Load the preferences
        if (!prefsLoaded)
        {
            LoadPrefs();
            prefsLoaded = true;
            OnWindowResize();
        }

        settingsScroll = EditorGUILayout.BeginScrollView(settingsScroll, GUILayout.MaxHeight(200));

        EditorGUI.BeginChangeCheck();

        /**
         * GENERAL SETTINGS
         */
        GUILayout.Label("General Settings", EditorStyles.boldLabel);

        pbStripProBuilderOnBuild   = EditorGUILayout.Toggle(new GUIContent("Strip PB Scripts on Build", "If true, when building an executable all ProBuilder scripts will be stripped from your built product."), pbStripProBuilderOnBuild);
        pbDisableAutoUV2Generation = EditorGUILayout.Toggle(new GUIContent("Disable Auto UV2 Generation", "Disables automatic generation of UV2 channel.  If Unity is sluggish when working with large ProBuilder objects, disabling UV2 generation will improve performance.  Use `Actions/Generate UV2` or `Actions/Generate Scene UV2` to build lightmap UVs prior to baking."), pbDisableAutoUV2Generation);
        pbShowSceneInfo            = EditorGUILayout.Toggle(new GUIContent("Show Scene Info", "Displays the selected object vertex and triangle counts in the scene view."), pbShowSceneInfo);
        pbShowEditorNotifications  = EditorGUILayout.Toggle("Show Editor Notifications", pbShowEditorNotifications);
        pbEnableBackfaceSelection  = EditorGUILayout.Toggle(new GUIContent("Enable Back-face Selection", "If enabled, you may select faces that have been culled by their back face."), pbEnableBackfaceSelection);

        /**
         * TOOLBAR SETTINGS
         */
        GUILayout.Label("Toolbar Settings", EditorStyles.boldLabel);

        pbIconGUI           = EditorGUILayout.Toggle(new GUIContent("Use Icon GUI", "Toggles the ProBuilder window interface between text and icon versions."), pbIconGUI);
        pbShiftOnlyTooltips = EditorGUILayout.Toggle(new GUIContent("Shift Key Tooltips", "Tooltips will only show when the Shift key is held"), pbShiftOnlyTooltips);
        pbToolbarLocation   = (SceneToolbarLocation)EditorGUILayout.EnumPopup("Toolbar Location", pbToolbarLocation);

        pbUniqueModeShortcuts       = EditorGUILayout.Toggle(new GUIContent("Unique Mode Shortcuts", "When off, the G key toggles between Object and Element modes and H enumerates the element modes.  If on, G, H, J, and K are shortcuts to Object, Vertex, Edge, and Face modes respectively."), pbUniqueModeShortcuts);
        defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);


        /**
         * DEFAULT SETTINGS
         */
        GUILayout.Label("Defaults", EditorStyles.boldLabel);

        pbDefaultMaterial = (Material)EditorGUILayout.ObjectField("Default Material", pbDefaultMaterial, typeof(Material), false);
        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Default Entity");
        pbDefaultEntity = ((EntityType)EditorGUILayout.EnumPopup((EntityType)pbDefaultEntity));
        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        EditorGUILayout.PrefixLabel("Default Collider");
        defaultColliderType = ((ColliderType)EditorGUILayout.EnumPopup((ColliderType)defaultColliderType));
        GUILayout.EndHorizontal();

        if ((ColliderType)defaultColliderType == ColliderType.MeshCollider)
        {
            pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);
        }

        /**
         * MISC. SETTINGS
         */
        GUILayout.Label("Misc. Settings", EditorStyles.boldLabel);

        pbDragCheckLimit   = EditorGUILayout.Toggle(new GUIContent("Limit Drag Check to Selection", "If true, when drag selecting faces, only currently selected pb-Objects will be tested for matching faces.  If false, all pb_Objects in the scene will be checked.  The latter may be slower in large scenes."), pbDragCheckLimit);
        pbPBOSelectionOnly = EditorGUILayout.Toggle(new GUIContent("Only PBO are Selectable", "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"), pbPBOSelectionOnly);
        pbCloseShapeWindow = EditorGUILayout.Toggle(new GUIContent("Close shape window after building", "If true the shape window will close after hitting the build button"), pbCloseShapeWindow);
        pbDrawAxisLines    = EditorGUILayout.Toggle(new GUIContent("Dimension Overlay Lines", "When the Dimensions Overlay is on, this toggle shows or hides the axis lines."), pbDrawAxisLines);

        GUILayout.Space(4);

        /**
         * GEOMETRY EDITING SETTINGS
         */
        GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

        pbDefaultFaceColor           = EditorGUILayout.ColorField("Selected Face Color", pbDefaultFaceColor);
        pbDefaultEdgeColor           = EditorGUILayout.ColorField("Edge Wireframe Color", pbDefaultEdgeColor);
        pbDefaultVertexColor         = EditorGUILayout.ColorField("Vertex Color", pbDefaultVertexColor);
        pbDefaultSelectedVertexColor = EditorGUILayout.ColorField("Selected Vertex Color", pbDefaultSelectedVertexColor);
        pbVertexHandleSize           = EditorGUILayout.Slider("Vertex Handle Size", pbVertexHandleSize, 0f, 1f);
        pbForceVertexPivot           = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Vertex Point", "If true, new objects will automatically have their pivot point set to a vertex instead of the center."), pbForceVertexPivot);
        pbForceGridPivot             = EditorGUILayout.Toggle(new GUIContent("Force Pivot to Grid", "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."), pbForceGridPivot);
        pbManifoldEdgeExtrusion      = EditorGUILayout.Toggle(new GUIContent("Manifold Edge Extrusion", "If false, only edges non-manifold edges may be extruded.  If true, you may extrude any edge you like (for those who like to live dangerously)."), pbManifoldEdgeExtrusion);
        pbPerimeterEdgeBridgeOnly    = EditorGUILayout.Toggle(new GUIContent("Bridge Perimeter Edges Only", "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."), pbPerimeterEdgeBridgeOnly);

        GUILayout.Space(4);

        /**
         * UV EDITOR SETTINGS
         */
        GUILayout.Label("UV Editing Settings", EditorStyles.boldLabel);
        pbUVGridSnapValue  = EditorGUILayout.FloatField("UV Snap Increment", pbUVGridSnapValue);
        pbUVGridSnapValue  = Mathf.Clamp(pbUVGridSnapValue, .015625f, 2f);
        pbUVEditorFloating = EditorGUILayout.Toggle(new GUIContent("Editor window floating", "If true UV   Editor window will open as a floating window"), pbUVEditorFloating);

        EditorGUILayout.EndScrollView();

        GUILayout.Space(4);

        GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

        if (GUI.Button(resetRect, "Use defaults"))
        {
            ResetToDefaults();
        }

        ShortcutSelectPanel();
        ShortcutEditPanel();

        // Save the preferences
        if (EditorGUI.EndChangeCheck())
        {
            SetPrefs();
        }
    }
Beispiel #9
0
        static void PreferencesGUI()
        {
            LoadPrefs();

            EditorGUIUtility.labelWidth = 200f;

            s_SettingsScroll = EditorGUILayout.BeginScrollView(s_SettingsScroll);

            EditorGUI.BeginChangeCheck();

            if (GUILayout.Button("Reset All Preferences"))
            {
                ResetToDefaults();
            }

            /**
             * GENERAL SETTINGS
             */
            GUILayout.Label("General Settings", EditorStyles.boldLabel);

            pbStripProBuilderOnBuild =
                EditorGUILayout.Toggle(
                    new GUIContent("Strip PB Scripts on Build",
                                   "If true, when building an executable all ProBuilder scripts will be stripped from your built product."),
                    pbStripProBuilderOnBuild);
            pbDisableAutoUV2Generation = EditorGUILayout.Toggle(
                new GUIContent("Disable Auto UV2 Generation",
                               "Disables automatic generation of UV2 channel.  If Unity is sluggish when working with large ProBuilder objects, disabling UV2 generation will improve performance.  Use `Actions/Generate UV2` or `Actions/Generate Scene UV2` to build lightmap UVs prior to baking."),
                pbDisableAutoUV2Generation);
            pbShowSceneInfo =
                EditorGUILayout.Toggle(
                    new GUIContent("Show Scene Info", "Displays the selected object vertex and triangle counts in the scene view."),
                    pbShowSceneInfo);
            pbShowEditorNotifications = EditorGUILayout.Toggle("Show Editor Notifications", pbShowEditorNotifications);

            /**
             * TOOLBAR SETTINGS
             */
            GUILayout.Label("Toolbar Settings", EditorStyles.boldLabel);

            pbIconGUI = EditorGUILayout.Toggle(
                new GUIContent("Use Icon GUI", "Toggles the ProBuilder window interface between text and icon versions."),
                pbIconGUI);
            pbShiftOnlyTooltips =
                EditorGUILayout.Toggle(new GUIContent("Shift Key Tooltips", "Tooltips will only show when the Shift key is held"),
                                       pbShiftOnlyTooltips);
            pbToolbarLocation = (SceneToolbarLocation)EditorGUILayout.EnumPopup("Toolbar Location", pbToolbarLocation);

            pbUniqueModeShortcuts = EditorGUILayout.Toggle(
                new GUIContent("Unique Mode Shortcuts",
                               "When off, the G key toggles between Object and Element modes and H enumerates the element modes.  If on, G, H, J, and K are shortcuts to Object, Vertex, Edge, and Face modes respectively."),
                pbUniqueModeShortcuts);
            defaultOpenInDockableWindow = EditorGUILayout.Toggle("Open in Dockable Window", defaultOpenInDockableWindow);

            /**
             * DEFAULT SETTINGS
             */
            GUILayout.Label("Defaults", EditorStyles.boldLabel);

            pbDefaultMaterial =
                (Material)EditorGUILayout.ObjectField("Default Material", pbDefaultMaterial, typeof(Material), false);

            pbDefaultStaticFlags = (StaticEditorFlags)EditorGUILayout.EnumFlagsField("Static Flags", pbDefaultStaticFlags);

            GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Default Collider");
            defaultColliderType = ((ColliderType)EditorGUILayout.EnumPopup((ColliderType)defaultColliderType));
            GUILayout.EndHorizontal();

            if ((ColliderType)defaultColliderType == ColliderType.MeshCollider)
            {
                pbForceConvex = EditorGUILayout.Toggle("Force Convex Mesh Collider", pbForceConvex);
            }

            GUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Shadow Casting Mode");
            pbShadowCastingMode = (ShadowCastingMode)EditorGUILayout.EnumPopup(pbShadowCastingMode);
            GUILayout.EndHorizontal();

            /**
             * HANDLE COLORS
             */
            GUILayout.Label("Handles & Colors", EditorStyles.boldLabel);

            pbUseUnityColors = EditorGUILayout.Toggle("Use Unity Colors", pbUseUnityColors);

            if (!pbUseUnityColors)
            {
                pbWireframeColor      = EditorGUILayout.ColorField("Wireframe", pbWireframeColor);
                pbPreselectionColor   = EditorGUILayout.ColorField("Preselection", pbPreselectionColor);
                faceSelectedColor     = EditorGUILayout.ColorField("Selected Face Color", faceSelectedColor);
                pbSelectedFaceDither  = EditorGUILayout.Toggle("Dither Face Overlay", pbSelectedFaceDither);
                pbUnselectedEdgeColor = EditorGUILayout.ColorField("Unselected Edge Color", pbUnselectedEdgeColor);
                pbSelectedEdgeColor   = EditorGUILayout.ColorField("Selected Edge Color", pbSelectedEdgeColor);
                vertexUnselectedColor = EditorGUILayout.ColorField("Unselected Vertex Color", vertexUnselectedColor);
                vertexSelectedColor   = EditorGUILayout.ColorField("Selected Vertex Color", vertexSelectedColor);
            }

            pbVertexHandleSize = EditorGUILayout.Slider("Vertex Size", pbVertexHandleSize, 1f, 10f);

            bool geoLine = BuiltinMaterials.geometryShadersSupported;

            GUI.enabled      = geoLine;
            pbLineHandleSize = EditorGUILayout.Slider("Line Size", geoLine ? pbLineHandleSize : 0f, 0f, 3f);
            pbWireframeSize  = EditorGUILayout.Slider("Wireframe Size", geoLine ? pbWireframeSize : 0f, 0f, 3f);
            GUI.enabled      = true;

            /**
             * MISC. SETTINGS
             */
            GUILayout.Label("Misc. Settings", EditorStyles.boldLabel);

            pbManageLightmappingStaticFlag = EditorGUILayout.Toggle(
                new GUIContent("Manage Lightmap Static Flag",
                               "Allow ProBuilder to toggle off the Lightmap Static flag when no UV2 channel is present. This prevents lighting artifacts caused by a missing UV2 channel."),
                pbManageLightmappingStaticFlag);

            showMissingLightmapUvWarning = EditorGUILayout.Toggle("Show Missing Lightmap UVs Warning", showMissingLightmapUvWarning);

            pbPBOSelectionOnly =
                EditorGUILayout.Toggle(
                    new GUIContent("Only PBO are Selectable",
                                   "If true, you will not be able to select non probuilder objects in Geometry and Texture mode"),
                    pbPBOSelectionOnly);
            pbCloseShapeWindow =
                EditorGUILayout.Toggle(
                    new GUIContent("Close shape window after building",
                                   "If true the shape window will close after hitting the build button"), pbCloseShapeWindow);

            GUILayout.Space(4);

            /**
             * GEOMETRY EDITING SETTINGS
             */
            GUILayout.Label("Geometry Editing Settings", EditorStyles.boldLabel);

            pbForceVertexPivot =
                EditorGUILayout.Toggle(
                    new GUIContent("Force Pivot to Vertex Point",
                                   "If true, new objects will automatically have their pivot point set to a vertex instead of the center."),
                    pbForceVertexPivot);
            pbForceGridPivot = EditorGUILayout.Toggle(
                new GUIContent("Force Pivot to Grid",
                               "If true, newly instantiated pb_Objects will be snapped to the nearest point on grid.  If ProGrids is present, the snap value will be used, otherwise decimals are simply rounded to whole numbers."),
                pbForceGridPivot);
            pbPerimeterEdgeBridgeOnly = EditorGUILayout.Toggle(
                new GUIContent("Bridge Perimeter Edges Only",
                               "If true, only edges on the perimeters of an object may be bridged.  If false, you may bridge any between any two edges you like."),
                pbPerimeterEdgeBridgeOnly);

            GUILayout.Space(4);

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

            pbEnableExperimental = EditorGUILayout.Toggle(
                new GUIContent("Experimental Features",
                               "Enables some experimental new features that we're trying out.  These may be incomplete or buggy, so please exercise caution when making use of this functionality!"),
                pbEnableExperimental);

            pbMeshesAreAssets =
                EditorGUILayout.Toggle(
                    new GUIContent("Meshes Are Assets",
                                   "Experimental!  Instead of storing mesh data in the scene, this toggle creates a Mesh cache in the Project that ProBuilder will use."),
                    pbMeshesAreAssets);

            pbShowPreselectionHighlight = EditorGUILayout.Toggle("Show Preselection Highlight", pbShowPreselectionHighlight);

            GUILayout.Space(4);

            /**
             * UV EDITOR SETTINGS
             */
            GUILayout.Label("UV Editing Settings", EditorStyles.boldLabel);
            pbUVGridSnapValue  = EditorGUILayout.FloatField("UV Snap Increment", pbUVGridSnapValue);
            pbUVGridSnapValue  = Mathf.Clamp(pbUVGridSnapValue, .015625f, 2f);
            pbUVEditorFloating =
                EditorGUILayout.Toggle(
                    new GUIContent("Editor window floating", "If true UV   Editor window will open as a floating window"),
                    pbUVEditorFloating);

            GUILayout.Space(4);

            GUILayout.Label("Shortcut Settings", EditorStyles.boldLabel);

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical(GUILayout.MinWidth(EditorGUIUtility.labelWidth), GUILayout.MaxWidth(EditorGUIUtility.labelWidth));
            ShortcutSelectPanel();
            GUILayout.EndVertical();
            GUILayout.BeginVertical();
            ShortcutEditPanel();
            GUILayout.EndVertical();
            GUILayout.EndHorizontal();

            EditorGUILayout.EndScrollView();

            // Save the preferences
            if (EditorGUI.EndChangeCheck())
            {
                SetPrefs();
            }

            EditorGUIUtility.labelWidth = 0f;
        }
Beispiel #10
0
	private void LoadPrefs()
	{
		// this exists to force update preferences when updating packages
		if(!EditorPrefs.HasKey(pb_Constant.pbEditorPrefVersion) || EditorPrefs.GetInt(pb_Constant.pbEditorPrefVersion) != EDITOR_PREF_VERSION )
		{
			EditorPrefs.SetInt(pb_Constant.pbEditorPrefVersion, EDITOR_PREF_VERSION);
			EditorPrefs.DeleteKey(pb_Constant.pbVertexHandleSize);
			EditorPrefs.DeleteKey(pb_Constant.pbDefaultFaceColor);
			EditorPrefs.DeleteKey(pb_Constant.pbDefaultEdgeColor);
			EditorPrefs.DeleteKey(pb_Constant.pbDefaultSelectedVertexColor);
			EditorPrefs.DeleteKey(pb_Constant.pbDefaultVertexColor);
		}

		editLevel 			= pb_Preferences_Internal.GetEnum<EditLevel>(pb_Constant.pbDefaultEditLevel);
		selectionMode		= pb_Preferences_Internal.GetEnum<SelectMode>(pb_Constant.pbDefaultSelectionMode);
		handleAlignment		= pb_Preferences_Internal.GetEnum<HandleAlignment>(pb_Constant.pbHandleAlignment);
		pref_showSceneInfo 	= pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneInfo);
		pref_backfaceSelect = pb_Preferences_Internal.GetBool(pb_Constant.pbEnableBackfaceSelection);

		pref_snapEnabled 	= pb_ProGrids_Interface.SnapEnabled();
		pref_snapValue		= pb_ProGrids_Interface.SnapValue();
		pref_snapAxisConstraints = pb_ProGrids_Interface.UseAxisConstraints();
				
		shortcuts 			= pb_Shortcut.ParseShortcuts(EditorPrefs.GetString(pb_Constant.pbDefaultShortcuts)).ToArray();
		limitFaceDragCheckToSelection = pb_Preferences_Internal.GetBool(pb_Constant.pbDragCheckLimit);


		pref_showToolbar = pb_Preferences_Internal.GetBool(pb_Constant.pbShowSceneToolbar);
		pref_sceneToolbarLocation = pb_Preferences_Internal.GetEnum<SceneToolbarLocation>(pb_Constant.pbToolbarLocation);
	}