145825 Commits

Author SHA1 Message Date
Jesse Yurkovich
a6ad8f4fd9 Cleanup: USD: Pass struct by ref and add more tests for scaling options
- There's only a few unit conversion options, just test all of them
- Use reference instead of pointer when passing export settings struct
- Organize scaling struct fields to keep similar options together

Pull Request: https://projects.blender.org/blender/blender/pulls/133774
2025-01-29 20:03:36 +01:00
Hans Goudey
ca64f2f7e7 Cleanup: Use StringRef instead of StringRefNull 2025-01-29 12:49:41 -05:00
Bartosz Kosiorek
5bcde9cbff UI: Make colorspace tooltips more useful for non English languages
Use longer descriptions for colorspace tooltips that better explain the
meanings of the acronyms.

Pull Request: https://projects.blender.org/blender/blender/pulls/119810
2025-01-29 18:46:38 +01:00
Habib Gahbiche
b51c560f6e Compositor: Implement shortcuts for Viewer nodes
Artists often want to quickly switch back and forth between two or more nodes while compositing.

This patch implements two operators `NODE_OT_viewer_shortcut_set` and `NODE_OT_viewer_shortcut_get` that allow users to map a viewer node to a shortcut. For example, pressing `cltr+1` while a node is selected, assigns that node to the shortcut `1`, creates a viewer node if it has none attached and sets that viewer node to active. Pressing `1` will set the active node with shortcut `1` to active.

Shortcuts are saved in DNA to preserve them after saving/loading blend files.

Limitations:
- Only compositor node tree is supported, because shading editor has no viewer node and geometry nodes viewer works differently.

Pull Request: https://projects.blender.org/blender/blender/pulls/123641
2025-01-29 18:35:26 +01:00
Habib Gahbiche
5eb8101efa UI: Show error if drag and drop of images fail
Adding an image object using drag and drop can fail without an apparent reason.

This patch shows an error when this happens so that the user can react accordingly (in this example switch to object mode, add the image and switch back to edit mode).

Pull Request: https://projects.blender.org/blender/blender/pulls/132994
2025-01-29 18:31:00 +01:00
Harley Acheson
1a2b126d5c UI: Simplification of Grease Pencil Fill Status Bar
Use icons and state highlighting to simplify the status bar display in
“Grease Pencil Fill” (GREASE_PENCIL_OT_fill).

Pull Request: https://projects.blender.org/blender/blender/pulls/133247
2025-01-29 18:19:13 +01:00
Omar Emara
2b2b27abf5 Fix #133565: Single value nodes wrongly return an image
In certain setups, nodes whose inputs are single value and whose outputs
are expected to be single value wrongly return an image. That's because
they wrongly join a pixel operation that operates on images.

To fix this, we split pixel operations by their value types. Single
value sub-trees get compiled into their own pixel operation and none
single value sub-trees get compiled into their own pixel operation.

This might unfortunately break up a long chain of pixel operations if
one of them was single value. This is solvable, but will require more
time and research, so we need to fix the bug first then look into it.

Pull Request: https://projects.blender.org/blender/blender/pulls/133701
2025-01-29 15:13:45 +01:00
Brecht Van Lommel
c4c0c23c5a Fix: Cycles: Always try to alloc MEM_DEVICE_ONLY on device
Regardless of what mem info reports. We can't move this to the host, so
might as well try because the free memory might not be a reliable predictor
of success.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:25 +01:00
Brecht Van Lommel
e8ebcb3ee3 Fix: Cycles: Check if memory is host mapped without access to device_mem_map
This avoids concurrency issues.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:23 +01:00
Brecht Van Lommel
8b7fce492e Refactor: Cycles: Change API so host and device memory are freed together
With host mapped memory these can be shared, and we can't get back the
original host pointer unless we make a copy which is inefficient.

