From 5094977614a04a71f885d0222dce777417a450fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 11 Nov 2016 09:06:59 +0100 Subject: [PATCH] Attract: "delete shots" now works on all selected Attract strips --- blender_cloud/attract/__init__.py | 33 +++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/blender_cloud/attract/__init__.py b/blender_cloud/attract/__init__.py index 635fda5..91e9bd2 100644 --- a/blender_cloud/attract/__init__.py +++ b/blender_cloud/attract/__init__.py @@ -205,7 +205,8 @@ class ToolsPanel(Panel): # Group more dangerous operations. dangerous_sub = layout.column(align=True) - dangerous_sub.operator(AttractShotDelete.bl_idname) + dangerous_sub.operator(AttractShotDelete.bl_idname, + text='Delete %s' % noun) dangerous_sub.operator('attract.strip_unlink') elif context.selected_sequences: @@ -442,13 +443,22 @@ class AttractShotDelete(AttractOperatorMixin, Operator): self.report({'WARNING'}, 'Delete aborted.') return {'CANCELLED'} - strip = active_strip(context) - node = pillar.sync_call(Node.find, strip.atc_object_id) - if not pillar.sync_call(node.delete): - print('Unable to delete the strip node on Attract.') - return {'CANCELLED'} + removed = kept = 0 + for strip in selected_shots(context): + node = pillar.sync_call(Node.find, strip.atc_object_id) + if not pillar.sync_call(node.delete): + self.report({'ERROR'}, 'Unable to delete shot %s on Attract.' % strip.atc_name) + kept += 1 + continue + remove_atc_props(strip) + removed += 1 + + if kept: + self.report({'ERROR'}, 'Removed %i shots, but was unable to remove %i' % + (removed, kept)) + else: + self.report({'INFO'}, 'Removed all %i shots from Attract' % removed) - remove_atc_props(strip) draw.tag_redraw_all_sequencer_editors() return {'FINISHED'} @@ -459,7 +469,14 @@ class AttractShotDelete(AttractOperatorMixin, Operator): def draw(self, context): layout = self.layout col = layout.column() - col.prop(self, 'confirm', text="I hereby confirm: delete this shot from The Edit.") + + selshots = list(selected_shots(context)) + if len(selshots) > 1: + noun = '%i shots' % len(selshots) + else: + noun = 'this shot' + + col.prop(self, 'confirm', text="I hereby confirm: delete %s from The Edit." % noun) class AttractStripUnlink(AttractOperatorMixin, Operator):