1
1

Compare commits

...

133 Commits

Author SHA1 Message Date
09098e6539 Merge branch 'master' into tracking_tools 2022-12-01 16:40:52 +01:00
7383c6c309 Merge branch 'master' into tracking_tools 2022-10-07 14:55:23 +02:00
a56a90a8e2 Merge branch 'master' into tracking_tools 2022-06-14 10:52:03 +02:00
3543081e6a Merge branch 'master' into tracking_tools 2022-06-13 17:33:47 +02:00
aee2b2c008 Merge branch 'master' into tracking_tools 2022-06-10 11:45:48 +02:00
92855f8ab7 Merge branch 'master' into tracking_tools 2022-06-09 15:56:29 +02:00
Sebastian Koenig
66b750eb6e Merge branch 'master' into tracking_tools 2022-06-05 16:31:07 +02:00
52399070c2 Merge branch 'master' into tracking_tools 2022-06-03 08:17:21 +02:00
8091e02525 Merge branch 'master' into tracking_tools 2022-06-01 08:19:19 +02:00
adfc603dd8 Merge branch 'master' into tracking_tools 2022-05-23 17:16:40 +02:00
fc9dff5677 Merge branch 'master' into tracking_tools 2022-05-23 14:23:30 +02:00
5f4a55d375 Cleanup: Autopep8 2022-05-19 12:32:47 +02:00
8146eac905 Merge branch 'master' into tracking_tools 2022-05-19 11:32:12 +02:00
05abd2496a Merge branch 'master' into tracking_tools 2022-05-18 17:20:58 +02:00
a3d6ce2cb3 Clip Editor: Cleanup Menues
Add Create Plane Track to context menu, move plane track, scene setup
and solve operators to Reconstruction Menu
2022-05-17 16:10:29 +02:00
02d5702797 Fix crash on startup after previous keymap change
Use list instead of tuple, even when modification is not needed.

Not sure why this was causing issues on just Linux, but this seems
to what all other places in the keymap are using.
2022-05-17 15:29:28 +02:00
fb61be68e3 Merge branch 'master' into tracking_tools 2022-05-17 13:03:58 +02:00
73e499fd5f Tracking: Re-write selection and tweak tool logic
The goal is to have the Add Marker and Tweak tool work the way how
VFX artists expects it to.

Share as much of code as possible, avoiding duplicated closest track
lookup, and sharing the same distance tolerance for selection and
marker slide operators.
2022-05-17 12:25:20 +02:00
ee5e117ae8 Fix circle select tool in clip editor
The API changed and the number of circle segments is to be passed as a
keyword argument.
2022-05-17 11:38:13 +02:00
1f031a47a3 Merge branch 'master' into tracking_tools 2022-05-17 11:32:37 +02:00
5dca2a7c68 Merge branch 'master' into tracking_tools 2022-05-17 10:38:26 +02:00
71baa5f332 Revert "Tracking: Improve selection during Add Marker and tweak tool"
This made it impossible to add markers. Need to have a second though.

This reverts commit 3c54a61394.
2022-05-16 16:29:34 +02:00
5e0bbbc24e Merge branch 'master' into tracking_tools 2022-05-16 15:53:02 +02:00
3c54a61394 Tracking: Improve selection during Add Marker and tweak tool
Allow selection by clicking an edge of patter/search marker areas.