Also add asserts to verify this doesn't happen.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:19 +01:00
Brecht Van Lommel
c0ba800f64 Refactor: Cycles: Avoid double host alloc in HIP-RT
This code should be changed to not modify host pointers directly. But as
long as we are going to do it, avoid unnecessary alloc and immediate free.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:16 +01:00
Brecht Van Lommel
b06def6b3e Refactor: Cycles: Remove confusing test for condition that should not happen
Device shouldn't have to allocate host pointer.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:12 +01:00
Brecht Van Lommel
1ec04e0eec Fix: Cycles: Only move textures to host on one device at a time
This was not thread safe. And it's better to do them one by one to avoid
moving more than is needed, when another thread already freed up enough.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:09 +01:00
Brecht Van Lommel
cd3d3b2646 Refactor: Cycles: Delay load_texture_info() to enqueue
Doing it immediately after moving textures to the host is less efficient, and
interacts in confusing ways.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:06 +01:00
Brecht Van Lommel
fec593ec3b Fix: Cycles: Avoid unnecessary move to host with multi-device
If one of the devices already used host happed memory but another not,
it would previously realloc both.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:12:02 +01:00
Brecht Van Lommel
2cfe2e0bfe Fix: Cycles: Re-copy memory from host to device without realloc
Should be a bit more efficient, and it fixes host memory fallback bugs,
where host memory was incorrectly freed during re-copy. For the case
where memory should get reallocated on the host, a new mem_move_to_host
was added.

Thanks to Jorn Visser for investigating and finding this problem.

Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:11:50 +01:00
Brecht Van Lommel
0e8a7c751a Refactor: Cycles: Simplify util_guarded_mem_alloc/free calls
Pull Request: https://projects.blender.org/blender/blender/pulls/132912
2025-01-29 14:11:47 +01:00
Brecht Van Lommel
1fc73188e3 Cleanup: Code style 2025-01-29 14:10:13 +01:00
Michael Kowalski
e021cf0491 Fix: USD export: missing prototype proxies
The scene graph instancing export code contains logic for
determining which instances need to be converted to prototypes
because the original prototypes are not included in the export
(e.g., because they are not visible).

This commit fixes an error in this logic, which incorrectly
assumed that if the root of the original prototype is included
in the export, then the entire original hierarchy beneath the
root is included as well.

To fix this, the logic in AbstractHierarchyIterator::
determine_duplication_references was updated so that if any
descendants of an instance are converted to prototypes, the
parent instance is converted to a prototype as well.

This addresses the bug noted by Brecht in
https://projects.blender.org/blender/blender/pulls/131707#issuecomment-1403309

Pull Request: https://projects.blender.org/blender/blender/pulls/133750
2025-01-29 14:05:52 +01:00
Brecht Van Lommel
9135929063 Tests: Add back missing memory / time title in benchmark html
Pull Request: https://projects.blender.org/blender/blender/pulls/133763
2025-01-29 13:55:29 +01:00
Omar Emara
c786b385ee Fix #133729: Crash when appending Glare node group
Blender crashes when appending a node group containing a Glare node from
older versions. That's because the Glare node is versioned taking the
scene resolution into account, and in case of appending a node group,
there is associated scene, and accessing a nullptr scene causes the
crash.

To fix this, assume some default resolution in cases where the node
can't be associated with a scene.
2025-01-29 14:19:02 +02:00
Sergey Sharybin
c70a38798d API: Better documentation of scene.frame_set()
Make it explicit that it updates all view layers.

Ref #133379

Pull Request: https://projects.blender.org/blender/blender/pulls/133536
2025-01-29 12:13:59 +01:00
Jacques Lucke
e1753900b7 BLI: improve UTF-8 safety when copying StringRef to char buffers
Previously, there was a `StringRef.copy` method which would copy the string into
the given buffer. However, it was not defined for the case when the buffer was
too small. It moved the responsibility of making sure the buffer is large enough
to the caller.

Unfortunately, in practice that easily hides bugs in builds without asserts
which don't come up in testing much. Now, the method is replaced with
`StringRef.copy_utf8_truncated` which has much more well defined semantics and
also makes sure that the string remains valid utf-8.

This also renames `unsafe_copy` to `copy_unsafe` to make the naming more similar
to `copy_utf8_truncated`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133677
2025-01-29 12:12:27 +01:00
Philipp Oeser
bf2264a3b8 Cleanup: typo 2025-01-29 10:09:59 +01:00
Philipp Oeser
8703317b81 Fix #133687: editbone transform wrong with hidden connected parent bone
If the parent editbone is hidden, it will (rightfully) not be taken into
account in `createTransArmatureVerts`.
In `recalcData_edit_armature` though, there was the assumption in a
particular code path that "this bone has a parent tip that has been
moved" even though it wasnt (because it was hidden -- see above).

To resolve, guard this code path with a `EBONE_VISIBLE` check.

Pull Request: https://projects.blender.org/blender/blender/pulls/133707
2025-01-29 10:07:27 +01:00
Philipp Oeser
0b97b60b2a Fix #133614: Grease Pencil: Handles wrong after Selection to cursor
Just missing the re-calculating of the handles [we already have a
function for this, just call it]

