Commit Graph

120055 Commits

Author SHA1 Message Date
Christoph Lendenfeld
8a79212031 Anim: thread remake_graph_transdata
On animations with high key counts, `remake_graph_transdata`
takes most of the compute time when moving keys.
This patch threads the loop over FCurves in that function to speed things up.

Test file with 10.000 keys per F-Curve
| - | Before | After |
| - | - | - |
| Moving 1 key of each FCurve |  ~2200ms | ~285ms |
| Moving a single key | ~0.70ms | ~0.72ms |

As demonstrated in the measurements, this speeds up the
case of modifying a lot of data, while not impacting the case
of modifying very little data.
The measurements were taken on an 8c/16t CPU.
The higher the thread count, the better the performance gain.

Measurements of `remake_graph_transdata` using the following test file.
https://download.blender.org/ftp/sybren/animation-rigging/heavy_mocap_test.blend

Pull Request: https://projects.blender.org/blender/blender/pulls/119497
2024-04-09 11:46:05 +02:00
Christoph Lendenfeld
956d8379a4 Anim: Detailed report if no keyframes have been inserted
With this PR, when pressing `I` in the viewport and the code
is unable to insert **ANY** keyframes, the user will be presented
with a single message detailing exactly why it has failed.

This PR promotes the functionality introduced in
#117449 into the header file so it can be used elsewhere.

The `CombinedKeyingResult` class is returned
from `insert_key_action` and `insert_key_rna`, and
used to produce a single report from the operator if it
failed to insert any keyframes.

In order to easily create a report from a `CombinedKeyingResult`
the function `generate_keyframe_reports_from_result`
has been moved into the class as `generate_reports`.

In addition to that the `UNABLE_TO_INSERT_TO_NLA_STACK` result
has been added. This notifies the user if keyframe insertion is not
possible due to NLA stack settings.

Pull Request: https://projects.blender.org/blender/blender/pulls/119201
2024-04-09 09:39:13 +02:00
Campbell Barton
38e4e9c68b Fix potential null pointer dereference from the RenderView::imbuf
This member is checked for null elsewhere, account for a null imbuf
when accessing pixels too.
2024-04-09 14:07:17 +10:00
Campbell Barton
6776d68f5e Cleanup: avoid shadowing variables 2024-04-09 14:07:17 +10:00
Campbell Barton
ea7657511c Cleanup: promote to size_t before calculating sizes
Avoids integer truncation although it's mostly theoretical in this case.
2024-04-09 14:06:37 +10:00
Campbell Barton
e01525cf2c Cleanup: remove redundant variables & assignments
Co-authored-by: Sean Kim <SeanCTKim@protonmail.com>
2024-04-09 13:52:41 +10:00
Campbell Barton
5741632e7c Cleanup: quiet missing-declarations warnings 2024-04-09 13:52:41 +10:00
Jesse Yurkovich
509a7870c3 Collection Exporters: Enable file exporters to be specified on Collections
This implements the ability to have file exporters added and configured on Collections.

Exporting is reachable from several locations:
- Individually on each exporter configuration: The `Export` button in each panel header
- For all exporters on the collection: The `Export All` button in the main panel interface
- For all exporters on all collections in the scene: The `File`->`Export All Collections` button

Visibility of which collections currently have exporters configured is done by ways of an icon added to the Collection row in the Outliner.

Adding multiple exporters for the same file type is permitted. The user is free to setup several exports of the same format but with different file locations or settings etc.

Notes:
Only USD and Wavefront OBJ are enabled for the initial commit. Additional formats, including those implemented in Python will be added as separate commits after this.

Ref #115690
Pull Request: https://projects.blender.org/blender/blender/pulls/116646
2024-04-08 22:10:39 +02:00
Clément Foucault
2d3368f5bf EEVEE-Next: Fix performance regression
The SAFE_UNION_ACCESS is always defined.
The correct check is to test for its value.

Fix DATA_MEMBER declaration too.
2024-04-08 20:06:39 +02:00
Sybren A. Stüvel
452c753023 Anim: change label & description of experimental flag again
Change the experimental flag "New Animation System" to "New Animation
Data-block", as that's really what it is about. The tooltip is now also
more precise about what this experimental stage is about.
2024-04-08 17:46:50 +02:00
Sybren A. Stüvel
26c5881cc2 Anim: change experimental flag label & linked issue on Gitea
Changed the experimental flag label from "Animation: Project Baklava" to
"New Animation System" to be more self-explanatory. Also I changed the
associated item on project.blender.org to #120406, which tracks the work
that is still to be done.
2024-04-08 17:34:11 +02:00
Omar Emara
3a551a859a Compositor: Allow inter-operation canceling
This patch adds support for inter-operation canceling. Though it should
be noted that canceling will actually not take place except in certain
circumstances because operations are already submitted to the GPU by
this point and can't be canceled.

