Commit Graph

118328 Commits

Author SHA1 Message Date
Habib Gahbiche
6542c86ff5 Nodes: implement operator node.activate_viewer()
The goal is to have a clear separation between active nodes and active viewers in a node tree. Both the compositor and geometry nodes viewers are supported. This will also allow us to implement shortcuts for viewers for geometry nodes.

A viewer node can be activated using
```
viewer_node = bpy.context.scene.node_tree.nodes["Viewer"]
with bpy.context.temp_override(node=viewer_node):
    bpy.ops.node.activate_viewer()
```

Pull Request: https://projects.blender.org/blender/blender/pulls/134456
2025-03-07 11:48:45 +01:00
Sybren A. Stüvel
5597e01aa6 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-07 11:25:30 +01:00
Bastien Montagne
00de07f752 I/O: Smoothgroups: Add option to also consider 'sharp vertices'.
According to reports and testing in blender/blender-addons#104434, DCCs
tend to behave badly when rebuilding normals from 'bitflags'
smoothgroups, if different smoothgroups using the same bitflag value share
(are connected by) some common vertices, even if there are no common
edges between them.

This commit adds a new option to the RNA API generating smooth groups,
to also consider smooth groups only sharing vertices as neighbors.

It also makes related required change to implementation, and some
refactor of the API, splitting public functions between 'normal' and
'bitflags' versions.

This should make changes proposed in blender/blender-addons#105516
much simpler, and allow for a matching behavior in smoothgroups
generated by the OBJ exporter as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135248
2025-03-07 11:24:37 +01:00
YimingWu
8ebeafa6b9 Fix #135586: Grease Pencil: Crash in length modifier extending curves
Previously in 43fde8c39c the point span
for calling `extend_curves_straight` was set to a fixed `{1}` with only
1 element, this causes index access to go out of range, which is the
cause of crash #135586. However there are some other issues within the
code path, mainly:

- The meaning of `start/end_points` are unclear
- Behaviour of extending a 2-point stroke is undefined

This PR clarifies these by adding some comments and change a bit of the
logic in the code so it's more understandable.

Pull Request: https://projects.blender.org/blender/blender/pulls/135608
2025-03-07 11:24:21 +01:00
YimingWu
ec33541b99 Fix #135611: Grease Pencil: Correct poll function for layer_group_color_tag
Operator `GREASE_PENCIL_OT_layer_group_color_tag` did not check the
existence of active layer group before executing. Now corrected with a
`poll()` callback.

Pull Request: https://projects.blender.org/blender/blender/pulls/135612
2025-03-07 11:21:01 +01:00
Clément Foucault
4179960ede Overlay: Add DepthOnly GPU debug capture scope
Allow to capture the depth loop.
2025-03-07 11:18:33 +01:00
Bastien Montagne
1e00054195 Cleanup: 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/134452
2025-03-07 10:44:49 +01:00
Sybren A. Stüvel
b71fed904b Cleanup: Remove F-Curve handling from undo in Curve edit mode
This commit removes the F-Curve handling from the legacy Curve edit mode
undo code.

The legacy Curve edit mode uses the per-mode undo system. This tried to
deal with changes in the animation data as well, but did so in a very
limited way. Only F-Curves were copied & restored, which means the
Action Groups were effectively deleted as soon as you undo something.
Furthermore, the code wasn't updated for slotted Actions yet, so
effectively it was a no-op, because it only saw the always-empty legacy
`Action::curves` field.

Fixing this properly would mean discarding this undo code, and moving to
the global undo system, as the animation editors allow changing the
animation of anything in the scene, not just the Curve data-block that
is being edited. Since the legacy curve ID type is, well, legacy, I
don't think it's worth going this route.

This is a non-functional change, as `action->curves` is always empty,
and so nothing was backed up or restored anyway.

Pull Request: https://projects.blender.org/blender/blender/pulls/135585
2025-03-07 10:40:16 +01:00
Pratik Borhade
adba9bda59 Cleanup: Grease Pencil: Remove legacy undo code
Remove GP legacy undo code. Annotation doesn't require it, memfile/global
undo is used by annotation system.
Continuation of d961f8f9ec.

Pull Request: https://projects.blender.org/blender/blender/pulls/135501
2025-03-07 10:33:26 +01:00
Pratik Borhade
4e141d11c5 Cleanup: Grease Pencil: Remove legacy animation drawing code
`ANIMTYPE_GPDATABLOCK` is not used anymore animation editor for channel
drawing. `ANIMTYPE_GPLAYER` is still needed for annotation channels in
dopesheet.

