Commit Graph

105118 Commits

Author SHA1 Message Date
Julian Eisel
b4d6c231c5 Fix failing assert when hiding header with asset shelf available
Old code to prevent multiple overlapping regions at the same place,
wasn't handling the combination of bit flags and the alignment enum in a
single field correctly. Newly introduced flags for the asset shelf
exposed this.

Was asserting on startup for a Pets production file
(`010_0050.anim.blend`).

Steps to reproduce:
* Replace default cube with armature object
* Enter Pose Mode (makes asset shelf available for pose libraries)
* Hide 3D View header
2023-12-06 20:47:51 +01:00
Aras Pranckevicius
06370b5fd6 VSE: make Wipe effect 6x-20x faster
Wipe effect was completely single threaded. So multi-thread that.
Additionally, simplify math done in Clock wipe code; asin() + hypot()
+ some checks is just atan2() really.

Applying Wipe to 4K UHD sequencer output, on Windows Ryzen 5950X:
- Single/Double: 99.1 -> 9.3 ms (10.6x faster)
- Iris: 153.3 -> 12.3 ms (12.4x faster)
- Clock: 301.4 -> 14.5 ms (20.8x faster)

The same on Mac M1 Max:
- Single: 74.5 -> 13.4 ms (5.6x faster)
- Iris: 84.2 -> 14.3 ms (5.9x faster)
- Clock: 185.3 -> 18.8 ms (9.8x faster)

Pull Request: https://projects.blender.org/blender/blender/pulls/115837
2023-12-06 19:42:59 +01:00
Aras Pranckevicius
fc64f48682 VSE: make Glow effect 6x-10x faster
Glow effect was doing the correct thing algorithmically (separable gaussian
blur), but it was 1) completely single-threaded, and 2) did operations in
several passes over the source images, instead of doing them in one go.

- Adds multi-threading to Glow effect.
- Combines some operations, e.g. instead of IMB_buffer_float_from_byte
  followed by IMB_buffer_float_premultiply, do
  IMB_colormanagement_transform_from_byte_threaded which achieves the same,
  but more efficiently.
- Simplifies the code: removing separate loops around image boundaries is
  both less code and slightly faster; use float4 vector type for more
  compact code; use Array classes instead of manual memory allocation, etc.
- Removes IMB_buffer_float_unpremultiply and IMB_buffer_float_premultiply
  since they are no longer used by anything whatsoever.

Applying Glow to 4K UHD sequencer output, on Windows Ryzen 5950X:
- Blur distance 4: 935ms -> 109ms (8.5x faster)
- Blur distance 20: 3526ms -> 336ms (10.5x faster)

Same on Mac M1 Max:
- Blur distance 4: 732ms -> 126ms (5.8x faster)
- Blur distance 20:  3047ms -> 528ms (5.7x faster)

Pull Request: https://projects.blender.org/blender/blender/pulls/115818
2023-12-06 19:39:42 +01:00
Aras Pranckevicius
9cbc96194e VSE: make Gamma Cross effect 4x faster
Gamma Cross code seems to be coming from year 2005 or earlier, with complex
table based machinery to approximate "raise to power" calculations. Which,
for Gamma Cross, have always been hardcoded to 2.0 "since forever". So
simplify all that, i.e. replace all the table lookup/interpolation things
with just `x*x` and `sqrt(x)`.

Applying Gamma Cross on 4K UHD resolution, Windows Ryzen 5950X machine:
36.2ms -> 8.1ms

Pull Request: https://projects.blender.org/blender/blender/pulls/115801
2023-12-06 19:37:00 +01:00
Bastien Montagne
1e50987d94 LibOverride: Refactor some part of hierarchy handling code.
This commit is a preparation for an actual change in behavior of
automatic liboverride hierarchies creation. Although it may introduce
some minor changes (fixes) in behavior in some corner-cases, it is
not expected to have any noticeable end-user changes.

The main change is some refactor of the `LibOverrideGroupTagData` util
struct, to make it more clear and easy to manage data (IDs) from linked
reference, and data from liboverrides.

