Commit Graph

230 Commits

Author SHA1 Message Date
Richard Antalik a2e3005b42 Fix VSE view clamping not working
Clamping was set up, but `v2d->cur` was never actually modified.
2022-05-03 10:55:05 +02:00
Richard Antalik fd98403211 Fix T97733: Crash when adding new scene
Caused by NULL dereference if sequencer data does not exist.
2022-05-03 10:20:41 +02:00
Hans Goudey 2d7957727c Fix: Incorrect conversion from C bitfield syntax
Recent cleanups 9a8669ac81 and 1c790555a0
incorrectly interpereted the bitfield width syntax as a default
value. Also resolve two other compilation warnings.
2022-04-28 11:19:12 -05:00
Richard Antalik 17769489d9 VSE: Add option to limit timeline view height
When height is limited, it is defined by space occupied by strips,
but at least channels 1 to 7 will be always visible. This allows it to
easily overview timeline content by zooming out to maximum extent in Y
axis and panning in X axis.

More channels can be "created" on demand by moving strip to higher
channel. When strip is removed and highest channel becomes empty, view
will stay as is until it is moved down. Then new highest point is
remembered and it is not possible to pan upwards until strip is moved to
higher channel.

Limiting takes into account height of scrubbing and markers area as
well as scrollers. This means that when zoomed out to maximum extent,
no strips are obstructed by fixed UI element.

Fixes T57976

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D14263
2022-04-28 16:14:51 +02:00
Sebastian Parborg 77794b1a7b VSE: Add precise drag and drop and strip previews
This patch adds the drag and drop strip previews in the VSE.
It also adds two new functions to the drag and drop API.

1. "draw_in_view" for callbacks that wants to draw elements in local viewport coordinates
2. "on_drag_start" that can be used for prefetching data only once at the start of the drag.

Reviewed By: Julian, Campbell

Differential Revision: http://developer.blender.org/D14560
2022-04-28 12:55:51 +02:00
Richard Antalik 48f369d63a Fix: VSE channels region visible in preview
Hide region for preview and sequencer/preview combined view.
2022-04-22 02:51:10 +02:00
Richard Antalik 277fa2f441 VSE: Add channel headers
This patch adds channel region to VSE timeline area for drawing channel
headers. It is synchronizedwith timeline region. 3 basic features are
implemented - channel visibility, locking and name.

Channel data is stored in `SeqTimelineChannel` which can be top-level
owned by `Editing`, or it is owned by meta strip to support nesting.
Strip properties are completely independent and channel properties are
applied on top of particular strip property, thus overriding it.

Implementation is separate from channel regions in other editors. This
is mainly because style and topology is quite different in VSE. But
also code seems to be much more readable this way.

Currently channels use functions similar to VSE timeline to draw
background to provide illusion of transparency, but only for background
and sfra/efra regions.

Great portion of this patch is change from using strip visibility and
lock status to include channel state - this is facilitated by functions
`SEQ_transform_is_locked` and `SEQ_render_is_muted`

Originally this included changes in D14263, but patch was split for
easier review.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D13836
2022-04-04 12:56:43 +02:00
Julian Eisel 9b298cf3db RNA: Generate property declerations header, solving msg-bus C++ incompatibility
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.

This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc17367. Removes any such declarations and the related
FIXME comments.

Reviewed By: campbellbarton, LazyDodo, brecht

Differential Revision: https://developer.blender.org/D13837
2022-03-14 16:50:49 +01:00
Campbell Barton c434782e3a File headers: SPDX License migration
Use a shorter/simpler license convention, stops the header taking so
much space.

Follow the SPDX license specification: https://spdx.org/licenses

- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile

While most of the source tree has been included

- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
  use different header conventions.

doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.

See P2788 for the script that automated these edits.

Reviewed By: brecht, mont29, sergey

Ref D14069
2022-02-11 09:14:36 +11:00
Jeroen Bakker a21bca0e20 Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-26 11:12:35 +01:00
Jeroen Bakker 460e0a1347 Revert "Performance: Remap multiple items in UI"
This reverts commit 948211679f.
This commit introduced some regressions in the test suite.
As this change is a core part of blender Bastien and I decided to revert
it as the solution isn't clear and needs more investigation.

The following tests FAILED:
	 62 - blendfile_liblink (SEGFAULT)
	 63 - blendfile_library_overrides (SEGFAULT)

It fails in (id_us_ensure_real)
2022-01-25 15:31:46 +01:00
Jeroen Bakker 948211679f Performance: Remap multiple items in UI
During sprite fright loading of complex scenes would spend a long time in remapping ID's
The remapping process is done on a per ID instance that resulted in a very time consuming
process that goes over every possible ID reference to find out if it needs to be updated.