The transform-tweak should behave as it was before for RMB selection.
The LMB selection will not have tweak transform in this tool.
2022-05-16 15:20:27 +02:00
ee954ed1d1 Merge branch 'master' into tracking_tools 2022-05-16 15:00:53 +02:00
aab388678a Merge branch 'master' into tracking_tools 2022-05-13 17:24:31 +02:00
4f28b881a6 Tracking: Always allow LMB select for tweak tools
Similar to the nodes editor: makes it very easy and convenient to
alter markers.
2022-05-13 16:53:20 +02:00
0c2c1601b9 Tracking: Make "Tweak" tool have same selection rules as "Add Marker and Tweak" 2022-05-13 16:23:17 +02:00
dc29529ca8 Merge branch 'master' into tracking_tools 2022-05-13 14:17:34 +02:00
e3e7543f30 Tracking: Restore pre-tool behavior for tweak tool with RMB select
Make it an explicit option for operator to make it behave in a way which
is the most convenient for left mouse select, and do not use it for the
right mouse select.
2022-05-13 10:31:57 +02:00
68fa87dbf0 Fix add marker and tweak tool with left mouse selection 2022-05-13 10:31:57 +02:00
613dd85541 Cleanup: Autopep8 in keymap 2022-05-13 10:30:12 +02:00
7488250e51 Merge branch 'master' into tracking_tools 2022-05-12 17:21:04 +02:00
80441866c2 Cleanup: New lines around function calls
Should make it more pep8 compliant.
2022-05-12 16:28:13 +02:00
981a360310 Tracking tools: Hide tool header in non-clip views
There are no tools in those editors, so there is no reason to
waste screen space with empty header.
2022-05-12 16:26:03 +02:00
d05575f942 Fix tool header position in movie clip editor
The tool header was added on top of the regular header for the
new clip editor spaces.
2022-05-12 13:04:10 +02:00
8f4e3458ac Tracking tools: Fix crash in tool header
The draw function should not modify the region visibility as it will
cause memory free in the middle of drawing. More proper way of hiding
the tool header is to do it in C.
2022-05-12 12:58:13 +02:00
fc589efd13 Merge branch 'master' into tracking_tools 2022-05-12 12:42:29 +02:00
e7d8e2c199 Merge branch 'master' into tracking_tools 2022-05-12 11:37:23 +02:00
7bda282c5d Show tracking object name in popover menu button
Allows to see currently active tracking object without opening
the popover.

Would be nice to have a dedicated icons, but those icons were
already used in the list.
2022-05-11 16:50:55 +02:00
d46feb8b4d Cleanup: Unused function 2022-05-11 15:39:49 +02:00
463e8c0cf5 Merge branch 'master' into tracking_tools 2022-05-11 15:36:09 +02:00
804c74a2fd Merge branch 'master' into tracking_tools 2022-05-11 12:14:07 +02:00
a9b204c501 Merge branch 'master' into tracking_tools 2022-05-09 16:15:01 +02:00
69df1d9ee1 Merge branch 'master' into tracking_tools 2022-05-03 08:58:52 +02:00
441ecf9ec6 Merge branch 'master' into tracking_tools 2022-04-29 12:35:57 +02:00
00f6dd3439 Merge branch 'master' into tracking_tools 2022-04-28 07:47:52 +02:00
25f8dfd436 Merge branch 'master' into tracking_tools 2022-04-27 13:59:35 +02:00
2a0f777243 Merge branch 'master' into tracking_tools 2022-04-14 08:26:38 +02:00
28c380ca2f Clip Editor: Clean and Filter Tracks buttons
Add Clean and Filter Tracks Operators to context menu.

Remove Options for the Clean Tracks operator from Cleanup Panel. Filter
Tracks only relies on the Last Operator Menu, so it is a bit weird that
Cleanup has the options visisble and Filter Tracks doesn't.
By removing the options it's consistent for both.
2022-04-13 09:54:13 +02:00
29cda45d83 Merge branch 'master' into tracking_tools 2022-04-13 08:26:07 +02:00
a41382aef6 Merge branch 'master' into tracking_tools 2022-04-12 15:24:52 +02:00
25873ff0f7 Clip Editor: Remove Objects Panel from sidebar
Since the objects panel is now accessible from the header, we don't need
to have it in the sidebar anymore.

Also, the Lens Panel was closed by default. However, it doesn't really
make sense to hide the Lens parameters from the camera, since they are
essential to solving.
2022-04-12 15:22:21 +02:00
39590dab00 Merge branch 'master' into tracking_tools 2022-04-12 12:40:13 +02:00
09014c1a2d Clip Editor: Show object name in Solve error message 2022-04-12 12:32:44 +02:00
bb6d0165b4 Curves Sculpting Icons: Snake Hook and Grow updates
This implements the icon for snake hook, as well as tweak the
growth brush to make it bigger and with the triangles more
distinct for better reading of the icon.

