[Bf-blender-cvs] [6f52ebba192] master: UI: Freestyle UI Upgrade
Iyad Ahmed
noreply at git.blender.org
Mon Sep 13 16:38:00 CEST 2021
Commit: 6f52ebba192b8a9c5fc1e211e4968ebb42ea8408
Author: Iyad Ahmed
Date: Mon Sep 13 10:29:24 2021 -0400
Branches: master
https://developer.blender.org/rB6f52ebba192b8a9c5fc1e211e4968ebb42ea8408
UI: Freestyle UI Upgrade
Suggested and funded by [[ https://blendernpr.org/| BNPR ]], this patch aims to update the long not-updated Freestyle UI
**Why do the UI upgrade:**
- Freestyle UI doesn't match the rest of Blender UI, it was neglected for a long time
- The current UI makes Freestyle workflows tedious and distracting
**Highlights:**
For before/after screenshots see https://developer.blender.org/D10505
Video:
https://youtu.be/qaXhuJW_c9U
Workflow video (older revision): https://youtu.be/IqbjIq_A800
Doc patch (WIP): https://github.com/bnpr/FreestyleUIUpgrade/blob/main/freestyle-ui-upgrade-docs.diff
Reviewed By: #user_interface, Blendify, HooglyBoogly, Severin
Differential Revision: https://developer.blender.org/D10505
===================================================================
M release/scripts/startup/bl_ui/properties_freestyle.py
M source/blender/freestyle/intern/application/AppConfig.h
M source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
M source/blender/makesdna/DNA_freestyle_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_freestyle.py b/release/scripts/startup/bl_ui/properties_freestyle.py
index fd12747e2fa..5ca44bb6555 100644
--- a/release/scripts/startup/bl_ui/properties_freestyle.py
+++ b/release/scripts/startup/bl_ui/properties_freestyle.py
@@ -22,7 +22,6 @@ from bpy.types import Menu, Panel, UIList
# Render properties
-
class RenderFreestyleButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -49,20 +48,17 @@ class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
layout.use_property_split = True
- layout.use_property_decorate = False # No animation.
-
+ layout.use_property_decorate = False
rd = context.scene.render
-
layout.active = rd.use_freestyle
-
- layout.prop(rd, "line_thickness_mode", expand=True)
-
+ layout.row().prop(rd, "line_thickness_mode", expand=True, text="Line Thickness Mode")
if rd.line_thickness_mode == 'ABSOLUTE':
layout.prop(rd, "line_thickness")
# Render layer properties
+
class ViewLayerFreestyleButtonsPanel:
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
@@ -76,8 +72,12 @@ class ViewLayerFreestyleButtonsPanel:
rd = scene.render
with_freestyle = bpy.app.build_options.freestyle
- return (scene and with_freestyle and rd.use_freestyle and
- (context.engine in cls.COMPAT_ENGINES))
+ return (
+ scene
+ and with_freestyle
+ and rd.use_freestyle
+ and (context.engine in cls.COMPAT_ENGINES)
+ )
class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel):
@@ -88,7 +88,35 @@ class ViewLayerFreestyleEditorButtonsPanel(ViewLayerFreestyleButtonsPanel):
if not super().poll(context):
return False
view_layer = context.view_layer
- return view_layer and view_layer.freestyle_settings.mode == 'EDITOR'
+ return (
+ view_layer
+ and view_layer.use_freestyle
+ and view_layer.freestyle_settings.mode == 'EDITOR'
+ )
+
+
+class ViewLayerFreestyleLineStyle(ViewLayerFreestyleEditorButtonsPanel):
+ # Freestyle Linestyle Panels
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+ @classmethod
+ def poll(cls, context):
+ if not super().poll(context):
+ return False
+ view_layer = context.view_layer
+ lineset = view_layer.freestyle_settings.linesets.active
+ if lineset is None:
+ return False
+ linestyle = lineset.linestyle
+ if linestyle is None:
+ return False
+
+ return True
+
+
+class ViewLayerFreestyleLinestyleStrokesSubPanel(ViewLayerFreestyleLineStyle):
+ # Freestyle Linestyle Strokes sub panels
+ bl_parent_id = "VIEWLAYER_PT_freestyle_linestyle_strokes"
class VIEWLAYER_UL_linesets(UIList):
@@ -126,54 +154,85 @@ class VIEWLAYER_PT_freestyle(ViewLayerFreestyleButtonsPanel, Panel):
def draw(self, context):
layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
view_layer = context.view_layer
freestyle = view_layer.freestyle_settings
layout.active = view_layer.use_freestyle
- row = layout.row()
- layout.prop(freestyle, "mode", text="Control Mode")
- layout.prop(freestyle, "use_view_map_cache", text="View Map Cache")
- layout.prop(freestyle, "as_render_pass", text="As Render Pass")
- layout.label(text="Edge Detection Options:")
+ col = layout.column(align=True)
+ col.prop(freestyle, "mode", text="Control Mode")
+ col.prop(freestyle, "use_view_map_cache", text="View Map Cache")
+ col.prop(freestyle, "as_render_pass", text="As Render Pass")
+
+
+class VIEWLAYER_PT_freestyle_edge_detection_options(ViewLayerFreestyleButtonsPanel, Panel):
+ bl_label = "Edge Detection Options"
+ bl_parent_id = "VIEWLAYER_PT_freestyle"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
- split = layout.split()
+ view_layer = context.view_layer
+ freestyle = view_layer.freestyle_settings
+
+ layout.active = view_layer.use_freestyle
- col = split.column()
+ col = layout.column()
col.prop(freestyle, "crease_angle")
col.prop(freestyle, "use_culling")
- col.prop(freestyle, "use_advanced_options")
-
- col = split.column()
col.prop(freestyle, "use_smoothness")
+
if freestyle.mode == 'SCRIPT':
col.prop(freestyle, "use_material_boundaries")
- # Advanced options are hidden by default to warn new users
- if freestyle.use_advanced_options:
- if freestyle.mode == 'SCRIPT':
- row = layout.row()
- row.prop(freestyle, "use_ridges_and_valleys")
- row.prop(freestyle, "use_suggestive_contours")
- row = layout.row()
- row.prop(freestyle, "sphere_radius")
- row.prop(freestyle, "kr_derivative_epsilon")
-
if freestyle.mode == 'SCRIPT':
- row = layout.row()
- row.label(text="Style Modules:")
- row.operator("scene.freestyle_module_add", text="Add")
- for module in freestyle.modules:
- box = layout.box()
- box.context_pointer_set("freestyle_module", module)
- row = box.row(align=True)
- row.prop(module, "use", text="")
- row.prop(module, "script", text="")
- row.operator("scene.freestyle_module_open", icon='FILEBROWSER', text="")
- row.operator("scene.freestyle_module_remove", icon='X', text="")
- row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
- row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+ col.prop(freestyle, "use_ridges_and_valleys")
+ col.prop(freestyle, "use_suggestive_contours")
+ col.prop(freestyle, "sphere_radius")
+ col.prop(freestyle, "kr_derivative_epsilon")
+
+
+class VIEWLAYER_PT_freestyle_style_modules(ViewLayerFreestyleButtonsPanel, Panel):
+ bl_label = "Style Modules"
+ bl_parent_id = "VIEWLAYER_PT_freestyle"
+ COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+ @classmethod
+ def poll(cls, context):
+ view_layer = context.view_layer
+ freestyle = view_layer.freestyle_settings
+ return freestyle.mode == 'SCRIPT'
+
+ def draw(self, context):
+ layout = self.layout
+ layout.use_property_split = True
+ layout.use_property_decorate = False
+
+ view_layer = context.view_layer
+ freestyle = view_layer.freestyle_settings
+
+ layout.active = view_layer.use_freestyle
+
+ col = layout.column()
+ col.use_property_split = False
+ row = col.row()
+ row.operator("scene.freestyle_module_add", text="Add")
+ for module in freestyle.modules:
+ box = col.box()
+ box.context_pointer_set("freestyle_module", module)
+ row = box.row(align=True)
+ row.prop(module, "use", text="")
+ row.prop(module, "script", text="")
+ row.operator("scene.freestyle_module_open", icon='FILEBROWSER', text="")
+ row.operator("scene.freestyle_module_remove", icon='X', text="")
+ row.operator("scene.freestyle_module_move", icon='TRIA_UP', text="").direction = 'UP'
+ row.operator("scene.freestyle_module_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel):
@@ -198,10 +257,13 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel
freestyle = view_layer.freestyle_settings
lineset = freestyle.linesets.active
- layout.active = view_layer.use_freestyle
-
row = layout.row()
- rows = 4 if lineset else 2
+
+ is_sortable = len(freestyle.linesets) > 1
+ rows = 3
+ if is_sortable:
+ rows = 5
+
row.template_list(
"VIEWLAYER_UL_linesets",
"",
@@ -212,157 +274,504 @@ class VIEWLAYER_PT_freestyle_lineset(ViewLayerFreestyleEditorButtonsPanel, Panel
rows=rows,
)
- sub = row.column(align=True)
- sub.operator("scene.freestyle_lineset_add", icon='ADD', text="")
- sub.operator("scene.freestyle_lineset_remove", icon='REMOVE', text="")
- sub.menu("RENDER_MT_lineset_context_menu", icon='DOWNARROW_HLT', text="")
+ col = row.column(align=True)
+ col.operator("scene.freestyle_lineset_add", icon='ADD', text="")
+ col.operator("scene.freestyle_lineset_remove", icon='REMOVE', text="")
+
+ col.separator()
+
+ col.menu("RENDER_MT_lineset_context_menu", icon="DOWNARROW_HLT", text="")
+
+ if is_sortable:
+ col.separator()
+ col.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
+ col.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
+
if lineset:
- sub.separator()
- sub.separator()
- sub.operator("scene.freestyle_lineset_move", icon='TRIA_UP', text="").direction = 'UP'
- sub.operator("scene.freestyle_lineset_move", icon='TRIA_DOWN', text="").direction = 'DOWN'
-
- col = layout.column()
- col.label(text="Selection By:")
- row = col.row(align=True)
- row.prop(lineset, "select_by_visibility", text="Visibility", toggle=True)
- row.prop(lineset, "select_by_edge_types", text="Edge Types", toggle=True)
- row.prop(lineset, "select_by_face_marks", text="Face Marks", toggle=Tru
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list