Commit Graph

147985 Commits

Author SHA1 Message Date
Jonas Holzman
bcb343c597 Python Templates: Add Gizmo Simple 2D
Following discussion to document the `icon_value` property of
`GIZMO_GT_button_2d` in PR #136080, and generally improve the
documentation of this Gizmo Type, this patch adds a new "Gizmo
Simple 2D" Python template, and renames the existing "Gizmo
Simple" template to "Gizmo Simple 3D".

Pull Request: https://projects.blender.org/blender/blender/pulls/136304
2025-03-21 12:20:22 +01:00
Casey Bianco-Davis
cdccc51b2e Grease Pencil: Draw Tool: Improve random color value and saturation setting results
This makes the random vertex color brightness work on a relative basis.

Because humans see relative differences in brightness more then absolute
brightness, simple adding randomness to `Value` will cause dark colors to be
effected more heavily then light colors.

This also fixes a problem desaturated colors with becoming red after
saturation randomization.

Pull Request: https://projects.blender.org/blender/blender/pulls/107315
2025-03-21 12:15:09 +01:00
Jonas Holzman
ec149a919a Gizmo: Add icon_value property to support using custom icons
This patch adds the icon_value property to GIZMO_GT_button_2d to support
using custom icons values. This allows for the use of user-defined icons
(via custom preview collections), or generated icons like material or
image previews.

On the API side, this property replicates the RNA UI API behavior (seen
in layout.operator/layout.prop) of prioritizing `icon` over `icon_value`
if the former is set.

Pull Request: https://projects.blender.org/blender/blender/pulls/136080
2025-03-21 12:10:49 +01:00
Campbell Barton
d037fcd5fb Cleanup: don't redefine built-ins in the key-map
Also remove redundant dictionary unpacking for a single item.
2025-03-21 22:08:31 +11:00
Campbell Barton
5b04f13219 Cleanup: wrap long lines 2025-03-21 22:08:31 +11:00
Campbell Barton
d9edc0c057 Cleanup: replace multiple checks with static sets 2025-03-21 22:08:31 +11:00
Omar Emara
d6fa68eb58 Compositor: Add boolean socket support
This patch adds support for boolean sockets in the compositor. This
involves adding a new Bool ResultType and handling it in relevant code.
For shader operations, booleans are passes as floats since GPUMaterial
does not yet support boolean types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136296
2025-03-21 12:03:09 +01:00
Bastien Montagne
cef8de874b Cleanup: blenlib: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136268
2025-03-21 11:50:00 +01:00
Bastien Montagne
14913a447c Fix #136294: Blender 4.4 is discarding exceptions occurred in operator's constructor
While using constructors in Operator classes is _really_ not
recommended, BPY code was a bit too eager to overwrite existing errors
with its own generic messages.

Now only generate these exceptions if there is no other exception
already set.
2025-03-21 11:29:59 +01:00
Omar Emara
3e595b0f30 Fix #136301: Wrong assert in compositor data sharing
The compositor asserts when sharing data with different precision, but
this is fine, since it can be thought of as precision promotion. So
remove the assert.
2025-03-21 11:55:34 +02:00
Philipp Oeser
109100869a Fix #136252: Extra chevron on Particle context data breadcrumbs
Dont increment the path count (and dont create a corresponding pointer)
in `ButsContextPath` when there is no current particle system.
This alone would do the trick for particles, but I have also changed
`buttons_panel_context_draw` slightly (so that it checks if the pointer
is valid -- earlying out otherwise -- **before** drawing the triangle
icon) in case it might happen elsewhere too.

Pull Request: https://projects.blender.org/blender/blender/pulls/136256
2025-03-21 10:35:31 +01:00
Philipp Oeser
f3c513f342 Fix #135961: Asset previews can be generated from non-renderable objects
For the "Render Active Object" operator, it is not enough to check if
the IDs in context (e.g. selected in the Asset browser) can generate
previews, more importantly, we have to check the object being rendered
here (the **active** object)

Pull Request: https://projects.blender.org/blender/blender/pulls/136074
2025-03-21 10:35:18 +01:00
Pratik Borhade
de845dbff8 Cleanup: Remove duplicated channel color RNA property
It has been moved to `rna_def_grease_pencil_tree_node` in 3ef2ee7c53

Pull Request: https://projects.blender.org/blender/blender/pulls/136297
2025-03-21 10:22:56 +01:00
Campbell Barton
bf3297aefd Correct error accessing current tags in last commit 2025-03-21 16:30:30 +11:00
Campbell Barton
9789dc8426 Fix #132636: Showing updates doesn't show available theme updates
When updates are available, clicking on the button in the status bar
was only showing "Add-on" updates.