Differential Revision: https://developer.blender.org/D14616
2022-04-11 16:33:46 +02:00
9fccd4d789 install_deps: Tweak rBbc9c9631a46f, libwebp is not only a dependency from ffmpeg. 2022-04-11 16:33:46 +02:00
Charles Flèche
7ef78a2683 Fix Cycles missing nullptr check in case mesh has no shader
Did not affect Blender, but could happen with other integrations.

Differential Revision: https://developer.blender.org/D14538
2022-04-11 16:33:46 +02:00
18916cb6eb Fix setting key shortcuts for insert keyframe menu items
It was not possible to assign a shortcut to menu items in the insert
key-frame menu going back to version 2.7x. Doing so would replace the
current key that opens the insert keyframe menu (I-key by default),
instead of binding a key to insert a key-frame for the keying-set
referenced by the menu item.

Now each menu item can be bound to a key or added to the "Quick
Favorites" menu, directly inserting a key-frame for the corresponding
keying-set.

Note that users must use the operator `anim.keyframe_insert_by_name`
when setting up key-shortcuts as `anim.keyframe_insert` is only intended
to launch the menu.

Keymap Editor:

When editing these key-map items in the key-map editor, the keying-set
identifier must be used. At the moment the key-map editor doesn't
support showing a drop-down list. The identifiers can be used from the
tool-tip or the info editor.

{F12994924}

Details:

Use `ANIM_OT_keyframe_insert_by_name` instead of
`ANIM_OT_keyframe_insert_menu` for the insert keyframe popup menu to
resolve the following issues binding keys to keying sets:

- The index of the keying set isn't stable (adding/removing keying sets
  may change it).
- Binding a key to items in the popup menu triggers a popup instead of
  inserting a key using the keying set from the menu item.

While support for using the current operator could be improved, it will
still only work for built-in keying sets, so I'd prefer to use an
operator that is intended for key-bindings.

Besides supporting binding keys to menu items there are no functional
changes.

Reviewed By: sybren

Ref D14289
2022-04-11 16:33:46 +02:00
11b5c6ac52 BMesh Python API: add access to vertex crease layer
This simply adds access to the vertex crease layer from Python
code. Documentation was modified to remove "Edge" as it is
shared between edges and vertices, similarly to bevel weights.

Differential Revision: https://developer.blender.org/D14605
2022-04-11 16:33:46 +02:00
faa4dabd75 Merge branch 'master' into tracking_tools 2022-04-11 13:58:17 +02:00
0485a873a3 Clip Editor: Objects popover placement
I have moved the objects popover from the toolbar header to the normal
header. If people would disable the toolbar header they would still need
to be able to see the objects popover.
In Tracking mode the placement is next to the solve error info, which
makes sense, because changing the tracking object also displays a
differen solve error.
In Mask mode it is a little bit weird, because the object popover is now
between the Mask Display popover and the Clip Display popover.
2022-04-11 13:54:44 +02:00
2fa4c4e62c Merge branch 'master' into tracking_tools 2022-04-08 12:01:40 +02:00
Sebastian Koenig
d9d49d3513 Merge branch 'master' into tracking_tools 2022-04-07 11:21:00 +02:00
dc14fb5708 Tracking: Make Tweak tool to tweak markers 2022-03-25 15:29:37 +01:00
aa2710afa5 Tracking: Allow tweaking plane track when Add Marker tool is active
Similar to allowing tweak of regular markers.
2022-03-25 15:07:41 +01:00
6088c154e0 Tracking: Allow changing frame while Add Marker tool is active 2022-03-25 14:49:08 +01:00
316ea9e080 Clip Editor: Proper do-version for tool header
It was only added for files saved prior to 2.90.
2022-03-25 12:45:05 +01:00
c8b84f2ad8 Cleanup: Warning about unused variables 2022-03-25 12:05:23 +01:00
a96147720f Merge branch 'master' into tracking_tools 2022-03-25 12:02:56 +01:00
88acad8c52 Merge branch 'master' into tracking_tools 2022-03-24 17:33:46 +01:00
92da23b464 Tracking: Use click for Add Marker tool
With some reshuffling of the keymap it is possible to have
click for both tweak action of currently selected marker and
for adding new markers (when clicking outside of any sliding
area).