If there are N of references to ID blocks and there are M ID blocks that needed to be remapped
it would take N*M checks. These checks are scattered around the place and memory.
Each reference would only be updated at most once, but most of the time no update is needed at all.

Idea: By grouping the changes together will reduce the number of checks resulting in improved performance.
This would only require N checks. Additional benefits is improved data locality as data is only loaded once
in the L2 cache.

It has be implemented for the resyncing process and UI editors.
On an Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz 16Gig the resyncing process went
from 170 seconds to 145 seconds (during hotspot recording).

After this patch has been applied we could add similar approach
to references (references between data blocks) and functionality (tagged deletion).
In my understanding this could reduce the resyncing process to less than a second.
Opening the village production file between 10 and 20 seconds.

Flame graphs showing that UI remapping isn't visible anymore (`WM_main_remap_editor_id_reference`)
* Master {F12769210 size=full}
* This patch {F12769211 size=full}

Reviewed By: mont29

Maniphest Tasks: T94185

Differential Revision: https://developer.blender.org/D13615
2022-01-25 14:51:44 +01:00
Campbell Barton 61776befc3 Cleanup: move public doc-strings into headers for 'editors'
Ref T92709
2021-12-09 01:14:10 +11:00
Peter Fog 34370d9fdf VSE: Add drag and drop handler for preview area
For some users, dropping assets into preview area may be more practical
due to space constraints or it may be just more intuitive.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13311
2021-11-23 05:40:08 +01:00
Peter Fog b42494cf6b VSE: Support drag and drop for datablocks
For using the Outliner and/or the Asset Browser as scene independent
tools to organize a/v source material is necessary for the users to be
able to drag and drop data blocks into the VSE. This was also an
unfulfilled design target for the Outliner Gsoc project.

Datablocks won't be used directly. Path to file will be passed to strip
add operator instead.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D13304
2021-11-23 05:39:10 +01:00
Richard Antalik 9bdf3fa5f0 Fix T91724: Strip height is too limited
This change was introduced in 997b5fe45d, to not display pixelated
thumbnails. However when VSE timeline height is made smaller, this
limits strip height.

Change limit, so one strip can occupy full height of VSE timeline
2021-11-17 02:45:53 +01:00
Campbell Barton d753ebd40a Cleanup: spelling in comments 2021-11-11 14:59:30 +11:00
Campbell Barton 445361c2ac Fix T70768: Python gizmo-groups not working in the sequencer 2021-11-05 15:49:33 +11:00
Campbell Barton 69a7734b75 UI: always show the cursor while transforming the cursor 2021-11-02 19:35:17 +11:00
Richard Antalik 33d6d7c6e3 VSE: Add 2D cursor overlay option
Since 2D cursor will be used rarely in VSE and it is adding visual
noise, it will be hidden by default.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12933
2021-10-21 07:49:12 +02:00
Campbell Barton e538b2c3a3 Cleanup: internal sequencer naming for overlays
- Rename RNA SpaceSeq.show_strip_overlay to show_overlays
  matching the 3D View, the term "strip" was misleading as this is used
  for the preview as well.

- Rename various RNA overlay settings to overlay_frame
  since "Frame Offset" is a specific feature, avoid having both
  Editor.show_overlay and SpaceSeq.show_overlays.

- Rename Editing `over_*` -> `overlay_frame_*` in DNA,
  as well as flags.
2021-10-18 15:47:28 +11:00
Dalai Felinto 6e92a2d591 Cleanup: make format (VSE) 2021-10-11 10:10:54 +02:00
Richard Antalik 27ac80f068 VSE: rename flag for Frame Overlay feature
Rename `SEQ_EDIT_OVERLAY_SHOW` to `SEQ_EDIT_USE_FRAME_OVERLAY` to avoid
confusion between `SEQ_SHOW_OVERLAY` of `SpaceSeq.flag`
2021-10-09 08:41:07 +02:00
Richard Antalik 13df8616ce VSE: Fix 2D cursor not visible
This was caused by confusing naming of frame overlay feature.
Correct flag to use is `sseq->flag & SEQ_SHOW_OVERLAY`, not
`ed->over_flag & SEQ_EDIT_OVERLAY_SHOW`.
2021-10-09 08:41:07 +02:00
Campbell Barton 741fb0d6c9 Sequencer: hide gizmos & cursor during scrubbing & playback
This was distracting prevented easily viewing an animation.
2021-10-08 18:06:50 +11:00
Campbell Barton ebe216f532 Sequencer: add option to toggle gizmos
Use shortcut matching the 3D view & popover in the header
2021-10-08 17:07:56 +11:00
Campbell Barton 8f4697e570 Sequencer: only show the 2D cursor with overlays enabled
Also hide when displaying scopes.
2021-10-08 13:20:19 +11:00
Campbell Barton 2f9fab716d Cleanup: remove deprecated SEQ_DRAW_SEQUENCE value
While drawing cleared this value (as part of temporary fix from 2009),
this was still being checked until recently.

