Commit Graph

120212 Commits

Author SHA1 Message Date
илья _
2add72df04 Fix: Geometry Nodes: Duplicate Elements node propagates instance handles incorrectly
The old code did not take the case into account when there is a non-full selection
is passed in.

Pull Request: https://projects.blender.org/blender/blender/pulls/139556
2025-06-02 18:47:44 +02:00
Brecht Van Lommel
bb6a88b95d Shaders: Reduce default distance/scale for bump/displacement nodes
The default was too high for most scenes, now it's 1mm for bump and
1cm for displacement by default.

Pull Request: https://projects.blender.org/blender/blender/pulls/139502
2025-06-02 18:44:44 +02:00
Jacques Lucke
8fe7e62656 Refactor: Nodes: extract socket items accessor defaults
This simplifies adding more functionality to socket items accessors without
having to change all the existing accessors.

Pull Request: https://projects.blender.org/blender/blender/pulls/139714
2025-06-02 18:41:10 +02:00
Habib Gahbiche
c956145530 Compositor: implement toggle for backdrop gizmos
The new gizmo toggle controls backdrop gizmo visibility for the
compositor node editor.

The implementation is consistent with the image editor, where the gizmo
toggle has a menu with a single entry, instead of having no drop down
menu at all.

The new toggle will be set inactive when there is no node tree in a
follow up PR: https://projects.blender.org/blender/blender/pulls/139526

Pull Request: https://projects.blender.org/blender/blender/pulls/139525
2025-06-02 17:48:19 +02:00
YimingWu
48f49deaa8 Fix #139572: Grease Pencil: Support pasting strokes into multiple frames
When multi-frame editing is enabled, users would expect to be able to
paste strokes into multiple selected frames. This PR supports this by
using `retrieve_editable_drawings` instead of `get_editable_drawing_at`
to achieve such feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/139573
2025-06-02 16:44:25 +02:00
Aras Pranckevicius
71897ebf95 Fix #139580: Movie proxies can be missing the last frame
Commit 611940805e changed movie proxies to use MP4 container format
instead of AVI (to support video rotation metadata), however MP4
container needs more care compared to AVI. Several parts of proxy
generation were subtly wrong before:

- AVStream.avg_frame_rate was not set, this can make the mp4 muxer
  incorrectly determine the video duration for the "moov" atom.
- AV_CODEC_FLAG_GLOBAL_HEADER (needed by mp4 more than by avi) was not
  set since the code was checking the flags on the wrong structure.
- avcodec_parameters_from_context were called at the wrong place
  (need to be called after avcodec_open2, not before it)
- avcodec_flush_buffers call before av_write_trailer was incorrect;
  the codec state should not be reset there!
- avcodec_free_context should be called after fully finishing with the
  file (i.e. after avio_close)

Pull Request: https://projects.blender.org/blender/blender/pulls/139731
2025-06-02 16:24:41 +02:00
Philipp Oeser
6e3b483c6d Fix #139675: Mesh analysis crashes in editmode with instances
Caused by a67b5f6f63

Since we dont necessarily act with `MeshExtractType::BMesh` (can be
`MeshExtractType::Mesh` as well -- and seems the specific mesh analysis
`statvis_calc` functions are well prepared for this), move access to
`BMesh` to the codepaths specific to `MeshExtractType::BMesh`.

Also remove (non-appropriate) assert in `extract_mesh_analysis`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139717
2025-06-02 16:15:21 +02:00
Hans Goudey
20ca13e4e4 Fix: Compile error in node socket shape shader 2025-06-02 10:10:46 -04:00
Omar Emara
4f125c6748 Fix: Memory leak in Image Coordinates node
The Image Coordinates node leaks memory if no input is connected and
some of the outputs are not connected. That's because all outputs are
allocated even if they are not used. To fix this, we only allocate
outputs that are actually needed.
2025-06-02 16:22:39 +03:00
Aras Pranckevicius
ba0b1acb4e Fix #139656: FBX importer does not set normalmap textures as "non-color"
Normal maps (and generally all other non-color textures) were not
marked as non-color in the new FBX importer.

Pull Request: https://projects.blender.org/blender/blender/pulls/139725
2025-06-02 15:15:05 +02:00
Jacques Lucke
6fb69eeb71 Geometry Nodes: initialize String node width based on content
When a String node is created using link-drag-search, it's width is now based on
the width of the string it contains. This eliminates the common step to increase
the width manually after the node has been created.

