Tracking Pie Menus for Blender 2.8
This patch adds 4 pie menus to space_clip.py, as discussed in T57912. Differential Revision: https://developer.blender.org/D4284
This commit is contained in:
parent
7c6c5b40ca
commit
4c14d820e3
|
@ -2575,8 +2575,11 @@ def km_clip(_params):
|
|||
{"properties": [("backwards", True), ("sequence", True)]}),
|
||||
("wm.context_toggle_enum", {"type": 'TAB', "value": 'PRESS'},
|
||||
{"properties": [("data_path", 'space_data.mode'), ("value_1", 'TRACKING'), ("value_2", 'MASK')]}),
|
||||
("clip.solve_camera", {"type": 'S', "value": 'PRESS', "shift": True}, None),
|
||||
("clip.prefetch", {"type": 'P', "value": 'PRESS'}, None),
|
||||
op_menu_pie("CLIP_MT_tracking_pie", {"type": 'E', "value": 'PRESS'}),
|
||||
op_menu_pie("CLIP_MT_solving_pie", {"type": 'S', "value": 'PRESS', "shift": True}),
|
||||
op_menu_pie("CLIP_MT_marker_pie", {"type": 'E', "value": 'PRESS', "shift": True}),
|
||||
op_menu_pie("CLIP_MT_reconstruction_pie", {"type": 'W', "value": 'PRESS', "shift": True}),
|
||||
])
|
||||
|
||||
return keymap
|
||||
|
|
|
@ -1514,6 +1514,156 @@ class CLIP_MT_pivot_pie(Menu):
|
|||
pie.prop_enum(context.space_data, "pivot_point", value='MEDIAN_POINT')
|
||||
|
||||
|
||||
class CLIP_MT_marker_pie(Menu):
|
||||
# Settings for the individual markers
|
||||
bl_label = "Marker Settings"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
return space.mode == 'TRACKING' and space.clip
|
||||
|
||||
def draw(self, context):
|
||||
clip = context.space_data.clip
|
||||
tracks = getattr(getattr(clip, "tracking", None), "tracks", None)
|
||||
track_active = tracks.active if tracks else None
|
||||
|
||||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# Use Location Tracking
|
||||
prop = pie.operator("wm.context_set_enum", text="Loc")
|
||||
prop.data_path = "space_data.clip.tracking.tracks.active.motion_model"
|
||||
prop.value = "Loc"
|
||||
# Use Affine Tracking
|
||||
prop = pie.operator("wm.context_set_enum", text="Affine")
|
||||
prop.data_path = "space_data.clip.tracking.tracks.active.motion_model"
|
||||
prop.value = "Affine"
|
||||
# Copy Settings From Active To Selected
|
||||
pie.operator("clip.track_settings_to_track", icon='COPYDOWN')
|
||||
# Make Settings Default
|
||||
pie.operator("clip.track_settings_as_default", icon='SETTINGS')
|
||||
if track_active:
|
||||
# Use Normalization
|
||||
pie.prop(track_active, "use_normalization", text="Normalization")
|
||||
# Use Brute Force
|
||||
pie.prop(track_active, "use_brute", text="Use Brute Force")
|
||||
# Match Keyframe
|
||||
prop = pie.operator("wm.context_set_enum", text="Match Previous", icon='KEYFRAME_HLT')
|
||||
prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match"
|
||||
prop.value = 'KEYFRAME'
|
||||
# Match Previous Frame
|
||||
prop = pie.operator("wm.context_set_enum", text="Match Keyframe", icon='KEYFRAME')
|
||||
prop.data_path = "space_data.clip.tracking.tracks.active.pattern_match"
|
||||
prop.value = 'PREV_FRAME'
|
||||
|
||||
|
||||
class CLIP_MT_tracking_pie(Menu):
|
||||
# Tracking Operators
|
||||
bl_label = "Tracking"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
return space.mode == 'TRACKING' and space.clip
|
||||
|
||||
def draw(self, context):
|
||||
space = context.space_data
|
||||
clip = space.clip
|
||||
act_track = clip.tracking.tracks.active
|
||||
|
||||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# Track Backwards
|
||||
prop = pie.operator("clip.track_markers", icon='TRACKING_BACKWARDS')
|
||||
prop.backwards = True
|
||||
prop.sequence = True
|
||||
# Track Forwards
|
||||
prop = pie.operator("clip.track_markers", icon='TRACKING_FORWARDS')
|
||||
prop.backwards = False
|
||||
prop.sequence = True
|
||||
# Disable Marker
|
||||
pie.operator("clip.disable_markers", icon="VISIBLE_IPO_ON").action = 'TOGGLE'
|
||||
# Detect Features
|
||||
pie.operator("clip.detect_features", icon='ZOOM_SELECTED')
|
||||
# Clear Path Backwards
|
||||
pie.operator("clip.clear_track_path", icon='TRACKING_CLEAR_BACKWARDS').action = 'UPTO'
|
||||
# Clear Path Forwards
|
||||
pie.operator("clip.clear_track_path", icon='TRACKING_CLEAR_FORWARDS').action = 'REMAINED'
|
||||
# Refine Backwards
|
||||
pie.operator("clip.refine_markers", icon='TRACKING_REFINE_BACKWARDS').backwards = True
|
||||
# Refine Forwards
|
||||
pie.operator("clip.refine_markers", icon='TRACKING_REFINE_FORWARDS').backwards = False
|
||||
|
||||
|
||||
class CLIP_MT_solving_pie(Menu):
|
||||
# Operators to solve the scene
|
||||
bl_label = "Solving"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
return space.mode == 'TRACKING' and space.clip
|
||||
|
||||
def draw(self, context):
|
||||
clip = context.space_data.clip
|
||||
settings = getattr(getattr(clip, "tracking", None), "settings", None)
|
||||
|
||||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# Clear Solution
|
||||
pie.operator("clip.clear_solution", icon='FILE_REFRESH')
|
||||
# Solve Camera
|
||||
pie.operator("clip.solve_camera", text="Solve Camera", icon='OUTLINER_OB_CAMERA')
|
||||
# Use Tripod Solver
|
||||
if settings:
|
||||
pie.prop(settings, "use_tripod_solver", text="Tripod Solver")
|
||||
# create Plane Track
|
||||
pie.operator("clip.create_plane_track", icon='MATPLANE')
|
||||
# Set Keyframe A
|
||||
pie.operator("clip.set_solver_keyframe", text="Set Keyframe A",
|
||||
icon='KEYFRAME').keyframe = 'KEYFRAME_A'
|
||||
# Set Keyframe B
|
||||
pie.operator("clip.set_solver_keyframe", text="Set Keyframe B",
|
||||
icon='KEYFRAME').keyframe = 'KEYFRAME_B'
|
||||
# Clean Tracks
|
||||
prop = pie.operator("clip.clean_tracks", icon='X')
|
||||
# Filter Tracks
|
||||
pie.operator("clip.filter_tracks", icon='FILTER')
|
||||
prop.frames = 15
|
||||
prop.error = 2
|
||||
|
||||
|
||||
class CLIP_MT_reconstruction_pie(Menu):
|
||||
# Scene Reconstruction
|
||||
bl_label = "Reconstruction"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space = context.space_data
|
||||
return space.mode == 'TRACKING' and space.clip
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
# Set Active Clip As Viewport Background
|
||||
pie.operator("clip.set_viewport_background", text="Set Viewport Background", icon='FILE_IMAGE')
|
||||
# Setup Tracking Scene
|
||||
pie.operator("clip.setup_tracking_scene", text="Setup Tracking Scene", icon='SCENE_DATA')
|
||||
# Setup Floor
|
||||
pie.operator("clip.set_plane", text="Set Floor", icon='AXIS_TOP')
|
||||
# Set Origin
|
||||
pie.operator("clip.set_origin", text="Set Origin", icon='OBJECT_ORIGIN')
|
||||
# Set X Axis
|
||||
pie.operator("clip.set_axis", text="Set X Axis", icon='AXIS_FRONT').axis = 'X'
|
||||
# Set Y Axis
|
||||
pie.operator("clip.set_axis", text="Set Y Axis", icon='AXIS_SIDE').axis = 'Y'
|
||||
# Set Scale
|
||||
pie.operator("clip.set_scale", text="Set Scale", icon='ARROW_LEFTRIGHT')
|
||||
# Apply Solution Scale
|
||||
pie.operator("clip.apply_solution_scale", icon='ARROW_LEFTRIGHT')
|
||||
|
||||
|
||||
|
||||
classes = (
|
||||
CLIP_UL_tracking_objects,
|
||||
CLIP_HT_header,
|
||||
|
@ -1569,6 +1719,10 @@ classes = (
|
|||
CLIP_MT_stabilize_2d_context_menu,
|
||||
CLIP_MT_stabilize_2d_rotation_context_menu,
|
||||
CLIP_MT_pivot_pie,
|
||||
CLIP_MT_marker_pie,
|
||||
CLIP_MT_tracking_pie,
|
||||
CLIP_MT_reconstruction_pie,
|
||||
CLIP_MT_solving_pie
|
||||
)
|
||||
|
||||
if __name__ == "__main__": # only for live edit.
|
||||
|
|
Loading…
Reference in New Issue