Pull Request: https://projects.blender.org/blender/blender/pulls/135556
2025-03-07 10:32:33 +01:00
Campbell Barton
9b9bddb3fd Merge branch 'blender-v4.4-release' 2025-03-07 20:12:48 +11:00
Campbell Barton
5849d9aec3 Fix crash using transform with grease pencil without an "area" 2025-03-07 20:11:51 +11:00
Philipp Oeser
be7e74972c Merge branch 'blender-v4.4-release' 2025-03-07 09:52:20 +01:00
Philipp Oeser
084cb40e98 Fix #108722 : Measures not cleared when removing annotation layer
Removing the layer would leave the ruler gizmos on screen, only way to
update was changing to another tool and back. Now remove all
corresponding gizmo ruler items found (also in different windows/scenes)
when removing the ruler annotation layer.

Also add a proper notifier that grease pencil was edited (this way we
also get immediate update when a ruler annotation layer was added --
which was also missing).

Pull Request: https://projects.blender.org/blender/blender/pulls/135571
2025-03-07 09:52:01 +01:00
Philipp Oeser
6fe188f9f2 Merge branch 'blender-v4.4-release' 2025-03-07 08:35:36 +01:00
Philipp Oeser
d18fe0c575 Fix #135523: Calculate Motion Paths ignores Selected Keys option
Since the switch to slotted actions, we cannot solely rely on the
Listbase of `curves` (this is for legacy actions only), but need to
consider Channelbag for new slotted actions. There is
`assigned_action_has_keyframes` that handles both of these
and would also early out if we have no keyframes to process,
so use it.

Pull Request: https://projects.blender.org/blender/blender/pulls/135566
2025-03-07 08:35:17 +01:00
Philipp Oeser
cf95ff1a6e Fix #129782: ActionSlot channels in Action Editor mode lack background
This was introduced in 1d2cea1e3e

It was not using any `draw_backdrop` callback though, which is now
added.

Main point of discussion is probably if we want to use `Dope Sheet
Channel` theming (which is only used for `Object` and `Scene` channels
atm., also referred to as "root" in code) or the `Dope Sheet Sub-
channel` theming (which is now used for all kinds things - object data,
but also actions..., also referred to as "dataexpand" in code)

Given the similarity to actions, one might lean towards "Sub", but otoh
that channel occupies a "root" channel in the action editor mode. If I
understand correctly, an `ActionSlot` is also mostly used to "separate"
different objects in the same action, so that then makes an ActionSlot
actually more similar to how the "root" channel is used for `Object` and
`Scene` in dopesheet mode.

This is why this PR makes an `ActionSlot` use the "root" theming.

NOTE: we also might want to revisit the naming in code (suggestion would
be TH_DOPESHEET_CHANNELOB > TH_DOPESHEET_CHANNELROOT,
TH_DOPESHEET_CHANNELSUBOB >TH_DOPESHEET_CHANNELSUBOB), but that is for
another time...

Pull Request: https://projects.blender.org/blender/blender/pulls/135506
2025-03-07 08:35:02 +01:00
Campbell Barton
bfa568b4ff Cleanup: replace filename with filepath for full paths 2025-03-07 15:56:24 +11:00
Campbell Barton
7d13c1d426 Merge branch 'blender-v4.4-release' 2025-03-07 15:50:15 +11:00
Campbell Barton
f6d730d6e6 Fix "Image from View" ignored filepath property
Assign the filepath from the operator to the generated image.
2025-03-07 15:49:39 +11:00
Campbell Barton
e9b4f13304 Merge branch 'blender-v4.4-release' 2025-03-07 15:18:14 +11:00
Campbell Barton
f7ba05991f Fix uninitialized return value from constraint operators
The utility function edit_constraint_invoke_properties could return
false without setting the return value, causing the operators invoke
function to return an uninitialized flag.
2025-03-07 15:16:51 +11:00
Campbell Barton
f9c1475020 Fix crash adding a view layer without an active window
Resolve regression in [0].

This is most likely to occur when called from Python.

[0]: d1972e50cb
2025-03-07 15:15:15 +11:00
Brecht Van Lommel
f6eb81e62a Cleanup: Fix (harmless) null pointer increment in particle code 2025-03-06 22:34:22 +01:00
Falk David
e39c83c881 Merge branch 'blender-v4.4-release' 2025-03-06 21:19:31 +01:00
John Kiril Swenson
993f9b2d30 VSE: Report one-time property changes
This patch adds warnings when view transform or FPS values are changed
by dragging in an initial strip with "Set Scene Frame Rate" or "Set View
Transform" enabled.

In the case that both occur at the same time, reports are not
interweaved but both still show up in the info viewer -- this is a
limitation of `BKE_report` itself. Future work could modify the report
system to support queuing, but this is still an improvement over
previous behavior.