Pull Request: https://projects.blender.org/blender/blender/pulls/139707
2025-06-02 14:56:18 +02:00
YimingWu
1cb20d444e Fix #138793: Grease Pencil: Tag ID update after conv from legacy curves
Converting from legacy curves to grease pencil with "Keep Original"
option enabled can cause the new grease pencil ID to not be evalueated,
leading to an situation where a evaluated grease pencil object would
point to the original legacy curve ID as its object data. This fix added
a depsgraph tag so it ensures the COW ID is the latest.

Pull Request: https://projects.blender.org/blender/blender/pulls/139006
2025-06-02 14:18:52 +02:00
Jacques Lucke
fbb1204913 Nodes: add NodeSocket.is_inactive and NodeSocket.is_icon_visible Python API
Over time, the various visibility states of sockets has become more complex. In
the past, it was only affected by `socket.enabled` and `socket.hide`. However,
the introduction or panels and automatic usage inferencing made it hard to
impossible to figure out how sockets are actually drawn from the Python API.

This adds two new getters to `NodeSocket`:
* `is_inactive`: If true, the socket values is grayed out because it has been
  detected to not have any effect.
* `is_icon_visible`: The socket is drawn as an interactible icon, i.e. it is not
  in a collapsed panel or otherwise hidden.

Both of these concepts map quite clearly to user-level concepts and are hard to
detect exactly otherwise which is why I'm exposing those. More visibility states
accessible on `bNodeSocket` could be made available but we also need to be
careful with not exposing too much stuff that we might not need in the future
anymore. I'd need more precise use-cases to justify adding more such accessors.

Pull Request: https://projects.blender.org/blender/blender/pulls/139424
2025-06-02 13:53:20 +02:00
Jacques Lucke
f3a1d8fad5 Refactor: Nodes: precompute node extra info rows
Previously, the extra info rows were computed twice per node on each redraw.
Now, they are only computed once.

Pull Request: https://projects.blender.org/blender/blender/pulls/139708
2025-06-02 13:50:49 +02:00
Jacques Lucke
3afc1cbbe1 Refactor: Nodes: change int to enum for bNodeSocketType.type
This eliminates the need for explicit type casts in many places.

Pull Request: https://projects.blender.org/blender/blender/pulls/139710
2025-06-02 13:50:07 +02:00
YimingWu
86f8ca124a Fix #139666: Grease Pencil: Fix modifier type when getting defgroup names
Previously `get_bone_deformed_vertex_group_names` checkes for regular
mesh armature modifier type instead of the one specific to grease pencil
and this caused it to always return empty defgroup name list, renders
auto-normalize ineffective downstream. Now corrected to using
`GreasePencilArmatureModifierData`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139706
2025-06-02 13:13:09 +02:00
Julian Eisel
da03a88636 Fix: Incorrect handling of asset libraries from Preferences
Asset libraries from the Preferences were not recognized as such. This
could cause various issues like the asset library not being refreshed
correctly on relevant changes. There was also a failed assert when
right-clicking the context menu of a custom brush asset, and the "Edit
Metadata" brush asset operator would be unavailable.

A pointer was unintentionally cast to a boolean, and instead null passed
for the pointer (because of a default argument value).
2025-06-02 12:50:47 +02:00
Omar Emara
425be6bb02 Compositor: Turn Flip node options to inputs
This patch turns the Flip node options to inputs.

Reference #137223.

Pull Request: https://projects.blender.org/blender/blender/pulls/139722
2025-06-02 12:48:00 +02:00
Damien Picard
0e8d041cb3 Fix: Use Color Temperature prop subtype for light temperature
The light objects' Color Temperature prop introduced in a12bce039f
currently is a temperature subtype. This means it is expressed in °C
if the user set that as scene unit, but a color temperature should
always be expressed in Kelvin.

Pull Request: https://projects.blender.org/blender/blender/pulls/139661
2025-06-02 12:25:40 +02:00
Sybren A. Stüvel
f9a9080f16 Cleanup: correct documentation of BLI_uniquename_cb for dynamic strings
Correct the documentation of the `BLI_uniquename_cb()` variant that was
introduced in 7afa5aaa59 to support
dynamically-allocated strings.

Contrary to the other functions with the same name, this variant does
not actually assign the name. It returns the new name and leaves the
assignment to the caller.