Remove this value in versioning code.

Also clear unused text space flag.
2021-10-08 13:15:19 +11:00
Campbell Barton d04d27b406 Sequencer: 2D cursor for the preview & transform
- Use 2D cursor in the preview space using shortcuts
  matching the UV editor and 3D view.
- Add Cursor tool, cursor transform.
- Support for cursor and bound-box pivot.
- Add pivot pie menu.
2021-10-08 03:27:55 +11:00
Falk David 5cebcb415e VSE: Add color tags to strips
This patch adds color tags to VSE strips, an overlay option to toggle the colors
on and off, a section in the theme settings to define the 9 possible colors and
two ways of changing the color tag through the UI. You can change the color
through the right-click context menu, or in the strip side panel next to the
strip name.

Color tags are defined in user preferences and they can be disabled in overlay
settings.

Reviewed By: campbellbarton, ISS

Differential Revision: https://developer.blender.org/D12405
2021-09-29 14:34:01 +02:00
Campbell Barton 4cf4bb2664 UI: swap tool and regular header
Swap the tool-header and header order so the tool-header
so the header is always next to the window edge.

Note that files saved in 3.0 will have overlapping headers when opened
in any version of Blender before this commit.

Reviewed By: Severin, fsiddi

Maniphest Tasks: T91536

Ref D12631
2021-09-29 20:03:47 +10:00
Campbell Barton ba313f8a74 Fix crash duplicating sequencer area
Error in 997b5fe45d.
2021-09-22 17:37:10 +10:00
Aditya Y Jeppu 997b5fe45d VSE strip thumbnails
Draw thumbnails as strip overlay. This works for movie and image strips.
To draw thumbnails, this overlay has to be enabled and strips must be
tall enough.

The thumbnails are loaded from source file using separate thread and
stored in cache.

Drawing code uses only images stored in cache, and if any is missing,
background rendering job is started. If job can not render thumbnail,
to prevent endless loop of creating job for missing image it sets
`SEQ_FLAG_SKIP_THUMBNAILS` bit of `Sequence` flag.

To prevent visual glitches during timeline panning and zooming, `View2D`
flag `V2D_IS_NAVIGATING` is implemented. If bit is set, drawing code
will look for set of evenly distributed thumbnails that should be
guaranteed to exist and also set of previously displayed thumbnails.
Due to volatile nature of cache these thumbnails can be missing anyway,
in which case no new thumbnails will be drawn for particular strip.

Cache capacity is limited to 5000 thumbnails and performs cleanup of
non visible images when limit is reached.

ref T89143

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12266
2021-09-21 10:55:04 +02:00
Richard Antalik fa2c1698b0 VSE: Image transform tools
Add tools for image manipulation in sequencer preview region.

This includes:
- Translate, rotate and resize operators, tools and gizmos
- Origin for image transformation
- Median point and individual origins pivot modes
- Select and Box select operator works in preview
- Image overlay drawing

ref T90156

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12105
2021-09-21 10:55:04 +02:00
Richard Antalik 7cb65e4581 Cleanup: Refactor VSE overlay settings
Move overlay flags into SequencerPreviewOverlay and
SequencerTimelineOverlay structs.

Reviewed By: campbellbarton

Differential Revision: https://developer.blender.org/D12569
2021-09-20 16:30:15 +02:00
Campbell Barton cea24b4b4a Cleanup: use "free_data" suffix when the argument isn't freed
Avoid API misuse that caused leaks in T90791 &
2788b0261c.
2021-08-20 16:37:50 +10:00
Jeroen Bakker d60a7a8744 WindowManager: Support Dynamic tooltips when dragging.
Originally the operator name was drawn next to the dragging content.
After that there was an option to add custom, static text with the
dragging content. This patch allows dynamic text to be drawn.

The custom text was implemented as out parameter of the poll function
what made the code unclear. This patch introduces a tooltip function
that separates tooltip generation from the poll function.

NOTE: the text should always be returned in its own memory block. This
block will be freed after it is copied in the drag struct.

Reviewed By: Severin

Differential Revision: https://developer.blender.org/D12104
2021-08-02 15:13:21 +02:00
Richard Antalik 0491052a96 VSE: Change grid line drawing
Add overlay option to disable grid drawing.
Reuse drawing code from other editors (timeline editor)
Add argument `display_minor_lines` to function
`UI_view2d_draw_lines_x__discrete_frames_or_seconds`
This way minor line drawing can be disabled and so it doesn't cause
too much visual noise. Also spacing seems to be too fine, so VSE uses 3x
what is defined in preferences.

