[Bf-blender-cvs] [a77b63c5694] master: UI: Preferences Redesign Part 2
Severin
noreply at git.blender.org
Fri Jan 4 22:20:27 CET 2019
Commit: a77b63c56943ebd0046f738e6abbea4c85dc65b6
Author: Severin
Date: Fri Jan 4 21:40:16 2019 +0100
Branches: master
https://developer.blender.org/rBa77b63c56943ebd0046f738e6abbea4c85dc65b6
UI: Preferences Redesign Part 2
(Part 1 was 00963afc14978b)
Does the following changes visible to users:
* Use panels and sub-panels for more structured & logical grouping
* Re-organized options more logically than before (see images in D4148)
* Use flow layout (single column by default).
* New layout uses horizontal margin if there's enough space.
* Change size of Preferences window to suit new layout.
* Move keymap related options from "Input" into own section.
* Own, left-bottom aligned region for Save Preferences button.
* Adjustments of names, tooltips & icons.
* Move buttons from header into the main region (except editor switch).
* Hide Preferences header when opened in temporary window.
* Use full area width for header.
* Don't use slider but regular number widget for UI scale.
* Gray out animation player path option if player isn't "Custom"
Internal changes:
* Rearrange RNA properties to match changed UI structure.
* Introduces new "EXECUTE" region type, see reasoning in D3982.
* Changes to panel layout and AZone code for dynamic panel region.
* Bumps subversion and does versioning for new regions.
RNA changes are documented in the release notes:
https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Python_API/Preferences_API
Design & implementation mostly done by @billreynish and myself.
I recommend checking out the screenshots posted by William:
https://developer.blender.org/D4148#93787
Reviewed By: brecht
Maniphest Tasks: T54115
Differential Revision: https://developer.blender.org/D4148
===================================================================
M intern/cycles/blender/addon/properties.py
M release/datafiles/userdef/userdef_default_theme.c
M release/scripts/modules/bpy/utils/__init__.py
M release/scripts/modules/rna_keymap_ui.py
M release/scripts/startup/bl_ui/space_userpref.py
M source/blender/blenkernel/BKE_blender_version.h
M source/blender/blenloader/intern/versioning_280.c
M source/blender/blenloader/intern/versioning_userdef.c
M source/blender/editors/include/ED_screen.h
M source/blender/editors/interface/interface_layout.c
M source/blender/editors/interface/interface_ops.c
M source/blender/editors/interface/interface_panel.c
M source/blender/editors/interface/resources.c
M source/blender/editors/screen/area.c
M source/blender/editors/screen/screen_edit.c
M source/blender/editors/screen/screen_intern.h
M source/blender/editors/screen/screen_ops.c
M source/blender/editors/space_userpref/space_userpref.c
M source/blender/makesdna/DNA_screen_types.h
M source/blender/makesdna/DNA_userdef_types.h
M source/blender/makesrna/RNA_access.h
M source/blender/makesrna/intern/rna_screen.c
M source/blender/makesrna/intern/rna_space.c
M source/blender/makesrna/intern/rna_userdef.c
M source/blender/windowmanager/intern/wm_files.c
===================================================================
diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index 3f6c6de5c5e..9cbb2e86369 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -1485,7 +1485,6 @@ class CyclesPreferences(bpy.types.AddonPreferences):
def draw_impl(self, layout, context):
available_device_types = self.get_device_types(context)
- layout.label(text="Cycles Compute Device:")
if len(available_device_types) == 1:
layout.label(text="No compatible GPUs found", icon='INFO')
return
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 6fe61c60470..7a7f804bbed 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -821,7 +821,8 @@ const bTheme U_theme_default = {
.button_title = RGBA(0xffffffff),
.button_text = RGBA(0xe5e5e5ff),
.button_text_hi = RGBA(0xffffffff),
- .navigation_bar = RGBA(0x373737ff),
+ .navigation_bar = RGBA(0x4b4b4bff),
+ .execution_buts = RGBA(0x4b4b4bff),
.panelcolors = {
.header = RGBA(0x42424200),
.back = RGBA(0x333333b3),
diff --git a/release/scripts/modules/bpy/utils/__init__.py b/release/scripts/modules/bpy/utils/__init__.py
index 5fbff2eb51b..b4c8c0899ac 100644
--- a/release/scripts/modules/bpy/utils/__init__.py
+++ b/release/scripts/modules/bpy/utils/__init__.py
@@ -572,7 +572,7 @@ def preset_find(name, preset_path, display_name=False, ext=".py"):
def keyconfig_init():
# Key configuration initialization and refresh, called from the Blender
# window manager on startup and refresh.
- active_config = _preferences.inputs.active_keyconfig
+ active_config = _preferences.keymap.active_keyconfig
# Load the default key configuration.
default_filepath = preset_find("blender", "keyconfig")
diff --git a/release/scripts/modules/rna_keymap_ui.py b/release/scripts/modules/rna_keymap_ui.py
index 3a44745e01b..268bcb6a7be 100644
--- a/release/scripts/modules/rna_keymap_ui.py
+++ b/release/scripts/modules/rna_keymap_ui.py
@@ -372,15 +372,24 @@ def draw_keymaps(context, layout):
subcol = subsplit.column()
col = subcol.column()
- row = col.row(align=True)
# row.prop_search(wm.keyconfigs, "active", wm, "keyconfigs", text="Key Config")
text = bpy.path.display_name(kc_active.name)
if not text:
text = "Blender (default)"
- row.menu("USERPREF_MT_keyconfigs", text=text)
- row.operator("wm.keyconfig_preset_add", text="", icon='ADD')
- row.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True
+
+ row = col.row()
+
+ row.operator("wm.keyconfig_import", text="Import...", icon='IMPORT')
+ row.operator("wm.keyconfig_export", text="Export...", icon='EXPORT')
+
+ row.separator()
+
+ rowsub = row.row(align=True)
+
+ rowsub.menu("USERPREF_MT_keyconfigs", text=text)
+ rowsub.operator("wm.keyconfig_preset_add", text="", icon='ADD')
+ rowsub.operator("wm.keyconfig_preset_add", text="", icon='REMOVE').remove_active = True
# layout.context_pointer_set("keyconfig", wm.keyconfigs.active)
# row.operator("wm.keyconfig_remove", text="", icon='X')
@@ -413,14 +422,14 @@ def draw_keymaps(context, layout):
box = col.box()
row = box.row(align=True)
- prefs = context.preferences
- inputs = prefs.inputs
- show_ui_keyconfig = inputs.show_ui_keyconfig
+ pref = context.preferences
+ keymappref = pref.keymap
+ show_ui_keyconfig = keymappref.show_ui_keyconfig
row.prop(
- inputs,
+ keymappref,
"show_ui_keyconfig",
text="",
- icon='TRIA_DOWN' if show_ui_keyconfig else 'TRIA_RIGHT',
+ icon='DISCLOSURE_TRI_DOWN' if show_ui_keyconfig else 'DISCLOSURE_TRI_RIGHT',
emboss=False,
)
row.label(text="Preferences")
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 7dacb8d9db6..a115213fc2a 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -32,34 +32,13 @@ class USERPREF_HT_header(Header):
def draw(self, context):
layout = self.layout
+ layout.operator_context = 'EXEC_AREA'
layout.template_header()
- prefs = context.preferences
-
- if prefs.active_section == 'INPUT':
- layout.operator("wm.keyconfig_import", icon='IMPORT')
- layout.operator("wm.keyconfig_export", icon='EXPORT')
- elif prefs.active_section == 'ADDONS':
- layout.operator("wm.addon_install", icon='FILEBROWSER')
- layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
- layout.menu("USERPREF_MT_addons_online_resources")
- elif prefs.active_section == 'LIGHTS':
- layout.operator("wm.studiolight_install", text="Install MatCap").type = 'MATCAP'
- layout.operator("wm.studiolight_install", text="Install LookDev HDRI").type = 'WORLD'
- layout.operator("wm.studiolight_install", text="Install Studio Light").type = 'STUDIO'
- elif prefs.active_section == 'THEMES':
- layout.operator("wm.theme_install", icon='FILEBROWSER')
- layout.operator("ui.reset_default_theme", icon='LOOP_BACK')
-
- layout.separator_spacer()
-
- layout.operator_context = 'EXEC_AREA'
- layout.operator("wm.save_userpref")
-
class USERPREF_PT_navigation(Panel):
- bl_label = ""
+ bl_label = "Preferences Navigation"
bl_space_type = 'PREFERENCES'
bl_region_type = 'NAVIGATION_BAR'
bl_options = {'HIDE_HEADER'}
@@ -76,309 +55,515 @@ class USERPREF_PT_navigation(Panel):
col.prop(prefs, "active_section", expand=True)
-class USERPREF_PT_interface(Panel):
+class USERPREF_PT_save_preferences(Panel):
+ bl_label = "Save Preferences"
bl_space_type = 'PREFERENCES'
- bl_label = "Interface"
- bl_region_type = 'WINDOW'
+ bl_region_type = 'EXECUTE'
bl_options = {'HIDE_HEADER'}
+ def draw(self, context):
+ layout = self.layout
+ layout.operator_context = 'EXEC_AREA'
+
+ prefs = context.preferences
+
+ layout.scale_x = 1.3
+ layout.scale_y = 1.3
+
+ layout.operator("wm.save_userpref")
+
+
+class PreferencePanel(Panel):
+ """
+ Base class for panels to center align contents with some horizontal margin.
+ Deriving classes need to implement a ``draw_props(context, layout)`` function.
+ """
+
+ bl_space_type = 'PREFERENCES'
+ bl_region_type = 'WINDOW'
+
+ def draw(self, context):
+ layout = self.layout
+ width = context.region.width
+ pixel_size = context.preferences.system.pixel_size
+
+ layout.use_property_split = True
+ layout.use_property_decorate = False # No animation.
+
+ row = layout.row()
+ if width > (350 * pixel_size): # No horizontal margin if region is rather small.
+ row.label() # Needed so col below is centered.
+
+ col = row.column()
+ col.ui_units_x = 50
+
+ # draw_props implemented by deriving classes.
+ self.draw_props(context, col)
+
+ if width > (350 * pixel_size): # No horizontal margin if region is rather small.
+ row.label() # Needed so col above is centered.
+
+
+class USERPREF_PT_interface_display(PreferencePanel):
+ bl_label = "Display"
+
@classmethod
def poll(cls, context):
prefs = context.preferences
return (prefs.active_section == 'INTERFACE')
- def draw(self, context):
- layout = self.layout
+ def draw_props(self, context, layout):
+ prefs = context.preferences
+ view = prefs.view
+
+ layout.prop(view, "ui_scale", text="Resolution Scale")
+ layout.prop(view, "ui_line_width", text="Line Width")
+
+class USERPREF_PT_interface_display_info(PreferencePanel):
+ bl_label = "Information"
+ bl_parent_id = "USERPREF_PT_interface_display"
+ bl_options = {'DEFAULT_CLOSED'}
+
+ def draw_props(self, context, layout):
prefs = context.preferences
view = prefs.view
- split = layout.split()
- row = split.row()
- col = row.column()
+ flow = layout.grid_flow(row_major=True, columns=0, even_columns=False, even_rows=False, align=False)
+
+ flow.prop(view, "show_tooltips")
+ flow.prop(view, "show_object_info", text="Object Info")
+ flow.prop(view, "show_large_cursors")
+ flow.prop(view, "show_view_name", text="View Name")
+ flow.prop(view, "show_playback_fps", text="Playback FPS")
+
+
+class USERPREF_PT_interface_text(PreferencePanel):
+ bl_label = "Text"
+ bl_options = {'DEFAULT_CLOSED'}
- col.label(text="Display:")
- col.prop(view, "ui_scale", text="Scale")
- col.prop(view, "ui_line_width", text="Line Width")
- col.prop(view, "show_tooltips")
- col.prop(view, "show_object_info", text="Object Info")
- col.prop(view, "show_large_cursors")
- col.prop(view, "show_view_name", text="View Name")
- col.prop(view, "show_playback_fps", text="Playback FPS")
- col.prop(view, "object_origin_size")
+ @classmethod
+ def poll(cls, context):
+ prefs = context.preferences
+ return (prefs.active_section == 'INTERFACE')
+
+ def draw_props(self, context, layout):
+ prefs = context.preferences
+ view = prefs.view
+
+ layout.prop(view, "use_text_antialiasing", text="Anti-aliasing")
+ sub = layout.column()
+ sub.active = view.use_text_antialiasing
+ sub.prop(view, "text_hinting", text="Hinting")
+
+ layout.prop(view, "font_path_ui")
+ layout.prop(view, "font_path_ui_mono")
+
+
+class USERPREF_PT_interface_text_translate(PreferencePanel):
+ bl_label = "Translate UI"
+ bl_options = {'DEFAULT_CLOSED'}
+ bl_parent_id = "USERPREF_PT_interface_text"
+
+ @classmethod
+
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list