Commit Graph

112580 Commits

Author SHA1 Message Date
Jacques Lucke
925bed91c7 Fix: mutable parameter should not be const
This worked fine when passing in a `MutableBitSpan` to `invert`, but not when
passing in a `BitVector`.
2024-08-29 11:15:54 +02:00
Campbell Barton
d497452a73 Cleanup: typo, spaces in comments, comment blocks & use double quotes 2024-08-29 17:16:44 +10:00
Campbell Barton
4ed0d9f30e Cleanup: spelling in comments 2024-08-29 17:16:42 +10:00
Campbell Barton
d1139277a0 Cleanup: add missing include 2024-08-29 17:16:41 +10:00
Jeroen Bakker
e82ba8d495 Vulkan: Incorrect buffer size when allocating large buffers
When 'really' large buffers are allocated the incorrect clamping
function was used and the actual buffer allocated was smaller than
expected.

This was detected during investigation of #126863.

Pull Request: https://projects.blender.org/blender/blender/pulls/126915
2024-08-29 08:55:02 +02:00
Aras Pranckevicius
528471541b VSE: Faster and more consistent thumbnails
Implementing part of design outlined in #126087.

- VSE thumbnail cache has a new implementation, hopefully simpler
  and easier to understand.
    - Instead of cache key being a VSE strip, frame index, plus
      complicated logic for cache items linking etc.,
    - The cache is keyed by media file path (if multiple strips
      use the same input file, they will share cache entries), frame
      index within media file, and any extra data (e.g. steam index
      for multi-steam videos)
- Much reduced cache flickering and strange/weird thumbnail choices.
    - Likewise, thumbnails no longer disappear-and-reload on operations
      like Undo, dragging new video strip into timeline, or F12 render.
- Thumbnails now load faster.
    - Images use dedicated/faster thumbnail loading routines when a
      format can do that (e.g. JPG and EXR can).
    - Movies reuse ffmpeg decoding context for neighboring strips
      that use the same file (as often happens when cutting footage)
    - Thumbnail requests are processed on several threads now too.

Images and more detail in PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/126405
2024-08-29 08:27:12 +02:00
Campbell Barton
ef174d1e81 Cleanup: remove logic for un-subdivide to support hidden faces
Revert [0] which intended to support hidden geometry but didn't
entirely fix #99887 which was reported again as #122786.

[0]: 00e2f55239
2024-08-29 14:56:53 +10:00
Campbell Barton
53072345cb Cleanup: simplify BMesh API use & avoid redundant checks
- Avoid counting elements when it's not needed.
- Pass multiple elements to functions instead of calling multiple times.
2024-08-29 14:48:00 +10:00
Campbell Barton
86f2c120f2 Fix multi-res un-subdivide skipping faces & leaking memory
When unsibdivide ran with quads that share shared two edges,
only one of the loops attached to the vertex would have its grid
initialized (multiple times), skipping the other loops grid calculation
and leaking memory.
2024-08-29 14:47:59 +10:00
Campbell Barton
2cc395be06 Fix #126633: Multi-resolution modifier un-subdivide freezes
Hidden geometry caused an eternal loop in the un-subdivide internal
logic.

Also fix the un-subdivide operator leaving an invalid selection,
where faces where unselected while all their edges were selected.
2024-08-29 14:47:58 +10:00
Harley Acheson
04652334f3 UI: Fix Docking Issue With No Overlay
Docking uses window overlays during feedback and these have to be
stopped and changed if you move the target from window to window.
The logic of changing the window that gets the overlay will sometimes
fail when the target window is null and old window was null - it
gets stopped (because they are equal) but not started again. This PR
just adds a check for null window.

Pull Request: https://projects.blender.org/blender/blender/pulls/126906
2024-08-29 04:36:49 +02:00
Arius-Cr
db5cd39a67 Fix incorrect location from SpaceText.region_location_from_cursor
The resulting location was incorrect because the offset didn't account
for multi-byte characters and the logic had not been updated to use the
TXT_LINE_HEIGHT macro.