Pull Request: https://projects.blender.org/blender/blender/pulls/139639
2025-06-02 12:20:23 +02:00
Aras Pranckevicius
4de9801dd4 Fix: VSE source cache eviction logic
New VSE cache implementation (!137926) uses the same eviction
logic for the source image ("raw") cache as for the final frame cache --
remove the frames furthest away from the playhead.

However, source image cache keys are source media frames, not timeline
frames, so this was not working correctly when strips are not at
timeline start.

So, for each cached entry record the strip-start-relative timeline
frame that the entry was created at. This takes care of things like
retiming, reversed frames etc. And also makes the cached frames
visualization more correct in presence of frame reversal etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/139667
2025-06-02 12:02:00 +02:00
Leon Schittek
8242eeb7ab Grease Pencil: Support exporting animated SVGs
Extend the existing SVG exporter so it can export frame-by-frame
animations as animated SVGs.

The animation data is fully contained inside the SVG. Each frame
is stored inside a `<g>` group that has the visibility turned off.
Then a `<use>` element displays the current frame using its `href`.
Inside the `<use>` element the `href` property is animated
with an `<animate>` tag that cycles through all the different frames.

To ensure unique element IDs within the file, the IDs of elements
user-defined names with user defined names are suffixed with
an continuously incrementing counter formatted as hex.

Pull Request: https://projects.blender.org/blender/blender/pulls/131173
2025-06-02 11:41:15 +02:00
Nathan Vegdahl
5ff12bdc98 Core: Show all path template errors in the UI
The path templates feature implemented in #134860 highlights path
properties that have syntax errors in red and provides a list of those
errors in the path's tool tip. However, syntax errors are not the only
kind of error.

For example, if given the render output path `//render/{blend_nam}`,
with a typo in the variable `blend_name`, this error is not indicated
until actually trying to render. This is because the path is
*syntactically* correct, and the error is due to `blend_nam` not being
an available variable.

This PR resolves this: paths with path template support now indicate all
errors in the UI, not just syntax errors, with red highlights and a list
of errors in the tool tip.

The primary mechanisms for this are:
- A new function `BKE_build_template_variables_for_prop()`, which takes
an RNA pointer and produces an appropriate template variable map for the
given property, which can then be used to fully validate a path
property's value in the UI code.
- A new enum `PropertyPathTemplateType` has been added to `PropertyRNA`,
which determines what variables should be made available to a property
and how they should be build. This is used by
`BKE_build_template_variables_for_prop()`.

Additionally, the following changes have been made to help ensure that
`BKE_path_apply_template()` and `BKE_path_validate_template()` produce
identical errors:
- Both functions now call into a third static function `eval_template()`
  that does the actual work, optionally modifying the input path or not.
