[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43729] trunk/blender/release/scripts/ startup: Movie clip editor: default tracking settings can be copied from active track now

Sergey Sharybin sergey.vfx at gmail.com
Thu Jan 26 16:04:26 CET 2012


Revision: 43729
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43729
Author:   nazgul
Date:     2012-01-26 15:04:25 +0000 (Thu, 26 Jan 2012)
Log Message:
-----------
Movie clip editor: default tracking settings can be copied from active track now

Modified Paths:
--------------
    trunk/blender/release/scripts/startup/bl_operators/clip.py
    trunk/blender/release/scripts/startup/bl_ui/space_clip.py

Modified: trunk/blender/release/scripts/startup/bl_operators/clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/clip.py	2012-01-26 14:55:46 UTC (rev 43728)
+++ trunk/blender/release/scripts/startup/bl_operators/clip.py	2012-01-26 15:04:25 UTC (rev 43729)
@@ -90,6 +90,31 @@
     return False
 
 
+def CLIP_default_settings_from_track(clip, track):
+    settings = clip.tracking.settings
+
+    width = clip.size[0]
+    height = clip.size[1]
+
+    pattern = track.pattern_max - track.pattern_min
+    search = track.search_max - track.search_min
+
+    pattern[0] = pattern[0] * clip.size[0]
+    pattern[1] = pattern[1] * clip.size[1]
+
+    search[0] = search[0] * clip.size[0]
+    search[1] = search[1] * clip.size[1]
+
+    settings.default_tracker = track.tracker
+    settings.default_pyramid_levels = track.pyramid_levels
+    settings.default_correlation_min = track.correlation_min
+    settings.default_pattern_size = max(pattern[0], pattern[1])
+    settings.default_search_size = max(search[0], search[1])
+    settings.default_frames_limit = track.frames_limit
+    settings.default_pattern_match = track.pattern_match
+    settings.default_margin = track.margin
+
+
 class CLIP_OT_track_to_empty(Operator):
     """Create an Empty object which will be copying movement of active track"""
 
@@ -805,3 +830,29 @@
         self._setupObjects(context)
 
         return {'FINISHED'}
+
+class CLIP_OT_track_settings_as_default(Operator):
+    """Copy trackign settings from active track to default settings"""
+
+    bl_idname = "clip.track_settings_as_default"
+    bl_label = "Track Settings As Default"
+    bl_options = {'UNDO', 'REGISTER'}
+
+    @classmethod
+    def poll(cls, context):
+        sc = context.space_data
+
+        if sc.type != 'CLIP_EDITOR':
+            return False
+
+        clip = sc.clip
+
+        return clip and clip.tracking.tracks.active
+
+    def execute(self, context):
+        sc = context.space_data
+        clip = sc.clip
+
+        CLIP_default_settings_from_track(clip, clip.tracking.tracks.active)
+
+        return {'FINISHED'}

Modified: trunk/blender/release/scripts/startup/bl_ui/space_clip.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-26 14:55:46 UTC (rev 43728)
+++ trunk/blender/release/scripts/startup/bl_ui/space_clip.py	2012-01-26 15:04:25 UTC (rev 43729)
@@ -147,7 +147,10 @@
             col.label(text="Match:")
             col.prop(settings, "default_pattern_match", text="")
 
+            col.separator()
+            col.operator('clip.track_settings_as_default', text="Copy From Active Track")
 
+
 class CLIP_PT_tools_tracking(Panel):
     bl_space_type = 'CLIP_EDITOR'
     bl_region_type = 'TOOLS'



More information about the Bf-blender-cvs mailing list