Also removes use of `goto` in favor of early return.

Ref !126720.
2024-08-29 11:42:49 +10:00
Hans Goudey
e0733e0bca Cleanup: Formatting 2024-08-28 16:21:22 -04:00
Hans Goudey
2d9a3e2593 Cleanup: Make PBVH tree constructor explicit 2024-08-28 15:14:56 -04:00
Hans Goudey
44e765bc7c Fix: Typo in recent node splitting change 2024-08-28 15:14:56 -04:00
Sean Kim
d42aec3cf7 Cleanup: Replace raw float[4] for math::Quaternion
Part of #126672

Also removes a "valid" boolean value in favor of using `std::optional`.

Pull Request: https://projects.blender.org/blender/blender/pulls/126725
2024-08-28 20:53:02 +02:00
Sean Kim
bb97131bb9 Fix #126713: Sculpting with shape keys produces artifacts
Brushes that were verified to be impacted by this:
* Clay
* Smooth
* Cloth

Brushes that were verified to not be impacted:
* Draw
* Blob

There is some dependency within the brush code that expects that the
`ss.deform_cos` variable is not updated during the middle of the stroke.
This commit only deals with fixing the immediate user-facing issue, for
a longer-term or more comprehensive fix, it is likely that these values
should not be touched at all inside the `sculpt_update_object` function
but should instead be initialized somewhere else so that the lifecycle
is more obvious and maintainable.

Pull Request: https://projects.blender.org/blender/blender/pulls/126803
2024-08-28 20:51:10 +02:00
Bastien Montagne
08c0f1adcb Refactor: Make gizmo use more C++ features, and new/delete allocations.
This mainly move some allocated data to new/delete, and storage of
operators data to a blender::Vector.