Restore the ability to show "All" extension types which is
set when showing updates.
2025-03-21 16:00:33 +11:00
Campbell Barton
bd2c0f2b49 Cleanup: remove unused variable 2025-03-21 15:07:07 +11:00
Harley Acheson
c13d3e2f7a UI: Color Icons for Red, Green, & Blue
This adds icons for ICON_RGB_RED, ICON_RGB_GREEN, and ICON_RGB_BLUE
that display with those colors. This does not remove the existing
monochrome ICON_COLOR_* icons. This also allows the translation of
the "R", "G", "B" characters shown, for languages that prefer color
words that do not start with these.

Pull Request: https://projects.blender.org/blender/blender/pulls/136154
2025-03-21 01:57:32 +01:00
Campbell Barton
1e6a0e6319 Cleanup: remove references to old names in doc-strings
Also move TODO into the function body as it's not a doc-string.
2025-03-21 00:51:51 +00:00
Campbell Barton
d616c87d03 Cleanup: spelling in comments (make check_spelling_*) 2025-03-21 11:51:50 +11:00
Campbell Barton
0f4056ab65 CMake: add missing headers, sort file lists 2025-03-21 00:19:55 +00:00
Campbell Barton
e1f91c2dba Cleanup: replace int with wmOperatorStatus, consistent naming
- Manually check over all direct calls to operator callbacks
  ensuring the result isn't assigned to an int.
- OPERATOR_RETVAL_CHECK() now fails unless a wmOperatorStatus is used.
- Check the return values of direct calls to callbacks.
- Remove invalid check for the return value of rna_operator_check_cb.
- Use the variable name `retval` as it's most widely used.
- Move the assignment of `retval` out of the `if` statement in
  sculpt/paint operators because it prevents assigning the result
  `const` variable.
2025-03-21 00:13:30 +00:00
John Kiril Swenson
77893a16f6 VSE: Fix typo introduced with recent refactor
Caused by #135560.
2025-03-20 18:45:33 -05:00
Harley Acheson
cc22de7acb UI: Increase Contrast of Area Resize Feedback
When dragging on area edges to resize them, the visual feedback is
brighter on high DPI displays like Retina. This is because the center
line is subpixel when on a regular monitor.  This PR increases the
width of the line and outline, giving a stronger highlight and one
that looks similar on all platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/136108
2025-03-21 00:32:34 +01:00
Campbell Barton
8a06a0da84 Cleanup: resolve build errors without TBB on Linux
Unfortunately C style casts are needed as the underlying types depend
on the build configuration.
2025-03-20 22:13:33 +00:00
Campbell Barton
2659ec12f5 Cleanup: replace int with wmOperatorStatus
Follow up to adding wmOperatorStatus, these cases were missed as they
didn't cause compiler warnings.
2025-03-21 08:34:21 +11:00
Campbell Barton
10233e95dd Cleanup: use a typed enum for operator & gizmo callbacks
Callbacks: exec invoke & modal now use a typed enum wmOperatorStatus.

This helps avoid mistakes returning incompatible booleans or other
values which don't make sense for operators to return.

It also makes it more obvious functions in the WM API are intended
to be used to calculate return values for operator callbacks.

Operator enums have been moved into DNA_windowmanager_enums.h
so this can be used in other headers without loading other includes
indirectly.

No functional changes expected.

Ref !136227
2025-03-20 21:11:06 +00:00
Harley Acheson
22ad0b9faf UI: Increase Border Edge Drag Width
When resizing areas by dragging at the edges, the hit area is wider
than the visible border. This extra border padding is extended in this
PR by another one pixel on each side. This increases the hit width by
about 30%. This is possible because this adjusts for scrollbars at the
edge of the area.

Pull Request: https://projects.blender.org/blender/blender/pulls/135952
2025-03-20 21:13:34 +01:00
Jesse Yurkovich
b030acbe9d Fix #135672: Ghost: Prefer CF_HDROP ahead of CF_TEXT during drag'n'drop
When a user starts a drag'n'drop operation, the originating application
dictates the formats carried along with it. In the context of what is
broadly supported by Blender, we actively look for "text" and "files" in
the data. In that order. This order sometimes leads to a suboptimal
choice where, for example, a drag'n'drop of a "file" is interpreted as
"text" containing just the path to the file.

This PR changes the ordering to prefer the "files" first. Two notable
applications where this matters are:
 - The Firefox download library window
 - The Perforce P4V client application

Dragging and dropping files, like say FBX or OBJ, from these two apps
now properly triggers file handler behavior. Existing behavior is best
seen in the Blender Text editor. Dragging and dropping a file from the
above apps into a Text data block will yield the raw "file:///test.ext"
text. This will no longer occur after this PR.