Pull Request: https://projects.blender.org/blender/blender/pulls/133649
2025-01-29 10:01:30 +01:00
Philipp Oeser
a77e0ccd78 Fix: Curves "Warp" and "Randomize" dont update properly
Resolve by tagging positions as changed.

With this and !133544 (which fixes #133537) we can also expose those operators in the menu.

Pull Request: https://projects.blender.org/blender/blender/pulls/133548
2025-01-29 10:00:05 +01:00
Philipp Oeser
8a45c24f57 Fix: "Affect only origins" does not work for Curves
For this to work, we need to properly support `XFormObjectData` for
`Curves`.

Similar to 50770bd8f54f

Part of #103680

Also fixes #133537

Pull Request: https://projects.blender.org/blender/blender/pulls/133544
2025-01-29 09:57:36 +01:00
Campbell Barton
1fdb91c766 License Headers: quiet "check_licenses" warnings 2025-01-29 17:22:51 +11:00
Michael B Johnson
662c1b815c Fix #131459: Treat USD DomeLight options as Lights rather than Materials
This commit moves the Convert World Material checkbox under Materials to
a World Dome Light option "under" Lights. Based on feedback this is more
intuitive for artists. Previously artists would try unchecking "Lights"
and be confused why a DomeLight would still be in their scene.

This is only a UI layout change, API remains unchanged.

Authored by Apple

Co-authored-by: Dhruv Govil <dgovil2@apple.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/131829
2025-01-29 06:56:40 +01:00
Campbell Barton
91fc1c7fac Refactor: split viewport bounds calculation into utility functions
Move 3D viewport bounds calculation out of the operator callbacks
into utility functions, needed for !129594.

Some minor renaming:

- `ok` -> `changed`.
- `ok_dist` -> `do_zoom`.
2025-01-29 14:39:33 +11:00
Harley Acheson
867e9d879a Fix #59358: Don't Show Status Bar Impossible Confirms & Cancels
When performing a transform operation that drags or tweaks, do not show
the Cancel or Confirm keymap item on the Status Bar if they use the
same mouse button that initiated the operation. For example if you are
RCS and are tweaking an object, don't show Cancel on status bar since
that requires right click. If LCS then don't show Confirm (requires
left click) when tweaking, dragging gizmo parts, etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/131336
2025-01-29 03:57:08 +01:00
Campbell Barton
bd1ded952b Cleanup: spelling in comments 2025-01-29 12:31:19 +11:00
Campbell Barton
915ba086ca Cleanup: use EBONE_VISIBLE / EBONE_SELECTABLE to simplify checks
ANIM_bone_is_visible_editbone was being used in situations where the
intention is to check if the bone is visible to the user.

In this case, EBONE_VISIBLE makes more sense as it also accounts
for hidden bones too.
2025-01-29 12:15:54 +11:00
Campbell Barton
73f66f5a72 Transform: use consistent bone visibility checking
Check bone visibility before selection to ensure bones in hidden
collections aren't handled as selected.
2025-01-29 12:15:53 +11:00
Campbell Barton
01e879957c 3D View: add missing calls to force-finish smooth view
Operations that act on the viewport should finish smooth-view first.
2025-01-29 12:15:53 +11:00
Campbell Barton
eb1340517f Fix use after free toggling quad-view 2025-01-29 12:15:53 +11:00
Jesse Yurkovich
e44fa6040a Cleanup: USD: Remove dead field from USDMeshReader
Remove the dead `uv_token_map_` field from `USDMeshReader`, reducing its
size by 448 bytes in the process.

Pull Request: https://projects.blender.org/blender/blender/pulls/133346
2025-01-29 02:13:17 +01:00
Lukas Stockner
ace85d3338 Fix #131218: Cycles: Race condition when syncing motion blur
The issue here is that motion_steps handling is a bit complex, and the
parallel synchronization of geometry does not play well with it.

The obvious result of this was a crash related to the main thread
checking attributes while the geometry sync was changing them, but
there was also another race condition that could result in ending up
with the wrong motion_steps.

Specific changes:
- Change place where `motion_steps` is set to avoid concurrent access
- Change the default `motion_steps` to zero, since they won't be
  explicitly set if there's no motion now
- Don't skip `motion_steps` copy in `sync_X` since it's no longer set
  in `sync_object` and we need to transfer the value in case it was set
  to 3 by the velocity code since that's no longer the default

