[Bf-blender-cvs] [34822e1c727] greasepencil-object: UI: New panel for onion skinning

Antonio Vazquez noreply at git.blender.org
Wed Jul 12 16:05:18 CEST 2017


Commit: 34822e1c72765c1b60c430a1c07525635c11dc82
Author: Antonio Vazquez
Date:   Wed Jul 12 16:05:10 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB34822e1c72765c1b60c430a1c07525635c11dc82

UI: New panel for onion skinning

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

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 d88b1a55a67..5e430a22a86 100644
--- a/release/scripts/startup/bl_ui/properties_data_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_data_gpencil.py
@@ -20,7 +20,8 @@
 import bpy
 from bpy.types import Panel
 from bl_ui.properties_grease_pencil_common import (
-        GreasePencilDataPanel
+        GreasePencilDataPanel,
+        GreasePencilOnionPanel
         )
 
 
@@ -57,6 +58,15 @@ class DATA_PT_gpencil_datapanel(GreasePencilDataPanel, Panel):
     # NOTE: this is just a wrapper around the generic GP Panel
 
 
+class DATA_PT_gpencil_onionpanel(GreasePencilOnionPanel, Panel):
+    bl_space_type = 'PROPERTIES'
+    bl_region_type = 'WINDOW'
+    bl_context = "data"
+    bl_label = "Onion Skinning"
+
+    # NOTE: this is just a wrapper around the generic GP Panel
+
+
 class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
     bl_label = "Display"
 
@@ -84,6 +94,7 @@ class DATA_PT_gpencil_display(DataButtonsPanel, Panel):
 classes = (
     DATA_PT_gpencil,
     DATA_PT_gpencil_datapanel,
+    DATA_PT_gpencil_onionpanel,
     DATA_PT_gpencil_display,
 )
 
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 38bcc5c26df..ffb00232589 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -1085,9 +1085,41 @@ class GreasePencilDataPanel:
         row.prop(gpl, "lock_frame", text=lock_label, icon='UNLOCKED')
         row.operator("gpencil.active_frame_delete", text="", icon='X')
 
-        layout.separator()
 
-        # Onion skinning
+class GreasePencilOnionPanel:
+    bl_label = "Onion Skinning"
+    bl_region_type = 'UI'
+
+    @classmethod
+    def poll(cls, context):
+        ts = context.scene.tool_settings
+
+        if context.gpencil_data is None:
+            return False
+
+        if context.space_data.type in ('VIEW_3D', 'PROPERTIES'):
+            if ts.grease_pencil_source == 'OBJECT':
+                if context.space_data.context != 'DATA':
+                    return False
+
+            if context.space_data.context == 'DATA':
+                if context.object.type != 'GPENCIL':
+                    return False
+                else:
+                    if context.object.grease_pencil != context.gpencil_data:
+                        return False
+
+        gpl = context.active_gpencil_layer
+        if gpl is None:
+            return False;
+
+        return True
+
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
+        gpl = context.active_gpencil_layer
+
         col = layout.column(align=True)
         col.active = not gpl.lock




More information about the Bf-blender-cvs mailing list