[Bf-blender-cvs] [6837474ae89] master: UI: Use sub-panels inside Grease Pencil Onion Skinning panel

William Reynish noreply at git.blender.org
Thu Mar 7 14:57:30 CET 2019


Commit: 6837474ae89ef20f624caa7da3e5588521d7b568
Author: William Reynish
Date:   Thu Mar 7 14:56:31 2019 +0100
Branches: master
https://developer.blender.org/rB6837474ae89ef20f624caa7da3e5588521d7b568

UI: Use sub-panels inside Grease Pencil Onion Skinning panel

Reviewers: Antonio Vazquez (antoniov)

Differential Revision: D4465

===================================================================

M	release/scripts/startup/bl_ui/properties_data_gpencil.py
M	release/scripts/startup/bl_ui/properties_grease_pencil_common.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/properties_data_gpencil.py b/release/scripts/startup/bl_ui/properties_data_gpencil.py
index d383982f61e..67f37304f85 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -21,7 +21,6 @@ import bpy
 from bpy.types import Menu, Panel, UIList
 from rna_prop_ui import PropertyPanel
 from .properties_grease_pencil_common import (
-    GreasePencilOnionPanel,
     GPENCIL_UL_layer,
 )
 
@@ -255,7 +254,68 @@ class DATA_PT_gpencil_onionpanel(Panel):
         if gpd.users > 1:
             layout.label(text="Multiuser datablock not supported", icon='ERROR')
 
-        GreasePencilOnionPanel.draw_settings(layout, gpd)
+        col = layout.column()
+        col.prop(gpd, "onion_mode")
+        col.prop(gpd, "onion_factor", text="Opacity", slider=True)
+
+        if gpd.onion_mode == 'ABSOLUTE':
+            col = layout.column(align=True)
+            col.prop(gpd, "ghost_before_range", text="Frames Before")
+            col.prop(gpd, "ghost_after_range", text="Frames After")
+        if gpd.onion_mode == 'RELATIVE':
+            col = layout.column(align=True)
+            col.prop(gpd, "ghost_before_range", text="Keyframes Before")
+            col.prop(gpd, "ghost_after_range", text="Keyframes After")
+
+
+class DATA_PT_gpencil_onionpanel_custom_colors(Panel):
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+    bl_parent_id = "DATA_PT_gpencil_onionpanel"
+    bl_label = "Custom Colors"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw_header(self, context):
+
+        gpd = context.gpencil_data
+
+        self.layout.prop(gpd, "use_ghost_custom_colors", text="")
+
+    def draw(self, context):
+        gpd = context.gpencil_data
+
+        layout = self.layout
+        layout.use_property_split = True
+        layout.enabled = gpd.users <= 1 and gpd.use_ghost_custom_colors
+
+        layout.prop(gpd, "before_color", text="Before")
+        layout.prop(gpd, "after_color", text="After")
+
+
+class DATA_PT_gpencil_onionpanel_display(Panel):
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+    bl_parent_id = "DATA_PT_gpencil_onionpanel"
+    bl_label = "Display"
+    bl_options = {'DEFAULT_CLOSED'}
+
+    def draw(self, context):
+        gpd = context.gpencil_data
+
+        layout = self.layout
+        layout.use_property_split = True
+        layout.enabled = gpd.users <= 1
+
+        layout.prop(gpd, "use_ghosts_always", text="View In Render")
+
+        col = layout.column(align=True)
+        col.prop(gpd, "use_onion_fade", text="Fade")
+        if hasattr(gpd, "use_onion_loop"):  # XXX
+            sub = layout.column()
+            sub.active = gpd.onion_mode in ('RELATIVE', 'SELECTED')
+            sub.prop(gpd, "use_onion_loop", text="Loop")
 
 
 class GPENCIL_MT_gpencil_vertex_group(Menu):
@@ -413,6 +473,8 @@ classes = (
     DATA_PT_gpencil,
     DATA_PT_gpencil_datapanel,
     DATA_PT_gpencil_onionpanel,
+    DATA_PT_gpencil_onionpanel_custom_colors,
+    DATA_PT_gpencil_onionpanel_display,
     DATA_PT_gpencil_layer_optionpanel,
     DATA_PT_gpencil_parentpanel,
     DATA_PT_gpencil_vertexpanel,
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index dd96df2ea65..82677192590 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -814,41 +814,6 @@ class AnnotationOnionSkin:
         row.prop(gpl, "annotation_onion_after_color", text="")
         sub.prop(gpl, "annotation_onion_after_range", text="After")
 
-
-class GreasePencilOnionPanel:
-    @staticmethod
-    def draw_settings(layout, gp):
-        col = layout.column()
-        col.prop(gp, "onion_mode")
-        col.prop(gp, "onion_factor", text="Opacity", slider=True)
-
-        if gp.onion_mode == 'ABSOLUTE':
-            col = layout.column(align=True)
-            col.prop(gp, "ghost_before_range", text="Frames Before")
-            col.prop(gp, "ghost_after_range", text="Frames After")
-        if gp.onion_mode == 'RELATIVE':
-            col = layout.column(align=True)
-            col.prop(gp, "ghost_before_range", text="Keyframes Before")
-            col.prop(gp, "ghost_after_range", text="Keyframes After")
-
-        layout.prop(gp, "use_ghost_custom_colors", text="Use Custom Colors")
-
-        if gp.use_ghost_custom_colors:
-            col = layout.column(align=True)
-            col.active = gp.use_ghost_custom_colors
-            col.prop(gp, "before_color", text="Color Before")
-            col.prop(gp, "after_color", text="After")
-
-        layout.prop(gp, "use_ghosts_always", text="View In Render")
-
-        col = layout.column(align=True)
-        col.prop(gp, "use_onion_fade", text="Fade")
-        if hasattr(gp, "use_onion_loop"):  # XXX
-            sub = layout.column()
-            sub.active = gp.onion_mode in ('RELATIVE', 'SELECTED')
-            sub.prop(gp, "use_onion_loop", text="Loop")
-
-
 class GreasePencilToolsPanel:
     # For use in "2D" Editors without their own toolbar
     # subclass must set



More information about the Bf-blender-cvs mailing list