[Bf-blender-cvs] [31732af4103] greasepencil-object: UI: reorganize animation panel

Antonio Vazquez noreply at git.blender.org
Fri Jul 7 12:37:41 CEST 2017


Commit: 31732af4103752b81b6f142451bee8afbe04e82d
Author: Antonio Vazquez
Date:   Fri Jul 7 12:37:24 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB31732af4103752b81b6f142451bee8afbe04e82d

UI: reorganize animation panel

Create a grease pencil animation panel and separate again interpolate panel.

The default animation panel is hidden when GP Object is selected and enable some GP mode

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

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

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

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 25601886a32..01ed2019fdb 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -223,9 +223,9 @@ class GreasePencilStrokeEditPanel:
             layout.operator_menu_enum("gpencil.reproject", text="Reproject Strokes...", property="type")
 
 
-class GreasePencilInterpolatePanel:
+class GreasePencilAnimationPanel:
     bl_space_type = 'VIEW_3D'
-    bl_label = "Grease Pencil"
+    bl_label = "Animation"
     bl_category = "Animation"
     bl_region_type = 'TOOLS'
 
@@ -235,15 +235,14 @@ class GreasePencilInterpolatePanel:
             return False
         elif context.space_data.type != 'VIEW_3D':
             return False
+        elif context.object.mode == 'OBJECT':
+            return False
 
         return True
 
     @staticmethod
     def draw(self, context):
         layout = self.layout
-        settings = context.tool_settings.gpencil_interpolate
-        gpd = context.gpencil_data
-        is_edit = bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode)
 
         col = layout.column(align=True)
         col.operator("gpencil.blank_frame_add", icon='NEW')
@@ -252,34 +251,56 @@ class GreasePencilInterpolatePanel:
         col.separator()
         col.prop(context.tool_settings, "use_gpencil_additive_drawing", text="Additive Drawing")
 
-        if is_edit is True:
-            col = layout.column(align=True)
-            col.label("Interpolate Strokes")
-            col.operator("gpencil.interpolate", text="Interpolate")
-            col.operator("gpencil.interpolate_sequence", text="Sequence")
-            col.operator("gpencil.interpolate_reverse", text="Remove Breakdowns")
 
-            col = layout.column(align=True)
-            col.label(text="Options:")
-            col.prop(settings, "interpolate_all_layers")
-            col.prop(settings, "interpolate_selected_only")
+class GreasePencilInterpolatePanel:
+    bl_space_type = 'VIEW_3D'
+    bl_label = "Interpolate Strokes"
+    bl_category = "Animation"
+    bl_region_type = 'TOOLS'
 
-            col = layout.column(align=True)
-            col.label(text="Sequence Options:")
-            col.prop(settings, "type")
-            if settings.type == 'CUSTOM':
-                box = layout.box()
-                # TODO: Options for loading/saving curve presets?
-                box.template_curve_mapping(settings, "interpolation_curve", brush=True)
-            elif settings.type != 'LINEAR':
-                col.prop(settings, "easing")
-
-                if settings.type == 'BACK':
-                    layout.prop(settings, "back")
-                elif setting.type == 'ELASTIC':
-                    sub = layout.column(align=True)
-                    sub.prop(settings, "amplitude")
-                    sub.prop(settings, "period")
+    @classmethod
+    def poll(cls, context):
+        if context.gpencil_data is None:
+            return False
+        elif context.space_data.type != 'VIEW_3D':
+            return False
+
+        gpd = context.gpencil_data
+
+        return bool(context.editable_gpencil_strokes) and bool(gpd.use_stroke_edit_mode)
+
+    @staticmethod
+    def draw(self, context):
+        layout = self.layout
+        settings = context.tool_settings.gpencil_interpolate
+
+        col = layout.column(align=True)
+        col.label("Interpolate Strokes")
+        col.operator("gpencil.interpolate", text="Interpolate")
+        col.operator("gpencil.interpolate_sequence", text="Sequence")
+        col.operator("gpencil.interpolate_reverse", text="Remove Breakdowns")
+
+        col = layout.column(align=True)
+        col.label(text="Options:")
+        col.prop(settings, "interpolate_all_layers")
+        col.prop(settings, "interpolate_selected_only")
+
+        col = layout.column(align=True)
+        col.label(text="Sequence Options:")
+        col.prop(settings, "type")
+        if settings.type == 'CUSTOM':
+            box = layout.box()
+            # TODO: Options for loading/saving curve presets?
+            box.template_curve_mapping(settings, "interpolation_curve", brush=True)
+        elif settings.type != 'LINEAR':
+            col.prop(settings, "easing")
+
+            if settings.type == 'BACK':
+                layout.prop(settings, "back")
+            elif setting.type == 'ELASTIC':
+                sub = layout.column(align=True)
+                sub.prop(settings, "amplitude")
+                sub.prop(settings, "period")
 
 
 class GreasePencilBrushPanel:
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 09a4282e482..e17d629639c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -23,6 +23,7 @@ from bpy.types import Menu, Panel, UIList
 from bl_ui.properties_grease_pencil_common import (
         GreasePencilDrawingToolsPanel,
         GreasePencilStrokeEditPanel,
+        GreasePencilAnimationPanel,
         GreasePencilInterpolatePanel,
         GreasePencilStrokeSculptPanel,
         GreasePencilBrushPanel,
@@ -270,6 +271,13 @@ class VIEW3D_PT_tools_animation(View3DPanel, Panel):
     bl_context = "objectmode"
     bl_label = "Animation"
 
+    @classmethod
+    def poll(cls, context):
+        if context.active_object and context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT'):
+            return False
+        else:
+            return True
+
     def draw(self, context):
         layout = self.layout
 
@@ -1986,6 +1994,10 @@ class VIEW3D_PT_tools_grease_pencil_edit(GreasePencilStrokeEditPanel, Panel):
     bl_space_type = 'VIEW_3D'
 
 
+# Grease Pencil stroke animation
+class VIEW3D_PT_tools_grease_pencil_animation(GreasePencilAnimationPanel, Panel):
+    bl_space_type = 'VIEW_3D'
+
 # Grease Pencil stroke interpolation tools
 class VIEW3D_PT_tools_grease_pencil_interpolate(GreasePencilInterpolatePanel, Panel):
     bl_space_type = 'VIEW_3D'
@@ -2032,7 +2044,6 @@ class VIEW3D_PT_tools_history(View3DPanel, Panel):
 
 classes = (
     VIEW3D_PT_tools_grease_pencil_edit,
-    VIEW3D_PT_tools_grease_pencil_interpolate,
     VIEW3D_PT_tools_grease_pencil_sculpt,
     VIEW3D_PT_tools_grease_pencil_brush,
     VIEW3D_PT_tools_grease_pencil_brushcurves,
@@ -2042,6 +2053,8 @@ classes = (
     VIEW3D_PT_tools_add_object,
     VIEW3D_PT_tools_relations,
     VIEW3D_PT_tools_animation,
+    VIEW3D_PT_tools_grease_pencil_animation,
+    VIEW3D_PT_tools_grease_pencil_interpolate,
     VIEW3D_PT_tools_rigid_body,
     VIEW3D_PT_tools_transform_mesh,
     VIEW3D_PT_tools_meshedit,




More information about the Bf-blender-cvs mailing list