Compare commits
133 Commits
xr-dev
...
tracking_t
Author | SHA1 | Date | |
---|---|---|---|
09098e6539 | |||
7383c6c309 | |||
a56a90a8e2 | |||
3543081e6a | |||
aee2b2c008 | |||
92855f8ab7 | |||
![]() |
66b750eb6e | ||
52399070c2 | |||
8091e02525 | |||
adfc603dd8 | |||
fc9dff5677 | |||
5f4a55d375 | |||
8146eac905 | |||
05abd2496a | |||
a3d6ce2cb3 | |||
02d5702797 | |||
fb61be68e3 | |||
73e499fd5f | |||
ee5e117ae8 | |||
1f031a47a3 | |||
5dca2a7c68 | |||
71baa5f332 | |||
5e0bbbc24e | |||
3c54a61394 | |||
ee954ed1d1 | |||
aab388678a | |||
4f28b881a6 | |||
0c2c1601b9 | |||
dc29529ca8 | |||
e3e7543f30 | |||
68fa87dbf0 | |||
613dd85541 | |||
7488250e51 | |||
80441866c2 | |||
981a360310 | |||
d05575f942 | |||
8f4e3458ac | |||
fc589efd13 | |||
e7d8e2c199 | |||
7bda282c5d | |||
d46feb8b4d | |||
463e8c0cf5 | |||
804c74a2fd | |||
a9b204c501 | |||
69df1d9ee1 | |||
441ecf9ec6 | |||
00f6dd3439 | |||
25f8dfd436 | |||
2a0f777243 | |||
28c380ca2f | |||
29cda45d83 | |||
a41382aef6 | |||
25873ff0f7 | |||
39590dab00 | |||
09014c1a2d | |||
bb6d0165b4 | |||
9fccd4d789 | |||
![]() |
7ef78a2683 | ||
18916cb6eb | |||
11b5c6ac52 | |||
faa4dabd75 | |||
0485a873a3 | |||
2fa4c4e62c | |||
![]() |
d9d49d3513 | ||
dc14fb5708 | |||
aa2710afa5 | |||
6088c154e0 | |||
316ea9e080 | |||
c8b84f2ad8 | |||
a96147720f | |||
88acad8c52 | |||
92da23b464 | |||
08117cb0e3 | |||
8b1d651350 | |||
2c55c8470d | |||
4e24add5ee | |||
da480ed9dc | |||
14e1154946 | |||
f78a432934 | |||
db6b6fd816 | |||
b6a2989289 | |||
be2b52a557 | |||
098bb648f3 | |||
0067b49bbf | |||
9435287c25 | |||
e1b8e6228e | |||
523ab17cd8 | |||
6ae01c4898 | |||
8a652aac01 | |||
7b615a2dfb | |||
b2f8e13989 | |||
e1a3584432 | |||
60229ac068 | |||
49054a7109 | |||
5ebdece0b8 | |||
222a0ab54a | |||
935c717e71 | |||
67a8896bcb | |||
9cb7ad7d19 | |||
d424344af1 | |||
7d9fc377e1 | |||
506aa3b788 | |||
6c5722ee40 | |||
abae63b979 | |||
934fd07a06 | |||
2a20754467 | |||
4fc7e38803 | |||
d535c5784b | |||
50ef1f6f0b | |||
8bf9eb9822 | |||
c732ee3bf3 | |||
69aee563db | |||
27e2382feb | |||
6da684a9c6 | |||
4d620c7028 | |||
c997998702 | |||
750a65bbf2 | |||
1ffad3992a | |||
c349152b50 | |||
546fe10b33 | |||
96af3700f4 | |||
d5df94c4ee | |||
![]() |
677212b016 | ||
9d81cfaba3 | |||
1da69b4eac | |||
c3bb138ade | |||
5727f7132e | |||
1e5377bdcf | |||
ebf217c79a | |||
6d7a6c46eb | |||
e9bf1d5f93 | |||
42a31482bf | |||
![]() |
72eb4aff7b |
@@ -939,8 +939,6 @@ def km_mask_editing(params):
|
||||
op_menu("MASK_MT_add", {"type": 'A', "value": 'PRESS', "shift": True}),
|
||||
*_template_items_proportional_editing(
|
||||
params, connected=False, toggle_data_path='tool_settings.use_proportional_edit_mask'),
|
||||
("mask.add_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
|
||||
("mask.add_feather_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "shift": True, "ctrl": True}, None),
|
||||
("mask.delete", {"type": 'X', "value": 'PRESS'}, None),
|
||||
("mask.delete", {"type": 'DEL', "value": 'PRESS'}, None),
|
||||
("mask.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
|
||||
@@ -962,8 +960,6 @@ def km_mask_editing(params):
|
||||
*_template_items_hide_reveal_actions("mask.hide_view_set", "mask.hide_view_clear"),
|
||||
("clip.select", {"type": params.select_mouse, "value": 'PRESS', "ctrl": True}, None),
|
||||
("mask.cyclic_toggle", {"type": 'C', "value": 'PRESS', "alt": True}, None),
|
||||
("mask.slide_point", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("mask.slide_spline_curvature", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("mask.handle_type_set", {"type": 'V', "value": 'PRESS'}, None),
|
||||
("mask.normals_make_consistent",
|
||||
{"type": 'N', "value": 'PRESS', "ctrl" if params.legacy else "shift": True}, None),
|
||||
@@ -3189,10 +3185,6 @@ def km_clip_editor(params):
|
||||
("clip.frame_jump", {"type": 'RIGHT_ARROW', "value": 'PRESS', "shift": True, "alt": True, "repeat": True},
|
||||
{"properties": [("position", 'PATHSTART')]}),
|
||||
("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("clip.select", {"type": params.select_mouse, "value": 'PRESS'},
|
||||
{"properties": [("deselect_all", not params.legacy)]}),
|
||||
("clip.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
|
||||
{"properties": [("extend", True)]}),
|
||||
*_template_items_select_actions(params, "clip.select_all"),
|
||||
("clip.select_box", {"type": 'B', "value": 'PRESS'}, None),
|
||||
("clip.select_circle", {"type": 'C', "value": 'PRESS'}, None),
|
||||
@@ -3201,10 +3193,8 @@ def km_clip_editor(params):
|
||||
{"properties": [("mode", 'ADD')]}),
|
||||
("clip.select_lasso", {"type": params.action_mouse, "value": 'CLICK_DRAG', "shift": True, "ctrl": True, "alt": True},
|
||||
{"properties": [("mode", 'SUB')]}),
|
||||
("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
|
||||
("clip.delete_marker", {"type": 'X', "value": 'PRESS', "shift": True}, None),
|
||||
("clip.delete_marker", {"type": 'DEL', "value": 'PRESS', "shift": True}, None),
|
||||
("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("clip.disable_markers", {"type": 'D', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("action", 'TOGGLE')]}),
|
||||
("clip.delete_track", {"type": 'X', "value": 'PRESS'}, None),
|
||||
@@ -3214,7 +3204,6 @@ def km_clip_editor(params):
|
||||
("clip.lock_tracks", {"type": 'L', "value": 'PRESS', "alt": True},
|
||||
{"properties": [("action", 'UNLOCK')]}),
|
||||
*_template_items_hide_reveal_actions("clip.hide_tracks", "clip.hide_tracks_clear"),
|
||||
("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 'CLICK_DRAG'}, None),
|
||||
("clip.keyframe_insert", {"type": 'I', "value": 'PRESS'}, None),
|
||||
("clip.keyframe_delete", {"type": 'I', "value": 'PRESS', "alt": True}, None),
|
||||
("clip.join_tracks", {"type": 'J', "value": 'PRESS', "ctrl": True}, None),
|
||||
@@ -6448,6 +6437,72 @@ def km_generic_tool_annotate_eraser(params):
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_select(params):
|
||||
return (
|
||||
"Mask Editing: Tweak",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
("mask.select", {"type": params.select_mouse, "value": 'PRESS'},
|
||||
{"properties": [("extend", False), ("deselect_all", not params.legacy)]}),
|
||||
]},
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_select_box(params):
|
||||
return (
|
||||
"Mask Editing: Select Box",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": _template_items_tool_select_actions_simple(
|
||||
"mask.select_box", type=params.tool_mouse, value='CLICK_DRAG',
|
||||
)},
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_select_lasso(params):
|
||||
return (
|
||||
"Mask Editing: Select Lasso",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": _template_items_tool_select_actions_simple(
|
||||
"mask.select_lasso", type=params.tool_mouse, value='PRESS',
|
||||
)},
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_select_circle(params):
|
||||
return (
|
||||
"Mask Editing: Select Circle",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": _template_items_tool_select_actions_simple(
|
||||
"mask.select_circle", type=params.tool_mouse, value='PRESS',
|
||||
properties=[("wait_for_input", False)],
|
||||
)},
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_add_vertex(params):
|
||||
return (
|
||||
"Mask Editing: Add Vertex and Slide",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
("mask.draw_mask", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("mask.add_feather_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
|
||||
]},
|
||||
)
|
||||
|
||||
|
||||
def km_generic_tool_mask_add_feather_vertex(params):
|
||||
return (
|
||||
"Mask Editing: Add Feather Vertex and Slide",
|
||||
{"space_type": 'EMPTY', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
("mask.slide_point", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("mask.draw_mask", {"type": 'LEFTMOUSE', "value": 'PRESS', "alt": True}, None),
|
||||
("mask.add_feather_vertex_slide", {"type": 'LEFTMOUSE', "value": 'PRESS', "ctrl": True}, None),
|
||||
("mask.slide_spline_curvature", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
]},
|
||||
)
|
||||
|
||||
|
||||
def km_image_editor_tool_generic_sample(params):
|
||||
return (
|
||||
"Image Editor Tool: Sample",
|
||||
@@ -6597,6 +6652,111 @@ def km_image_editor_tool_uv_scale(params):
|
||||
)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Tool System (Clip Editor)
|
||||
|
||||
def _template_items_clip_tool_mouse_selection(params, use_release=False):
|
||||
return [
|
||||
("clip.select", {"type": params.select_mouse, "value": 'RELEASE' if use_release else 'PRESS'},
|
||||
{"properties": [
|
||||
("extend", False),
|
||||
("deselect_all", True),
|
||||
("activate_selected", params.select_mouse == 'LEFTMOUSE')]}
|
||||
),
|
||||
("clip.select", {"type": params.select_mouse, "value": 'PRESS', "shift": True},
|
||||
{"properties": [("extend", True)]}),
|
||||
]
|
||||
|
||||
|
||||
def _template_items_clip_tool_tweak_selection(params):
|
||||
items = [
|
||||
*_template_items_clip_tool_mouse_selection(params),
|
||||
]
|
||||
|
||||
if params.select_mouse == 'RIGHTMOUSE':
|
||||
items.append(
|
||||
("clip.select", {"type": 'LEFTMOUSE', "value": 'PRESS'},
|
||||
{"properties": [
|
||||
("extend", False),
|
||||
("deselect_all", True),
|
||||
("activate_selected", True),
|
||||
]
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
return items
|
||||
|
||||
|
||||
def _template_items_clip_tool_tweak(params):
|
||||
return [
|
||||
("clip.change_frame", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
*_template_items_clip_tool_tweak_selection(params),
|
||||
("clip.slide_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
("clip.slide_plane_marker", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
]
|
||||
|
||||
|
||||
def km_clip_editor_tool_select(params):
|
||||
return [
|
||||
"Clip Editor: Tweak",
|
||||
{"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": _template_items_clip_tool_tweak(params)},
|
||||
]
|
||||
|
||||
|
||||
def km_clip_editor_tool_select_box(params):
|
||||
return (
|
||||
"Clip Editor: Select Box",
|
||||
{"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*_template_items_clip_tool_mouse_selection(params, params.select_mouse == 'LEFTMOUSE'),
|
||||
*_template_items_tool_select_actions_simple(
|
||||
"clip.select_box", type=params.tool_mouse, value='CLICK_DRAG'),
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def km_clip_editor_tool_select_lasso(params):
|
||||
return (
|
||||
"Clip Editor: Select Lasso",
|
||||
{"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*_template_items_clip_tool_mouse_selection(params, params.select_mouse == 'LEFTMOUSE'),
|
||||
*_template_items_tool_select_actions_simple(
|
||||
"clip.select_lasso", type=params.tool_mouse, value='PRESS'),
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def km_clip_editor_tool_select_circle(params):
|
||||
return (
|
||||
"Clip Editor: Select Circle",
|
||||
{"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*_template_items_clip_tool_mouse_selection(params, params.select_mouse == 'LEFTMOUSE'),
|
||||
*_template_items_tool_select_actions_simple(
|
||||
"clip.select_circle", type=params.tool_mouse, value='PRESS',
|
||||
properties=[("wait_for_input", False)]),
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def km_clip_editor_tool_add_marker_tweak(params):
|
||||
return (
|
||||
"Clip Editor: Add Marker and Tweak",
|
||||
{"space_type": 'CLIP_EDITOR', "region_type": 'WINDOW'},
|
||||
{"items": [
|
||||
*_template_items_clip_tool_tweak(params),
|
||||
("clip.add_marker_slide", {"type": 'LEFTMOUSE', "value": 'PRESS'}, None),
|
||||
]
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Tool System (Node Editor)
|
||||
|
||||
@@ -8076,6 +8236,13 @@ def generate_keymaps(params=None):
|
||||
km_generic_tool_annotate_polygon(params),
|
||||
km_generic_tool_annotate_eraser(params),
|
||||
|
||||
km_generic_tool_mask_select(params),
|
||||
km_generic_tool_mask_select_box(params),
|
||||
km_generic_tool_mask_select_lasso(params),
|
||||
km_generic_tool_mask_select_circle(params),
|
||||
km_generic_tool_mask_add_vertex(params),
|
||||
km_generic_tool_mask_add_feather_vertex(params),
|
||||
|
||||
km_image_editor_tool_generic_sample(params),
|
||||
km_image_editor_tool_uv_cursor(params),
|
||||
*(km_image_editor_tool_uv_select(params, fallback=fallback) for fallback in (False, True)),
|
||||
@@ -8086,6 +8253,11 @@ def generate_keymaps(params=None):
|
||||
km_image_editor_tool_uv_sculpt_stroke(params),
|
||||
km_image_editor_tool_uv_move(params),
|
||||
km_image_editor_tool_uv_rotate(params),
|
||||
km_clip_editor_tool_select(params),
|
||||
km_clip_editor_tool_select_box(params),
|
||||
km_clip_editor_tool_select_lasso(params),
|
||||
km_clip_editor_tool_select_circle(params),
|
||||
km_clip_editor_tool_add_marker_tweak(params),
|
||||
km_image_editor_tool_uv_scale(params),
|
||||
*(km_node_editor_tool_select(params, fallback=fallback) for fallback in (False, True)),
|
||||
*(km_node_editor_tool_select_box(params, fallback=fallback) for fallback in (False, True)),
|
||||
|
@@ -17,6 +17,7 @@ _modules = [
|
||||
"file",
|
||||
"geometry_nodes",
|
||||
"image",
|
||||
"mask",
|
||||
"mesh",
|
||||
"node",
|
||||
"object",
|
||||
|
56
release/scripts/startup/bl_operators/mask.py
Normal file
56
release/scripts/startup/bl_operators/mask.py
Normal file
@@ -0,0 +1,56 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
# <pep8-80 compliant>
|
||||
|
||||
import bpy
|
||||
from bpy.types import Operator
|
||||
from bpy.props import EnumProperty
|
||||
|
||||
|
||||
class MASK_OT_draw_mask(Operator):
|
||||
"""Smart code to draw a mask"""
|
||||
bl_label = "Draw a mask"
|
||||
bl_idname = "mask.draw_mask"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if context.space_data.type == 'CLIP_EDITOR':
|
||||
clip = context.space_data.clip
|
||||
return clip
|
||||
else:
|
||||
return True
|
||||
|
||||
type: EnumProperty(
|
||||
name="Type",
|
||||
items=(
|
||||
('AUTO', "Auto", ""),
|
||||
('VECTOR', "Vector", ""),
|
||||
('ALIGNED', "Aligned Single", ""),
|
||||
('ALIGNED_DOUBLESIDE', "Aligned", ""),
|
||||
('FREE', "Free", ""),
|
||||
),
|
||||
)
|
||||
|
||||
def execute(self, context):
|
||||
return bpy.ops.mask.add_vertex_slide(
|
||||
MASK_OT_add_vertex={
|
||||
"type": self.type,
|
||||
}
|
||||
)
|
||||
|
||||
def invoke(self, context, _event):
|
||||
bpy.ops.mask.add_vertex_slide(
|
||||
'INVOKE_REGION_WIN',
|
||||
MASK_OT_add_vertex={
|
||||
"type": self.type,
|
||||
}
|
||||
)
|
||||
|
||||
# ignore return from operators above because they are 'RUNNING_MODAL',
|
||||
# and cause this one not to be freed. T24671.
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
classes = (
|
||||
MASK_OT_draw_mask,
|
||||
)
|
@@ -372,19 +372,10 @@ class AnnotationDataPanel:
|
||||
layout = self.layout
|
||||
layout.use_property_decorate = False
|
||||
|
||||
is_clip_editor = context.space_data.type == 'CLIP_EDITOR'
|
||||
|
||||
# Grease Pencil owner.
|
||||
gpd_owner = context.annotation_data_owner
|
||||
gpd = context.annotation_data
|
||||
|
||||
# Owner selector.
|
||||
if is_clip_editor:
|
||||
col = layout.column()
|
||||
col.label(text="Data Source:")
|
||||
row = col.row()
|
||||
row.prop(context.space_data, "annotation_source", expand=True)
|
||||
|
||||
# Only allow adding annotation ID if its owner exist
|
||||
if context.annotation_data_owner is None:
|
||||
row = layout.row()
|
||||
|
@@ -247,64 +247,6 @@ class MASK_PT_display:
|
||||
row.prop(space_data, "blend_factor", text="Blending Factor")
|
||||
|
||||
|
||||
class MASK_PT_transforms:
|
||||
# subclasses must define...
|
||||
# ~ bl_space_type = 'CLIP_EDITOR'
|
||||
# ~ bl_region_type = 'TOOLS'
|
||||
bl_label = "Transforms"
|
||||
bl_category = "Mask"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space_data = context.space_data
|
||||
return space_data.mask and space_data.mode == 'MASK'
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Transform:")
|
||||
col.operator("transform.translate")
|
||||
col.operator("transform.rotate")
|
||||
col.operator("transform.resize", text="Scale")
|
||||
col.operator("transform.transform", text="Scale Feather").mode = 'MASK_SHRINKFATTEN'
|
||||
|
||||
|
||||
class MASK_PT_tools:
|
||||
bl_label = "Mask Tools"
|
||||
bl_category = "Mask"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
space_data = context.space_data
|
||||
return space_data.mask and space_data.mode == 'MASK'
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Spline:")
|
||||
col.operator("mask.delete")
|
||||
col.operator("mask.cyclic_toggle")
|
||||
col.operator("mask.switch_direction")
|
||||
col.operator("mask.handle_type_set").type = 'VECTOR'
|
||||
col.operator("mask.feather_weight_clear")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Parenting:")
|
||||
row = col.row(align=True)
|
||||
row.operator("mask.parent_set", text="Parent")
|
||||
row.operator("mask.parent_clear", text="Clear")
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.label(text="Animation:")
|
||||
row = col.row(align=True)
|
||||
row.operator("mask.shape_key_insert", text="Insert Key")
|
||||
row.operator("mask.shape_key_clear", text="Clear Key")
|
||||
col.operator("mask.shape_key_feather_reset", text="Reset Feather Animation")
|
||||
col.operator("mask.shape_key_rekey", text="Re-Key Shape Points")
|
||||
|
||||
|
||||
class MASK_MT_mask(Menu):
|
||||
bl_label = "Mask"
|
||||
|
||||
|
@@ -8,10 +8,12 @@ from bpy.app.translations import (
|
||||
)
|
||||
from bl_ui.utils import PresetPanel
|
||||
from bl_ui.properties_grease_pencil_common import (
|
||||
AnnotationDrawingToolsPanel,
|
||||
AnnotationDataPanel,
|
||||
)
|
||||
|
||||
from bl_ui.space_toolsystem_common import (
|
||||
ToolActivePanelHelper,
|
||||
)
|
||||
|
||||
class CLIP_UL_tracking_objects(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, _icon,
|
||||
@@ -110,22 +112,98 @@ class CLIP_PT_clip_display(Panel):
|
||||
col.prop(clip, "display_aspect", text="Display Aspect Ratio")
|
||||
|
||||
|
||||
class CLIP_PT_active_tool(ToolActivePanelHelper, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Tool"
|
||||
|
||||
|
||||
class CLIP_HT_tool_header(Header):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOL_HEADER'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
sc = context.space_data
|
||||
|
||||
if sc.view == 'CLIP':
|
||||
|
||||
self.draw_tool_settings(context)
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
CLIP_HT_header.draw_xform_template(layout, context)
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
self.draw_mode_settings(context)
|
||||
|
||||
def draw_tool_settings(self, context):
|
||||
layout = self.layout
|
||||
# Active Tool
|
||||
# -----------
|
||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||
tool = ToolSelectPanelHelper.draw_active_tool_header(context, layout)
|
||||
tool_mode = context.mode if tool is None else tool.mode
|
||||
if tool_mode == 'TRACKING':
|
||||
clip = context.space_data.clip
|
||||
if clip:
|
||||
layout.separator()
|
||||
CLIP_PT_tracking_settings_presets.draw_menu(self.layout)
|
||||
|
||||
def draw_mode_settings(self, context):
|
||||
layout = self.layout
|
||||
|
||||
# Active Tool
|
||||
# -----------
|
||||
from bl_ui.space_toolsystem_common import ToolSelectPanelHelper
|
||||
tool = ToolSelectPanelHelper.tool_active_from_context(context)
|
||||
tool_mode = context.mode if tool is None else tool.mode
|
||||
clip = context.space_data.clip
|
||||
if clip:
|
||||
if tool_mode == 'TRACKING':
|
||||
settings = clip.tracking.settings
|
||||
layout.prop(settings, "speed", text="")
|
||||
|
||||
|
||||
|
||||
class CLIP_HT_header(Header):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
|
||||
@staticmethod
|
||||
def draw_xform_template(layout, context):
|
||||
sc = context.space_data
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
layout.prop(sc, "pivot_point", text="", icon_only=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "use_proportional_edit_mask", text="", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.use_proportional_edit_mask
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", text="", icon_only=True)
|
||||
|
||||
def _draw_tracking(self, context):
|
||||
layout = self.layout
|
||||
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
show_region_tool_header = sc.show_region_tool_header
|
||||
|
||||
CLIP_MT_tracking_editor_menus.draw_collapsible(context, layout)
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
if not show_region_tool_header:
|
||||
if sc.view == 'CLIP':
|
||||
CLIP_HT_header.draw_xform_template(layout, context)
|
||||
|
||||
row = layout.row()
|
||||
if sc.view == 'CLIP':
|
||||
row.template_ID(sc, "clip", open="clip.open")
|
||||
row = layout.row(align=True)
|
||||
row.popover(panel='CLIP_PT_solve_panel')
|
||||
row.operator("clip.solve_camera", text="", icon='PLAY')
|
||||
else:
|
||||
row = layout.row(align=True)
|
||||
props = row.operator("clip.refine_markers", text="", icon='TRACKING_REFINE_BACKWARDS')
|
||||
@@ -166,14 +244,15 @@ class CLIP_HT_header(Header):
|
||||
|
||||
if sc.view == 'CLIP':
|
||||
r = active_object.reconstruction
|
||||
|
||||
if r.is_valid and sc.view == 'CLIP':
|
||||
layout.label(text=iface_("Solve error: %.2f px") %
|
||||
(r.average_error),
|
||||
translate=False)
|
||||
|
||||
object_icon = 'CAMERA_DATA' if active_object.is_camera else 'OBJECT_DATA'
|
||||
|
||||
row = layout.row()
|
||||
row.prop(sc, "pivot_point", text="", icon_only=True)
|
||||
row.popover(panel='CLIP_PT_objects', text=active_object.name, icon=object_icon)
|
||||
row = layout.row(align=True)
|
||||
icon = 'LOCKED' if sc.lock_selection else 'UNLOCKED'
|
||||
row.operator("clip.lock_selection_toggle", icon=icon, text="", depress=sc.lock_selection)
|
||||
@@ -209,7 +288,6 @@ class CLIP_HT_header(Header):
|
||||
def _draw_masking(self, context):
|
||||
layout = self.layout
|
||||
|
||||
tool_settings = context.tool_settings
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
|
||||
@@ -217,24 +295,20 @@ class CLIP_HT_header(Header):
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
if not sc.show_region_tool_header:
|
||||
CLIP_HT_header.draw_xform_template(layout, context)
|
||||
|
||||
row = layout.row()
|
||||
row.template_ID(sc, "clip", open="clip.open")
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
if clip:
|
||||
|
||||
layout.prop(sc, "pivot_point", text="", icon_only=True)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "use_proportional_edit_mask", text="", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.use_proportional_edit_mask
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", text="", icon_only=True)
|
||||
|
||||
row = layout.row()
|
||||
row.template_ID(sc, "mask", new="mask.new")
|
||||
row.popover(panel='CLIP_PT_mask_display')
|
||||
row = layout.row()
|
||||
row.popover(panel='CLIP_PT_objects')
|
||||
row = layout.row(align=True)
|
||||
icon = 'LOCKED' if sc.lock_selection else 'UNLOCKED'
|
||||
row.operator("clip.lock_selection_toggle", icon=icon, text="", depress=sc.lock_selection)
|
||||
@@ -336,10 +410,10 @@ class CLIP_PT_reconstruction_panel:
|
||||
|
||||
class CLIP_PT_tools_clip(Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Clip"
|
||||
bl_translation_context = bpy.app.translations.contexts.id_movieclip
|
||||
bl_category = "Track"
|
||||
bl_category = "Footage"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -513,11 +587,19 @@ class CLIP_PT_tools_plane_tracking(CLIP_PT_tracking_panel, Panel):
|
||||
layout.operator("clip.create_plane_track")
|
||||
|
||||
|
||||
class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
|
||||
class CLIP_PT_solve_panel(Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Solve"
|
||||
bl_category = "Solve"
|
||||
|
||||
def draw(self, _context):
|
||||
pass
|
||||
|
||||
class CLIP_PT_tools_solve(Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Solve"
|
||||
bl_parent_id = 'CLIP_PT_solve_panel'
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -528,7 +610,7 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
|
||||
tracking = clip.tracking
|
||||
settings = tracking.settings
|
||||
tracking_object = tracking.objects.active
|
||||
camera = clip.tracking.camera
|
||||
camera = tracking.camera
|
||||
|
||||
col = layout.column()
|
||||
col.prop(settings, "use_tripod_solver", text="Tripod")
|
||||
@@ -556,17 +638,21 @@ class CLIP_PT_tools_solve(CLIP_PT_tracking_panel, Panel):
|
||||
col = layout.column(align=True)
|
||||
col.scale_y = 2.0
|
||||
|
||||
col.operator("clip.solve_camera",
|
||||
text="Solve Camera Motion" if tracking_object.is_camera
|
||||
else "Solve Object Motion")
|
||||
|
||||
|
||||
class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
|
||||
class CLIP_PT_cleanup(CLIP_PT_tracking_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Clean Up"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Solve"
|
||||
bl_category = "Reconstruction"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if CLIP_PT_clip_view_panel.poll(context):
|
||||
sc = context.space_data
|
||||
|
||||
return sc.mode == 'TRACKING' and sc.clip
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -577,20 +663,25 @@ class CLIP_PT_tools_cleanup(CLIP_PT_tracking_panel, Panel):
|
||||
settings = clip.tracking.settings
|
||||
|
||||
col = layout.column()
|
||||
col.prop(settings, "clean_frames", text="Frames")
|
||||
col.prop(settings, "clean_error", text="Error")
|
||||
col.prop(settings, "clean_action", text="Type")
|
||||
col.separator()
|
||||
col.operator("clip.clean_tracks")
|
||||
col.operator("clip.filter_tracks")
|
||||
|
||||
|
||||
class CLIP_PT_tools_geometry(CLIP_PT_tracking_panel, Panel):
|
||||
class CLIP_PT_geometry(CLIP_PT_tracking_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Geometry"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
bl_category = "Solve"
|
||||
bl_category = "Reconstruction"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if CLIP_PT_clip_view_panel.poll(context):
|
||||
sc = context.space_data
|
||||
|
||||
return sc.mode == 'TRACKING' and sc.clip
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, _context):
|
||||
layout = self.layout
|
||||
@@ -599,11 +690,20 @@ class CLIP_PT_tools_geometry(CLIP_PT_tracking_panel, Panel):
|
||||
layout.operator("clip.track_to_empty")
|
||||
|
||||
|
||||
class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, Panel):
|
||||
class CLIP_PT_orientation(CLIP_PT_reconstruction_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Orientation"
|
||||
bl_category = "Solve"
|
||||
bl_category = "Reconstruction"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
if CLIP_PT_clip_view_panel.poll(context):
|
||||
sc = context.space_data
|
||||
|
||||
return sc.mode == 'TRACKING' and sc.clip
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
@@ -611,7 +711,9 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, Panel):
|
||||
layout.use_property_decorate = False
|
||||
|
||||
sc = context.space_data
|
||||
settings = sc.clip.tracking.settings
|
||||
clip = sc.clip
|
||||
tracking_object = clip.tracking.objects.active
|
||||
settings = clip.tracking.settings
|
||||
|
||||
col = layout.column(align=True)
|
||||
|
||||
@@ -630,60 +732,29 @@ class CLIP_PT_tools_orientation(CLIP_PT_tracking_panel, Panel):
|
||||
col = layout.column()
|
||||
|
||||
row = col.row(align=True)
|
||||
row.operator("clip.set_scale")
|
||||
if tracking_object.is_camera:
|
||||
row.operator("clip.set_scale")
|
||||
col.prop(settings, "distance")
|
||||
else:
|
||||
row.operator("clip.set_solution_scale", text="Set Scale")
|
||||
col.prop(settings, "object_distance")
|
||||
|
||||
row.operator("clip.apply_solution_scale", text="Apply Scale")
|
||||
|
||||
col.prop(settings, "distance")
|
||||
|
||||
|
||||
class CLIP_PT_tools_object(CLIP_PT_reconstruction_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_label = "Object"
|
||||
bl_category = "Solve"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
sc = context.space_data
|
||||
if CLIP_PT_reconstruction_panel.poll(context) and sc.mode == 'TRACKING':
|
||||
clip = sc.clip
|
||||
|
||||
tracking_object = clip.tracking.objects.active
|
||||
|
||||
return not tracking_object.is_camera
|
||||
|
||||
return False
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
sc = context.space_data
|
||||
clip = sc.clip
|
||||
tracking_object = clip.tracking.objects.active
|
||||
settings = sc.clip.tracking.settings
|
||||
|
||||
col = layout.column()
|
||||
|
||||
col.prop(tracking_object, "scale")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.operator("clip.set_solution_scale", text="Set Scale")
|
||||
col.prop(settings, "object_distance")
|
||||
|
||||
|
||||
class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Track"
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Objects"
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
sc = context.space_data
|
||||
tracking = sc.clip.tracking
|
||||
tracking_object = sc.clip.tracking.objects.active
|
||||
|
||||
row = layout.row()
|
||||
row.template_list("CLIP_UL_tracking_objects", "", tracking, "objects",
|
||||
@@ -694,6 +765,10 @@ class CLIP_PT_objects(CLIP_PT_clip_view_panel, Panel):
|
||||
sub.operator("clip.tracking_object_new", icon='ADD', text="")
|
||||
sub.operator("clip.tracking_object_remove", icon='REMOVE', text="")
|
||||
|
||||
if not tracking_object.is_camera:
|
||||
row = layout.row()
|
||||
row.prop(tracking_object, "scale")
|
||||
|
||||
|
||||
class CLIP_PT_track(CLIP_PT_tracking_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
@@ -775,13 +850,20 @@ class CLIP_PT_plane_track(CLIP_PT_tracking_panel, Panel):
|
||||
clip = context.space_data.clip
|
||||
active_track = clip.tracking.plane_tracks.active
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
|
||||
col.separator()
|
||||
col.operator("clip.create_plane_track")
|
||||
|
||||
row = layout.row()
|
||||
if not active_track:
|
||||
layout.active = False
|
||||
layout.label(text="No active plane track")
|
||||
row.active = False
|
||||
row.label(text="No active plane track")
|
||||
return
|
||||
|
||||
layout.prop(active_track, "name")
|
||||
layout.prop(active_track, "use_auto_keying")
|
||||
layout.prop(active_track, "use_auto_keying", text="")
|
||||
row = layout.row()
|
||||
row.template_ID(
|
||||
active_track, "image", new="image.new", open="image.open")
|
||||
@@ -820,6 +902,34 @@ class CLIP_PT_track_settings(CLIP_PT_tracking_panel, Panel):
|
||||
col.prop(active, "use_normalization")
|
||||
|
||||
|
||||
class CLIP_PT_track_settings_tool(CLIP_PT_tracking_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'HEADER'
|
||||
bl_label = "Extras"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
clip = context.space_data.clip
|
||||
|
||||
return clip
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
clip = context.space_data.clip
|
||||
settings = clip.tracking.settings
|
||||
|
||||
col = layout.column(align=True)
|
||||
col.prop(settings, "default_correlation_min")
|
||||
col.prop(settings, "default_margin")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(settings, "default_frames_limit")
|
||||
col.prop(settings, "use_default_mask")
|
||||
|
||||
|
||||
class CLIP_PT_track_settings_extras(CLIP_PT_tracking_panel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
@@ -848,9 +958,8 @@ class CLIP_PT_track_settings_extras(CLIP_PT_tracking_panel, Panel):
|
||||
col.prop(active, "margin")
|
||||
|
||||
col = layout.column()
|
||||
col.prop(active, "use_mask")
|
||||
col.prop(active, "frames_limit")
|
||||
col.prop(settings, "speed")
|
||||
col.prop(active, "use_mask")
|
||||
|
||||
|
||||
class CLIP_PT_tracking_camera(Panel):
|
||||
@@ -891,7 +1000,6 @@ class CLIP_PT_tracking_lens(Panel):
|
||||
bl_category = "Track"
|
||||
bl_label = "Lens"
|
||||
bl_parent_id = 'CLIP_PT_tracking_camera'
|
||||
bl_options = {'DEFAULT_CLOSED'}
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -1165,45 +1273,35 @@ from bl_ui.properties_mask_common import (
|
||||
MASK_PT_spline,
|
||||
MASK_PT_point,
|
||||
MASK_PT_display,
|
||||
MASK_PT_transforms,
|
||||
MASK_PT_tools
|
||||
)
|
||||
|
||||
|
||||
class CLIP_PT_mask_layers(MASK_PT_layers, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Mask"
|
||||
bl_category = 'Mask'
|
||||
|
||||
|
||||
class CLIP_PT_mask_display(MASK_PT_display, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'HEADER'
|
||||
|
||||
|
||||
class CLIP_PT_active_mask_spline(MASK_PT_spline, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Mask"
|
||||
|
||||
bl_category = 'Mask'
|
||||
|
||||
class CLIP_PT_active_mask_point(MASK_PT_point, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Mask"
|
||||
bl_category = 'Mask'
|
||||
|
||||
|
||||
class CLIP_PT_mask(MASK_PT_mask, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_category = "Mask"
|
||||
|
||||
|
||||
class CLIP_PT_tools_mask_transforms(MASK_PT_transforms, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_category = "Mask"
|
||||
|
||||
|
||||
class CLIP_PT_tools_mask_tools(MASK_PT_tools, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_category = "Mask"
|
||||
bl_category = 'Mask'
|
||||
|
||||
|
||||
class CLIP_PT_mask_display(MASK_PT_display, Panel):
|
||||
@@ -1234,12 +1332,12 @@ class CLIP_PT_footage(CLIP_PT_clip_view_panel, Panel):
|
||||
col.template_movieclip_information(sc, "clip", sc.clip_user)
|
||||
|
||||
|
||||
class CLIP_PT_tools_scenesetup(Panel):
|
||||
class CLIP_PT_scenesetup(Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Scene Setup"
|
||||
bl_translation_context = bpy.app.translations.contexts.id_movieclip
|
||||
bl_category = "Solve"
|
||||
bl_category = "Reconstruction"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -1266,12 +1364,6 @@ class CLIP_PT_annotation(AnnotationDataPanel, CLIP_PT_clip_view_panel, Panel):
|
||||
# But, this should only be visible in "clip" view
|
||||
|
||||
|
||||
# Grease Pencil drawing tools
|
||||
class CLIP_PT_tools_grease_pencil_draw(AnnotationDrawingToolsPanel, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
|
||||
|
||||
class CLIP_MT_view_zoom(Menu):
|
||||
bl_label = "Fractional Zoom"
|
||||
|
||||
@@ -1302,6 +1394,7 @@ class CLIP_MT_view(Menu):
|
||||
if sc.view == 'CLIP':
|
||||
layout.prop(sc, "show_region_ui")
|
||||
layout.prop(sc, "show_region_toolbar")
|
||||
layout.prop(sc, "show_region_tool_header")
|
||||
layout.prop(sc, "show_region_hud")
|
||||
|
||||
layout.separator()
|
||||
@@ -1356,11 +1449,6 @@ class CLIP_MT_clip(Menu):
|
||||
layout.operator("clip.reload")
|
||||
layout.menu("CLIP_MT_proxy")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.set_viewport_background")
|
||||
layout.operator("clip.setup_tracking_scene")
|
||||
|
||||
|
||||
class CLIP_MT_proxy(Menu):
|
||||
bl_label = "Proxy"
|
||||
@@ -1479,9 +1567,6 @@ class CLIP_MT_track(Menu):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
clip = context.space_data.clip
|
||||
tracking_object = clip.tracking.objects.active
|
||||
|
||||
layout.menu("CLIP_MT_track_transform")
|
||||
layout.menu("CLIP_MT_track_motion")
|
||||
layout.menu("CLIP_MT_track_clear")
|
||||
@@ -1491,7 +1576,6 @@ class CLIP_MT_track(Menu):
|
||||
|
||||
layout.operator("clip.add_marker_move", text="Add Marker")
|
||||
layout.operator("clip.detect_features")
|
||||
layout.operator("clip.create_plane_track")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("clip.new_image_from_plane_marker")
|
||||
@@ -1499,13 +1583,6 @@ class CLIP_MT_track(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator(
|
||||
"clip.solve_camera",
|
||||
text=(
|
||||
"Solve Camera Motion" if tracking_object.is_camera else
|
||||
"Solve Object Motion"
|
||||
),
|
||||
)
|
||||
|
||||
layout.separator()
|
||||
|
||||
@@ -1540,8 +1617,10 @@ class CLIP_MT_track(Menu):
|
||||
class CLIP_MT_reconstruction(Menu):
|
||||
bl_label = "Reconstruction"
|
||||
|
||||
def draw(self, _context):
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
clip = context.space_data.clip
|
||||
tracking_object = clip.tracking.objects.active
|
||||
|
||||
layout.operator("clip.set_origin")
|
||||
layout.operator("clip.set_plane", text="Set Floor").plane = 'FLOOR'
|
||||
@@ -1550,6 +1629,24 @@ class CLIP_MT_reconstruction(Menu):
|
||||
layout.operator("clip.set_axis", text="Set X Axis").axis = 'X'
|
||||
layout.operator("clip.set_axis", text="Set Y Axis").axis = 'Y'
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator(
|
||||
"clip.solve_camera",
|
||||
text=(
|
||||
"Solve Camera Motion" if tracking_object.is_camera else
|
||||
"Solve Object Motion"
|
||||
),
|
||||
)
|
||||
layout.operator("clip.create_plane_track")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.set_viewport_background")
|
||||
layout.operator("clip.setup_tracking_scene")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.set_scale")
|
||||
layout.operator("clip.apply_solution_scale")
|
||||
|
||||
@@ -1610,10 +1707,6 @@ class CLIP_MT_tracking_context_menu(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.track_copy_color")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.copy_tracks", icon='COPYDOWN')
|
||||
layout.operator("clip.paste_tracks", icon='PASTEDOWN')
|
||||
|
||||
@@ -1640,10 +1733,22 @@ class CLIP_MT_tracking_context_menu(Menu):
|
||||
layout.operator("clip.join_tracks")
|
||||
layout.operator("clip.average_tracks")
|
||||
|
||||
layout.separator()
|
||||
layout.operator("clip.filter_tracks")
|
||||
layout.operator("clip.clean_tracks")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.delete_track")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.track_copy_color")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator("clip.create_plane_track")
|
||||
|
||||
elif mode == 'MASK':
|
||||
from .properties_mask_common import draw_mask_context_menu
|
||||
draw_mask_context_menu(layout, context)
|
||||
@@ -1927,32 +2032,31 @@ class CLIP_PT_gizmo_display(Panel):
|
||||
classes = (
|
||||
CLIP_UL_tracking_objects,
|
||||
CLIP_HT_header,
|
||||
CLIP_HT_tool_header,
|
||||
CLIP_PT_display,
|
||||
CLIP_PT_clip_display,
|
||||
CLIP_PT_marker_display,
|
||||
CLIP_MT_tracking_editor_menus,
|
||||
CLIP_MT_masking_editor_menus,
|
||||
CLIP_PT_active_tool,
|
||||
CLIP_PT_track,
|
||||
CLIP_PT_tools_clip,
|
||||
CLIP_PT_tools_marker,
|
||||
CLIP_PT_tracking_settings,
|
||||
CLIP_PT_tracking_settings_extras,
|
||||
CLIP_PT_tools_tracking,
|
||||
CLIP_PT_tools_plane_tracking,
|
||||
CLIP_PT_solve_panel,
|
||||
CLIP_PT_tools_solve,
|
||||
CLIP_PT_tools_cleanup,
|
||||
CLIP_PT_tools_geometry,
|
||||
CLIP_PT_tools_orientation,
|
||||
CLIP_PT_tools_object,
|
||||
CLIP_PT_objects,
|
||||
CLIP_PT_plane_track,
|
||||
CLIP_PT_track_settings_tool,
|
||||
CLIP_PT_track_settings,
|
||||
CLIP_PT_track_settings_extras,
|
||||
CLIP_PT_orientation,
|
||||
CLIP_PT_scenesetup,
|
||||
CLIP_PT_geometry,
|
||||
CLIP_PT_cleanup,
|
||||
CLIP_PT_tracking_camera,
|
||||
CLIP_PT_tracking_lens,
|
||||
CLIP_PT_marker,
|
||||
CLIP_PT_proxy,
|
||||
CLIP_PT_footage,
|
||||
CLIP_PT_tools_clip,
|
||||
CLIP_PT_stabilization,
|
||||
CLIP_PT_2d_cursor,
|
||||
CLIP_PT_mask,
|
||||
@@ -1960,11 +2064,10 @@ classes = (
|
||||
CLIP_PT_mask_display,
|
||||
CLIP_PT_active_mask_spline,
|
||||
CLIP_PT_active_mask_point,
|
||||
CLIP_PT_tools_mask_transforms,
|
||||
CLIP_PT_tools_mask_tools,
|
||||
CLIP_PT_tools_scenesetup,
|
||||
CLIP_PT_annotation,
|
||||
CLIP_PT_tools_grease_pencil_draw,
|
||||
CLIP_PT_camera_presets,
|
||||
CLIP_PT_track_color_presets,
|
||||
CLIP_PT_tracking_settings_presets,
|
||||
CLIP_MT_view_zoom,
|
||||
CLIP_MT_view,
|
||||
CLIP_MT_clip,
|
||||
@@ -1982,9 +2085,6 @@ classes = (
|
||||
CLIP_MT_select_grouped,
|
||||
CLIP_MT_tracking_context_menu,
|
||||
CLIP_MT_plane_track_image_context_menu,
|
||||
CLIP_PT_camera_presets,
|
||||
CLIP_PT_track_color_presets,
|
||||
CLIP_PT_tracking_settings_presets,
|
||||
CLIP_MT_stabilize_2d_context_menu,
|
||||
CLIP_MT_stabilize_2d_rotation_context_menu,
|
||||
CLIP_MT_pivot_pie,
|
||||
|
@@ -737,6 +737,16 @@ class IMAGE_HT_header(Header):
|
||||
if show_uvedit or show_maskedit:
|
||||
layout.prop(sima, "pivot_point", icon_only=True)
|
||||
|
||||
if show_maskedit:
|
||||
# Proportional Editing
|
||||
tool_settings = context.tool_settings
|
||||
row = layout.row(align=True)
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "use_proportional_edit_mask", text="", icon_only=True)
|
||||
sub = row.row(align=True)
|
||||
sub.active = tool_settings.use_proportional_edit_mask
|
||||
sub.prop(tool_settings, "proportional_edit_falloff", text="", icon_only=True)
|
||||
|
||||
if show_uvedit:
|
||||
tool_settings = context.tool_settings
|
||||
|
||||
@@ -772,6 +782,7 @@ class IMAGE_HT_header(Header):
|
||||
panel="IMAGE_PT_proportional_edit",
|
||||
)
|
||||
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
@@ -818,15 +829,18 @@ class IMAGE_HT_header(Header):
|
||||
|
||||
layout.template_ID(sima, "image", new="image.new", open="image.open")
|
||||
|
||||
if show_maskedit:
|
||||
row = layout.row()
|
||||
row.template_ID(sima, "mask", new="mask.new")
|
||||
|
||||
if not show_render:
|
||||
layout.prop(sima, "use_image_pin", text="", emboss=False)
|
||||
|
||||
layout.separator_spacer()
|
||||
|
||||
# Masking
|
||||
if show_maskedit:
|
||||
row = layout.row()
|
||||
row.template_ID(sima, "mask", new="mask.new")
|
||||
row.popover(panel='IMAGE_PT_mask_display')
|
||||
|
||||
# Gizmo toggle & popover.
|
||||
row = layout.row(align=True)
|
||||
row.prop(sima, "show_gizmo", icon='GIZMO', text="")
|
||||
|
@@ -462,6 +462,17 @@ class ToolSelectPanelHelper:
|
||||
if tool is not None:
|
||||
tool.refresh_from_context()
|
||||
return tool
|
||||
elif space_type == 'CLIP_EDITOR':
|
||||
space_data = context.space_data
|
||||
if mode is None:
|
||||
if space_data is None:
|
||||
mode = 'TRACKING'
|
||||
else:
|
||||
mode = space_data.mode
|
||||
tool = context.workspace.tools.from_space_clip_mode(mode, create=create)
|
||||
if tool is not None:
|
||||
tool.refresh_from_context()
|
||||
return tool
|
||||
elif space_type == 'NODE_EDITOR':
|
||||
space_data = context.space_data
|
||||
tool = context.workspace.tools.from_space_node(create=create)
|
||||
@@ -744,6 +755,10 @@ class ToolSelectPanelHelper:
|
||||
if space_data is None:
|
||||
space_data = context.space_data
|
||||
return space_type, space_data.mode
|
||||
elif space_type == 'CLIP_EDITOR':
|
||||
if space_data is None:
|
||||
space_data = context.space_data
|
||||
return space_type, space_data.mode
|
||||
elif space_type == 'NODE_EDITOR':
|
||||
return space_type, None
|
||||
elif space_type == 'SEQUENCE_EDITOR':
|
||||
|
@@ -175,6 +175,9 @@ class _defs_annotate:
|
||||
elif space_type in {'IMAGE_EDITOR', 'NODE_EDITOR', 'SEQUENCE_EDITOR', 'CLIP_EDITOR'}:
|
||||
row = layout.row(align=True)
|
||||
row.prop(tool_settings, "annotation_stroke_placement_view2d", text="Placement")
|
||||
if (space_type == 'CLIP_EDITOR') and (tool_settings.annotation_stroke_placement_view2d == 'IMAGE'):
|
||||
row = layout.row(align=True)
|
||||
row.prop(context.space_data, "annotation_source", text="Data Source", expand=True)
|
||||
|
||||
if tool.idname == "builtin.annotate_line":
|
||||
props = tool.operator_properties("gpencil.annotate")
|
||||
@@ -2444,6 +2447,219 @@ class _defs_gpencil_vertex:
|
||||
)
|
||||
|
||||
|
||||
class _defs_clip_select:
|
||||
|
||||
@ToolDef.from_fn
|
||||
def select():
|
||||
return dict(
|
||||
idname="builtin.select",
|
||||
label="Tweak",
|
||||
icon="ops.generic.select",
|
||||
widget=None,
|
||||
keymap="Clip Editor: Tweak",
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def box():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("clip.select_box")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
return dict(
|
||||
idname="builtin.select_box",
|
||||
label="Select Box",
|
||||
icon="ops.generic.select_box",
|
||||
widget=None,
|
||||
keymap="Clip Editor: Select Box",
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def lasso():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("clip.select_lasso")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
return dict(
|
||||
idname="builtin.select_lasso",
|
||||
label="Select Lasso",
|
||||
icon="ops.generic.select_lasso",
|
||||
widget=None,
|
||||
keymap="Clip Editor: Select Lasso",
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def circle():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("clip.select_circle")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
layout.prop(props, "radius")
|
||||
|
||||
def draw_cursor(_context, tool, xy):
|
||||
from gpu_extras.presets import draw_circle_2d
|
||||
props = tool.operator_properties("clip.select_circle")
|
||||
radius = props.radius
|
||||
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||
|
||||
return dict(
|
||||
idname="builtin.select_circle",
|
||||
label="Select Circle",
|
||||
icon="ops.generic.select_circle",
|
||||
widget=None,
|
||||
keymap="Clip Editor: Select Circle",
|
||||
draw_settings=draw_settings,
|
||||
draw_cursor=draw_cursor,
|
||||
)
|
||||
|
||||
|
||||
class _defs_clip_tracking_tools:
|
||||
|
||||
@ToolDef.from_fn
|
||||
def add_marker_tweak():
|
||||
def draw_settings(_context, layout, tool):
|
||||
clip = _context.space_data.clip
|
||||
if clip:
|
||||
settings = clip.tracking.settings
|
||||
# layout.use_property_split = True
|
||||
row = layout.row(align=True)
|
||||
row.prop(settings, "default_pattern_size", text="")
|
||||
row.prop(settings, "default_search_size", text="")
|
||||
row = layout.row()
|
||||
row.ui_units_x = 5
|
||||
row.prop(settings, "default_motion_model", text="")
|
||||
row = layout.row()
|
||||
row.ui_units_x = 5
|
||||
row.prop(settings, "default_pattern_match", text="")
|
||||
row = layout.row()
|
||||
row.prop(settings, "use_default_brute")
|
||||
row.prop(settings, "use_default_normalization")
|
||||
row = layout.row(align=True)
|
||||
row.prop(settings, "use_default_red_channel", text="R", toggle=True)
|
||||
row.prop(settings, "use_default_green_channel", text="G", toggle=True)
|
||||
row.prop(settings, "use_default_blue_channel", text="B", toggle=True)
|
||||
row = layout.row()
|
||||
row.prop(settings, "default_weight")
|
||||
row.popover(panel="CLIP_PT_track_settings_tool")
|
||||
|
||||
return dict(
|
||||
idname="builtin.add_marker_tweak",
|
||||
label="Add Marker and Tweak",
|
||||
icon="ops.generic.select",
|
||||
cursor='CROSSHAIR',
|
||||
widget=None,
|
||||
draw_settings=draw_settings,
|
||||
keymap="Clip Editor: Add Marker and Tweak"
|
||||
)
|
||||
|
||||
|
||||
class _defs_mask_select:
|
||||
|
||||
@ToolDef.from_fn
|
||||
def select():
|
||||
return dict(
|
||||
idname="builtin.select",
|
||||
label="Tweak",
|
||||
icon="ops.generic.select",
|
||||
widget=None,
|
||||
keymap="Mask Editing: Select Box",
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def box():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("mask.select_box")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
return dict(
|
||||
idname="builtin.select_box",
|
||||
label="Select Box",
|
||||
icon="ops.generic.select_box",
|
||||
widget=None,
|
||||
keymap="Mask Editing: Select Box",
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def lasso():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("mask.select_lasso")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
return dict(
|
||||
idname="builtin.select_lasso",
|
||||
label="Select Lasso",
|
||||
icon="ops.generic.select_lasso",
|
||||
widget=None,
|
||||
keymap="Mask Editing: Select Lasso",
|
||||
draw_settings=draw_settings,
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def circle():
|
||||
def draw_settings(_context, layout, tool):
|
||||
props = tool.operator_properties("mask.select_circle")
|
||||
row = layout.row()
|
||||
row.use_property_split = False
|
||||
row.prop(props, "mode", text="", expand=True, icon_only=True)
|
||||
layout.prop(props, "radius")
|
||||
|
||||
def draw_cursor(_context, tool, xy):
|
||||
from gpu_extras.presets import draw_circle_2d
|
||||
props = tool.operator_properties("mask.select_circle")
|
||||
radius = props.radius
|
||||
draw_circle_2d(xy, (1.0,) * 4, radius, segments=32)
|
||||
|
||||
return dict(
|
||||
idname="builtin.select_circle",
|
||||
label="Select Circle",
|
||||
icon="ops.generic.select_circle",
|
||||
widget=None,
|
||||
keymap="Mask Editing: Select Circle",
|
||||
draw_settings=draw_settings,
|
||||
draw_cursor=draw_cursor,
|
||||
)
|
||||
|
||||
|
||||
class _defs_mask_tools:
|
||||
@ToolDef.from_fn
|
||||
def add_vertex_slide():
|
||||
def draw_settings(_context, layout, tool):
|
||||
tool_settings = _context.tool_settings
|
||||
props = tool.operator_properties("mask.draw_mask")
|
||||
row = layout.row()
|
||||
row.label(text="Mask Settings")
|
||||
row.prop(props, "type")
|
||||
|
||||
return dict(
|
||||
idname="builtin.draw_mask",
|
||||
label="Draw a Mask",
|
||||
icon="ops.curve.extrude_move",
|
||||
widget=None,
|
||||
draw_settings=draw_settings,
|
||||
keymap="Mask Editing: Add Vertex and Slide"
|
||||
)
|
||||
|
||||
@ToolDef.from_fn
|
||||
def add_feather_vertex_slide():
|
||||
def draw_settings(_context, layout, tool):
|
||||
row = layout.row()
|
||||
row.label(text="Slide / Feather")
|
||||
return dict(
|
||||
idname="builtin.add_feather_vertex_slide",
|
||||
label="Slide Mask / Add a Feather Vertex",
|
||||
icon="ops.curve.radius",
|
||||
widget=None,
|
||||
keymap="Mask Editing: Add Feather Vertex and Slide"
|
||||
)
|
||||
|
||||
|
||||
class _defs_node_select:
|
||||
|
||||
@ToolDef.from_fn
|
||||
@@ -2687,7 +2903,7 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
_defs_image_uv_transform.transform,
|
||||
)
|
||||
|
||||
_tools_select = (
|
||||
_tools_select_uv = (
|
||||
(
|
||||
_defs_image_uv_select.select,
|
||||
_defs_image_uv_select.box,
|
||||
@@ -2696,6 +2912,15 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
),
|
||||
)
|
||||
|
||||
_tools_select_mask = (
|
||||
(
|
||||
_defs_mask_select.select,
|
||||
_defs_mask_select.box,
|
||||
_defs_mask_select.lasso,
|
||||
_defs_mask_select.circle,
|
||||
),
|
||||
)
|
||||
|
||||
_tools_annotate = (
|
||||
(
|
||||
_defs_annotate.scribble,
|
||||
@@ -2717,7 +2942,7 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
*_tools_annotate,
|
||||
],
|
||||
'UV': [
|
||||
*_tools_select,
|
||||
*_tools_select_uv,
|
||||
_defs_image_generic.cursor,
|
||||
None,
|
||||
*_tools_transform,
|
||||
@@ -2733,7 +2958,12 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
),
|
||||
],
|
||||
'MASK': [
|
||||
_defs_mask_tools.add_vertex_slide,
|
||||
_defs_mask_tools.add_feather_vertex_slide,
|
||||
None,
|
||||
*_tools_select_mask,
|
||||
None,
|
||||
*_tools_annotate,
|
||||
],
|
||||
'PAINT': [
|
||||
_defs_texture_paint.generate_from_brushes,
|
||||
@@ -2743,6 +2973,86 @@ class IMAGE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
}
|
||||
|
||||
|
||||
class CLIP_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
bl_space_type = 'CLIP_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
bl_label = "Tools" # not visible
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
# Satisfy the 'ToolSelectPanelHelper' API.
|
||||
keymap_prefix = "Clip Editor Tool:"
|
||||
|
||||
# Default group to use as a fallback.
|
||||
tool_fallback_id = "builtin.select_box"
|
||||
|
||||
@classmethod
|
||||
def tools_from_context(cls, context, mode=None):
|
||||
if mode is None:
|
||||
if context.space_data is None:
|
||||
mode = 'TRACKING'
|
||||
else:
|
||||
mode = context.space_data.mode
|
||||
for tools in (cls._tools[None], cls._tools.get(mode, ())):
|
||||
for item in tools:
|
||||
if not (type(item) is ToolDef) and callable(item):
|
||||
yield from item(context)
|
||||
else:
|
||||
yield item
|
||||
|
||||
@classmethod
|
||||
def tools_all(cls):
|
||||
yield from cls._tools.items()
|
||||
|
||||
_tools_clip_select = (
|
||||
(
|
||||
_defs_clip_select.select,
|
||||
_defs_clip_select.box,
|
||||
_defs_clip_select.lasso,
|
||||
_defs_clip_select.circle,
|
||||
),
|
||||
)
|
||||
_tools_mask_select = (
|
||||
(
|
||||
_defs_mask_select.select,
|
||||
_defs_mask_select.box,
|
||||
_defs_mask_select.lasso,
|
||||
_defs_mask_select.circle,
|
||||
),
|
||||
)
|
||||
|
||||
_tools_annotate = (
|
||||
(
|
||||
_defs_annotate.scribble,
|
||||
_defs_annotate.line,
|
||||
_defs_annotate.poly,
|
||||
_defs_annotate.eraser,
|
||||
),
|
||||
)
|
||||
|
||||
_tools = {
|
||||
None: [
|
||||
None,
|
||||
],
|
||||
'TRACKING': [
|
||||
_defs_clip_tracking_tools.add_marker_tweak,
|
||||
None,
|
||||
*_tools_clip_select,
|
||||
None,
|
||||
*_tools_annotate,
|
||||
None,
|
||||
],
|
||||
'MASK': [
|
||||
_defs_mask_tools.add_vertex_slide,
|
||||
_defs_mask_tools.add_feather_vertex_slide,
|
||||
None,
|
||||
*_tools_mask_select,
|
||||
None,
|
||||
*_tools_annotate,
|
||||
None
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
class NODE_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
bl_space_type = 'NODE_EDITOR'
|
||||
bl_region_type = 'TOOLS'
|
||||
@@ -3264,6 +3574,7 @@ class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||
classes = (
|
||||
IMAGE_PT_tools_active,
|
||||
NODE_PT_tools_active,
|
||||
CLIP_PT_tools_active,
|
||||
VIEW3D_PT_tools_active,
|
||||
SEQUENCER_PT_tools_active,
|
||||
)
|
||||
|
@@ -622,16 +622,6 @@ static void do_versions_remove_regions_by_type(ListBase *regionbase, int regiont
|
||||
}
|
||||
}
|
||||
|
||||
static ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
LISTBASE_FOREACH (ARegion *, region, regionbase) {
|
||||
if (region->regiontype == regiontype) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static ARegion *do_versions_find_region(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
ARegion *region = do_versions_find_region_or_null(regionbase, regiontype);
|
||||
|
@@ -3732,5 +3732,33 @@ void blo_do_versions_300(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
image->seam_margin = 8;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) {
|
||||
LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) {
|
||||
LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) {
|
||||
if (sl->spacetype != SPACE_CLIP) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SpaceClip *space_clip = (SpaceClip *)sl;
|
||||
ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase :
|
||||
&sl->regionbase;
|
||||
|
||||
ARegion *new_tool_header = do_versions_add_region_if_not_found(
|
||||
regionbase, RGN_TYPE_TOOL_HEADER, "tool header", RGN_TYPE_HEADER);
|
||||
|
||||
if (new_tool_header != NULL) {
|
||||
new_tool_header->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM :
|
||||
RGN_ALIGN_TOP;
|
||||
|
||||
if (space_clip->view != SC_VIEW_CLIP) {
|
||||
new_tool_header->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -29,6 +29,16 @@
|
||||
using blender::Map;
|
||||
using blender::StringRef;
|
||||
|
||||
ARegion *do_versions_find_region_or_null(ListBase *regionbase, int regiontype)
|
||||
{
|
||||
LISTBASE_FOREACH (ARegion *, region, regionbase) {
|
||||
if (region->regiontype == regiontype) {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ARegion *do_versions_add_region_if_not_found(ListBase *regionbase,
|
||||
int region_type,
|
||||
const char *name,
|
||||
|
@@ -19,6 +19,8 @@ struct bNodeTree;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct ARegion *do_versions_find_region_or_null(struct ListBase *regionbase, int regiontype);
|
||||
|
||||
struct ARegion *do_versions_add_region_if_not_found(struct ListBase *regionbase,
|
||||
int region_type,
|
||||
const char *name,
|
||||
|
@@ -218,6 +218,9 @@ static void blo_update_defaults_screen(bScreen *screen,
|
||||
sl->spacetype == SPACE_SEQ) {
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
else if ((sl->spacetype == SPACE_CLIP) && ((SpaceClip *)sl)->view != SC_VIEW_CLIP) {
|
||||
region->flag |= RGN_FLAG_HIDDEN;
|
||||
}
|
||||
else {
|
||||
region->flag &= ~(RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER);
|
||||
}
|
||||
|
@@ -42,8 +42,10 @@ static void setup_vertex_point(Mask *mask,
|
||||
const float u,
|
||||
const float ctime,
|
||||
const MaskSplinePoint *reference_point,
|
||||
const bool reference_adjacent)
|
||||
const bool reference_adjacent,
|
||||
int handle_type)
|
||||
{
|
||||
reference_point = NULL;
|
||||
const MaskSplinePoint *reference_parent_point = NULL;
|
||||
BezTriple *bezt;
|
||||
float co[3];
|
||||
@@ -54,7 +56,7 @@ static void setup_vertex_point(Mask *mask,
|
||||
/* point coordinate */
|
||||
bezt = &new_point->bezt;
|
||||
|
||||
bezt->h1 = bezt->h2 = HD_ALIGN;
|
||||
bezt->h1 = bezt->h2 = handle_type;
|
||||
|
||||
if (reference_point) {
|
||||
if (reference_point->bezt.h1 == HD_VECT && reference_point->bezt.h2 == HD_VECT) {
|
||||
@@ -119,14 +121,14 @@ static void setup_vertex_point(Mask *mask,
|
||||
}
|
||||
|
||||
/* handle type */
|
||||
char handle_type = 0;
|
||||
char handle_type_referenced = 0;
|
||||
if (prev_point) {
|
||||
handle_type = prev_point->bezt.h2;
|
||||
handle_type_referenced = prev_point->bezt.h2;
|
||||
}
|
||||
if (next_point) {
|
||||
handle_type = MAX2(next_point->bezt.h2, handle_type);
|
||||
handle_type_referenced = MAX2(next_point->bezt.h2, handle_type_referenced);
|
||||
}
|
||||
bezt->h1 = bezt->h2 = handle_type;
|
||||
bezt->h1 = bezt->h2 = handle_type_referenced;
|
||||
|
||||
/* parent */
|
||||
reference_parent_point = close_point;
|
||||
@@ -235,7 +237,7 @@ static void mask_spline_add_point_at_index(MaskSpline *spline, int point_index)
|
||||
spline->tot_point++;
|
||||
}
|
||||
|
||||
static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2])
|
||||
static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2], int handle_type)
|
||||
{
|
||||
MaskLayer *mask_layer;
|
||||
MaskSpline *spline;
|
||||
@@ -269,7 +271,7 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2
|
||||
|
||||
new_point = &spline->points[point_index + 1];
|
||||
|
||||
setup_vertex_point(mask, spline, new_point, co, u, ctime, NULL, true);
|
||||
setup_vertex_point(mask, spline, new_point, co, u, ctime, NULL, true, handle_type);
|
||||
|
||||
/* TODO: we could pass the spline! */
|
||||
BKE_mask_layer_shape_changed_add(mask_layer,
|
||||
@@ -289,10 +291,8 @@ static bool add_vertex_subdivide(const bContext *C, Mask *mask, const float co[2
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool add_vertex_extrude(const bContext *C,
|
||||
Mask *mask,
|
||||
MaskLayer *mask_layer,
|
||||
const float co[2])
|
||||
static bool add_vertex_extrude(
|
||||
const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2], int handle_type)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const float ctime = scene->r.cfra;
|
||||
@@ -375,7 +375,7 @@ static bool add_vertex_extrude(const bContext *C,
|
||||
|
||||
mask_layer->act_point = new_point;
|
||||
|
||||
setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false);
|
||||
setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false, handle_type);
|
||||
|
||||
if (mask_layer->splines_shapes.first) {
|
||||
point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
||||
@@ -391,7 +391,8 @@ static bool add_vertex_extrude(const bContext *C,
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2])
|
||||
static bool add_vertex_new(
|
||||
const bContext *C, Mask *mask, MaskLayer *mask_layer, const float co[2], int handle_type)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const float ctime = scene->r.cfra;
|
||||
@@ -414,7 +415,7 @@ static bool add_vertex_new(const bContext *C, Mask *mask, MaskLayer *mask_layer,
|
||||
|
||||
mask_layer->act_point = new_point;
|
||||
|
||||
setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false);
|
||||
setup_vertex_point(mask, spline, new_point, co, 0.5f, ctime, ref_point, false, handle_type);
|
||||
|
||||
{
|
||||
int point_index = (((int)(new_point - spline->points) + 0) % spline->tot_point);
|
||||
@@ -512,6 +513,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
MaskViewLockState lock_state;
|
||||
ED_mask_view_lock_state_store(C, &lock_state);
|
||||
const int handle_type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
if (mask == NULL) {
|
||||
@@ -528,6 +530,40 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
float co[2];
|
||||
RNA_float_get_array(op->ptr, "location", co);
|
||||
|
||||
/* TODO(sergey): This is to get a quick proof-of-concept behavior fer the "Draw a Mask" tool.
|
||||
* The idea is to add new vertex unless clicking on an existing one. When clicking on the
|
||||
* existing one select it, and let it to be slid.
|
||||
* For the final implementation we'd either need to introduce new operator, or a new property
|
||||
* to enable this behavior. */
|
||||
if (mask_layer != NULL) {
|
||||
MaskMouseSelectProperties properties;
|
||||
properties.extend = false;
|
||||
properties.deselect = true;
|
||||
properties.deselect_all = false;
|
||||
properties.toggle = false;
|
||||
|
||||
if (ED_mask_select_mouse_pick(C, co, &properties)) {
|
||||
ED_mask_view_lock_state_restore_no_jump(C, &lock_state);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
MaskLayer *mask_layer_under_mouse;
|
||||
MaskSpline *spline_under_mouse;
|
||||
if (ED_mask_spline_under_mouse_get(
|
||||
C, mask, co, &mask_layer_under_mouse, &spline_under_mouse)) {
|
||||
if (mask_layer_under_mouse == mask_layer) {
|
||||
mask_layer->act_spline = spline_under_mouse;
|
||||
|
||||
DEG_id_tag_update(&mask->id, ID_RECALC_SELECT);
|
||||
WM_event_add_notifier(C, NC_MASK | ND_SELECT, mask);
|
||||
|
||||
ED_mask_view_lock_state_restore_no_jump(C, &lock_state);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: having an active point but no active spline is possible, why? */
|
||||
if (mask_layer && mask_layer->act_spline && mask_layer->act_point &&
|
||||
MASKPOINT_ISSEL_ANY(mask_layer->act_point)) {
|
||||
@@ -538,15 +574,15 @@ static int add_vertex_exec(bContext *C, wmOperator *op)
|
||||
return cyclic_result;
|
||||
}
|
||||
|
||||
if (!add_vertex_subdivide(C, mask, co)) {
|
||||
if (!add_vertex_extrude(C, mask, mask_layer, co)) {
|
||||
if (!add_vertex_subdivide(C, mask, co, handle_type)) {
|
||||
if (!add_vertex_extrude(C, mask, mask_layer, co, handle_type)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!add_vertex_subdivide(C, mask, co)) {
|
||||
if (!add_vertex_new(C, mask, mask_layer, co)) {
|
||||
if (!add_vertex_subdivide(C, mask, co, handle_type)) {
|
||||
if (!add_vertex_new(C, mask, mask_layer, co, handle_type)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
@@ -575,6 +611,15 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
|
||||
void MASK_OT_add_vertex(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem editcurve_handle_type_items[] = {
|
||||
{HD_AUTO, "AUTO", 0, "Auto", ""},
|
||||
{HD_VECT, "VECTOR", 0, "Vector", ""},
|
||||
{HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
|
||||
{HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
|
||||
{HD_FREE, "FREE", 0, "Free", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Add Vertex";
|
||||
ot->description = "Add vertex to active spline";
|
||||
@@ -599,6 +644,8 @@ void MASK_OT_add_vertex(wmOperatorType *ot)
|
||||
"Location of vertex in normalized space",
|
||||
-1.0f,
|
||||
1.0f);
|
||||
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", editcurve_handle_type_items, 1, "Type", "Spline type");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@@ -29,6 +29,11 @@ struct Mask *ED_mask_new(struct bContext *C, const char *name);
|
||||
* Get active layer. Will create mask/layer to be sure there's an active layer.
|
||||
*/
|
||||
struct MaskLayer *ED_mask_layer_ensure(struct bContext *C, bool *r_added_mask);
|
||||
bool ED_mask_spline_under_mouse_get(const struct bContext *C,
|
||||
struct Mask *mask,
|
||||
const float co[2],
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_mask_spline);
|
||||
|
||||
void MASK_OT_new(struct wmOperatorType *ot);
|
||||
void MASK_OT_layer_new(struct wmOperatorType *ot);
|
||||
@@ -84,6 +89,24 @@ void ED_mask_layer_select_set(struct MaskLayer *mask_layer, bool do_select);
|
||||
void ED_mask_select_toggle_all(struct Mask *mask, int action);
|
||||
void ED_mask_select_flush_all(struct Mask *mask);
|
||||
|
||||
typedef struct MaskMouseSelectProperties {
|
||||
/* Extend selection instead of deselecting everything first. */
|
||||
bool extend;
|
||||
|
||||
/* Remove from selection. */
|
||||
bool deselect;
|
||||
|
||||
/* Deselect all when nothing under the cursor. */
|
||||
bool deselect_all;
|
||||
|
||||
/* Toggle the selection. */
|
||||
bool toggle;
|
||||
} MaskMouseSelectProperties;
|
||||
|
||||
bool ED_mask_select_mouse_pick(struct bContext *C,
|
||||
float co[2],
|
||||
const MaskMouseSelectProperties *properties);
|
||||
|
||||
/* mask_editor.c */
|
||||
|
||||
/* Generalized solution for preserving editor viewport when making changes while lock-to-selection
|
||||
|
@@ -243,11 +243,11 @@ static void mask_point_undistort_pos(SpaceClip *sc, float r_co[2], const float c
|
||||
BKE_mask_coord_from_movieclip(sc->clip, &sc->user, r_co, r_co);
|
||||
}
|
||||
|
||||
static bool spline_under_mouse_get(const bContext *C,
|
||||
Mask *mask_orig,
|
||||
const float co[2],
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_mask_spline)
|
||||
bool ED_mask_spline_under_mouse_get(const bContext *C,
|
||||
Mask *mask_orig,
|
||||
const float co[2],
|
||||
MaskLayer **r_mask_layer,
|
||||
MaskSpline **r_mask_spline)
|
||||
{
|
||||
const float threshold = 19.0f;
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
@@ -468,7 +468,7 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
|
||||
}
|
||||
|
||||
if (action == SLIDE_ACTION_NONE) {
|
||||
if (spline_under_mouse_get(C, mask, co, &mask_layer, &spline)) {
|
||||
if (ED_mask_spline_under_mouse_get(C, mask, co, &mask_layer, &spline)) {
|
||||
action = SLIDE_ACTION_SPLINE;
|
||||
point = NULL;
|
||||
}
|
||||
@@ -486,7 +486,9 @@ static void *slide_point_customdata(bContext *C, wmOperator *op, const wmEvent *
|
||||
customdata->action = action;
|
||||
customdata->uw = uw;
|
||||
|
||||
customdata->is_sliding_new_point = RNA_boolean_get(op->ptr, "is_new_point");
|
||||
if (point != NULL) {
|
||||
customdata->is_sliding_new_point = RNA_boolean_get(op->ptr, "is_new_point");
|
||||
}
|
||||
|
||||
if (customdata->action != SLIDE_ACTION_SPLINE) {
|
||||
customdata->old_h1 = point->bezt.h1;
|
||||
|
@@ -235,41 +235,37 @@ void MASK_OT_select_all(wmOperatorType *ot)
|
||||
/** \name Select (Cursor Pick) Operator
|
||||
* \{ */
|
||||
|
||||
static int select_exec(bContext *C, wmOperator *op)
|
||||
bool ED_mask_select_mouse_pick(bContext *C,
|
||||
float co[2],
|
||||
const MaskMouseSelectProperties *properties)
|
||||
{
|
||||
Mask *mask = CTX_data_edit_mask(C);
|
||||
MaskLayer *mask_layer;
|
||||
MaskSpline *spline;
|
||||
MaskSplinePoint *point = NULL;
|
||||
float co[2];
|
||||
bool extend = RNA_boolean_get(op->ptr, "extend");
|
||||
bool deselect = RNA_boolean_get(op->ptr, "deselect");
|
||||
bool toggle = RNA_boolean_get(op->ptr, "toggle");
|
||||
const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
|
||||
eMaskWhichHandle which_handle;
|
||||
const float threshold = 19;
|
||||
|
||||
MaskViewLockState lock_state;
|
||||
ED_mask_view_lock_state_store(C, &lock_state);
|
||||
|
||||
RNA_float_get_array(op->ptr, "location", co);
|
||||
|
||||
point = ED_mask_point_find_nearest(
|
||||
C, mask, co, threshold, &mask_layer, &spline, &which_handle, NULL);
|
||||
|
||||
if (extend == false && deselect == false && toggle == false) {
|
||||
if (properties->extend == false && properties->deselect == false &&
|
||||
properties->toggle == false) {
|
||||
ED_mask_select_toggle_all(mask, SEL_DESELECT);
|
||||
}
|
||||
|
||||
if (point) {
|
||||
if (which_handle != MASK_WHICH_HANDLE_NONE) {
|
||||
if (extend) {
|
||||
if (properties->extend) {
|
||||
mask_layer->act_spline = spline;
|
||||
mask_layer->act_point = point;
|
||||
|
||||
BKE_mask_point_select_set_handle(point, which_handle, true);
|
||||
}
|
||||
else if (deselect) {
|
||||
else if (properties->deselect) {
|
||||
BKE_mask_point_select_set_handle(point, which_handle, false);
|
||||
}
|
||||
else {
|
||||
@@ -279,19 +275,19 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
if (!MASKPOINT_ISSEL_HANDLE(point, which_handle)) {
|
||||
BKE_mask_point_select_set_handle(point, which_handle, true);
|
||||
}
|
||||
else if (toggle) {
|
||||
else if (properties->toggle) {
|
||||
BKE_mask_point_select_set_handle(point, which_handle, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (extend) {
|
||||
if (properties->extend) {
|
||||
mask_layer->act_spline = spline;
|
||||
mask_layer->act_point = point;
|
||||
|
||||
BKE_mask_point_select_set(point, true);
|
||||
}
|
||||
else if (deselect) {
|
||||
else if (properties->deselect) {
|
||||
BKE_mask_point_select_set(point, false);
|
||||
}
|
||||
else {
|
||||
@@ -301,7 +297,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
if (!MASKPOINT_ISSEL_ANY(point)) {
|
||||
BKE_mask_point_select_set(point, true);
|
||||
}
|
||||
else if (toggle) {
|
||||
else if (properties->toggle) {
|
||||
BKE_mask_point_select_set(point, false);
|
||||
}
|
||||
}
|
||||
@@ -325,7 +321,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
if (ED_mask_feather_find_nearest(
|
||||
C, mask, co, threshold, &mask_layer, &spline, &point, &uw, NULL)) {
|
||||
|
||||
if (extend) {
|
||||
if (properties->extend) {
|
||||
mask_layer->act_spline = spline;
|
||||
mask_layer->act_point = point;
|
||||
|
||||
@@ -333,7 +329,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
uw->flag |= SELECT;
|
||||
}
|
||||
}
|
||||
else if (deselect) {
|
||||
else if (properties->deselect) {
|
||||
if (uw) {
|
||||
uw->flag &= ~SELECT;
|
||||
}
|
||||
@@ -346,7 +342,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
if (!(uw->flag & SELECT)) {
|
||||
uw->flag |= SELECT;
|
||||
}
|
||||
else if (toggle) {
|
||||
else if (properties->toggle) {
|
||||
uw->flag &= ~SELECT;
|
||||
}
|
||||
}
|
||||
@@ -361,12 +357,31 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
|
||||
}
|
||||
if (deselect_all) {
|
||||
if (properties->deselect_all) {
|
||||
ED_mask_deselect_all(C);
|
||||
ED_mask_view_lock_state_restore_no_jump(C, &lock_state);
|
||||
return OPERATOR_PASS_THROUGH | OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static int select_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
MaskMouseSelectProperties properties;
|
||||
|
||||
properties.extend = RNA_boolean_get(op->ptr, "extend");
|
||||
properties.deselect = RNA_boolean_get(op->ptr, "deselect");
|
||||
properties.toggle = RNA_boolean_get(op->ptr, "toggle");
|
||||
properties.deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
|
||||
|
||||
float co[2];
|
||||
RNA_float_get_array(op->ptr, "location", co);
|
||||
|
||||
if (ED_mask_select_mouse_pick(C, co, &properties)) {
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
return OPERATOR_PASS_THROUGH;
|
||||
}
|
||||
|
||||
|
@@ -1969,7 +1969,6 @@ void ED_area_init(wmWindowManager *wm, wmWindow *win, ScrArea *area)
|
||||
if ((G.moving & G_TRANSFORM_WM) == 0) {
|
||||
if ((1 << area->spacetype) & WM_TOOLSYSTEM_SPACE_MASK) {
|
||||
WM_toolsystem_refresh_screen_area(workspace, scene, view_layer, area);
|
||||
area->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE;
|
||||
}
|
||||
else {
|
||||
area->runtime.tool = NULL;
|
||||
|
@@ -45,7 +45,8 @@ struct wmOperatorType;
|
||||
/* clip_buttons.c */
|
||||
|
||||
void ED_clip_buttons_register(struct ARegionType *art);
|
||||
|
||||
/* clip_toolbar.c */
|
||||
void clip_toolbar_register(struct ARegionType *art);
|
||||
/* clip_dopesheet_draw.c */
|
||||
|
||||
void clip_draw_dopesheet_main(struct SpaceClip *sc, struct ARegion *region, struct Scene *scene);
|
||||
|
@@ -61,6 +61,8 @@
|
||||
#include "DEG_depsgraph.h"
|
||||
#include "DEG_depsgraph_build.h"
|
||||
|
||||
#include "WM_message.h"
|
||||
|
||||
#include "clip_intern.h" /* own include */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -1595,6 +1597,9 @@ static int mode_set_exec(bContext *C, wmOperator *op)
|
||||
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_CLIP, NULL);
|
||||
|
||||
struct wmMsgBus *mbus = CTX_wm_message_bus(C);
|
||||
WM_msg_publish_rna_prop(mbus, (ID *)CTX_wm_screen(C), sc, SpaceClipEditor, mode);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,8 @@
|
||||
#include "GPU_matrix.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
#include "WM_message.h"
|
||||
#include "WM_toolsystem.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
@@ -237,6 +239,14 @@ static SpaceLink *clip_create(const ScrArea *area, const Scene *scene)
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* tool header */
|
||||
region = MEM_callocN(sizeof(ARegion), "tool header for clip");
|
||||
|
||||
BLI_addtail(&sc->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_TOOL_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
region->flag = RGN_FLAG_HIDDEN | RGN_FLAG_HIDDEN_BY_USER;
|
||||
|
||||
/* tools view */
|
||||
region = MEM_callocN(sizeof(ARegion), "tools for clip");
|
||||
|
||||
@@ -667,10 +677,12 @@ static void clip_refresh(const bContext *C, ScrArea *area)
|
||||
SpaceClip *sc = (SpaceClip *)area->spacedata.first;
|
||||
ARegion *region_main = BKE_area_find_region_type(area, RGN_TYPE_WINDOW);
|
||||
ARegion *region_tools = BKE_area_find_region_type(area, RGN_TYPE_TOOLS);
|
||||
ARegion *region_tool_header = BKE_area_find_region_type(area, RGN_TYPE_TOOL_HEADER);
|
||||
ARegion *region_preview = ED_clip_has_preview_region(C, area);
|
||||
ARegion *region_properties = ED_clip_has_properties_region(area);
|
||||
ARegion *region_channels = ED_clip_has_channels_region(area);
|
||||
bool main_visible = false, preview_visible = false, tools_visible = false;
|
||||
bool main_visible = false, preview_visible = false, tools_visible = false,
|
||||
tool_header_visible = false;
|
||||
bool properties_visible = false, channels_visible = false;
|
||||
bool view_changed = false;
|
||||
|
||||
@@ -679,6 +691,7 @@ static void clip_refresh(const bContext *C, ScrArea *area)
|
||||
main_visible = true;
|
||||
preview_visible = false;
|
||||
tools_visible = true;
|
||||
tool_header_visible = true;
|
||||
properties_visible = true;
|
||||
channels_visible = false;
|
||||
break;
|
||||
@@ -686,6 +699,7 @@ static void clip_refresh(const bContext *C, ScrArea *area)
|
||||
main_visible = false;
|
||||
preview_visible = true;
|
||||
tools_visible = false;
|
||||
tool_header_visible = false;
|
||||
properties_visible = false;
|
||||
channels_visible = false;
|
||||
|
||||
@@ -695,6 +709,7 @@ static void clip_refresh(const bContext *C, ScrArea *area)
|
||||
main_visible = false;
|
||||
preview_visible = true;
|
||||
tools_visible = false;
|
||||
tool_header_visible = false;
|
||||
properties_visible = false;
|
||||
channels_visible = true;
|
||||
|
||||
@@ -702,10 +717,18 @@ static void clip_refresh(const bContext *C, ScrArea *area)
|
||||
break;
|
||||
}
|
||||
|
||||
/* TODO(sergey): Look into preserving the alignment of the regions when hiding, so that we do
|
||||
* not need to have all the logic about alignment here. */
|
||||
view_changed |= clip_set_region_visible(C, region_main, main_visible, RGN_ALIGN_NONE, false);
|
||||
view_changed |= clip_set_region_visible(
|
||||
C, region_properties, properties_visible, RGN_ALIGN_RIGHT, false);
|
||||
view_changed |= clip_set_region_visible(C, region_tools, tools_visible, RGN_ALIGN_LEFT, false);
|
||||
view_changed |= clip_set_region_visible(C,
|
||||
region_tool_header,
|
||||
tool_header_visible,
|
||||
(U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM :
|
||||
RGN_ALIGN_TOP,
|
||||
false);
|
||||
view_changed |= clip_set_region_visible(
|
||||
C, region_preview, preview_visible, RGN_ALIGN_NONE, true);
|
||||
view_changed |= clip_set_region_visible(
|
||||
@@ -933,6 +956,20 @@ static void clip_main_region_listener(const wmRegionListenerParams *params)
|
||||
}
|
||||
}
|
||||
|
||||
static void clip_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
||||
{
|
||||
struct wmMsgBus *mbus = params->message_bus;
|
||||
ScrArea *area = params->area;
|
||||
ARegion *region = params->region;
|
||||
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_refresh = {
|
||||
.owner = region,
|
||||
.user_data = area,
|
||||
.notify = WM_toolsystem_do_msg_notify_tag_refresh,
|
||||
};
|
||||
WM_msg_subscribe_rna_anon_prop(mbus, SpaceClipEditor, mode, &msg_sub_value_region_tag_refresh);
|
||||
}
|
||||
|
||||
/****************** preview region ******************/
|
||||
|
||||
static void clip_preview_region_init(wmWindowManager *wm, ARegion *region)
|
||||
@@ -1156,34 +1193,8 @@ static void clip_tools_region_draw(const bContext *C, ARegion *region)
|
||||
|
||||
/****************** tool properties region ******************/
|
||||
|
||||
static void clip_props_region_listener(const wmRegionListenerParams *params)
|
||||
static void clip_tools_region_listener(const wmRegionListenerParams *UNUSED(params))
|
||||
{
|
||||
ARegion *region = params->region;
|
||||
const wmNotifier *wmn = params->notifier;
|
||||
|
||||
/* context changes */
|
||||
switch (wmn->category) {
|
||||
case NC_WM:
|
||||
if (wmn->data == ND_HISTORY) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
break;
|
||||
case NC_SCENE:
|
||||
if (wmn->data == ND_MODE) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
break;
|
||||
case NC_SPACE:
|
||||
if (wmn->data == ND_SPACE_CLIP) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
break;
|
||||
case NC_GPENCIL:
|
||||
if (wmn->action == NA_EDITED) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/****************** properties region ******************/
|
||||
@@ -1295,7 +1306,9 @@ void ED_spacetype_clip(void)
|
||||
art->init = clip_main_region_init;
|
||||
art->draw = clip_main_region_draw;
|
||||
art->listener = clip_main_region_listener;
|
||||
art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_GPENCIL;
|
||||
art->message_subscribe = clip_main_region_message_subscribe;
|
||||
art->keymapflag = ED_KEYMAP_GIZMO | ED_KEYMAP_FRAMES | ED_KEYMAP_UI | ED_KEYMAP_GPENCIL |
|
||||
ED_KEYMAP_TOOL;
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
@@ -1321,15 +1334,28 @@ void ED_spacetype_clip(void)
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
ED_clip_buttons_register(art);
|
||||
|
||||
/* regions: tools */
|
||||
/* regions: tool(bar) */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype clip region tools");
|
||||
art->regionid = RGN_TYPE_TOOLS;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
||||
art->keymapflag = ED_KEYMAP_FRAMES | ED_KEYMAP_UI;
|
||||
art->listener = clip_props_region_listener;
|
||||
art->prefsizex = 58;
|
||||
art->prefsizey = 50;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
|
||||
art->listener = clip_tools_region_listener;
|
||||
art->message_subscribe = ED_region_generic_tools_region_message_subscribe;
|
||||
art->snap_size = ED_region_generic_tools_region_snap_size;
|
||||
art->init = clip_tools_region_init;
|
||||
art->draw = clip_tools_region_draw;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: tool header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype clip tool header region");
|
||||
art->regionid = RGN_TYPE_TOOL_HEADER;
|
||||
art->prefsizey = HEADERY;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
||||
art->listener = clip_header_region_listener;
|
||||
art->message_subscribe = ED_area_do_mgs_subscribe_for_tool_header;
|
||||
art->init = clip_header_region_init;
|
||||
art->draw = clip_header_region_draw;
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: header */
|
||||
|
@@ -570,7 +570,7 @@ static int select_exec(bContext *C, wmOperator *op)
|
||||
* operator can be used immediately after.
|
||||
* This logic makes it convenient to slide markers when left mouse selection is used. Without it
|
||||
* selection will be lost which causes inconvenience for the VFX artist. */
|
||||
const bool activate_selected = !extend;
|
||||
const bool activate_selected = RNA_boolean_get(op->ptr, "activate_selected");
|
||||
if (activate_selected && ed_tracking_pick_can_slide(sc, &pick)) {
|
||||
if (pick.point_track_pick.track != NULL) {
|
||||
tracking_object->active_track = pick.point_track_pick.track;
|
||||
@@ -708,6 +708,7 @@ void CLIP_OT_select(wmOperatorType *ot)
|
||||
"Extend",
|
||||
"Extend selection rather than clearing the existing selection");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
prop = RNA_def_boolean(ot->srna,
|
||||
"deselect_all",
|
||||
false,
|
||||
@@ -715,6 +716,14 @@ void CLIP_OT_select(wmOperatorType *ot)
|
||||
"Deselect all when nothing under the cursor");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
prop = RNA_def_boolean(
|
||||
ot->srna,
|
||||
"activate_selected",
|
||||
0,
|
||||
"Activate Selected",
|
||||
"When selecting already selected track activate it and do not alter others selection");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
|
||||
RNA_def_float_vector(
|
||||
ot->srna,
|
||||
"location",
|
||||
|
@@ -7569,8 +7569,9 @@ static void rna_def_space_clip(BlenderRNA *brna)
|
||||
RNA_def_struct_sdna(srna, "SpaceClip");
|
||||
RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
|
||||
|
||||
rna_def_space_generic_show_region_toggles(
|
||||
srna, (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_HUD));
|
||||
rna_def_space_generic_show_region_toggles(srna,
|
||||
(1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_UI) |
|
||||
(1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_HUD));
|
||||
|
||||
/* movieclip */
|
||||
prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
|
||||
|
@@ -153,6 +153,17 @@ static bToolRef *rna_WorkSpace_tools_from_space_node(WorkSpace *workspace, bool
|
||||
},
|
||||
create);
|
||||
}
|
||||
static bToolRef *rna_WorkSpace_tools_from_space_clip_mode(WorkSpace *workspace,
|
||||
int mode,
|
||||
bool create)
|
||||
{
|
||||
return rna_WorkSpace_tools_from_tkey(workspace,
|
||||
&(bToolKey){
|
||||
.space_type = SPACE_CLIP,
|
||||
.mode = mode,
|
||||
},
|
||||
create);
|
||||
}
|
||||
static bToolRef *rna_WorkSpace_tools_from_space_sequencer(WorkSpace *workspace,
|
||||
int mode,
|
||||
bool create)
|
||||
@@ -177,6 +188,8 @@ const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(bContext *UNUSED(C),
|
||||
return rna_enum_space_image_mode_all_items;
|
||||
case SPACE_SEQ:
|
||||
return rna_enum_space_sequencer_view_type_items;
|
||||
case SPACE_CLIP:
|
||||
return rna_enum_clip_editor_mode_items;
|
||||
}
|
||||
return DummyRNA_DEFAULT_items;
|
||||
}
|
||||
@@ -369,6 +382,16 @@ static void rna_def_workspace_tools(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
/* return type */
|
||||
parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
|
||||
RNA_def_function_return(func, parm);
|
||||
|
||||
func = RNA_def_function(
|
||||
srna, "from_space_clip_mode", "rna_WorkSpace_tools_from_space_clip_mode");
|
||||
RNA_def_function_ui_description(func, "");
|
||||
parm = RNA_def_enum(func, "mode", rna_enum_clip_editor_mode_items, 0, "", "");
|
||||
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
|
||||
RNA_def_boolean(func, "create", false, "Create", "");
|
||||
/*return type */
|
||||
parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
|
||||
RNA_def_function_return(func, parm);
|
||||
}
|
||||
|
||||
static void rna_def_workspace(BlenderRNA *brna)
|
||||
|
@@ -27,7 +27,8 @@ struct wmOperatorType;
|
||||
/* wm_toolsystem.c */
|
||||
|
||||
#define WM_TOOLSYSTEM_SPACE_MASK \
|
||||
((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ))
|
||||
((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ) | \
|
||||
(1 << SPACE_CLIP))
|
||||
/**
|
||||
* Space-types that define their own "mode" (as returned by #WM_toolsystem_mode_from_spacetype).
|
||||
*/
|
||||
|
@@ -437,6 +437,11 @@ static bool toolsystem_key_ensure_check(const bToolKey *tkey)
|
||||
return true;
|
||||
case SPACE_SEQ:
|
||||
return true;
|
||||
case SPACE_CLIP:
|
||||
if (ELEM(tkey->mode, SC_MODE_TRACKING, SC_MODE_MASKEDIT)) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -475,6 +480,11 @@ int WM_toolsystem_mode_from_spacetype(const Scene *scene,
|
||||
mode = sseq->view;
|
||||
break;
|
||||
}
|
||||
case SPACE_CLIP: {
|
||||
SpaceClip *sc = area->spacedata.first;
|
||||
mode = sc->mode;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return mode;
|
||||
}
|
||||
@@ -585,6 +595,8 @@ void WM_toolsystem_refresh_screen_area(WorkSpace *workspace,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
area->flag |= AREA_FLAG_ACTIVE_TOOL_UPDATE;
|
||||
}
|
||||
|
||||
void WM_toolsystem_refresh_screen_window(wmWindow *win)
|
||||
@@ -736,6 +748,8 @@ static const char *toolsystem_default_tool(const bToolKey *tkey)
|
||||
switch (tkey->mode) {
|
||||
case SI_MODE_PAINT:
|
||||
return "builtin_brush.Draw";
|
||||
case SI_MODE_MASK:
|
||||
return "builtin.draw_mask";
|
||||
}
|
||||
break;
|
||||
case SPACE_NODE: {
|
||||
@@ -752,6 +766,15 @@ static const char *toolsystem_default_tool(const bToolKey *tkey)
|
||||
}
|
||||
return "builtin.select_box";
|
||||
}
|
||||
case SPACE_CLIP: {
|
||||
switch (tkey->mode) {
|
||||
case SC_MODE_TRACKING:
|
||||
return "builtin.add_marker_tweak";
|
||||
case SC_MODE_MASKEDIT:
|
||||
return "builtin.draw_mask";
|
||||
}
|
||||
return "builtin.select_box";
|
||||
}
|
||||
}
|
||||
|
||||
return "builtin.select_box";
|
||||
|
Reference in New Issue
Block a user