However, for operations that do CPU<->GPU transfers, like OIDN denoise,
which is one of the most expensive operations, this will actually cancel
the evaluation and greatly improve interactivity.

Pull Request: https://projects.blender.org/blender/blender/pulls/119917
2024-04-08 16:23:58 +02:00
Iliya Katueshenock
942ca6be6d Fix #120071: quadratic complexity for dangling reroute check
To know if link is connected to dangling reroute and can be skipped
as value-less, we need to know if reroute is dangling. This requires
graph traversal. Currently this is done by non-recursive iteration.
But this can lead quadratic complexity for some of the cases.
Other way is to make this linear while cache building.

Pull Request: https://projects.blender.org/blender/blender/pulls/120375
2024-04-08 16:19:40 +02:00
Campbell Barton
2b595e7bcc Cleanup: quiet missing-declarations warnings 2024-04-08 21:57:41 +10:00
Pratik Borhade
782d096905 Fix #120374: Knife crashes when displaying measurements
Caused by 7ed02da2be.
`curr.ob_index` is -1 when the ray does not hit any face
(`knife_find_closest_face`). This will lead to crash when mouse
is not over any faces. To avoid crash, use `bvh.ob_index`.

Pull Request: https://projects.blender.org/blender/blender/pulls/120392
2024-04-08 13:31:54 +02:00
Jacques Lucke
936fb7488e Cleanup: move runtime data to Library.runtime
Having a better separation between runtime and non-runtime data makes
it easier to reason about the code.

Pull Request: https://projects.blender.org/blender/blender/pulls/120271
2024-04-08 13:08:36 +02:00
Sybren A. Stüvel
694e5b50f4 Anim: show animated properties with the appropriate color in the GUI
Use the `Animation` data-block to find F-Curves, for drawing the
background color of properties in the GUI (green for 'animated', yellow
for 'keyed on this frame', etc.).

This assumes (correctly) that the `Animation` is limited to a single
layer with a single strip. As such, there is only one set of F-Curves
for every animated ID, which means that the correct F-Curve will be
found. This will need adjustment when the same property can have
multiple F-Curves (due to layers) or when an F-Curve may not be
applicable for each point in time (due to the use of finite strips).

Pull Request: https://projects.blender.org/blender/blender/pulls/118677
2024-04-08 12:53:32 +02:00
Sybren A. Stüvel
631f72265d Anim: add evaluation of Animation data-blocks
Include Animation data-block handling in Blender's animation evaluation
stack. If an `Animation` is assigned to an `ID`, it will take precedence
over the NLA and/or any `Action` that might be assigned as well.

For more info, see #113594.

Pull Request: https://projects.blender.org/blender/blender/pulls/118677
2024-04-08 12:53:32 +02:00
Sybren A. Stüvel
8879654dd0 Anim: allow inserting keys in Animation data-block
Allow inserting keys into Keyframe strips (which is the only type of
strip that is currently implemented).

Note that the data model is currently limited to a single layer, with a
single infinite strip. Because of this, the strip will not be shown in
any UI, as there is no way to manipulate it anyway.

Note that the inserted keys are not yet evaluated, so the animation
isn't visible in the 3D viewport yet. That's for an upcoming commit.

For more info, see #113594.

Pull Request: https://projects.blender.org/blender/blender/pulls/118677
2024-04-08 12:53:32 +02:00
Sybren A. Stüvel
13f3a81842 Anim: allow assigning Animation data-blocks
Expand the `AnimData` struct with an `Animation *` + an
`binding_stable_index` field, and properly handle those relations.

This also adds functionality for actually pointing animated IDs to
`Animation` data-blocks, and automatically hooking up the relevant
`Binding`.

The Depsgraph code is extended to take these new relations into account,
but doesn't trigger any animation evaluation yet.

For more info, see #113594.

Pull Request: https://projects.blender.org/blender/blender/pulls/118677
2024-04-08 12:53:32 +02:00
Sybren A. Stüvel
38878b4ac2 Anim: add Animation data-block management functions
Add code (including RNA wrappers) for:

- Creating, removing, and accessing `Animation` data-blocks.
- Creating and removing layers, strips, and bindings on those `Animation`
  data-blocks.
- Accessing those via RNA.

Note that this does not include assignment to any animated data-block,
so it is of limited practical use.

For more info, see #113594.

Pull Request: https://projects.blender.org/blender/blender/pulls/118677
2024-04-08 12:53:32 +02:00
Iliya Katueshenock
f8efd4fad0 Fix #120367: Attach to root panel if new parent is null
If pointer to new parent is null, use pointer to root panel of interface.

