[Bf-blender-cvs] [227ddeb4355] greasepencil-object: Cleanup: Replace duplicated poll lines by function
Antonio Vazquez
noreply at git.blender.org
Fri Oct 20 18:53:41 CEST 2017
Commit: 227ddeb435594a9eafed733df3e7d0bc946f1c16
Author: Antonio Vazquez
Date: Fri Oct 20 18:53:22 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB227ddeb435594a9eafed733df3e7d0bc946f1c16
Cleanup: Replace duplicated poll lines by function
===================================================================
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 b470614e63d..431a0a3e134 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -72,6 +72,12 @@ def draw_vpaint_symmetry(layout, vpaint):
# ********** default tools for object-mode ****************
+# Helper for checking grease pencil modes
+def is_any_gpmode(context):
+ is_gpmode = context.active_object and \
+ 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"
@@ -79,12 +85,7 @@ class VIEW3D_PT_tools_transform(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
def draw(self, context):
layout = self.layout
@@ -105,12 +106,7 @@ class VIEW3D_PT_tools_object(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
def draw(self, context):
layout = self.layout
@@ -161,12 +157,7 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
@staticmethod
def draw_add_mesh(layout, label=False):
@@ -266,12 +257,7 @@ class VIEW3D_PT_tools_relations(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
def draw(self, context):
layout = self.layout
@@ -310,12 +296,7 @@ class VIEW3D_PT_tools_animation(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
def draw(self, context):
layout = self.layout
@@ -346,12 +327,7 @@ class VIEW3D_PT_tools_rigid_body(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object and \
- context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if is_gpmode:
- return False
- else:
- return True
+ return is_any_gpmode(context)
def draw(self, context):
layout = self.layout
More information about the Bf-blender-cvs
mailing list