Reviewed By: fsiddi, Severin

Differential Revision: https://developer.blender.org/D11790
2021-07-29 11:38:43 +02:00
Julian Eisel e81fca1ed3 Assets: Remove appended asset when dropping operation fails
When dropping an asset somewhere, it is appended and then a drop operation is
called to actually add it to the scene based on current context. If this drop
operation fails, the appended data-block is now still in the .blend. The user
may not notice and not expect this.
Instead idea is to rollback any changes done by dropping code if the operation
fails, namely removing the appended data-block again.

Adds a new `cancel()` callback which is called if the drop operator returns
`OPERATOR_CANCELLED` to drop-boxes and a generic function to deal with assets
on drop failure.

Also removes the `free_id_on_error` property of the `NODE_OT_add_group`
operator, which was used as ad-hoc solution to get this same behavior.
2021-02-16 15:34:32 +01:00
Campbell Barton bdb42c2c2d Cleanup: remove redundant headers in source/blender/editors/
Remove redundant headers using
`./source/tools/utils_maintenance/code_clean.py`

Reviewed By: jmonteath

Ref D10364
2021-02-10 09:38:24 +11:00
Campbell Barton 17e1e2bfd8 Cleanup: correct spelling in comments 2021-02-05 16:23:34 +11:00
Campbell Barton 2fa7e81d9c Cleanup: use 'const' argument for parameter argument 2021-01-19 12:59:00 +11:00
Hans Goudey 09c7c63890 UI Code Quality: Use "params" struct for area and region callbacks
These functions with many arguments can be unwieldy. Aside from the obvious issues
with rewriting the list of arguments and the opportunities for error and frustration
that presents, the long list of arguments make these systems hard to change. So when
an argument should be added, someone might skip that and add some hack instead.

So, as proposed in T73586#1037210, this patch instead uses a "params" struct for
each of these callbacks.

- Use param argument for `ARegionType.listener`
    - Remove unused window field in region listener
- Use param argument for `SpaceType.listener`
- Use params struct for `ARegionType.message_subscribe`

Differential Revision: https://developer.blender.org/D9750
2021-01-18 17:28:47 -06:00
Richard Antalik a5a302bd18 Cleanup: Split SEQ_sequencer.h file 2020-12-19 07:25:01 +01:00
Richard Antalik 046ca0749a Cleanup: Rename BKE_sequencer functions
API functions get SEQ_ prefix.
Intern functions get seq_ prefix

Functions also have appropriate category included in name.
2020-12-19 06:29:15 +01:00
Campbell Barton 588f107f11 Cleanup: clang-format 2020-12-16 16:13:05 +11:00
Peter Fog fad80a95fd VSE: Add Overlay popover panels
Add panels with overlay settings for strips and preview and overlay
enable/disable button.

Entries from the View menus moved to the overlay panels, which will
simplify cluttered View menus.

Additional options have been added:
 - Strip Name
 - Strip Source(ex. path)
 - Strip Duration

So users can now select what info they need to see on the strips. When
No text is displayed, waveforms are drawn in full height.

Reviewed By: ISS, HooglyBoogly, pablovazquez

Differential Revision: https://developer.blender.org/D9751
2020-12-15 23:50:18 +01:00
Richard Antalik ea1c5a6c15 Rename BKE_sequencer.h
Reviewed By: sergey

Differential Revision: https://developer.blender.org/D9349
2020-11-01 21:10:36 +01:00
Sybren A. Stüvel 90a27d5aa9 Cleanup: Use enum for return values in context callbacks
Define enum `eContextResult` and use its values for returns, instead of
just returning 1, 0, or -1 (and always having some comment that explains
what -1 means).

This also cleans up the mixup between returning `0` and `false`, and `1`
and `true`. An inconsistency was discovered during this cleanup, and
marked with `TODO(sybren)`. It's not fixed here, as it would consititute
a functional change.

The enum isn't used everywhere, as enums in C and C++ can have different
storage sizes. To prevent issues, callback functions are still declared
as returning`int`. To at least make things easier to understand for
humans, I marked those with `int /*eContextResult*/`.

This is a followup of D9090, and is intended to unify how context
callbacks return values. This will make it easier to extend the approach
in D9090 to those functions.

No functional changes.

Differential Revision: https://developer.blender.org/D9095
2020-10-02 18:56:25 +02:00
Sybren A. Stüvel fb5e2f5610 Cleanup: Clang-Tidy bugprone-incorrect-roundings fixes
Should cause no noticeable difference.
2020-09-04 16:23:08 +02:00