Pull Request: https://projects.blender.org/blender/blender/pulls/120369
2024-04-08 12:42:34 +02:00
Campbell Barton
6b14b67a29 Cleanup: spelling in comments 2024-04-08 16:23:25 +10:00
Campbell Barton
27d8eb25bb Cleanup: pass const arguments in freestyle functions
Also move implementation notes into the funciton body.
2024-04-08 12:03:15 +10:00
Campbell Barton
430d7961a2 Cleanup: remove redundant checks & struct declaration 2024-04-08 12:03:08 +10:00
Campbell Barton
3c183e426a Cleanup: pass const arrays for default boolean arguments 2024-04-08 12:03:05 +10:00
Campbell Barton
bce2cf5f92 Cleanup: use const EnumPropertyItem pointers 2024-04-08 12:03:03 +10:00
Campbell Barton
76c7d1c66b Fix assert in the case of a null library_reference items
Missing return allowed a null return (which asserts) & ignored the
r_free assignment.
2024-04-08 12:03:00 +10:00
Harley Acheson
2d5a83f294 UI: Show Maximize Area on Asset Browser Header Context Menu
On the Header Context Menu, show "Maximize Area" for Asset Browser and
File Browser.

Pull Request: https://projects.blender.org/blender/blender/pulls/118060
2024-04-07 23:03:16 +02:00
Germano Cavalcante
727979c1a8 Fix #120366: Snap to Grid is affected by geometry occlusion
To maintain the previous and more useful behavior, disable the
occlusion test in the snap to gird.
2024-04-07 11:23:55 -03:00
Germano Cavalcante
115a925ffe Fix: Incremental snap not matching grid resolution
Caused by f0479e915f

`t->snap_spatial` is still required for Incremental snap.
2024-04-07 10:26:21 -03:00
Harley Acheson
e5e6aa0bbf UI: Menu Status Text Clears Incorrectly
When we open dropdown (and context) menus we often show "Press spacebar
to search..." or "Type to search..." in the status bar. The status text
is set when menus are opened, and cleared when closed, but this means
that they are cleared when closing a submenu. This PR corrects this to
only clear then the base menu is freed.