This feels to fit better into the tool design where usually
the modifier key is not used.
2022-03-24 15:20:42 +01:00
08117cb0e3 Move space selector to header
This is where it belongs in all other editors.
Is also weird to see it below the space menu.
2022-03-24 12:57:09 +01:00
8b1d651350 Merge branch 'master' into tracking_tools 2022-03-24 12:50:24 +01:00
2c55c8470d Merge branch 'master' into tracking_tools 2021-10-07 09:21:23 +02:00
4e24add5ee Merge branch 'master' into tracking_tools 2021-10-06 07:49:44 +02:00
da480ed9dc Merge branch 'master' into tracking_tools 2021-10-04 17:00:30 +02:00
14e1154946 Merge branch 'master' into tracking_tools 2021-10-04 12:24:43 +02:00
f78a432934 Merge branch 'master' into tracking_tools 2021-10-04 12:06:21 +02:00
db6b6fd816 Merge branch 'master' into tracking_tools 2021-09-30 11:20:55 +02:00
b6a2989289 Mask tools: Remove mask delete tool
I have deleted the tool to delete add vertex by clicking on it. In
practise I found it not helpful, and this way it is more in line how
other elements are deleted in blender (vertices, objects etc)
2021-09-30 08:56:12 +02:00
be2b52a557 Merge branch 'master' into tracking_tools 2021-09-30 07:51:31 +02:00
098bb648f3 Merge branch 'master' into tracking_tools 2021-09-29 15:01:09 +02:00
0067b49bbf Masking: Add masking tools to image editor
Clip and Image editor are using the same masking tools when in MASKEDIT
mode. To make that work in the keymap I have set the space_type to
'EMPTY', similar to the annotation tools. This seems to work well,
though I am not sure it is the right approach.
2021-09-29 14:55:28 +02:00
9435287c25 Merge branch 'master' into tracking_tools 2021-09-29 11:54:39 +02:00
e1b8e6228e Merge branch 'master' into tracking_tools 2021-09-28 16:09:59 +02:00
523ab17cd8 Merge branch 'master' into tracking_tools 2021-09-28 14:41:12 +02:00
6ae01c4898 Merge branch 'master' into tracking_tools 2021-09-28 08:27:07 +02:00
8a652aac01 Clip Editor: Add Clip Tools to Footage Settings
Since the old toolshelf is gone Prefetch and Set Scene Frames was only
avaible via the menu. I have now moved the old Clip Tools panel over to
the UI area in the Footage category. This is the category that is open
when a user opens a new clip, so now these opertors are quickly availble
from the sidebar for the user to set the scene frames and prefetch the
footage.
The Reload button is a bit redundant, since we have a button for that
in the footage settings panel as well, but this way the panel looks the
same as in 2.93.
2021-09-25 11:05:15 +02:00
7b615a2dfb Merge branch 'master' into tracking_tools 2021-09-25 10:21:03 +02:00
b2f8e13989 Merge branch 'master' into tracking_tools 2021-09-24 08:03:10 +02:00
e1a3584432 Tracking Tools: Only show toolheader in Clip View
There are no tools available for Graph and Dopesheet view, so do not
show the tool header there.
2021-09-23 08:59:04 +02:00
60229ac068 Merge branch 'master' into tracking_tools 2021-09-23 08:25:11 +02:00
49054a7109 Merge branch 'master' into tracking_tools 2021-09-22 11:49:07 +02:00
5ebdece0b8 Merge branch 'master' of git.blender.org:blender into tracking_tools 2021-08-11 14:47:12 +02:00
222a0ab54a Merge branch 'master' of git.blender.org:blender into tracking_tools 2021-08-11 14:40:27 +02:00
935c717e71 Merge branch 'master' into tracking_tools 2021-08-11 14:40:09 +02:00
67a8896bcb Wip: start on image editor mask tools 2021-07-26 21:33:33 -04:00
9cb7ad7d19 Keymap: Give mask tools a generic name
These will be shared across editors so give them a generic name
2021-07-26 20:56:33 -04:00
d424344af1 Annotations: only show data source for image placement
This option is only relevent for that placement mode
2021-07-26 20:40:33 -04:00
7d9fc377e1 Merge branch 'master' into tracking_tools 2021-07-26 19:03:34 -04:00
506aa3b788 MCE: Only draw annotation placement panel with Clip
The annotation placement panel only makes sense when the Data Source is
CLIP, when TRACK is use the anntation placement options don't apply.
2021-07-22 09:17:34 +02:00
6c5722ee40 Masking: Only execute draw_mask with a clip
When going to maskedit mode without a clip loaded and clicking anywhere
Blender crashed. Now use poll to check for a clip before exeting the
draw_mask operator.
2021-07-21 08:43:53 +02:00
abae63b979 Merge branch 'master' into tracking_tools 2021-07-20 15:40:06 -04:00
934fd07a06 Fix default tool not set when changing clip editor modes
Also see D11977.
2021-07-20 19:06:03 +02:00
2a20754467 Fix crash/undefined-behavior when opening tracker with clip region open
Python code was explicitly hiding the tool header region, but drawing
should not modify screen context. That can cause all kinds of issues,
like this one. Such stuff can be handled by editor C code.
2021-07-20 15:36:52 +02:00
4fc7e38803 Cleanup: Remove unused (potentially problematic) region type declaration
There were two region types declared for `RGN_TYPE_TOOLS`, there should
only ever be one. In fact this may cause problems when region types are
looked up, although it didn't seem to cause any obvious ones in this
case.

