mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
WM: avoid Python exceptions in poll functions
This commit is contained in:
parent
cfe25e6efb
commit
fa5cc84a0a
3 changed files with 9 additions and 7 deletions
|
|
@ -40,7 +40,8 @@ def geometry_modifier_poll(context):
|
|||
|
||||
|
||||
def get_context_modifier(context):
|
||||
if context.area.type == 'PROPERTIES':
|
||||
area = context.area
|
||||
if (area is not None) and (area.type == 'PROPERTIES'):
|
||||
modifier = context.modifier
|
||||
else:
|
||||
ob = context.object
|
||||
|
|
|
|||
|
|
@ -178,12 +178,8 @@ class ProjectApply(Operator):
|
|||
|
||||
def execute(self, _context):
|
||||
image_name = ProjectEdit._proj_hack[0] # TODO, deal with this nicer
|
||||
|
||||
try:
|
||||
image = bpy.data.images[image_name, None]
|
||||
except KeyError:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
image = bpy.data.images.get((image_name, None))
|
||||
if image is None:
|
||||
self.report({'ERROR'}, tip_("Could not find image '%s'") % image_name)
|
||||
return {'CANCELLED'}
|
||||
|
||||
|
|
|
|||
|
|
@ -655,6 +655,11 @@ class IsolateTypeRender(Operator):
|
|||
bl_label = "Restrict Render Unselected"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
ob = context.object
|
||||
return (ob is not None)
|
||||
|
||||
def execute(self, context):
|
||||
act_type = context.object.type
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue