Commit Graph

116108 Commits

Author SHA1 Message Date
Sergey Sharybin
e4bf58e285 Tracking: Image from Plane Marker operators
There are two operators added, which are available via a special
content menu next to the plane track image selector:

- New Image from Plane Marker
- Update Image from Plane Marker

The former one creates an image from pixels which the active plane
track marker "sees" at the current frame and sets it as the plane
track's image.

The latter one instead of creating the new image data-block updates
the image in-place.

This allows to create unwarped texture from a billboard from footage.
The intent is to allow this image to be touched up and re-projected
back to the footage with an updated content.

Available from a plane track image context menu, as well as from the
Track menu.

{F13243219}

The demo of the feature from Sebastian Koenig: https://www.youtube.com/watch?v=PDphO-w2SsA

Differential Revision: https://developer.blender.org/D15312
2022-07-01 09:44:07 +02:00
Sergey Sharybin
72b9e07cf2 Add helper function to replace buffer of a single-frame image
Very similar to BKE_image_add_from_imbuf with the exception that no
new image data-block is created, but instead the given one is modified.
2022-07-01 09:44:07 +02:00
Sergey Sharybin
dfa5bd689e Fix possible wrong image color space when it is created from image buffer
From quick look it doesn't seem to be leading to real issues yet as the
image buffers are created with the default roles, but valid color space
is needed to be ensured for an upcoming development.
2022-07-01 09:44:07 +02:00
Sergey Sharybin
c922b9e2c1 Fix image-from-imbuf resulting in invalid image configuration
The image which source is set to file is not expected to have empty
file path. If it happens it becomes very tricky to save the image on
exit using the standard quit dialog.

This change makes it so if the image buffer does not have file path
then the new image is set to the "generated" source and it behaves
as if the image was created like so and was fully painted on.

Additionally, mark image as dirty, so that quitting Blender after
such image was added will warn about possible data loss.
2022-07-01 09:44:07 +02:00
Sergey Sharybin
b872ad037a Fix T99315: Unit plane track deform compositor node leads to unnecessary blur 2022-07-01 09:42:48 +02:00
Richard Antalik
16264aebe6 Fix sequencer transform test failing.
Issue was caused by using function `SEQ_render_give_stripelem` to obtain
first `StripElem`, but this function now takes retiming into account.

Since first element was meant to be obtained, point to it directly by
using `seq->strip->stripdata`.
2022-07-01 09:02:07 +02:00
Campbell Barton
b1d3b14711 Fix crash when creating an off-screen context fails in Wayland
This is very unlikely to happen but better not to crash.
2022-07-01 15:33:51 +10:00
Campbell Barton
650a15fb9b Fix accessing windows from surfaces in Wayland
This is a follow up to [0], where it was assumed flushing the output
would run the appropriate leave handlers & clear the keyboard & pointer
surfaces. While that's mostly true it's not guaranteed.

Resolve this by clearing the pointers when closing windows and add NULL
checks before accessing the windows.

Tested with Gnome, KDE & River compositors.

[0]: 58ccd8338e53423e223085094af2d35c76285c30
2022-07-01 15:16:45 +10:00
Hans Goudey
bd7b181e10 Cleanup: Remove outdated comments
Point clouds always use geometry_set_eval, and so do volumes.
2022-06-30 21:52:04 -05:00
Hans Goudey
df8d96ab66 Cleanup: Remove unnecessary includes from geometry nodes header 2022-06-30 21:51:13 -05:00
Hans Goudey
276e419671 Curves: Avoid initializing offsets when first allocated
The offsets array that encodes the sizes of each curve must be filled
anyway, or the curves will be in an invalid state. Calloc is unnecessary
here. To make that situation clearer, fill the offsets with -1 in debug
builds. Always set the first offset to zero though, since that can save
some boilerplate in other areas.
2022-06-30 21:42:09 -05:00
Hans Goudey
7e55ff15b0 Fix: Incorrectly sized curves created in set conversion node
The number of points in the source curve was needed, but the offset
(just zero) was passed instead. It's unclear how this worked before.
A mistake in the recent commit 9e393fc2f12583d32dd.

Also use a common utility for retrieving the sizes of curves
in ranges instead of reimplementing it for this file.
2022-06-30 21:33:11 -05:00
Campbell Barton
3d3ba9ca8e Cleanup: group public utility functions for Wayland System/Window
GHOST methods were mixed in with Wayland specific utility functions,
making it difficult to navigate or know where to add new functions.
2022-07-01 11:19:01 +10:00
Campbell Barton
cf64a1d73e Cleanup: spelling in comments 2022-07-01 11:18:58 +10:00
Campbell Barton
90f4b35bc2 Cleanup: remove unused argument 2022-07-01 11:18:56 +10:00
Hans Goudey
c15ae2e87b Fix: Correct attribute names in resample curves code 2022-06-30 19:30:06 -05:00
Hans Goudey
4206b30275 Curves: Adjust "for each curve by type" utility
The first change is reusing the same vector for all types. While we don't
generally optimize for the multi-type case, it doesn't hurt here. The
second change is avoiding calling the corresponding function if there
are no curves of a certain type. This avoids creating attributes for
types that aren't used, for example.
2022-06-30 19:29:32 -05:00
Hans Goudey
32e9c9802e Cleanup: Add assert for customdata realloc size
This gives a more clear error than finding the error with the signed
to unsigned conversion for size_t.
2022-06-30 19:27:41 -05:00
Hans Goudey
6161ce6e5d Cleanup: Add assert for unsupported legacy curve type 2022-06-30 19:26:51 -05:00
Hans Goudey
982d6589a8 Cleanup: Remove duplicate include 2022-06-30 19:25:44 -05:00
Hans Goudey
a69e5c2348 Cleanup: Avoid assigning constructed VArray to reference
This is clearer about what is actually happening (VArray is small
enough to be a by-value type and is constructed on demand, while
only the generic virtual array is stored).
2022-06-30 19:17:32 -05:00
Hans Goudey
95055af668 Fix T99309: Duplicate elements deletes instance attributes
The node had incorrect handling of instance attributes. For the instance
component, instead of using the instance domain over the point domain,
it just looked through instances recursively when retrieving attributes.
We never want to do that, since we only work on one geometry at a time.
Instead, just switch out the instance domain for the point domain like
the set position node.
2022-06-30 19:01:02 -05:00
Gaia Clary
106d937a4e COLLADA: Support for alpha color in vertex data.
Many thanks to the original Author of this patch: Christian Aguilera

The COLLADA importer was silently ignoring the alpha component in the
vertex data.

The `stride` variable holds the component count (3 for RGB; 4 for RGBA),
and can be used for honouring the alpha channel in the vertex data.

Test plan:
- Open Blender.
- Clear the scene.
- Add a plane.
- Enter **Vertex Paint** mode.
- Switch to the **Erase Alpha** blending mode.
- Select a tone of gray.
- Turn strength down to less than 1
- Paint [some of] the vertices of the plane.
- Export project as a COLLADA file (`.dae`).
- Clear the scene.
- Re-import the COLLADA file again.
- Export the project again (with different name).

**Without** this patch, the second exported project will have lost the
alpha component in their vertex data:

```lang=xml, counterexample
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1</float_array>
```

**With** the patch, the first and the second exported projects retain
the alpha values painted previously:

```lang=xml
<float_array id="Plane-mesh-colors-Col-array" count="24">1 1 1 1 1 1 1 0.5490196 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.5490196</float_array>
```

Reviewed By: cristian64, SonnyCampbell_Unity
Authored by: Christian Aguilera

Differential Revision: https://developer.blender.org/D14246
2022-06-30 23:13:37 +02:00
Clément Foucault
f18067aa03 EEVEE-Next: Add Film and RenderBuffers module
This modules handles renderpasses allocation and filling. Also handles
blitting to viewport framebuffer and render result reading.

Changes against the old implementation:
- the filling of the renderpasses happens all at once requiring
  only 1 geometry pass.
- The filtering is optimized with weights precomputed on CPU and
  reuse of neighboor pixels.
- Only one accumulation buffer for renderpasses (no ping-pong).
- Accumulation happens in one pass for every passes using a single
  dispatch or fullscreen triangle pass.

TAA and history reprojection is not yet implemented.
AOVs support is present but with a 16 AOV limit for now.
Cryptomatte is not yet implemented.
2022-06-30 22:45:42 +02:00
Richard Antalik
a9696f04a0 Fix T90964: Strip can't be deleted if cursor is at bottom of timeline
Caused by hard-coded width of markers region causing operator to pass
through.

Execute operator if there are no markers.
2022-06-30 20:45:37 +02:00
Brecht Van Lommel
fbcc00d10d Fix broken Cycles performance benchmark after recent logging changes
Ensure full render report is printed with default verbosity.
2022-06-30 19:51:50 +02:00
Julian Eisel
c9795102c2 Fix build error with Alembic after 65166e145b4d 2022-06-30 19:47:21 +02:00
Julian Eisel
e7c58941b1 Fix pointer to pointer passed where single pointer is expected (VSE versioning) 2022-06-30 18:42:22 +02:00
Julian Eisel
65166e145b Cleanup: Remove scene frame macros (CFRA et al.)
Removes the following macros for scene/render frame values:
- `CFRA`
- `SUBFRA`
- `SFRA`
- `EFRA`

These macros don't add much, other than saving a few characters when typing.
It's not immediately clear what they refer to, they just hide what they
actually access. Just be explicit and clear about that.
Plus these macros gave read and write access to the variables, so eyesores like
this would be done (eyesore because it looks like assigning to a constant):
```
CFRA = some_frame_nbr;
```

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D15311
2022-06-30 18:38:44 +02:00
Richard Antalik
66de653784 Fix incorrect strip position if pitch was animated
Commit 302b04a5a3fc introduced new retiming system, that unified sound
pitch animation with strip speed control. Because sound playback is
handled in different way, this did not work as expected and old files
were broken. In addition animation was not copied to new property.

Revert length position and offset handling for sound strips so their
position does not change and remap fcurves to new `speed_factor`
property.
2022-06-30 18:33:34 +02:00
Patrick Huang
79fe27b976 Fix T96429: outliner tooltip inconsistent with behavior when linking collections
Previously, it would show "Link inside collection" but move between collections
instead in some cases. Additionally there was no tooltip for the "Link before/
after/between collections" case.

Behavior and tooltip should now be consistent in all cases.

Differential Revision: https://developer.blender.org/D15237
2022-06-30 17:19:48 +02:00
Brecht Van Lommel
34e04ccde2 Cleanup: fix compiler warnings
"override" should be used either for all methods or none, otherwise Clang gives
warnings. Adding it for all platforms is a bigger change.
2022-06-30 17:17:25 +02:00
Patrick Mours
ef268c7893 Build: Fix build of library dependencies on Linux aarch64
rBb9c37608a9e959a896f5358d4ab3d3d001a70833 moved evaluation of
`versions.cmake` before `options.cmake`, as a result of which
`BLENDER_PLATFORM_ARM` was no longer defined in `versions.cmake`,
causing it to choose the wrong OpenSSL version for aarch64. This
reverts that. Also fixes a compiler crash when building flex with some
glibc versions.

Differential Revision: https://developer.blender.org/D15319
2022-06-30 16:49:42 +02:00
Andrii Symkin
f00d9e80ae Cycles: add more math functions for float4
Add more math functions for float4 to make them on par with float3 ones. It
makes it possible to change the types of float3 variables to float4 without
additional work.

Differential Revision: https://developer.blender.org/D15318
2022-06-30 16:25:21 +02:00
Richard Antalik
6bb703a9ee Fix T99266: Crash when dragging file to VSE from file browser
Crash happened because sequencer data was not initialized. Ensure data
is initialized before adding strip.
2022-06-30 15:56:08 +02:00
Campbell Barton
8bf9d482da Cleanup: colon after params, move text into public doc-strings, spelling 2022-06-30 23:48:22 +10:00
Campbell Barton
58ccd8338e GHOST/Wayland: clarify window access from surfaces
It wasn't obvious when direct access or lookups should be used.

Add class methods for direct lookups as well as searching from known
windows when windows are accessed outside Wayland's handlers.

This avoids having to check if the window has been removed in some cases.
2022-06-30 23:46:57 +10:00
Campbell Barton
7c98632289 GHOST/Wayland: use flush instead of roundtrip
Using flush avoids handling new events which complicates logic here.
2022-06-30 23:46:57 +10:00
Campbell Barton
cfd087673d Fix key/dnd event handling accessing freed memory under Wayland
Closing a window could leave danging pointers which Wayland
callbacks are responsible for clearing.

However, any calls Blender makes that don't originate from Wayland's
handlers don't have that assurance (key-repeat in this case).

Resolve by using a window lookup on each key-repeat event.
2022-06-30 23:46:57 +10:00
Campbell Barton
1cf64434ed Fix accessing cursor position for GHOST/Wayland
GHOST_GetCursorPosition wasn't working properly under Wayland because
the last focused window didn't necessarily match the window used to call
wm_cursor_position_get(..).

Now the window passed into wm_cursor_position_get is passed to GHOST
so that window is used to access cursor coordinates.
2022-06-30 23:46:57 +10:00
Campbell Barton
6bd2c6789b GHOST: get/set cursor position now uses client instead of screen coords
Use client (window) relative coordinates for cursor position access,
this only moves the conversion from window-manager into GHOST,
(no functional changes).

This is needed for fix a bug in GHOST/Wayland which doesn't support
accessing absolute cursor coordinates & the window is needed to properly
access the cursor coordinates.

As it happens every caller to GHOST_GetCursorPosition was already making
the values window-relative, so there is little benefit in attempting to
workaround the problem on the Wayland side.

If needed the screen-space versions of functions can be exposed again.
2022-06-30 23:46:57 +10:00
Campbell Barton
df40e9d0aa Fix memory leak with off-screen buffers under Wayland
Each off-screen buffer created a surface and EGL window which was
only freed when Blender exited.

Resolve by freeing the associated data when disposing the off-screen
context.
2022-06-30 23:46:57 +10:00
Campbell Barton
e190b70946 Cleanup: declare GHOST/Wayland methods const
Needed when called by functions that are const too.
2022-06-30 23:46:57 +10:00
Campbell Barton
e75f3e3feb Cleanup: use "use_" prefix for boolean property 2022-06-30 23:46:57 +10:00
Campbell Barton
90ccb71969 Fix missing argument, avoid instancing function call in macro 2022-06-30 23:44:13 +10:00
Richard Antalik
547efb6b1e Fix T99133:animating multiply factor on video strips crashes blender
Crash caused by `effect_seq->len` being 0, so frame map was not built.

Get length in timeline using handle positions.
2022-06-30 15:31:58 +02:00
Amélie Fondevilla
92d7f9ac56 Animation: Add GP layers in regular Dopesheet
Grease Pencil animation channels are now also shown in the Dopesheet
mode of the Dopesheet editor and in the Timeline.

Grease pencil related events are now listened not only by container
`SACTCONT_GPENCIL` (Grease Pencil Dopesheet), but also
`SACTCONT_DOPESHEET` (main Dopesheet), and `SACTCONT_TIMELINE`
(timeline).