Part of the effort to make PointerRNA non-trivial (#122431).

Pull Request: https://projects.blender.org/blender/blender/pulls/126855
2024-08-28 17:46:19 +02:00
Bastien Montagne
39867e84d3 Cleanup: make format. 2024-08-28 17:26:20 +02:00
Bastien Montagne
bb43726ddd Fix #126802: Embedded data ID usages doubled-refcounted on copying.
ID usages of embedded data would be refcounted twice when copying their
owner ID.

Also did cleanup on naming, since proper names of these IDs is
'embedded', not the old 'private' one.
2024-08-28 17:06:13 +02:00
Philipp Oeser
d1f0084a33 Compositor: add button to add a new texture in the Texture node
This replaces the plain texture selector with a proper TemplateID,
resulting in buttons to add a new texture if none is there yet, and if
there is one, there will be the usual conveniece buttons to add a fake
user, create single user copies, ..., as well as the button to go to the
textures tab in the Properties Editor for more fine-grained control over
the texture.

Fixes #126856

Pull Request: https://projects.blender.org/blender/blender/pulls/126890
2024-08-28 16:54:19 +02:00
Hans Goudey
52bf292349 Sculpt: Split BVH nodes structs by geometry type
In order to make per-BVH-node overhead smaller and also to improve
type safety and code clarity, split the `pbvh::Node` struct into four classes:
a base class, and a class for each sculpt geometry type.

The size of a mesh BVH node changes from 408 to 176 bytes. For multires
the nodes are smaller at 96 bytes. This gives us leeway to make nodes smaller
to benefit more from spacial locality, etc. It also just reduces memory usage.

Using a `std::variant` makes the change quite simple actually. For the few
places that actually need to process the node types separately given their
different types, we use `std::visit`. Elsewhere we use `IndexMask` to retrieve
selections of nodes from the vector instead, though most code will be
refactored to that pattern separately. The new function `search_nodes`
is the equivalent of the existing `gather_nodes` that returns an `IndexMask`
instead of a vector of node pointers.

Part of #118145.

Pull Request: https://projects.blender.org/blender/blender/pulls/126873
2024-08-28 15:18:21 +02:00
Campbell Barton
21b820cd33 Fix the type value of 'bpy.types.*.bl_rna'
The type of an RNA types "bl_rna" should be `bpy.types.Struct`,
it was being set to the type it represented so:
`type(bpy.types.Object.bl_rna) == bpy.types.Object`
which wasn't correct.

Ref !126877

Co-authored-by: Bastien Montagne <bastien@blender.org>
2024-08-28 19:07:14 +10:00
Clément Foucault
25b2c5f170 BLI: Add reduce_mul 2024-08-28 09:48:17 +02:00
YimingWu
17397dae19 Fix #125680: Grease Pencil edit overlay shader theme switch
Grease Pencil v3 was using the same shader as particle strands, this leads
to sharing edit overlay color as particle strands. This patch fixes this
behaviour by adding a grease pencil toggle in the shader so grease pencil
overlay will use appropriate color and point sizes specified in the theme.

Pull Request: https://projects.blender.org/blender/blender/pulls/125689
2024-08-28 09:10:05 +02:00
Campbell Barton
83ffadb248 Cleanup: reduce right-shift 2024-08-28 16:30:57 +10:00
Campbell Barton
b30bbcb17d Cleanup: remove duplicate function call & null check 2024-08-28 15:42:13 +10:00
Harley Acheson
c30d7bb458 UI: Fix Docking Issues for Very Narrow Areas
When docking to very narrow areas it is only possible to dock to a
subset of three zones. This PR corrects mistakes in that code so that
you can correctly dock to tiny areas.

Pull Request: https://projects.blender.org/blender/blender/pulls/126868
2024-08-28 05:32:23 +02:00
Campbell Barton
ab261355ab UI: clarify "show faces" description
The text made it seem the overlay *only* highlighted selected faces
when this applies to unselected faces too.
2024-08-28 13:11:43 +10:00
Harley Acheson
9665b32320 UI: Remove OPTYPE_INTERNAL from SCREEN_OT_area_join
SCREEN_OT_area_join now works when called from a menu item, shortcut,
or quick favorites, so remove OPTYPE_INTERNAL so it can be found in
operator search.

Pull Request: https://projects.blender.org/blender/blender/pulls/126862
2024-08-28 01:56:44 +02:00
Harley Acheson
f40cd831fd UI: Hide Timeline Scrollbars When Very Short
If the Timeline is sized too short to show any of the scrubbing area,
then the scrollbars obscure the time line and current frame marker.
This PR hides the scrollbars in this case. Also for similar cases with
Dope Sheet, Graph Editor, and the embedded Graph Editor/DopeSheet in
Movie Clip Editor.

Pull Request: https://projects.blender.org/blender/blender/pulls/126806
2024-08-27 21:18:10 +02:00
Bastien Montagne
5eb80b1fa0 Refactor: Eyedropper: Use C++ new/delete allocations.
Pretty trivial. Part of the effort to make PointerRNA non-trivial (#122431).
2024-08-27 19:23:44 +02:00
Sybren A. Stüvel
841669c79e Anim: Fix library override on action slot
Assigning an Action slot changes two RNA properties on the `AnimData` struct:
- `action_slot`: pointer property used for the selector in the UI, and
- `action_slot_handle`: int property that's the ground truth of the assigned slot.

With this commit, there will only be an override operation stored for the
`action_slot_handle` property, and the pointer property will be ignored.

This also cleans up some other library overrides related things:
- Disallow overriding slot properties (like the slot name).
- Properly handle slot assignment in the case where the library did not have an `AnimData` at the time of the creation of the override, but when it does when applying the override (in `rna_AnimaData_override_apply()`).

Fixes #125978

Pull Request: https://projects.blender.org/blender/blender/pulls/126828
2024-08-27 18:11:45 +02:00
Sybren A. Stüvel
d3c4760617 Cleanup: expand documentation of Action::assign_id()
No functional changes.
2024-08-27 18:08:45 +02:00
Nathan Vegdahl
72aaecae51 Cleanup: improve some code documentation in the animation code 2024-08-27 17:44:50 +02:00
Alaska
6ccb33e9fe Shader: Add Metallic BSDF Node
Add Metallic BSDF Node to the shader editor.

This node can primarily be used to create more realistic looking
metallic materials than the existing Glossy BSDF node.

This commit does not add any new closures to Cycles, it simply exposes
existing closures that were previous hard to access on their own.

- Exposes the F82 fresnel type that is currently used by the
metallic component of the Principled BSDF. Results should match
between the Metallic BSDF and Principled BSDF when using the same
settings.
- Exposes the Physical Conductor fresnel type that was previously
limited to custom OSL scripts. The Conductor fresnel type accepts
IOR and Extinction coefficients to define the appearance of the
material based off real life measurements.

EEVEE only supports the F82 fresnel type with internal code to convert
the the physical conductor inputs in to a colour format for F82,
which can lead to noticeable rendering differences with
some configurations.

Pull Request: https://projects.blender.org/blender/blender/pulls/114958
2024-08-27 17:20:46 +02:00
Nathan Vegdahl
e3311e48c0 Fix: crash when loading layered animation with channel groups
The issue was that the forward compatibility saving code was setting the
group's `channels` listbase to point at the forward-compatible fcurve
listbase, but the `channels` listbase wasn't later getting cleared when
loading the groups as part of a layered action. In fact, the listbase
pointers were being completely ignored in that case because they aren't
relevant to groups on layered actions, and therefore weren't getting
remapped to the new correct memory addresses of the fcurves.

The end result was that after loading, the group's `channels` listbase
would be non-null and pointing to invalid memory, and there are some
code paths that then try to use that listbase, resulting in a segfault.

This commit fixes the issue by ensuring that the groups' `channels`
listbases are cleared when loading them as part of a layered action.
Additionally, we now also clear them after they're set during
forward-compatibly saving, the lack of which wasn't immediately
causing problems but was nevertheless incorrect.

Pull Request: https://projects.blender.org/blender/blender/pulls/126834
2024-08-27 17:02:18 +02:00
Hans Goudey
6b281264b2 Refactor: Sculpt: Remove PBVH BMesh pointer
Part of #118145.
In order to reduce the purview of the sculpt BVH tree and clarify its
responsibility, replace the geometry back pointer with just passing
the BMesh pointer as an argument where necessary or retrieving it
from the object instead.
2024-08-27 10:59:06 -04:00
Philipp Oeser
6036163e14 Fix #126728: Movie Clip Editor "Sync Visible Range" option not working
True for both `Graph` and `Dopesheet` views in the MCE.

For all other time-based editors, the main region (`RGN_TYPE_WINDOW`) is
of interest to be tagged for syncing `V2D_VIEWSYNC_SCREEN_TIME`. In the
case of the Movie Clip Editor however, the `Graph` and `Dopesheet`
regions in question are of type `RGN_TYPE_PREVIEW`.

So to resolve, we have to take this into account in view2d_sync RNA code

NOTE: this PR does not add versioning code, so any "falsely" tagged
`Graph` and `Dopesheet` view will "loose" the setting (will have to be
enabled again on the "right" region), this could be added though -- it
would be impossible to tell **which**  view exactly, so on each
`RGN_TYPE_WINDOW` encountered, we'd have to then tag **both** `Graph`
and `Dopesheet` afaict

Pull Request: https://projects.blender.org/blender/blender/pulls/126785
2024-08-27 16:54:32 +02:00
Ray Molenkamp
82a4291596 Fix #126798: launcher manifest not linked leading to startup issues
The manifest was not linked, leading blender-launcher not to look in
the blender.crt folder for the vcruntime140.dll. Causing issues for
systems where this binary was not available elsewhere (like pristine
windows installs)
2024-08-27 08:02:20 -06:00
Jeroen Bakker
f19675ffca Vulkan: Incorrect default for missing orco
When orcos are not available in the geometry data it is bound with
a default buffer. This buffer was initialized with only zeros. But
orcos required to read the 0, 0, 0, 1.

Fixes `render/shader/tex_voronoi.blend` render test.

Pull Request: https://projects.blender.org/blender/blender/pulls/126838
2024-08-27 16:00:00 +02:00
Hans Goudey
e7d43d07a1 Sculpt: Specialize some pose fake neighbors calculation
Move the outer loop to happen after the mesh data has been
retrieved. Though this doesn't address the problematic
algorithmic complexity of the algorithm, it should at least
reduce some overhead, and it removes a few more uses of
the `PBVHVertRef` API that we are working to remove.
2024-08-27 09:48:19 -04:00
Bastien Montagne
733ed5dc83 Refactor: Move some UI-related allocations to use C++ new/delete.
Mainly changes some UI-internal structs allocation, and the Panel
runtime custom data storage.

These changes from C-style alloc/free to C++ new/delete are a step
towards making PointerRNA non-trivial (part of #122431).

Pull Request: https://projects.blender.org/blender/blender/pulls/126698
2024-08-27 15:35:18 +02:00
Jeroen Bakker
8e80cfdfd9 EEVEE: Enable Shader Specialization Spatial Denoise
Spatial denoise uses shader specialization. The current shader had
this disabled for OpenGL and Vulkan. As OpenGL and Vulkan supports
shader specialization it is fine to enable them. Would result in
better optimized shaders.

I checked other shaders as well. This was the only one ignoring shader
specialization.

Pull Request: https://projects.blender.org/blender/blender/pulls/126830
2024-08-27 15:30:26 +02:00
Sybren A. Stüvel
f018c4a989 Anim: always allow unassigning the action slot
Setting `id.animation_data.action_slot = None` should always be
possible, even when there is no Action assigned (that is, when
`id.animation_data.action = None`). In that case `.action_slot` should
already be `None`, and so writing its current value should not cause any
errors.

Pull Request: https://projects.blender.org/blender/blender/pulls/126827
2024-08-27 14:53:55 +02:00
Jacques Lucke
51f7936335 Nodes: expose unique identifier for node panels in RNA
This adds a new read-only `persistent_uid` property to `NodeTreeInterfacePanel` in RNA.
This integer remains the same even if the panel is moved around or the file is reopened.
Internally, the property exists already, this patch just exposes it.

Pull Request: https://projects.blender.org/blender/blender/pulls/126797
2024-08-27 13:47:11 +02:00
Omar Emara
96416f5401 Refactor: Abstract away the ShaderOperation class
This patch abstracts away the ShaderOperation class into an asbtract
PixelOperation class, which the ShaderOperation now implemenets. This
makes way for a new subclass that uses FN multi-functions for evaluation
for the new CPU compositor.

Reference #125968.
2024-08-27 14:42:11 +03:00
Pratik Borhade
1dbb88070b Fix #126677: Pin to last is possible on override object modifier
It is possible to change th order of library override modifier with pin
to last option. This breaks the modifier order and also introduces a
copy of modifier after reopening the linked file. To fix this issue,
do not set `PROPOVERRIDE_OVERRIDABLE_LIBRARY` on `use_pin_to_last`
property.

Pull Request: https://projects.blender.org/blender/blender/pulls/126813
2024-08-27 13:41:41 +02:00
Bastien Montagne
7ff1d5d9e4 Fix #82514: Default Value for Viewport Display Color's Alpha Wrong.
For now duplicate default diffuse color values into RNA code too. Sad
work-around, but fixes the problem, until we get rid of hacks like
'interpret 4 consecutive floats in DNA as an array of 4 floats in RNA'.
2024-08-27 13:25:14 +02:00
Jeroen Bakker
660e571969 Vulkan: Recycle resources when rendering in background
When rendering in background there is no swap chain in play and
resources would never be collected. Resulting in out of resources and
crashes.

This PR is an initial fix what cycles resource pools every time a layer
has been rendered. It counts the render hierarchy
(GPU_rendering_begin/end) to identify if the background render is
completed and if so would cycle to the next resource pool.

Pull Request: https://projects.blender.org/blender/blender/pulls/126819
2024-08-27 10:09:53 +02:00