Other platforms might have similar concepts but I don't have the
capability of checking how they handle this type of situation. They
would have to be checked against several applications to see if they
have the same issue.

Pull Request: https://projects.blender.org/blender/blender/pulls/135939
2025-03-20 19:23:52 +01:00
Jesse Yurkovich
7e70e93345 Cleanup: USD: Small header adjustment to usd_asset_utils
Adjustment from recent clang19 build problems. Only use the more
expensive stage.h header in the implementation file where it's needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/136159
2025-03-20 18:58:31 +01:00
Julian Eisel
103d535fe4 UI: Use snapping when drag & dropping collections
Part of #134755 / #134766.

Previously dropping collections would use some point under the mouse
cursor, I think projected based on the 3D cursor location. According to
feedback this is pretty useless and unpredictable, snapping to surfaces
under the mouse cursor is preferred.

With this the collection or collection instance will be transformed so
objects are placed relative to the dropping point (plus the collection
instance offset, if any).

This is added for dragging assets mostly, but works for dragging
collections from anywhere (e.g. Outliner).

Pull Request: https://projects.blender.org/blender/blender/pulls/136181
2025-03-20 18:52:42 +01:00
Harley Acheson
dbf3a3979d UI: Increase Height of the Left-Size Corner Action Zones
This PR increase the height (only) of the corner action zones at the
top-left and bottom-left area corners. They get more than twice as tall
so they are twice as easy to hit. Especially nice using a pen.

Pull Request: https://projects.blender.org/blender/blender/pulls/135954
2025-03-20 18:44:51 +01:00
Julian Eisel
6c1c5e8923 Asset browser import settings popover with collection instancing option
Part of #134755 / #134766.

Adds options to the new Import Settings popover (added in 7a6beb65f4)
to toggle collection instancing for dragging in collections. It can be
toggled separately for linking and appending, since it's typical to use
instancing for linking, but not appending (current default, also with
this change).

Previously, toggling collection instancing was only possible via the
Adjust Last Operation panel but this wasn't obvious, many people were
not aware. Adding this option based on feedback by the Blender Studio.

Pull Request: https://projects.blender.org/blender/blender/pulls/135996
2025-03-20 18:44:24 +01:00
Sean Kim
d9ec8c531f Tests: Update submodule hash
blender/blender-test-data#65

Pull Request: https://projects.blender.org/blender/blender/pulls/135544
2025-03-20 18:22:27 +01:00
Richard Antalik
60de2103c0 Fix: Crash when adding strips above channel 128
Crashes were caused by setting `Strip::machine` above `MAX_CHANNELS`
value.

Instead of clamping this value at multiple places, setter function
`seq::strip_channel_set` was added that implements clamping.

This also allows for better handling of clamping if it was ever needed.

Function `strip_transform_handle_expand_to_fit` still sets machine value
directly and above `MAX_CHANNELS` as a hack. This could be avoided, but
it would require some refactoring.

Pull Request: https://projects.blender.org/blender/blender/pulls/136163
2025-03-20 18:11:08 +01:00
Richard Antalik
a4c86b13ba VSE: Add seq::channel_get_by_index documentation
Usage of this function was quite confusing.

Pull Request: https://projects.blender.org/blender/blender/pulls/136161
2025-03-20 18:10:44 +01:00
Harley Acheson
d61e4d0930 Fix #136206: Clamp Max Row Calculation in Enum Lists
For very large scales with very small windows the enum list calculation
of how many rows might fit can result in zero, causing problems with a
later division. clamping this to a minimum of one fixes this and causes
no harm. This calculation is just a hint on how to behave, whether to
show lists in columns or not, etc. Lists still display fine even when
this variable reaches this minimum.

Pull Request: https://projects.blender.org/blender/blender/pulls/136265
2025-03-20 17:35:25 +01:00
Sergey Sharybin
bf65b64708 Refactor: De-duplicate local intersection reservoir sampling logic
The code which was checking whether local intersection is to be
recorded, and under which index was duplicated for triangles,
motion triangles, and HIP-RT triangle filter function.

This change moves the common logic to an utility function which
is reused from all the places mentioned above.

Pull Request: https://projects.blender.org/blender/blender/pulls/136244
2025-03-20 17:19:31 +01:00
Harley Acheson
b034cdd728 Cleanup: Make format
formatting changes resulting from running Make Format
2025-03-20 08:39:02 -07:00
Sybren A. Stüvel
640255bbbf Anim: add keying set support to Copy Global Transform add-on
When the scene settings indicate the active keying set should be used,
this is taken into account for all auto-keying done by the add-on. This
covers:

- Pasting global transform
- Pasting relative transform
- Fix to Camera

Support is limited to *relative* keying sets. Absolute keying sets,
which thus determine what gets keyed regardless of the selection, are
not supported, as the interaction between the "copy this object/bone's
transform" is currently not known.

