[Bf-extensions-cvs] [5b667415] master: space_clip_editor_autotracker: move to contrib: T63750

meta-androcto noreply at git.blender.org
Fri May 24 09:41:44 CEST 2019


Commit: 5b66741510f753da4839f2f94658025912a7af49
Author: meta-androcto
Date:   Fri May 24 17:41:23 2019 +1000
Branches: master
https://developer.blender.org/rBA5b66741510f753da4839f2f94658025912a7af49

space_clip_editor_autotracker: move to contrib: T63750

===================================================================

D	space_clip_editor_autotracker.py

===================================================================

diff --git a/space_clip_editor_autotracker.py b/space_clip_editor_autotracker.py
deleted file mode 100644
index 55f66a57..00000000
--- a/space_clip_editor_autotracker.py
+++ /dev/null
@@ -1,682 +0,0 @@
-# ##### 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 #####
-
-bl_info = {
-    "name": "Autotrack",
-    "author": "Miika Puustinen, Matti Kaihola, Stephen Leger",
-    "version": (0, 1, 1),
-    "blender": (2, 78, 0),
-    "location": "Movie clip Editor > Tools Panel > Autotrack",
-    "description": "Motion Tracking with automatic feature detection.",
-    "warning": "",
-    "wiki_url": "https://github.com/miikapuustinen/blender_autotracker",
-    "category": "Motion Tracking",
-    }
-
-import bpy
-import bgl
-import blf
-from bpy.types import (
-        Operator,
-        Panel,
-        PropertyGroup,
-        WindowManager,
-        )
-from bpy.props import (
-        BoolProperty,
-        FloatProperty,
-        IntProperty,
-        EnumProperty,
-        PointerProperty,
-        )
-
-# for debug purposes
-import time
-
-# set to True to enable debug prints
-DEBUG = False
-
-
-# pass variables just like for the regular prints
-def debug_print(*args, **kwargs):
-    global DEBUG
-    if DEBUG:
-        print(*args, **kwargs)
-
-
-# http://blenderscripting.blogspot.ch/2011/07/bgl-drawing-with-opengl-onto-blender-25.html
-class GlDrawOnScreen():
-    black = (0.0, 0.0, 0.0, 0.7)
-    white = (1.0, 1.0, 1.0, 0.5)
-    progress_colour = (0.2, 0.7, 0.2, 0.5)
-
-    def String(self, text, x, y, size, colour):
-        ''' my_string : the text we want to print
-            pos_x, pos_y : coordinates in integer values
-            size : font height.
-            colour : used for defining the colour'''
-        dpi, font_id = 72, 0   # dirty fast assignment
-        bgl.glColor4f(*colour)
-        blf.position(font_id, x, y, 0)
-        blf.size(font_id, size, dpi)
-        blf.draw(font_id, text)
-
-    def _end(self):
-        bgl.glEnd()
-        bgl.glPopAttrib()
-        bgl.glLineWidth(1)
-        bgl.glDisable(bgl.GL_BLEND)
-        bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
-
-    def _start_line(self, colour, width=2, style=bgl.GL_LINE_STIPPLE):
-        bgl.glPushAttrib(bgl.GL_ENABLE_BIT)
-        bgl.glLineStipple(1, 0x9999)
-        bgl.glEnable(style)
-        bgl.glEnable(bgl.GL_BLEND)
-        bgl.glColor4f(*colour)
-        bgl.glLineWidth(width)
-        bgl.glBegin(bgl.GL_LINE_STRIP)
-
-    def Rectangle(self, x0, y0, x1, y1, colour, width=2, style=bgl.GL_LINE):
-        self._start_line(colour, width, style)
-        bgl.glVertex2i(x0, y0)
-        bgl.glVertex2i(x1, y0)
-        bgl.glVertex2i(x1, y1)
-        bgl.glVertex2i(x0, y1)
-        bgl.glVertex2i(x0, y0)
-        self._end()
-
-    def Polygon(self, pts, colour):
-        bgl.glPushAttrib(bgl.GL_ENABLE_BIT)
-        bgl.glEnable(bgl.GL_BLEND)
-        bgl.glColor4f(*colour)
-        bgl.glBegin(bgl.GL_POLYGON)
-        for pt in pts:
-            x, y = pt
-            bgl.glVertex2f(x, y)
-        self._end()
-
-    def ProgressBar(self, x, y, width, height, start, percent):
-        x1, y1 = x + width, y + height
-        # progress from current point to either start or end
-        xs = x + (x1 - x) * float(start)
-        if percent > 0:
-            # going forward
-            xi = xs + (x1 - xs) * float(percent)
-        else:
-            # going backward
-            xi = xs - (x - xs) * float(percent)
-        self.Polygon([(xs, y), (xs, y1), (xi, y1), (xi, y)], self.progress_colour)
-        self.Rectangle(x, y, x1, y1, self.white, width=1)
-
-
-def draw_callback(self, context):
-    self.gl.ProgressBar(10, 24, 200, 16, self.start, self.progress)
-    self.gl.String(str(int(100 * abs(self.progress))) + "% ESC to Stop", 14, 28, 10, self.gl.white)
-
-
-class OP_Tracking_auto_tracker(Operator):
-    bl_idname = "tracking.auto_track"
-    bl_label = "AutoTracking"
-    bl_description = ("Start Autotracking, Press Esc to Stop \n"
-                      "When stopped, the added Track Markers will be kept")
-
-    _timer = None
-    _draw_handler = None
-
-    gl = GlDrawOnScreen()
-    progress = 0
-    limits = 0
-    t = 0
-
-    def find_track_start(self, track):
-        for m in track.markers:
-            if not m.mute:
-                return m.frame
-        return track.markers[0].frame
-
-    def find_track_end(self, track):
-        for m in reversed(track.markers):
-            if not m.mute:
-                return m.frame
-        return track.markers[-1].frame - 1
-
-    def find_track_length(self, track):
-        tstart = self.find_track_start(track)
-        tend = self.find_track_end(track)
-        return tend - tstart
-
-    def show_tracks(self, context):
-        clip = context.area.spaces.active.clip
-        tracks = clip.tracking.tracks
-        for track in tracks:
-            track.hide = False
-
-    def get_vars_from_context(self, context):
-        scene = context.scene
-        props = context.window_manager.autotracker_props
-        clip = context.area.spaces.active.clip
-        tracks = clip.tracking.tracks
-        current_frame = scene.frame_current
-        clip_end = clip.frame_start + clip.frame_duration
-        clip_start = clip.frame_start
-        if props.track_backwards:
-            last_frame = min(clip_end, current_frame + props.frame_separation)
-        else:
-            last_frame = max(clip_start, current_frame - props.frame_separation)
-        return scene, props, clip, tracks, current_frame, last_frame
-
-    def delete_tracks(self, to_delete):
-        bpy.ops.clip.select_all(action='DESELECT')
-        for track in to_delete:
-            track.select = True
-        bpy.ops.clip.delete_track()
-
-    # DETECT FEATURES
-    def auto_features(self, context):
-        """
-            Detect features
-        """
-        t = time.time()
-
-        scene, props, clip, tracks, current_frame, last_frame = self.get_vars_from_context(context)
-
-        selected = []
-        old = []
-        to_delete = []
-        width = clip.size[0]
-        delete_threshold = float(props.delete_threshold) / 100.0
-
-        bpy.ops.clip.select_all(action='DESELECT')
-
-        # Detect Features
-        bpy.ops.clip.detect_features(
-                threshold=props.df_threshold,
-                min_distance=props.df_distance / 100.0 * width,
-                margin=props.df_margin / 100.0 * width,
-                placement=props.placement_list
-                )
-
-        # filter new and old tracks
-        for track in tracks:
-            if track.hide or track.lock:
-                continue
-            marker = track.markers.find_frame(current_frame)
-            if marker is not None:
-                if (not track.select) and (not marker.mute):
-                    old.append(track)
-                if track.select:
-                    selected.append(track)
-
-        added_tracks = len(selected)
-
-        # Select overlapping new markers
-        for track_new in selected:
-            marker0 = track_new.markers.find_frame(current_frame)
-            for track_old in old:
-                marker1 = track_old.markers.find_frame(current_frame)
-                distance = (marker1.co - marker0.co).length
-                if distance < delete_threshold:
-                    to_delete.append(track_new)
-                    added_tracks -= 1
-                    break
-
-        # Delete Overlapping Markers
-        self.delete_tracks(to_delete)
-        debug_print("auto_features %.4f seconds, add: %s tracks" % (time.time() - t, added_tracks))
-
-    # AUTOTRACK FRAMES
-    def track_frames_backward(self):
-        # INVOKE_DEFAULT to show progress and take account of frame_limit
-        t = time.time()
-        res = bpy.ops.clip.track_markers('INVOKE_DEFAULT', backwards=True, sequence=True)
-        debug_print("track_frames_backward %.2f seconds %s" % (time.time() - t, res))
-
-    def track_frames_forward(self):
-        # INVOKE_DEFAULT to show progress and take account of frame_limit
-        t = time.time()
-        res = bpy.ops.clip.track_markers('INVOKE_DEFAULT', backwards=False, sequence=True)
-        debug_print("track_frames_forward %.2f seconds %s" % (time.time() - t, res))
-
-    def get_active_tracks(self, context):
-        scene, props, clip, tracks, current_frame, last_frame = self.get_vars_from_context(context)
-
-        active_tracks = []
-        for track in tracks:
-            if track.hide or track.lock:
-                continue
-            if len(track.markers) < 2:
-                active_tracks.append(track)
-            else:
-                marker = track.markers.find_frame(current_frame)
-                if (marker is not None) and (not marker.mute):
-                    active_tracks.append(track)
-        return active_tracks
-
-    def select_active_tracks(self, context):
-        t = time.time()
-        scene, props, clip, tracks, current_frame, last_frame = self.get_vars_from_context(context)
-        # Select active trackers for tracking
-        bpy.ops.clip.select_all(action='DESELECT')
-        selected = self.get_active_tracks(context)
-        for track in selected:
-            track.select = True
-        debug_print("select_active_tracks %.2f seconds,"
-                    " selected: %s" % (time.time() - t, len(selected)))
-        return selected
-
-    def estimate_motion(self, context, last, frame):
-        """
-       

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list