Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'release/scripts/startup/bl_operators/clip.py')
-rw-r--r--release/scripts/startup/bl_operators/clip.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/release/scripts/startup/bl_operators/clip.py b/release/scripts/startup/bl_operators/clip.py
index 203a1673c0b..091e3defbf8 100644
--- a/release/scripts/startup/bl_operators/clip.py
+++ b/release/scripts/startup/bl_operators/clip.py
@@ -24,27 +24,27 @@ from bpy.types import Operator
from bpy_extras.io_utils import unpack_list
+def CLIP_track_view_selected(sc, track):
+ if track.select_anchor:
+ return True
+
+ if sc.show_marker_pattern and track.select_pattern:
+ return True
+
+ if sc.show_marker_search and track.select_search:
+ return True
+
+ return False
+
class CLIP_OT_track_to_empty(Operator):
"""Create an Empty object which will be copying movement of active track"""
bl_idname = "clip.track_to_empty"
- bl_label = "2D Track to Empty"
+ bl_label = "Link Empty to Track"
bl_options = {'UNDO', 'REGISTER'}
- @classmethod
- def poll(cls, context):
- if context.space_data.type != 'CLIP_EDITOR':
- return False
-
+ def _link_track(self, context, track):
sc = context.space_data
- clip = sc.clip
-
- return clip and clip.tracking.tracks.active
-
- def execute(self, context):
- sc = context.space_data
- clip = sc.clip
- track = clip.tracking.tracks.active
constraint = None
ob = None
@@ -65,6 +65,14 @@ class CLIP_OT_track_to_empty(Operator):
constraint.track = track.name
constraint.use_3d_position = False
+ def execute(self, context):
+ sc = context.space_data
+ clip = sc.clip
+
+ for track in clip.tracking.tracks:
+ if CLIP_track_view_selected(sc, track):
+ self._link_track(context, track)
+
return {'FINISHED'}
@@ -179,7 +187,7 @@ class CLIP_OT_delete_proxy(Operator):
class CLIP_OT_set_viewport_background(Operator):
- """Set current movie clip as a camera background in 3D viewport"""
+ """Set current movie clip as a camera background in 3D viewport (works only when a 3D viewport is visible)"""
bl_idname = "clip.set_viewport_background"
bl_label = "Set as Background"