- Previously only `BKE_path_apply_template()` had unit tests, but now
  the unit tests have been reorganized to simultaneously test both
  `BKE_path_apply_template()` and `BKE_path_validate_template()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/138679
2025-06-02 11:40:05 +02:00
quackarooni
0a1ff2b2ff Nodes: add "Power" and "Sign" operations to Vector Math node
This adds "Power" and "Sign" as per-element/channel operations to the Vector Math node.

Pull Request: https://projects.blender.org/blender/blender/pulls/139474
2025-06-02 08:53:13 +02:00
Jacques Lucke
cb795cc13a Cleanup: repeated typo
This changes `ouput`  to `output`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139711
2025-06-02 08:36:43 +02:00
Jacques Lucke
2daa3cc65d Cleanup: typo 2025-06-02 06:56:31 +02:00
Campbell Barton
492fa01eb3 Fix UV select similar with multi-object editing & sync-select
When sync select was enabled, checking for selected elements isn't
a correct way to check for visible UV's for that mesh.

Meshes without any selected vertices were skipped, even when they
contained similar UV's that should have been selected.
2025-06-01 14:30:16 +00:00
Campbell Barton
3d7b85ffda Fix UV select similar missing selection flushing calls
Selecting vertices/edges wasn't flushing the selection to faces.
2025-06-02 00:09:33 +10:00
Campbell Barton
e6e997ec60 Fix UV select similar vertex & edge tagging for updates on every face
Tagging for update on change was being called inside the face.
2025-06-01 23:53:46 +10:00
Campbell Barton
776e2eb707 PyAPI: expose Event.ndof_motion via RNA
Support reading NDOF motion via: even.ndof_motion which exposes:
translation, rotation, progress & time_delta properties.

Based on !139410.

Co-authored-by: Michael Menzi <nakoustix@gmail.com>
2025-06-01 06:39:26 +00:00
Campbell Barton
b4b2518c5b Build: resolve build error with USD enabled 2025-06-01 15:09:25 +10:00
Campbell Barton
d23e3b3863 Fix invalid blend-file writing logic in "Add color jitter support"
Error in [0] caused out of bounds buffer reads when writing CurveMapping
data.

[0]: 96e549c092
2025-06-01 14:46:16 +10:00
Campbell Barton
0e5a5ade32 Cleanup: add missing include 2025-06-01 14:09:16 +10:00
Charles S
96e549c092 Paint: Add color jitter support
Add ability to randomize color of each stroke for or use perlin noise
randomization during the stroke. Works similarly to grease pencil stroke
color randomization. This feature is available for all mesh color
painting modes (Sculpt Paint brush, Texture Paint and Vertex Paint)

This setting is available both as a per-brush setting and a unified
setting on the scene level. Additionally, the equivalent Grease Pencil
options have been migrated to these more generic flags and values.

Based on this [1] RCS request.

[1]: https://blender.community/c/rightclickselect/mwgbbc/

Pull Request: https://projects.blender.org/blender/blender/pulls/128953
2025-05-31 23:48:59 +02:00
Casey Bianco-Davis
2fd5b39a1b Grease Pencil: Edit Mode Outline Strokes operator
This adds an edit mode operator for converting the selected
strokes to outlines, same as it used to work in 4.2 LTS.

Co-authored-by: Falk David <falk@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/139540
2025-05-31 22:38:33 +02:00
Falk David
d332411b21 Grease Pencil: Fill Tool: Draw fill guides
This implements the "boundary strokes" features (from 4.2 LTS).
To make it a bit more clear, the feature is now called "fill guides".
It uses the same `Alt`+`LMB` shortcut.

Fill guides are denoted by a `".is_fill_guide"` attribute set to `true`.
Otherwise they behave as normal strokes.

There is the `Clean Up` > `Remove Fill Guides` operator to remove
the strokes.

This also adds an option to the Fill tool to automatically remove fill
guides once a fill has been created.

Pull Request: https://projects.blender.org/blender/blender/pulls/139293
2025-05-31 12:23:39 +02:00
Maxime-Cots
efd871e9ef USD: Implement new DomeLight_1 Schema for Import
Handle the `DomeLight_1` schema for import and translate to a World
material like what was already done for the original `DomeLight` schema.

The primary difference is that the new schema provides a `poleAxis`
attribute that authoring applications can use to remove ambiguity for
the orientation of the HDRI texture. Some care was made to match
`usdview` with a set of hand-crafted files. However, after matching,
some real scenes ended up displaying differently. These were corrected
but this could mean there's still issues that will need investigation
and fixing in the future.

Co-authored-by: Nig3l <nig3lpro@gmail.com>
Co-authored-by: Jesse Yurkovich <jesse.y@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/137761
2025-05-31 01:15:19 +02:00
John Kiril Swenson
0f37863fba Cleanup: VSE: Replace redundant "Change Effect Input" with "Swap Inputs"
The `SEQUENCER_OT_change_effect_input` operator does exactly the same thing
as `SEQUENCER_OT_swap_inputs` . "Change effect input" in the
"Effect Strip" context menu also seems bugged in recent versions.

Since "Swap Inputs" already has a keybind and the name itself is closer
to its intended use, just use that operator over the other one.

Also poll "Swap Inputs" so it is grayed out if the effect does not take
two inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/139615
2025-05-30 23:28:06 +02:00
Jacques Lucke
583586bf2d UI: use automatic search box width in more places
Most search-boxes still used a hard-coded width. This has the problem that it is
often too wide or too small for its content. This patch builds on top of
bf696320f6 to make the size of more menus adapt
automatically.

In all the cases I've tried, the width-detection code only ran once when the
search is triggered, and not continuously as might happen for some menus as
mentioned in
https://projects.blender.org/blender/blender/pulls/138653#issuecomment-1572027.

Pull Request: https://projects.blender.org/blender/blender/pulls/139423
2025-05-30 22:02:44 +02:00
Nika Kutsniashvili
975c71d43c UI: Fix incorrect capitalizations
Fixing some incorrect capitalizations I've come across

Pull Request: https://projects.blender.org/blender/blender/pulls/139548
2025-05-30 20:59:20 +02:00
Brecht Van Lommel
becc2fa9cb Fix: Metal parallel shader compilation does not respect -t option
This command line option to control the number of threads was already taken
into account for OpenGL and Vulkan.
2025-05-30 17:50:56 +02:00
Miguel Pozo
045926a305 GPU: Always use MTLShaderCompiler
No reason to use the base compiler on Metal.

Pull Request: https://projects.blender.org/blender/blender/pulls/139638
2025-05-30 17:41:13 +02:00
Philipp Oeser
7494a57b16 Fix: Graph Editor Circle/Lasso select fails to select handles
... if "Only Show Selected Keyframes Handles" is turned ON

The piece of code from fa24ad1fd5 -- and that copied from 233c650d55 --
which alters `incl_handles` for Circle/Lasso is outdated...

Atm. it would set `incl_handles` to `false` as soon as either "Show
Handles" is OFF or "Only Show Selected Keyframes Handles" is ON.
So bug-symptoms would be:
- turn ON both "Show Handles" and "Only Show Selected Keyframes Handles"
- select a single keyframe (so its handles are visible)
- try to select that handle using Circle/Lasso
- fail
- (alternatively: select the key using Circle/Lasso >> handles get
selected as well, also a fail)

In b037ba2665 though we introduced
`KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE` in which can properly handle
such cases in `keyframe_ok_checks` / `select_bezier_add` /
`select_bezier_subtract`, so it makes sense to only check for "Show
Handles" Circle/Lasso and let `initialize_box_select_key_editing_data` /
`keyframe_ok_checks` / `select_bezier_add` / `select_bezier_subtract`
handle the rest...

Noticed while doing !139349, part of #139314

Pull Request: https://projects.blender.org/blender/blender/pulls/139531
2025-05-30 16:31:51 +02:00
Omar Emara
f54b49b773 Fix #139586: Switch node crops input image
The Switch node in the compositor crops the input image. That's because
the two inputs share the same operation domain.

To fix this, we avoid domain realization for either inputs.

Pull Request: https://projects.blender.org/blender/blender/pulls/139637
2025-05-30 16:25:30 +02:00
Jeroen Bakker
cfe0dc2cc1 Refactor: Vulkan: Reuse GHOST VkInstance
This PR will reuse the VkInstance of GHOST_ContextVK when querying for
possible compatible devices. Previously a temporary VkInstance was
created but could trigger an error in the Vulkan loader.

Pull Request: https://projects.blender.org/blender/blender/pulls/139640
2025-05-30 16:03:45 +02:00
Miguel Pozo
b147b83413 Fix #139590: Draw: Ensure dupli batches are always extracted
Call `duplis.try_add` as part of `drw_engines_cache_populate`.

Pull Request: https://projects.blender.org/blender/blender/pulls/139597
2025-05-30 15:40:46 +02:00
Clément Foucault
940ef330c8 Fix: GPU: Make StaticShader::ensure_compile_async request for ready state
This was missing from the initial implementation.

This did not affect any user code path since they were not
checking for completion and only blocking on first `get`.
2025-05-30 15:21:06 +02:00
Clément Foucault
f82673afd9 Fix: GPU: Invalid logic in StaticShader::get()
Simple oversight. Didn't have any effect.
2025-05-30 15:21:06 +02:00
Julian Eisel
e87a9f2f69 Fix: Asset library tests using wrong internal asset library type
For automated tests we have support for directly loading a directory as
asset library. We might need this for other things too in future, so
this should be supported generally.

Directories loaded as asset libraries this way would internally be
treated as a Preferences on-disk library, which isn't correct. This
didn't cause any known issues, but with blender/blender!138150 it would
make tests fail incorrectly.
2025-05-30 15:05:47 +02:00
Hans Goudey
8e2c6bc617 Fix: Various fixes to unused CustomData to AttributeStorage conversion
So far this is unused, but it's used in #139165, and that pointed out
some obvious flaws in the code, like the resulting AttributeStorage
being completely ignored, and old CustomData layers not being freed.
Restructure the API a bit to make it simpler to use, and also make it
keep the non-generic layers in CustomData. That's not necessary for
point clouds but it will be necessary for curves (the next step) since
they have vertex groups.

Pull Request: https://projects.blender.org/blender/blender/pulls/139609
2025-05-30 14:46:39 +02:00