Pull Request: https://projects.blender.org/blender/blender/pulls/120351
2024-04-07 03:02:01 +02:00
Lukas Tönne
68060a9ccf GPv3: Implement UV rotation mode for the noise modifier
UV rotation in the noise modifier was a todo since UVs were not
supported yet at the time the modifier was added. This patch adds the
missing UV rotation feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/120336
2024-04-06 14:25:18 +02:00
Lukas Tönne
ee1714136e Fix #119554: Remove links to and from unsupported socket types
#114401 added forward compatibility code to remove unsupported socket
types and avoid crashing with unknown default_value data. However, this
did not update link pointers (which haven't been read at that point),
so the tree can end up with dangling pointers.

To fix this, removal of unsupported sockets is moved further back to a
point where links have been read and can be fixed accordingly.

Ported to main from #119630

Pull Request: https://projects.blender.org/blender/blender/pulls/119650
2024-04-06 11:23:53 +02:00
Hans Goudey
61b28227bb Fix #120309: Remove from Vertex Group operator broken
This check for whether there is vertex group data was mistakenly
reversed in b52a071e7a.
2024-04-05 13:41:59 -04:00
Pablo Vazquez
4e90501377 UI: Fix label in Particle System modifier
Fix two issues with the current label:
1. "particle tab" should be "Particles tab" since that's the actual name
    of the tab.
2. "Settings are in..." is inconsistent with similar labels where the
   word used is "inside" instead of "in".

Pull Request: https://projects.blender.org/blender/blender/pulls/120319
2024-04-05 18:50:57 +02:00
Harley Acheson
5bed08fc56 Fix #120133: Incorrect BG color Hovering Inactive
Hovering on inactive menu items combines the colors in a way that does
not work correctly with light themes. This PR changes nothing but how
colors are mixed for hover + inactive, doing so similarly to hovering
active.

Pull Request: https://projects.blender.org/blender/blender/pulls/120262
2024-04-05 18:08:45 +02:00
Clément Foucault
70bd907855 Fix: EEVEE-Next: Broken volume integration shader on Metal 2024-04-05 17:52:59 +02:00
Clément Foucault
4a7e98be40 EEVEE-Next: Volume: Fragment shader voxelization
This replaces the compute shader pass for volume material properties
voxelization by a fragment shader that is run only once per pixel.
The fragment shader then execute the nodetree in a loop for each
individual froxel.

The motivations are:
- faster evaluation of homogenous materials: can evaluate nodetree
  once and fast write the properties for all froxel in a loop.
  This matches cycles homogenous material optimization (except that
  it only considers the first hit).
- no invocations for empty froxels: not restricted to box dispach.
- support for more than one material: invocations are per pixel.
- cleaner implementation (no compute shader specific paths).

Implementation wise, this is done by adding a stencil texture when
rendering volumetric objects. It is populated during the occupancy
phase but it is not directly used (the stencil test is enabled but
since we use `imageAtomic` to set the occupancy bits, the fragment
shader is forced to be run). The early depth-test is then turned
on for the material properties pass, allowing only one fragment to
be invoked.
This fragment runs the nodetree at the desired frequency: once per
direction (homogenous), or once per froxel (heterogenous).

Note that I tried to use the frontmost fragment using a depth equal
test but it was failing for some reason on Apple silicon producing
flickering artifacts. We might reconsider this frontmost fragment
approach later since the result is now face order dependant when
an object has multiple materials.

Pull Request: https://projects.blender.org/blender/blender/pulls/119439
2024-04-05 16:33:58 +02:00
Philipp Oeser
5f23e0fa8d Fix #120012: 3D Viewport sidebar not updating when playback stops
Since d8388ef36a, updates were missing after stopping playback.
As a followup, c774cc0cc0 added a notifier which we can also listen to
from the sidebar.

Pull Request: https://projects.blender.org/blender/blender/pulls/120300
2024-04-05 16:26:27 +02:00
Philipp Oeser
bdf11c7344 Fix #120211: Dynamic paint surface format change resets surface type too
There is no need to reset this since most types are supported for both
formats:
- if format is image sequence: `Paint`, `Displace`, `Waves` are
supported
- if format is vertex: `Paint`, `Displace`, `Weight`, `Waves` are
supported

So the only combination that needs a reset is when we change from vertex
format (weight type) to image sequence.

Pull Request: https://projects.blender.org/blender/blender/pulls/120248
2024-04-05 16:25:50 +02:00
Julian Eisel
3e71cec988 Fix slightly increased layout height for tree-view item rows
Since 427bdc8dcf there is some trickery going on to make the underlying
view-item button slightly bigger, but that unintentionally also scaled
up the layout drawn on top of it. This would be visible whenever the
background is drawn, e.g. by using a different emboss type or when an
animated property was displayed.
2024-04-05 16:15:03 +02:00
Pratik Borhade
129d5a1067 Fix #120278: Anim properties are not highlighted in tree view
Animation state of any property is not colored in tree-view structure.
This is due to wrong emboss value. `widget_color_blend_from_flags`
returns correct theme value if emboss is not `UI_EMBOSS_NONE`.

`UI_EMBOSS_NONE_OR_STATUS` is preferred for animating properties.

Pull Request: https://projects.blender.org/blender/blender/pulls/120298
2024-04-05 16:13:04 +02:00
Jacques Lucke
619ab92c77 Cleanup: quiet warning 2024-04-05 15:38:49 +02:00
Falk David
1c0a278abd Fix: GPv3: Crash on conversion
This was introduced by d7230516c1.
The wrong API was used.
2024-04-05 15:34:26 +02:00
Falk David
d7230516c1 Cleanup: GPv3: Add drawing API for fill color
This adds two functions to the `Drawing` class: `fill_colors()`
and `fill_colors_for_write()`.
In places where the attribute API was used directly, these
functions are now used instead.

This is part of #119080. The point is that developers
shouldn't need to remember the name, type, default value,
and domain of built-in attributes (e.g. used by the renderer).

Pull Request: https://projects.blender.org/blender/blender/pulls/120296
2024-04-05 15:28:28 +02:00
Hans Goudey
3ed4e51437 Fix #117338: Texture paint sampling broken with modifiers
e64b3c8212 worked to complete a transition started during 2.8
development to avoid dynamically re-evaluating objects outside of the
dependency graph's control. However, that behavior was used to make
sure the original index mapping was available for the texture paint
sample operator.

Conceptually, sampling a texture on an arbitrary evaluated mesh should
not require original indices at all. All we need to know is the UV map
value under the mouse. This commit changes from using GPU index textures
to a BVH tree raycast. This significantly simplifies the code and makes
it work with GPU subdivision too. Though it may be slower to build the
BVH tree, that should be okay because it's cached and only needs to be
built once, and that's something we're want to optimize anyway.

Removing the reliance on original indices also means we could paint
textures on completely procedurally generated meshes, which may be
an interesting feature in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/120259
2024-04-05 14:17:43 +02:00
Jacques Lucke
548df007a5 Curves: add subdivide curves edit mode operator 2024-04-05 13:50:09 +02:00
Jacques Lucke
6c25c66194 Curves: add switch direction edit mode operator 2024-04-05 13:23:22 +02:00
Sybren A. Stüvel
d6863d43da Cleanup: Anim, re-word the explanation of the term 'binding'
Re-word the explanation of 'binding', as the old explanation was still
based on the old name 'output'.

No functional changes.
2024-04-05 12:45:26 +02:00