[Bf-blender-cvs] [cf19500907b] greasepencil-object: UI: Cleanup error when context object is none
Antonio Vazquez
noreply at git.blender.org
Thu Aug 3 23:21:36 CEST 2017
Commit: cf19500907b50b89afcce0a7078d179b9eb80cc1
Author: Antonio Vazquez
Date: Thu Aug 3 23:21:28 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rBcf19500907b50b89afcce0a7078d179b9eb80cc1
UI: Cleanup error when context object is none
===================================================================
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 b06884e353d..9aaf4f5e94a 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -137,7 +137,8 @@ class GreasePencilDrawingToolsPanel:
col.prop(gpd, "use_stroke_edit_mode", text="Enable Editing", icon='EDIT', toggle=True)
if is_3d_view:
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT')
+ is_gpmode = context.active_object and \
+ context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT')
if context.active_object is None or is_gpmode is False:
col.label(text="Tools:")
col.operator("view3d.ruler")
@@ -475,7 +476,8 @@ class GreasePencilAppearancePanel:
if context.gpencil_data is None:
return False
- is_gpmode = context.active_object.mode in ('GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
+ is_gpmode = context.active_object and \
+ context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT')
if context.active_object and is_gpmode:
return True
else:
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 837ed09d152..fca060d6b1f 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -64,8 +64,9 @@ class VIEW3D_PT_tools_transform(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
@@ -89,8 +90,9 @@ class VIEW3D_PT_tools_object(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
@@ -144,8 +146,9 @@ class VIEW3D_PT_tools_add_object(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
@@ -248,8 +251,9 @@ class VIEW3D_PT_tools_relations(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
@@ -291,8 +295,9 @@ class VIEW3D_PT_tools_animation(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
@@ -326,8 +331,9 @@ class VIEW3D_PT_tools_rigid_body(View3DPanel, Panel):
@classmethod
def poll(cls, context):
- is_gpmode = context.active_object.mode in ('GPENCIL_EDIT', 'GPENCIL_PAINT', 'GPENCIL_SCULPT', 'GPENCIL_WEIGHT')
- if context.active_object and is_gpmode:
+ 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
More information about the Bf-blender-cvs
mailing list