Fix to Camera has its own settings for what to key; these will be
combined with the keying set. Only those properties that are enabled in
the Fix to Camera settings AND included in the keying set will be keyed.
To give a concrete example: when the "Location & Rotation" keying set is
active, and "Location" and "Scale" are checked in the Fix to Camera
panel, only the location will be keyed.

A message is shown in the Fix to Camera panel to notify users that the
keying set will affect the keys as well.

The keying set will only be considered when the auto-keying option "Only
Active Keying Set" is enabled.

Fixes: #136076

Pull Request: https://projects.blender.org/blender/blender/pulls/136187
2025-03-20 16:08:10 +01:00
Jeroen Bakker
a92981e77b Refactor: Vulkan: Move render graph submission into device_submission.cc
Pull Request: https://projects.blender.org/blender/blender/pulls/136257
2025-03-20 15:55:30 +01:00
YimingWu
0566b802c7 Fix #134550: Python: Limit numpy version for bpy wheel
bpy is not compatible with numpy 2+, as the VFX reference platform uses
1.26 atm. This fix amended the install requirement package to specify
numpy>=1.26,<2.0 to mitigate this issue.

Suggested by Brandy Johnston (@bradyajohnston)

Pull Request: https://projects.blender.org/blender/blender/pulls/134551
2025-03-20 15:19:05 +01:00
Pablo Vazquez
58ed0e1568 Fix: UI: Wrong tooltip for Developer Extras
Geometry indices is no longer hidden under Developer Extras, also
remove mention "Edit Source" since nowadays this feature exposes more
features than just that (this tooltip dates back to Blender 2.5 days).

Use `Display` instead of `Show` to be consistent with other tooltips.

Pull Request: https://projects.blender.org/blender/blender/pulls/134584
2025-03-20 15:11:25 +01:00
Michael Jones
9dca0ba856 Cycles: Maximise MTLCompiler concurrency when GUI isn't active
This PR will result in much faster Metal kernel (re)compilation for command line rendering.

Pull Request: https://projects.blender.org/blender/blender/pulls/136247
2025-03-20 14:07:14 +01:00
Julian Eisel
77a0c92283 Fix #113215: Missed asset storage update when node tool is removed
Make sure refreshing an asset library properly clears all storage for
this library, both in the global asset list storage and the storage of
each asset browser.

The `ed::asset::list::clear()` function handled clearing of asset
browsers too since recently, however the refresh operator wouldn't use
that when clearing directly from an asset browser. Instead, always clear
all asset library storage/chaches.
2025-03-20 13:07:42 +01:00
Jeroen Bakker
177bbf12df Fix #136239: SubDiv: Read out of bounds
GPU subdivision shaders can read out of bound when evaluating
the last face. This seems to be always been the case, but Metal + Vulkan
has validation to detect these mis-usages.

Binary search was initialized with out of bound values so the last
face could select out of bound index due to rounding.

Pull Request: https://projects.blender.org/blender/blender/pulls/136242
2025-03-20 12:17:58 +01:00
Bastien Montagne
7aced80eec Cleanup: blenkernel: Replace 'void' MEM_[cm]allocN with templated, type-safe MEM_[cm]allocN<T>.
The main issue of 'type-less' standard C allocations is that there is no check on
allocated type possible.

This is a serious source of annoyance (and crashes) when making some
low-level structs non-trivial, as tracking down all usages of these
structs in higher-level other structs and their allocation is... really
painful.

MEM_[cm]allocN<T> templates on the other hand do check that the
given type is trivial, at build time (static assert), which makes such issue...
trivial to catch.

NOTE: New code should strive to use MEM_new (i.e. allocation and
construction) as much as possible, even for trivial PoD types.

Pull Request: https://projects.blender.org/blender/blender/pulls/136134
2025-03-20 11:25:19 +01:00
Omar Emara
8b418a63c4 Cleanup: Use socket type in single input value operation
This patch uses the socket type as opposed to the result type in the
switch case that initialize the values of the single input value
results, since that makes more sense as we are retrieving the values
from the sockets. This also matches the implementation in pixel
operations.
2025-03-20 12:19:43 +02:00
Omar Emara
776810aec9 Cleanup: Remove outdated comments
Float2 and Int2 are no longer internal types, so removes some outdated
comments in the result types enum.
2025-03-20 12:18:35 +02:00
Omar Emara
38446399f4 Cleanup: Use fixed width integer for int results
We use fixed width integers in the variant definition, so retrieve using
fixed width as well.
2025-03-20 12:16:46 +02:00
Sergey Sharybin
7165146fb2 Cleanup: More spelling fixes in comments 2025-03-20 10:37:09 +01:00