Pull Request: https://projects.blender.org/blender/blender/pulls/133669
2025-01-29 01:59:38 +01:00
Lukas Stockner
a6e7bf2095 Cycles: Support Ray Depth attributes for OptiX OSL
Following the ShaderGlobals refactor, we can now easily pass IntegratorState
along on the GPU side as well, so let's implement these missing attributes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133689
2025-01-29 01:01:08 +01:00
Lukas Stockner
e0d14d3b92 Cycles: Refactor: Store Cycles-specific pointers in our own ShaderGlobals
OSL has OSL::ShaderGlobals, which contains all the state for OSL shader
execution. The renderer fills it out and hands a pointer to OSL, and any
callbacks (e.g. for querying attributes) get the pointer back.

In order to store renderer-specific data in it, there's a few opaque pointers
in the struct, but using those has led to a mess of reinterpret_cast<> and
pointer indirection in order to carry all the data around.

However, there is a way to do this nicer: Good old C-style struct inheritance.
In short: Unless you're doing pointer arithmetic, you can just add additional
data at the end of a base struct, and the rest of the code won't care.

In this case, this means that we can have our own ShaderGlobals struct and
add more Cycles-specific data at the end. Additionally, we can replace the
generic opaque void pointers with ones of the correct type, which saves us
from needing to cast them back.

Since we have a copy of ShaderGlobals for GPU OSL anyways, it's just a matter
of refactoring the code a bit to make use of that.

The advantages of this are:
- Avoids casts all over the place, just needs one cast to turn our
  ShaderGlobals into the "base" type that OSL expects and one to turn the
  pointer that OSL gives us on callbacks back into our "derived" type.
- Removes indirection, all the relevant stuff (sd, kg, state) is now
  directly in the ShaderGlobals
- Removes some OSL-specific state from ShaderData, which helps to keep
  memory usage down

Pull Request: https://projects.blender.org/blender/blender/pulls/133689
2025-01-29 01:01:08 +01:00
Harley Acheson
05151fcd60 UI: Reduce Light Theme Icon Border Opacity
Reduce the Light Theme Icon Border Intensity from 1.0 to 0.7 to better
match the result in Blender versions prior to SVG icons. The icon
border is now done within the text shader so the result is a bit
stronger than the old method.

Pull Request: https://projects.blender.org/blender/blender/pulls/131396
2025-01-28 19:39:14 +01:00
Julian Eisel
9d83061ed4 UI: Don't re-query invalid preview images from disk
Loading a custom preview/icon from disk can fail, e.g. if the image file
is corrupted. This was never handled that well, and I think since
315e7e04a8 we'd continuously re-query such previews.

Fixes #133617.
Also needed for #131871.

Pull Request: https://projects.blender.org/blender/blender/pulls/133679
2025-01-28 19:32:54 +01:00
Hans Goudey
5a0aa0a422 Tests: Update hash for recently added geometry nodes test
Regression for #101979
2025-01-28 12:51:58 -05:00
Hans Goudey
8692c093d6 Fix #101979: Edge angle node outputs wrong sign
Use the third point of the triangle connected to the edge
instead of the center of the second face as a reference point
for the concavity test.

Pull Request: https://projects.blender.org/blender/blender/pulls/133682
2025-01-28 18:16:53 +01:00
Clément Foucault
10c0b19213 Cleanup: GPUMaterial: Remove leftover EEVEE Legacy code 2025-01-28 17:48:34 +01:00
Clément Foucault
bb72bd509e Fix #88185: EEVEE: Collection Holdout not working properly in Blended mode
This was caused by using the same factor as in dithered.
But dithered already has the transparency applied from
the dithered transparency. The transparency needs to be
applied to holdout in forward.
2025-01-28 17:48:33 +01:00
Ray Molenkamp
78cf27df32 Deps: Update GLU/Mesa upstream URIs
Looks like their ftp server isn't responding, switched
over to https.
2025-01-28 09:30:32 -07:00
Brecht Van Lommel
174dd77a97 Tests: Render test images with UTF-8 filenames
This helps verify they are handled correctly in OpenImageIO, OpenEXR,
and OpenUSD.
2025-01-28 17:21:08 +01:00
Hans Goudey
3deedd9181 Sculpt: Simplify vector displacement brush calculation
Remove the need for a temporary array of colors.
Just put the data directly into the translations vector.
This should provide a small performance improvement.
2025-01-28 11:16:06 -05:00