Removed the listener callback alongside it, which is written
specifically for the old tools region and shouldn't be needed anymore
either.
2021-07-20 14:59:54 +02:00
d535c5784b Fix missing Tool Settings button toggle
The View > Tool Settings button didn't show up because of a wrong
property name.
2021-07-20 14:56:38 +02:00
50ef1f6f0b Merge branch 'master' into tracking_tools 2021-07-20 14:36:23 +02:00
8bf9eb9822 MCE: Remove unused hotkey configs 2021-07-20 12:53:55 +02:00
c732ee3bf3 MCE: Remove redundant tool: Add_marker_slide
The default tool for tracking mode in the clip editor is
add_marker_tweak. Add_marker_slide is not needed anymore.
2021-07-20 11:15:02 +02:00
69aee563db Masking: Slide origin with draw_mask tool
The mask tool creates a curve point when leftclicking. When clicking
near an existing point it switches to select and move instead. The same
happens now when clicking near the origin point so it is now possible to move the
entire mask again with LMB.
Patch by Sergey, thanks a lot!
2021-07-20 10:05:13 +02:00
27e2382feb MCE: Only show marker settings with active clip
When no clip was loaded, draw the add_marker_tweak tool options gave an
error. So only draw them when a clip is open.
2021-07-20 09:59:21 +02:00
6da684a9c6 MCE: Change default tool
Use the add_marker_tweak tool in Tracking mode and the draw_mask tool in
Masking by default instead of select_box.
It doesn't yet work for masking  when switchin modes with Tab, only when
changing the workspace.
2021-07-20 09:39:54 +02:00
4d620c7028 Cleanup: Remove unused masking tool panels 2021-07-19 18:51:11 -04:00
c997998702 Restore selection shortcuts 2021-07-19 17:56:18 -04:00
750a65bbf2 Cleanup: Clang format 2021-07-19 17:13:49 -04:00
1ffad3992a Merge branch 'master' into tracking_tools 2021-07-19 17:12:57 -04:00
c349152b50 Merge branch 'master' into tracking_tools 2021-07-19 16:52:29 -04:00
546fe10b33 MCE: Mask tool improvements
The mask tool now respects the settings for new handle_type in the tool
settings for new points. This makes it work more like a proper tool.

However, now it does not use the active point anymore as a reference for the handle_type
settings of new points as it was until 2.93.
So e.g. if the user starts to draw a mask with handle_type Auto and
changes the active point to Vector, every new point
drawn with the mask tool will still have handle_type Auto. Overall I
think the new behavior is better though.
Also, the user does not need to keep Ctrl pressed to draw a mask.
Instead, the tool will draw a mask point on every click, unless the mouse
is close to an existing point, then it will work like the tweak tool.

