[Bf-blender-cvs] [2c71b7ec6c3] greasepencil-object: Code Cleanup - Fix name of helper function to be less misleading

Joshua Leung noreply at git.blender.org
Tue Oct 24 13:56:22 CEST 2017


Commit: 2c71b7ec6c342120353f31f82e808d1e278722dd
Author: Joshua Leung
Date:   Wed Oct 25 00:47:17 2017 +1300
Branches: greasepencil-object
https://developer.blender.org/rB2c71b7ec6c342120353f31f82e808d1e278722dd

Code Cleanup - Fix name of helper function to be less misleading

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

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

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

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index a8a26833008..7520e378c9c 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -71,12 +71,13 @@ def draw_vpaint_symmetry(layout, vpaint):
 # ********** default tools for object-mode ****************
 
 
-# Helper for checking grease pencil modes
-def is_any_gpmode(context):
+# Most of these panels should not be visible in GP edit modes
+def is_not_gpencil_edit_mode(context):
     is_gpmode = context.active_object and \
-                context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
+                context.active_object.mode in {'GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT'}
     return not is_gpmode
 
+
 class VIEW3D_PT_tools_transform(View3DPanel, Panel):
     bl_category = "Tools"
     bl_context = "objectmode"
@@ -84,7 +85,7 @@ class VIEW3D_PT_tools_transform(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     def draw(self, context):
         layout = self.layout
@@ -105,7 +106,7 @@ class VIEW3D_PT_tools_object(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     def draw(self, context):
         layout = self.layout
@@ -156,7 +157,7 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     @staticmethod
     def draw_add_mesh(layout, label=False):
@@ -256,7 +257,7 @@ class VIEW3D_PT_tools_relations(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     def draw(self, context):
         layout = self.layout
@@ -295,7 +296,7 @@ class VIEW3D_PT_tools_animation(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     def draw(self, context):
         layout = self.layout
@@ -326,7 +327,7 @@ class VIEW3D_PT_tools_rigid_body(View3DPanel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return is_any_gpmode(context)
+        return is_not_gpencil_edit_mode(context)
 
     def draw(self, context):
         layout = self.layout



More information about the Bf-blender-cvs mailing list