Pull Request: https://projects.blender.org/blender/blender/pulls/135494
2025-03-06 21:13:12 +01:00
Jesse Yurkovich
0a16ba9911 Fix #135502: Handle Alembic attribute size mismatch when reading points
The Alembic file in the issue had 0 points, and 4 widths, defined for
frame 33 which is certainly incorrect from whichever software produced
said file. However, our import code should have proper guards in place
to more gracefully handle the situation.

Pull Request: https://projects.blender.org/blender/blender/pulls/135548
2025-03-06 20:54:53 +01:00
Jesse Yurkovich
3a0e4fe316 Fix #134039: Alembic procedural proxy mesh should be owned by GeometrySet
When using Alembic procedurals, the Mesh Sequence Cache attempts to
replace the original geometry with a plain old cube. However, it never
frees this new cube geometry. Transfer ownership to the underlying
GeometrySet instead.

Investigating the scenario also showed that the `~AlembicProcedural`
dtor was removing an item from the `nodes` vector while iterating over
it, which triggers debug asserts on at least MSVC. I believe the removal
is unnecessary since this is the dtor and ASAN appears clean now.

Pull Request: https://projects.blender.org/blender/blender/pulls/134085
2025-03-06 20:53:52 +01:00
Clément Foucault
2131ef0a20 DRW: Use depsgraph update count to replace view_update
This avoid having to flush explicitely and the need for syncing.
It also removes a lot of complexity in the process.

These updates are not granular and do not need to so much
boiler plate code.

The depsgraph update counter now becomes atomic to avoid
undefined behavior when a depsgraph is being destroyed and
its memory reused (same thinking as the non-copy-on-eval IDs).

I tested some use cases (object update, sculpt update,
shading update) and they are all working.

Pull Request: https://projects.blender.org/blender/blender/pulls/135580
2025-03-06 19:15:29 +01:00
Julian Eisel
b9907cb60b Fix #134418: Double clicking a file crashes Blender if load UI is off
Screen initialization is more context dependent than it used to be
because of region polling, so the context needs to be set up correctly.
Here was a case where the initialized window/screen passed to polling
didn't match what's in context (UI context was unset in fact).

Some asserts could be added to ensure data passed to screen
initialization matches context, but can do that separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/135568
2025-03-06 19:01:10 +01:00
Clément Foucault
b4a1a140d7 Fix #134509: GPU: Node editor links are invisible on Intel GPU
This bug also affects integrated GPU as well.
Remove the GPU familly check.
2025-03-06 18:48:56 +01:00
Hans Goudey
9287bb759b Geometry Nodes: Import Text node
As a small addition to the import node features for 4.5,
this simple node imports a text file as a string. Potential
use cases include retrieving text for motion graphics.

Currently this just allows .txt files. More extensions could
be allowed in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/135459
2025-03-06 18:47:30 +01:00
Hans Goudey
4fd96e61d5 Fix: Missing cache invalidation in grease pencil transform operator 2025-03-06 12:40:46 -05:00
Richard Antalik
951adb19ab Fix lite build error
Missed renaming LoadData in ifdef'd parts of code.
2025-03-06 18:38:32 +01:00
Miguel Pozo
db053ff8c5 Fix: EEVEE: Avoid double lock in ShaderModule::module_free
Use a separate lock for the module ops.

Pull Request: https://projects.blender.org/blender/blender/pulls/135587
2025-03-06 18:13:18 +01:00
Jacques Lucke
cc8979650b Screen: support garbage collection of layout panel states
Identifying layout-panels using strings and storing their open-state in their
parent panel is generally very convenient. However, right now there is no
mechanism to free the open-close state of panels that are not in use anymore.
It's generally not possible to know if a panel is not used anymore (e.g. it may
also belong to a temporarily disabled add-on). So every mechanism here will be
based on heuristics. A simple but typically very good heuristic is to just
remove the least-recently-used panel states when there are too many. So that's
what is implemented here.

This introduces a logical clock that increases whenever a panel state is used
and stores the last usage time on the panel state. This allows us to remove the
least-recently-used states later on. Specifically, that is done when the .blend
file is loaded the next time. It's not done at another time, because it quite
difficult to be sure that freeing panel states wouldn't cause dangling pointers
in such cases. I think doing it on-load should be good enough for all practical
use-cases.

Note, I don't know if the lack of such garbage collection has ever caused a
problem anywhere. However, it seems better to have some solution now than trying
to solve it after the problem has occurred and made someone's file unusable.

