diff --git a/rigify/ui.py b/rigify/ui.py index f8491d8618067067f83775e9245efd795a3abc70..ad1c41564520eba66c95b0fc2f17f837b0388517 100644 --- a/rigify/ui.py +++ b/rigify/ui.py @@ -68,6 +68,8 @@ class DATA_PT_rigify_buttons(bpy.types.Panel): @classmethod def poll(cls, context): + if not context.object: + return False return context.object.type == 'ARMATURE' and context.active_object.data.get("rig_id") is None def draw(self, context): @@ -197,6 +199,8 @@ class DATA_PT_rigify_layer_names(bpy.types.Panel): @classmethod def poll(cls, context): + if not context.object: + return False return context.object.type == 'ARMATURE' and context.active_object.data.get("rig_id") is None def draw(self, context): @@ -280,7 +284,7 @@ class DATA_OT_rigify_add_bone_groups(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -323,7 +327,7 @@ class DATA_OT_rigify_use_standard_colors(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -350,7 +354,7 @@ class DATA_OT_rigify_apply_selection_colors(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -374,7 +378,7 @@ class DATA_OT_rigify_bone_group_add(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -428,7 +432,7 @@ class DATA_OT_rigify_bone_group_add_theme(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -460,7 +464,7 @@ class DATA_OT_rigify_bone_group_remove(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -482,7 +486,7 @@ class DATA_OT_rigify_bone_group_remove_all(bpy.types.Operator): @classmethod def poll(cls, context): - return context.object.type == 'ARMATURE' + return context.object and context.object.type == 'ARMATURE' def execute(self, context): obj = context.object @@ -533,6 +537,8 @@ class DATA_PT_rigify_bone_groups(bpy.types.Panel): @classmethod def poll(cls, context): + if not context.object: + return False return context.object.type == 'ARMATURE' and context.active_object.data.get("rig_id") is None def draw(self, context): @@ -575,7 +581,8 @@ class BONE_PT_rigify_buttons(bpy.types.Panel): @classmethod def poll(cls, context): - + if not context.object: + return False return context.object.type == 'ARMATURE' and context.active_pose_bone\ and context.active_object.data.get("rig_id") is None