A new Animation Filter flag was added: `ANIMFILTER_FCURVESONLY`. For now
this only filters out Grease Pencil Layer channels.

**Implemented:**

- Preview range set: now only considers selected Grease Pencil keyframes
  when `onlySel` parameter is true. Not only this allows the operator to
  work with grease pencil keyframes in main dopesheet, but it also fixes
  the operator in the Grease Pencil dopesheet.
- Translation: allocation (and freeing) of specific memory for
  translation of Grease Pencil keyframes.
- Copy/Paste: call to both Fcurve and GPencil operators, to allow for
  mixed selection. Errors are only reported when both the FCurve and
  GPencil functions fail to paste anything.
- Keyframe Type change and Insert Keyframe: removed some code here to
  unify Grease Pencil dopesheet and main dopesheet code.

- Jump, Snap, Mirror, Select all/box/lasso/circle, Select left/right,
  Clickselect: account for Grease Pencil channels within the channels
  loop, no need for `ANIMFILTER_FCURVESONLY` there.

**Not Implemented:**

- Graph-related operators. The filter `ANIMFILTER_FCURVESONLY` is
  naively added to all graph-related operators, meaning more-or-less all
  operators that used `ANIMFILTER_CURVE_VISIBLE`.
- Select linked: is for F-curves channel only
- Select more/less: not yet implemented for grease pencil layers.
- Clean Keys, Sample, Extrapolation, Interpolation, Easing, and Handle
  type change: work on Fcurve-channels only, so the
  `ANIMFILTER_FCURVESONLY` filter is activated

Graying out these operators (when no fcurve keyframe is selected) can be
done with custom poll functions BUT may affect performance. This is NOT
done in this patch.

**Dopesheet Summary Selection:**

The main summary of the dopesheet now also takes into account Grease
Pencil keyframes, using some nasty copy/pasting of code, as explained
[on devtalk](https://devtalk.blender.org/t/gpencil-layers-integration-in-main-dopesheet-selection-issue/24527).
It works, but may be improved, providing some deeper changes.

Reviewed By: mendio, pepeland, sybren

Maniphest Tasks: T97477

Differential Revision: https://developer.blender.org/D15003
2022-06-30 15:20:18 +02:00
Jacques Lucke
416aef4e13 Curves: New tools for curves sculpt mode.
This commit contains various new features for curves sculpt mode
that have been developed in parallel.

* Selection:
  * Operator to select points/curves randomly.
  * Operator to select endpoints of curves.
  * Operator to grow/shrink an existing selection.
* New Brushes:
  * Pinch: Moves points towards the brush center.
  * Smooth: Makes individual curves straight without changing the root
    or tip position.
  * Puff: Makes curves stand up, aligning them with the surface normal.
  * Density: Add or remove curves to achieve a certain density defined
    by a minimum distance value.
  * Slide: Move root points on the surface.

Differential Revision: https://developer.blender.org/D15134
2022-06-30 15:09:13 +02:00
Nate Rupsis
0f22b5599a Normalize Weights: use valid default Subset for current context
For the Normalize Weights operator, dynamically set the default 'Subset'
parameter so that it is applicable to the current context.

When the user's last use of Normalize Weights was set to "Deform Pose
Bones", and then tries to use the operator on a mesh without armature,
Blender would try to use the previous opertor properties and show an
error message. This is resolved by switching to `WT_VGROUP_ACTIVE` in
such cases.

Reviewed By: zanqdo, sybren

Maniphest Tasks: T95038

Differential Revision: https://developer.blender.org/D14961
2022-06-30 12:54:27 +02:00
Alexander Gavrilov
4a7e1c9209 Constraints: rename and refactor custom space initialization.
Rename and simplify the function for initializing the custom space,
avoiding the need for the calling code to be aware of the internals
of bConstraintOb. This patch should not change any behavior.

This was split off from D9732.

Differential Revision: https://developer.blender.org/D15252
2022-06-30 12:51:26 +03:00