In addition, some minor changes in code logic, either optimizations or
hardened checks, e.g. to skip any processing of hierarchies when the
linked reference of its root is missing, or to ensure that libraries are
matching, etc.
2023-12-06 18:32:48 +01:00
Charles Wardlaw
b7fa45b68d Fix: USD import: Improve texture color space choice
Many assets with UsdPreviewSurface materials exist in which the textures
do not have authored color space settings.  Because of this, assets with
normal maps and other non-color data look incorrect on import because
these textures are marked as being sRGB instead of Non-Color.

This patch fixes the color space choices for these textures based on
connections to the PBR shader; if no color space is specified, non-Albedo
maps get an automatic Non-Color assignment.

Co-authored-by: Charles Wardlaw <kattkieru@users.noreply.github.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/113374
2023-12-06 18:17:53 +01:00
Bastien Montagne
d24a49da84 Fix (unreported) missing Viewlayer update in liboverride code.
In post-processing of objects & collections after liboverrides creation,
viewlayer could be accessed while tagged as dirty, since the
object/collection hierarchy may be modified several times during this
process.
2023-12-06 17:11:56 +01:00
Brecht Van Lommel
e06561a27a Build: replace Blender specific DEBUG by standard NDEBUG
NDEBUG is part of the C standard and disables asserts. Only this will
now be used to decide if asserts are enabled.

DEBUG was a Blender specific define, that has now been removed.

_DEBUG is a Visual Studio define for builds in Debug configuration.
Blender defines this for all platforms. This is still used in a few
places in the draw code, and in external libraries Bullet and Mantaflow.

Pull Request: https://projects.blender.org/blender/blender/pulls/115774
2023-12-06 16:05:14 +01:00
Brecht Van Lommel
fc863c63e6 BMesh: don't make threading threshold dependent on debug/release build
While it may be useful to detect threading issues for low poly meshes in debug
builds, it can also cause confusion when one breaks but not the other.

Further, having this logic for just a handlful bmesh functions while everything
else does not makes little sense.
2023-12-06 16:05:12 +01:00
Hans Goudey
2609f16fc8 Cleanup: Resolve inconsistent struct vs. class declaration warning
Also add a missing include in a header
2023-12-06 10:00:25 -05:00
Hans Goudey
79552f87f2 Fix: Protect against access of empty geometry bounds optional 2023-12-06 09:12:09 -05:00
Philipp Oeser
79ed05b29f Fix #115830: Poly Build tool crash with clipping borders
Since 02ee5a7693 we cant call `ED_view3d_win_to_ray_clipped_ex` with
null `r_ray_end`, `ED_view3d_clip_segment` relies on it.

To fix this, just pass a dummy from `ED_view3d_win_to_ray_clipped`.