Pull Request: https://projects.blender.org/blender/blender/pulls/135569
2025-03-06 17:41:49 +01:00
Hans Goudey
a15005dbef Fix: Build error after recent Grease Pencil commit
Caused by e0f5ce46b7.
2025-03-06 11:00:09 -05:00
Hans Goudey
395e8796cf Fix: Missing radius change tag in curves radius transform operator 2025-03-06 10:35:36 -05:00
Falk David
5f464b2de0 Fix #135235: Grease Pencil: Crash when removing layers in python API
When iterating over the layers in a Grease Pencil object,
removing the layers can lead to crashes.

This PR is a better alternative to !135253.

Instead of checking if the layer is valid, simply fetch the latest layer
cache for each iteration and check if the index is valid.

This means that we will skip over layers if they get removed during
iteration, but we no longer can crash. If users want to remove multiple
layers at once, it's better to do this in two passes. E.g. by first
collecting the names of the layers to remove, iterating over
these names and then removing the layers by getting it by its name.

Pull Request: https://projects.blender.org/blender/blender/pulls/135574
2025-03-06 16:30:35 +01:00
Jeroen Bakker
be4f9c0ac8 Merge branch 'blender-v4.4-release' 2025-03-06 16:30:16 +01:00
YimingWu
e0f5ce46b7 Fix #134599: Grease Pencil: Connect edges when converting from mesh
The Mesh to Grease Pencil conversion would convert every edge into a stroke.
This was not the case prior to Blender 4.3. Edges with no branches would be
converted into a single stroke instead of mutliple ones.

This fix uses `geometry::mesh_to_curve_convert` from geometry nodes to
achieve more optimal result with edges connected into one stroke when
possible.

Pull Request: https://projects.blender.org/blender/blender/pulls/135557
2025-03-06 16:29:14 +01:00
Jeroen Bakker
37d781aa2a Fix #135516: Vulkan: Shader output viewport broken on RDNA2
When using the official RDNA2 driver +vulkan we see the same issue we
as #123787. Adding the same workaround to vulkan as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/135565
2025-03-06 16:28:47 +01:00
Clément Foucault
f8c23fc793 Cleanup: EEVEE: Unused variables 2025-03-06 16:24:59 +01:00
Hans Goudey
466d5e2a4c Cleanup: Use StringRef for point cloud attribute names
Also these don't need to be exposed elsewhere. The same name
is used everywhere anyway. And avoid some namespace repetition
in one function.
2025-03-06 09:55:02 -05:00
Christoph Lendenfeld
ba1e51cff9 Merge branch 'blender-v4.4-release' 2025-03-06 15:54:03 +01:00
Christoph Lendenfeld
b834ca4fb1 Fix: Custom Properties named identical to existing properties fails to key
When inserting keys in the viewport by pressing `I`,
certain custom properties would not get keyed if their name
was identical to existing properties (for example `scale`).

That was because we use the name of the property to resolve
an rna path and check if the path resolved. This was of course
true in the described case and the square brackets would never be added.
The solution is to check for `RNA_property_is_runtime` which is false
for properties defined inside Blender.

Pull Request: https://projects.blender.org/blender/blender/pulls/135304
2025-03-06 15:52:29 +01:00
Clément Foucault
5a32440edf Refactor: DRW: Replace by enabled engine list by static members
Iteration is done through templates.

Removes the need for the enabled engine list/vector.

Reduces API complexity.
2025-03-06 15:20:35 +01:00
Clément Foucault
4f909ba6fd DRW: Make DRWContext thread local
The owner of the context is now always the local context.
The `DRWContext` is now a temporary object that owns
no data.

The draw debug API is being put in a non-working state by
this PR as it conflicts with the new lifetime / ownership of
the `DRWContext` class.
A new design with a global (threadsafe) debug module is needed
to add back support for these debug features. Note that these
are not user facing features.

Some parts of EEVEE are still calling the global context and that
caused crashes in the volume probe baking pipeline where
the context is not yet known. Sort circuiting these function
calls in this case fixes the issue, but a more longer term
solution would be to alway have a `DRWContext` available inside
`eevee::Instance`.

I did some testing and didn't find much of a difference in frame time.
However, we should still strive to remove all global access in the future
to avoid potential overhead of `thread_local`.

Pull Request: https://projects.blender.org/blender/blender/pulls/135521
2025-03-06 15:18:02 +01:00
Clément Foucault
e36cc4dcf7 Cleanup: Grease Pencil: Remove uneeded push-constants
All of these push-constants were either redundant or
not used anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/135561
2025-03-06 15:14:05 +01:00
Sybren A. Stüvel
15758ab854 Merge remote-tracking branch 'origin/blender-v4.4-release' 2025-03-06 14:13:03 +01:00