[Bf-extensions-cvs] [e1aa864] master: Fix T37897 copy properties operator freeze blender
carlospadial
noreply at git.blender.org
Sat Jan 4 19:02:26 CET 2014
Commit: e1aa86422fd7b4658caf21511e85c6df8027437d
Author: carlospadial
Date: Sat Jan 4 18:22:07 2014 +0100
https://developer.blender.org/rBAe1aa86422fd7b4658caf21511e85c6df8027437d
Fix T37897 copy properties operator freeze blender
the script was checking for selected strips one by one,
and sometimes this drives into freeze (can't explain why, but its obviously
a bad way to do it...
now it uses context.selected_editable_sequences, now it is more efficient
and the bug seems to be solved.
===================================================================
A sequencer_extra_actions/operators_extra_actions.py
===================================================================
diff --git a/sequencer_extra_actions/operators_extra_actions.py b/sequencer_extra_actions/operators_extra_actions.py
new file mode 100644
index 0000000..244cf8c
--- /dev/null
+++ b/sequencer_extra_actions/operators_extra_actions.py
@@ -0,0 +1,1948 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+'''
+TODO
+align strip to the left (shift-s + -lenght)
+
+'''
+
+import bpy
+
+import random
+import math
+import os, sys
+
+from bpy.props import IntProperty
+from bpy.props import FloatProperty
+from bpy.props import EnumProperty
+from bpy.props import BoolProperty
+from bpy.props import StringProperty
+
+from . import functions
+from . import exiftool
+
+
+# Initialization
+
+
+def initSceneProperties(context, scn):
+ try:
+ if context.scene.scene_initialized == True:
+ return False
+ except AttributeError:
+ pass
+
+ bpy.types.Scene.default_slide_offset = IntProperty(
+ name='Offset',
+ description='Number of frames to slide',
+ min=-250, max=250,
+ default=0)
+ scn.default_slide_offset = 0
+
+ bpy.types.Scene.default_fade_duration = IntProperty(
+ name='Duration',
+ description='Number of frames to fade',
+ min=1, max=250,
+ default=scn.render.fps)
+ scn.default_fade_duration = scn.render.fps
+
+ bpy.types.Scene.default_fade_amount = FloatProperty(
+ name='Amount',
+ description='Maximum value of fade',
+ min=0.0,
+ max=100.0,
+ default=1.0)
+ scn.default_fade_amount = 1.0
+
+ bpy.types.Scene.default_distribute_offset = IntProperty(
+ name='Offset',
+ description='Number of frames between strip start frames',
+ min=1,
+ max=250,
+ default=2)
+ scn.default_distribute_offset = 2
+
+ bpy.types.Scene.default_distribute_reverse = BoolProperty(
+ name='Reverse Order',
+ description='Reverse the order of selected strips',
+ default=False)
+ scn.default_distribute_reverse = False
+
+ bpy.types.Scene.default_proxy_suffix = StringProperty(
+ name='default proxy suffix',
+ description='default proxy filename suffix',
+ default="-25")
+ scn.default_proxy_suffix = "-25"
+
+ bpy.types.Scene.default_proxy_extension = StringProperty(
+ name='default proxy extension',
+ description='default proxy file extension',
+ default=".mkv")
+ scn.default_proxy_extension = ".mkv"
+
+ bpy.types.Scene.default_proxy_path = StringProperty(
+ name='default proxy path',
+ description='default proxy file path (relative to original file)',
+ default="")
+ scn.default_proxy_path = ""
+
+ bpy.types.Scene.default_build_25 = BoolProperty(
+ name='default_build_25',
+ description='default build_25',
+ default=True)
+ scn.default_build_25 = True
+
+ bpy.types.Scene.default_build_50 = BoolProperty(
+ name='default_build_50',
+ description='default build_50',
+ default=False)
+ scn.default_build_50 = False
+
+ bpy.types.Scene.default_build_75 = BoolProperty(
+ name='default_build_75',
+ description='default build_75',
+ default=False)
+ scn.default_build_75 = False
+
+ bpy.types.Scene.default_build_100 = BoolProperty(
+ name='default_build_100',
+ description='default build_100',
+ default=False)
+ scn.default_build_100 = False
+
+ bpy.types.Scene.default_recursive = BoolProperty(
+ name='Recursive',
+ description='Load in recursive folders',
+ default=False)
+ scn.default_recursive = False
+
+ bpy.types.Scene.default_recursive_proxies = BoolProperty(
+ name='Recursive proxies',
+ description='Load in recursive folders + proxies',
+ default=False)
+ scn.default_recursive_proxies = False
+
+ bpy.types.Scene.default_recursive_select_by_extension = BoolProperty(
+ name='Recursive ext',
+ description='Load only clips with selected extension',
+ default=False)
+ scn.default_recursive_select_by_extension = False
+
+ bpy.types.Scene.default_ext = EnumProperty(
+ items=functions.movieextdict,
+ name="ext enum",
+ default="3")
+ scn.default_ext = "3"
+
+ bpy.types.Scene.scene_initialized = BoolProperty(
+ name='Init',
+ default=False)
+ scn.scene_initialized = True
+
+ return True
+
+
+# TRIM TIMELINE
+class Sequencer_Extra_TrimTimeline(bpy.types.Operator):
+ bl_label = 'Trim to Timeline Content'
+ bl_idname = 'timeextra.trimtimeline'
+ bl_description = 'Automatically set start and end frames'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ scn = context.scene
+ if scn and scn.sequence_editor:
+ return scn.sequence_editor.sequences
+ else:
+ return False
+
+ def execute(self, context):
+ scn = context.scene
+ seq = scn.sequence_editor
+ meta_level = len(seq.meta_stack)
+ if meta_level > 0:
+ seq = seq.meta_stack[meta_level - 1]
+
+ frame_start = 300000
+ frame_end = -300000
+ for i in seq.sequences:
+ try:
+ if i.frame_final_start < frame_start:
+ frame_start = i.frame_final_start
+ if i.frame_final_end > frame_end:
+ frame_end = i.frame_final_end - 1
+ except AttributeError:
+ pass
+
+ if frame_start != 300000:
+ scn.frame_start = frame_start
+ if frame_end != -300000:
+ scn.frame_end = frame_end
+ return {'FINISHED'}
+
+
+# TRIM TIMELINE TO SELECTION
+class Sequencer_Extra_TrimTimelineToSelection(bpy.types.Operator):
+ bl_label = 'Trim to Selection'
+ bl_idname = 'timeextra.trimtimelinetoselection'
+ bl_description = 'Set start and end frames to selection'
+ bl_options = {'REGISTER', 'UNDO'}
+
+ @classmethod
+ def poll(self, context):
+ scn = context.scene
+ if scn and scn.sequence_editor:
+ return scn.sequence_editor.sequences
+ else:
+ return False
+
+ def execute(self, context):
+ scn = context.scene
+ seq = scn.sequence_editor
+ meta_level = len(seq.meta_stack)
+ if meta_level > 0:
+ seq = seq.meta_stack[meta_level - 1]
+
+ frame_start = 300000
+ frame_end = -300000
+ for i in seq.sequences:
+ try:
+ if i.frame_final_start < frame_start and i.select == True:
+ frame_start = i.frame_final_start
+ if i.frame_final_end > frame_end and i.select == True:
+ frame_end = i.frame_final_end - 1
+ except AttributeError:
+ pass
+
+ if frame_start != 300000:
+ scn.frame_start = frame_start
+ if frame_end != -300000:
+ scn.frame_end = frame_end
+ return {'FINISHED'}
+
+
+# SLIDE STRIP
+class Sequencer_Extra_SlideStrip(bpy.types.Operator):
+ bl_label = 'Slide'
+ bl_idname = 'sequencerextra.slide'
+ bl_description = 'Alter in and out points but not duration of a strip'
+ mode = EnumProperty(
+ name='Mode',
+ items=(
+ ('TOSTART', 'Current Frame to Strip Start', ''),
+ ('TOEND', 'Current Frame to Strip End', ''),
+ ('INPUT', 'Input...', '')),
+ default='INPUT',
+ options={'HIDDEN'})
+ bl_options = {'REGISTER', 'UNDO'}
+
+ slide_offset = IntProperty(
+ name='Offset',
+ description='Number of frames to slide',
+ min=-250, max=250,
+ default=0)
+
+ @classmethod
+ def poll(self, context):
+ strip = functions.act_strip(context)
+ scn = context.scene
+ if scn and scn.sequence_editor and scn.sequence_editor.active_strip:
+ return strip.type in ('MOVIE', 'IMAGE', 'META', 'SCENE')
+ else:
+ return False
+
+ def execute(self, context):
+ strip = functions.act_strip(context)
+ scn = context.scene
+ cf = scn.frame_current
+
+ if self.mode == 'TOSTART':
+ sx = strip.frame_final_start - cf
+ elif self.mode == 'TOEND':
+ sx = strip.frame_final_end - cf
+ else:
+ sx = self.slide_offset
+
+ frame_end = strip.frame_start + strip.frame_duration
+ pad_left = strip.frame_final_start - strip.frame_start
+ pad_right = (frame_end - strip.frame_final_end) * -1
+
+ if sx > pad_left:
+ sx = pad_left
+ elif sx < pad_right:
+ sx = pad_right
+
+ strip.frame_start += sx
+ strip.frame_final_start -= sx
+ strip.frame_final_end -= sx
+
+ self.report({'INFO'}, 'Strip slid %d frame(s)' % (sx))
+ scn.default_slide_offset = sx
+ bpy.ops.sequencer.reload()
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ scn = context.scene
+ initSceneProperties(context,scn)
+ self.slide_offset = scn.default_slide_offset
+ if self.mode == 'INPUT':
+ return context.window_manager.invoke_props_dialog(self)
+ else:
+ return self.execute(context)
+
+
+# SLIDE GRAB
+class Sequencer_Extra_SlideGrab(bpy.types.Operator):
+ bl_label = 'Slide Grab'
+ bl_idname = 'sequencerextra.slidegrab'
+ bl_de
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list