Pull Request: https://projects.blender.org/blender/blender/pulls/115840
2023-12-06 14:13:07 +01:00
Campbell Barton
6af92e1360 PyAPI: support overriding the "screen" with Context.temp_override()
Previously it was checking the actually active screen - it was leading
to the issue where it's no longer possible to override context.screen
(#108763) which was possible with old context override method.

Now the screen can be overridden, keeping the window & workspace
consistent.

Ref !114269.

Co-authored-by: Andrej730 <azhilenkov@gmail.com>
2023-12-06 20:45:36 +11:00
Campbell Barton
6bb875db93 Cleanup: minor correction to exception message, add doxy section 2023-12-06 20:45:35 +11:00
casey bianco-davis
773d5745e8 Fix: GPv3: Strokes with hidden materials are editable
Makes it so that strokes and fills of hidden materials are not editable.

Note: this does not make strokes of hidden materials invisible.

Pull Request: https://projects.blender.org/blender/blender/pulls/115777
2023-12-06 10:37:49 +01:00
Philipp Oeser
94defad5f1 Fix #115662: Outliner slows down many geometry operations in big scenes
This was reported for UV editing but also e.g. some modeling operations
were affected.

In 295bc1249a, a listener for `NC_GEOM` > `ND_DATA` was added to the
Outliner in order to update when renaming bones (c4622c405e).
Since we are only interested in the naming part (no need to update the
Outliner otherwise), the notifier/listener combo was made more specific
by including the `NA_RENAME` action here.

Since this was a very general thing to listen to, other operations might
have relied on this to properly update, but having checked many things,
I could spot only one case where an Outliner update was missing after
the initial change and that was adding images.
This case was added separately now.

Pull Request: https://projects.blender.org/blender/blender/pulls/115799
2023-12-06 10:22:54 +01:00
Hans Goudey
865b806811 BMesh: Use simpler element copy within the same mesh
After previous commits, there is a new function to copy a BMesh
custom data block that doesn't go through the "find common layers
between two formats" code. This is *much* faster when there is a
large amount of layers with the same type, since that code is
quadratic currently. It may not be noticeable in many simpler
setups though.

Related to #115776
2023-12-05 22:09:37 -05:00
Hans Goudey
fc4d29e08a Cleanup: Simplify common logic for BMesh attribute copy
Overload the attribute copy function for each element type, avoiding
the switch of different abstraction levels. The two extra arguments
besides the meshes and elements were constant, so the resulting
logic can be inlined as well.
2023-12-05 22:09:37 -05:00
Hans Goudey
66da875488 BMesh: Improve performance when copying attributes in same mesh
When the BMesh source and result arguments are the same, restore
performance lost by 9175d9b7c2, which made copying layers
have quadratic time complexity. When we know the custom data format
is the same between the source and result, the copying can be much
simpler, so it's worth specializing this case. There is still more
to be done, because often we only know that the two meshes are the
same at runtime. A followup commit will add that check.

The quadratic runtime means performance is fine for low layer counts,
and terrible with higher layer counts. For example, in my testing with
47 boolean attributes, copying 250k vertices went from 2.3 seconds to
316 ms.

The implementation uses a new CustomData function that copies an entire
BMesh custom data block, called by a function in the BMesh module
overloaded for every BMesh element type. That handles the extra data
like flags, normals, and material indices.

Related to #115776
2023-12-05 22:09:37 -05:00
Hans Goudey
cc7080b8b0 Cleanup: Remove unnecessary size argument to CustomData free function
The size of the data is already known, there's no need to pass it
to the type's callback.
2023-12-05 22:09:37 -05:00
Hans Goudey
353d000f15 Cleanup: Remove unusd custom data function 2023-12-05 22:09:37 -05:00
Hans Goudey
32776880a0 Cleanup: BMesh: Add function for copying within the same BMesh
For now it has the same implementation as the function that allows
passing separate source and destination custom data formats. But
copying to the same format can potentially be much simpler.
2023-12-05 22:09:36 -05:00
Campbell Barton
3eaf2b2e50 Fix #115253: NDOF zoom-speed depends on selected objects
Recent refactor to viewport navigation caused a regression where
"Orbit Around Selected" logic to impacted "Free" NDOF navigation logic.

Resolve by disabling orbit around selection with "Free" navigation.
2023-12-06 13:17:10 +11:00
Campbell Barton
8b26ad0a8a Fix sequencer modifier operators crashing with no active strip set 2023-12-06 13:17:10 +11:00
Harley Acheson
27992034f2 Fix #115815: Include Category name in Enum Row Calculation
Report #115815 shows a time where our calculation of rows and columns
should also include the category name lines. The code was calculating
where to break not including these and is too short if it has a
category.

Pull Request: https://projects.blender.org/blender/blender/pulls/115822
2023-12-06 01:37:04 +01:00
Hans Goudey
7a96c4672c Cleanup: Move BMesh headers to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/115817
2023-12-05 23:01:12 +01:00
Germano Cavalcante
383db31556 Fix asserts is last commit
These asserts need to be placed before incrementing the parameters.
2023-12-05 18:42:19 -03:00
Germano Cavalcante
7f626e08e1 Fix #115813: Handles get broken when scaling annotation keyframes in Dope Sheet
Apparently this problem has existed at least since b6b61681ef.

When converting pointers to generic structs in
`transform_convert_action.cc`, elements of type `TransData` and
`TransData2D` must align by maintaining synchronized indices within
their respective arrays.

Despite both arrays having equivalent lengths, some `TransData2D`
instances were omitted when they come from types `ANIMTYPE_GPLAYER` or
`ANIMTYPE_MASKLAYER`.

This misalignment resulted in `TransData` elements not properly
corresponding with their `TransData2D` counterparts.

A potential fix could be incrementing `td2d++` for each
`ANIMTYPE_GPLAYER` or `ANIMTYPE_MASKLAYER` occurrence. This approach,
while introducing blank `TransData2D` entries, would preserve index
alignment with `TransData`.

However, I opted for a less workaround-centric approach by converting
`tGPFtransdata` elements into `TransData2D`.This solution, albeit
slightly fragile due to the lack of a dedicated member in `TransData2D`
for integer value flushing, appears better than allowing blank
`TransData2D` fields.
2023-12-05 18:37:23 -03:00
Miguel Pozo
7ec59b05ff Fix #115786: EEVEE-Next: Texture paint delayed redraw 2023-12-05 17:06:35 +01:00
Miguel Pozo
026cdb1058 Fix #115594: EEVEE Next: Crash with VDB 2023-12-05 16:46:45 +01:00
Falk David
0fd851bd4b Cleanup: GPv3: Use foreach_range
Instead of using `to_ranges` and then iterating, we just iterate over
the ranges directly.
2023-12-05 16:28:00 +01:00
Sybren A. Stüvel
d63b68b01b Cleanup: run make format
Just running `make format`, no functional changes.
2023-12-05 16:01:28 +01:00
Jacques Lucke
a23bd3d7f3 Nodes: add node callback for extra info that is drawn above node
This allows nodes to show some extra information next to the node. This can be
useful for debugging and will likely also be used for the new Bake node (#115466).

Pull Request: https://projects.blender.org/blender/blender/pulls/115805
2023-12-05 15:57:40 +01:00
Hans Goudey
3a075a95ee Cleanup: Remove unused modifier functions 2023-12-05 09:36:13 -05:00
Hans Goudey
fe3b8b6e9b Cleanup: Remove remnants of old color layer preview system
For context, see 6d09fa3577. Overall, these values were still
written in some cases, but never used. Nowadays the viewer node and
attribute overlays give even better answers to these needs.
2023-12-05 09:36:13 -05:00
Hans Goudey
874f83c42e Cleanup: Use FunctionRef for PBVH batch drawing
Also use const arguments, move a null check from the callback to the
PBVH function, and reorganice the PBVH code to be in a consistent
place in the file and to simplify the logic.
2023-12-05 09:36:13 -05:00
Sybren A. Stüvel
0cc58e40af Cleanup: Anim, remove accidentally committed declaration
Remove a function declaration that belongs in a future commit.

No functional changes.
2023-12-05 15:12:16 +01:00
Sybren A. Stüvel
42083c8357 Refactor: move ANIM_bone_collections.h into the .hh file
Move the contents of `ANIM_bone_collections.h` into its C++
`ANIM_bone_collections.hh` sibling. Blender is C++ by now that we can do
without the C header.

No functional changes.
2023-12-05 15:10:27 +01:00
Iliya Katueshenock
5429e006c8 Geometry Nodes: Face Group Boundaries node speedup
The multithreaded algorithm works by atomically assigning each face's
group ID to the surrounding edges. If the ID for the edge is different
than one set previously, the edge becomes a boundary.

Using the edge to face topology map was also tested, but it wasn't
faster, and given the large memory usage of the map, the increased
complexity of this algorithm was considered worthwhile.

Speed improvement for attached example file is listed in table:
| Cube resolution | Main | PR |
| -- | -- | -- |
| 20x20x20 | `71920 ns` | `97400 ns` |
| 100x100x100 | `1.27 ms` | `1.17 ms` |
| 500x500x500 | `79.37 ms` | `23.16 ms` |
| 1000x1000x1000 | `520.31 ms` | `142.21 ms` |

Pull Request: https://projects.blender.org/blender/blender/pulls/115138
2023-12-05 14:45:03 +01:00
Sebastian Parborg
4c527b095a Make the preference option "remap relative" apply for all save operations
Before it would only apply for the "Save" but not "Save As" and "Save
Copy" operators.

Pull Request: https://projects.blender.org/blender/blender/pulls/115791
2023-12-05 14:11:15 +01:00
Philipp Oeser
c5538b6851 Fix #115657 : Bone's tail is still selected after invert selection
The whole logic of selecting a parent bone's tip when selecting a bone
should only happen when they are actually **connected**
(BONE_CONNECTED), same as when picking a bone in the UI
(`ED_armature_edit_select_pick_bone`).

Pull Request: https://projects.blender.org/blender/blender/pulls/115663
2023-12-05 14:08:07 +01:00
Jacques Lucke
822cb1afd7 Fix: ensure function does not create geometry instances in all cases
This caused a crash further down the line where the code expected geometry
instances after calling `ensure_geometry_instances`, which seems reasonable
to assume.
2023-12-05 13:28:29 +01:00
Christoph Lendenfeld
1149bb216d Fix #115678: Padding not applied correctly when framing keyframes
When framing a single keyframe in the Graph Editor
the padding to the y axis wasn't applied correctly.
This meant that the viewport would zoom in too far
making it hard to zoom out again.

Pull Request: https://projects.blender.org/blender/blender/pulls/115792
2023-12-05 12:01:45 +01:00
Christoph Lendenfeld
f489b84316 Fix #115683: Crash with IK constraint
The issue was that the IK constraint wasn't set up correctly,
in such a way that the bone that had the constraint had no parents.
(refer to the file in the bugreport)

This lead to a crash when trying to get the tip of the chain because
`pchan_tip->parent` was a `nullptr`.

Fix it by only getting the parent if it's not a `nullptr`.
This has the side effect of not being able to move the bone in the test file.

Caused by: 0c2afa7c17

Pull Request: https://projects.blender.org/blender/blender/pulls/115788
2023-12-05 12:00:37 +01:00
Nathan Vegdahl
05ac25dfba Cleanup: use existing bone iterator function 2023-12-05 11:54:16 +01:00
Bastien Montagne
fa25a286d8 Refactor: BKE: Move BKE_library header to full CPP. 2023-12-05 11:53:55 +01:00
Christoph Lendenfeld
b549260aa4 Fix #114828: Don't rebuild outliner tree when frame scrubbing
Before this PR, whenever the frame changed during scrubbing,
the whole outliner tree would be rebuilt.
This rebuilding did not happen when playing back.
This was a major bottleneck, especially on scenes with many objects.

As far as I can tell there is no need to do that,
since there is no function that changes the
scene structure when the frame is changed.
The only way to do that is to add a python handler
for `post_frame_change`, but that also fires when playing back.

The performance gains can be quite significant.
I've made a scene with 32.000 cubes
and the `wm_draw_update` function goes from
~60ms
to
~30ms

Pull Request: https://projects.blender.org/blender/blender/pulls/114845
2023-12-05 11:04:24 +01:00
Falk David
5fea1eda36 GPv3: Drawing Placements
This PR adds the drawing placement modes from GPv2.

The drawing placement defines the depth (origin, view, surface, etc.) and a plane (view, cursor, xz, etc.).

This introduces a new helper class `DrawingPlacement` that does all of the internals to find the correct projection and just exposes a simple function to project from screen space to the drawing plane/surface.

Note: Drawing on other strokes currently doesn't work, because GPv3 can't be rendered to image yet. We use the depth buffer of the grease pencil render result to find the right depth.

Pull Request: https://projects.blender.org/blender/blender/pulls/115602
2023-12-05 11:01:42 +01:00
Nathan Vegdahl
9e7a70d6c6 Anim: store BoneCollections in a flat array
This is in preparation for eventual hierarchical bone collections.

The motivation here is that this will allow us to efficiently specify
children as an index range, which would be inefficient with a listbase
due to the list traversal overhead incurred for index-based look ups.

We're still saving to blend files as a list base for forwards compatibility
with Blender 4.0, but storing as an array at runtime for efficient indexing.

This should not result in any user-visible changes.

Pull Request: https://projects.blender.org/blender/blender/pulls/115354
2023-12-05 10:39:45 +01:00
Omar Emara
689040db2f Fix #107465: Compositor Texture node produces artifacts
The compositor texture node produces artifacts in its Color output.
This was due to uninitialized alpha channel. Set the alpha channel to
1.0 if it was not written to fix the issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/115768
2023-12-05 09:17:08 +01:00