The user can hold down Ctrl to activate the add_feather_vertex_slide
tool.
2021-07-19 15:08:09 +02:00
96af3700f4 Merge branch 'tracking_tools' of git.blender.org:blender into tracking_tools 2021-07-19 09:37:11 +02:00
d5df94c4ee MCE: Always use mask preset for new vertex.
This is more a test, but this change makes it so that a new vertex uses
the mask tool setting for a new vertex. Not sure if this is the desired
behavior though, because before you could change the handle_type of the
active point and then every point extruded from it would use the new
handle_type.
2021-07-19 09:33:35 +02:00
Aaron Carlisle
677212b016 UI: Tracking: Move Object Scale to objects panel
The goal of this patch is to simplify the object panel shown below to help the process of migrating the current toolbar to a new active tool based toolbar

{F10174064}

This moves the scale property from the rather hidden toolbar panel to the sidebar "Objects" panel in the sidebar:

{F10174050}

This also moves the two set scale operators to the same location and will change based on the active "object type" (Camera or Object)

Reviewed By: sebastian_k, sergey

Differential Revision: https://developer.blender.org/D9806
2021-07-18 18:09:02 -04:00
9d81cfaba3 Annotations: Cleanup old tools and tool settings
This removes the unused generic toolbar panel.

There is also an issue with `annotation_stroke_placement_view2d`,
this property needs to be updated for view2d types.
This is a bug that can be fixed in master be creating a new
enum of view2d placement options.
2021-07-18 18:03:07 -04:00
1da69b4eac Merge branch 'master' into tracking_tools 2021-07-18 16:21:45 -04:00
c3bb138ade Merge branch 'master' into tracking_tools 2021-07-16 11:39:40 +02:00
5727f7132e MCE: Trying to add mask handle props into toolbar
I tried implementing this https://developer.blender.org/P1923
To get the properties to do anything, I would need to change
add_vertex_slide to just add_vertex. add_vertex_slide is a macro, and
apparently the properties of MASK_OT_add_vertex do not have any
influence on the tool if it is set to use the macro.
But even then it only updates the handle type when activating the tool
(after switching to a different tool before). So some update thingy is
still missing.
2021-07-16 11:33:55 +02:00
1e5377bdcf MCE: Fix default tracking settings extras
The default tracking settings popover was using the tracking settings
extras panel from the actve track, not the default one.
2021-07-15 13:59:22 +02:00
ebf217c79a Merge branch 'master' into tracking_tools 2021-07-15 13:28:40 +02:00
6d7a6c46eb MCE: Only options in toolbar in correct context
Some popovers produced errors if no clip was loaded yet or the wrong
mode was active.
2021-07-14 15:15:44 +02:00
e9bf1d5f93 MCE: Add some options to the topbar tool settings
There are now 3 new menues on the left side of the topbar tool settings:
- Speed
- Tracking Settings
- Objects
Having the tracking speed menu now in the topbar makes more sense than
before, where it was located in the tracking settings.

The tracking presets are now located in left side of the topbar, next to
the tool settings. That way the presets are always accessible, even when
a different tool is active, which might be handy when using Detect
Features.
2021-07-14 13:42:59 +02:00
42a31482bf Merge branch 'master' into tracking_tools 2021-07-13 22:06:16 -04:00
Sebastian Koenig
72eb4aff7b Attempt to migrate Movie Clip Editor to new tool system
Here's my monkey-code like attempt to migrate the current clip editor to the tool system we use in the rest of Blender.
I am trying to implement what is suggested here: https://developer.blender.org/T83612
It's a work in progress, but some things are working already.

{F9602862}
{F9602876}

Differential Revision: https://developer.blender.org/D10198
2021-07-13 17:27:08 +02:00
27 changed files with 1140 additions and 330 deletions

View File

@@ -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)),

View File

@@ -17,6 +17,7 @@ _modules = [
"file",
"geometry_nodes",
"image",
"mask",
"mesh",
"node",
"object",

View 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,
)

View File

@@ -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()

View File

@@ -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"

View File

@@ -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,

View File

@@ -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="")

View File

@@ -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':

View File

@@ -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,
)

View File

@@ -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);

View File

@@ -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;
}
}
}
}
}
}
}
}
}

View File

@@ -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,

View File

@@ -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,

View File

@@ -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);
}

View File

@@ -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");
}
/** \} */

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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",

View File

@@ -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);

View File

@@ -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)

View File

@@ -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).
*/

View File

@@ -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";