Commit Graph

115771 Commits

Author SHA1 Message Date
Hans Goudey
4bf34d9591 Nodes: Simplify location storage, remove hidden offfsets
Currently each node's position is stored in the coordinate space of
its parent. To find the location of a node on the canvas, we have to
apply the translation of each of its parents. Also, nodes have hidden
"offset" values used while transforming frame nodes. Together,
those made the system much more complicated than necessary,
and they made the Python API ineffective.

This commit removes usage of the offset values and moves nodes
to be stored in the "global" space of the node canvas. It also resolves
some weird behavior when resizing frame nodes, and fixes a few bugs.

The change is forward compatible, so we still write files with nodes in
the old parent-space format. In 5.0 the conversion when writing can be
removed. The existing Python API also stays the same. A new
"location_absolute" property gives node locations in global space,
and changing the old property also moves the child nodes of frames.

Resolves #92458, #72904.

Pull Request: https://projects.blender.org/blender/blender/pulls/131335
2024-12-11 21:06:41 +01:00
Germano Cavalcante
179f2a3cb1 PyGPU: Show error for unsupported POLYLINE shader configurations
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.

In C++, workarounds allow these shaders to function as before, albeit
with some limitations.

To address these known limitations, error messages are now raised when
a polyline shader is used with unsupported configurations.

Pull Request: https://projects.blender.org/blender/blender/pulls/131055
2024-12-11 20:39:25 +01:00
Germano Cavalcante
19fee82b72 Fix #131236: 'batch_for_shader' not working with POLYLINE shaders
In Blender 4.4 (since commit 00a8d006fe), polyline shaders stopped
using geometry shaders and now rely on SSBOs.

In C++, workarounds allow these shaders to function as before, albeit
with some limitations.

However, this change broke the `batch_for_shader` function in Python,
as `GPUShader.attrs_info_get()` only reads attributes and does not
support SSBOs.

To address this, the method now treats polyline shaders differently,
accessing SSBO inputs instead of attributes.

fix
2024-12-11 20:39:24 +01:00
Germano Cavalcante
93e3da136f PyGPU: Rename 'program' to 'shader' in documentation for 'GPUBatch.draw'
Renaming 'program' to 'shader' makes the documentation clearer.
2024-12-11 20:39:24 +01:00
Miguel Pozo
9584c9917a Fix #131040: EEVEE: First sample rendered with queued shaders
The first check for `materials.queued_shaders_count > 0` was done
before any synchronization, so it would always pass.

Pull Request: https://projects.blender.org/blender/blender/pulls/131756
2024-12-11 19:43:23 +01:00
Clément Foucault
9a21d67a54 Fix #131652: DRW: Viewport/EEVEE retained ghost image of object
This was caused by a bad state where a texture (likely the viewport)
texture, could be bound as texture by the viewport blit function
and kept bound as texture input during the subsequent redraw.
This would provoke a feedback loop which is UB.

It is still unknown why this is not catched by our GL layer
and why it isn't an issue in Vulkan or Metal nor other GL
implementations.

Add back all missing calls from previous `DRW_state_reset` to
avoid more regressions.
2024-12-11 18:13:21 +01:00
Harley Acheson
f05fff0d97 Fix #93769: Improved File Browser Button Tooltips
In the File Browser the "Cancel" button always has a tooltip hint of
"Cancel loading of selected file", even when you are saving. This PR
changes that to a more generic "Cancel file operation". Similarly the
save/load button always shows "Execute selected file", even when
loading. This PR instead uses the description of the operator that is
called when that button is pressed. When opening a file it shows "Open
a Blender file", saving shows "Save the current file in the desired
location", etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/131703
2024-12-11 18:11:27 +01:00
Hans Goudey
de8f882817 Cleanup: Use "this" keyword to access class members 2024-12-11 11:47:20 -05:00
Guillermo Venegas
0576f22a67 BLI: allow extending a Vector with another Vector with move-semantics
This enables moving elements form one vector to another.

Usually this is being doing by extending a vector with the content
from the secondary vector and then clearing the secondary vector.
However sometimes this being performed to transfer ownership of managed elements,
if elements are copied from the secondary vector, but not cleared, this could
lead to 2 vectors to share ownership of objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/131560
2024-12-11 17:43:44 +01:00
Matthew-Kabin
661facbde0 Fix #131370: Curves: Sculpt selection overlay missing
Selecting curves in sculpt mode is once again visible.

Pull Request: https://projects.blender.org/blender/blender/pulls/131550
2024-12-11 17:07:36 +01:00
Julian Eisel
2ce383b2f1 Fix: UI: Asset shelf popup not available
Mistake in f6a4d01703. This refactored the lookup for a named string context
member to avoid code duplication.

Intention was to construct a StringRef referencing the string stored in
context. But the refactored lookup returned an unintentional string copy, so
the reference would be constructed from a temporary string object that would
get destructed immediately.
2024-12-11 17:04:52 +01:00
Hans Goudey
cf6f6d515d Fix #112445: Possible to create invalid attribute with rename
Renaming attributes in the property editor didn't take into account
the required domains and types for builtin attributes. It might be
possible to trigger crashes by using a builtin name with the wrong
metadata. At the very least it would be confusing.

This commit extends the attribute provider check for builtin
attributes to give the required domain and type. We check that in
the attribute rename function to make sure the new name is valid.

Pull Request: https://projects.blender.org/blender/blender/pulls/131702
2024-12-11 16:52:33 +01:00
Hans Goudey
20c3269ac9 Fix #100324: Curves sculpt slide brush always resets with pressure
When releasing the pen the pressure would always go back to zero,
undoing the effect of the brush. To fix this, don't take pressure into
account for the strength, and don't display it in the UI. The grab brush
in mesh sculpt mode works the same way.

Pull Request: https://projects.blender.org/blender/blender/pulls/131744
2024-12-11 16:43:15 +01:00
Hans Goudey
071fb86a07 Cleanup: Remove unused function 2024-12-11 10:23:45 -05:00
Hans Goudey
937f5022f4 Fix: Missing translation in parent set menu item 2024-12-11 10:08:43 -05:00
Hans Goudey
50585b8131 Fix #131749: Missing text for operator buttons
Missing change of nullptr to std::nullopt after a recent cleanup.
2024-12-11 10:07:59 -05:00
Hans Goudey
c4d3f25aae Fix #91271: Reset to Default broken for fluid cache file format
The default wasn't in the list of static enum items which means the
value was reset to 0 instead of the proper default. Even though the
list is dynamically generated, the possible enum items should be
part of the static list anyway.
2024-12-11 09:58:02 -05:00
Omar Emara
28f8f6ccc6 Cleanup: Reduce code duplication in Dilate node 2024-12-11 16:38:36 +02:00
Philipp Oeser
5e5f2d2048 Fix #131726: New Editors initialize Custom Normal Display size to zero
The property actually had a default, but defined via
`RNA_def_property_float_default` [**RNA** defaults handle highlevel (UI)
stuff like "Reset to Default", but is not in effect when creating new
data/editors].

For this to work, we now define the default in **DNA**

(Also corrects the mismatch in value in this particular case)

NOTE: other editors also handle "defaults" in `SpaceLink` creation functions
in their respective space_XXX.cc files, so that is another system to look at.

NOTE: there might be many more cases that could benefit from moving the
default from RNA (or `SpaceLink` creation functions) to DNA, or possibly even
doing this via other alternatives like supporting C++ in-class member initializers
in makesdna, goal is the same: having a single "source of truth".
But going over these will be for another time...

Pull Request: https://projects.blender.org/blender/blender/pulls/131735
2024-12-11 15:21:37 +01:00
Hans Goudey
60056e55fb Fix #131721: Bevel modifier weight attribute crash with curve object
Missing an object type check.
2024-12-11 09:11:34 -05:00
Clément Foucault
81a6cd40e3 Fix #131732: Selection: Selecting in wireframe shading is broken
In the process of fixing, add some convenience functions.
2024-12-11 14:20:20 +01:00
Julian Eisel
caf11a2b9f Fix #111463: Outliner use-after-free when deleting an override on a mesh
Pass the session UID to the identity comparison callback directly,
instead of passing the ID pointer and accessing the session UID inside
the function. This way the dangling ID pointer is avoided.

Makes use of the support for passing named integers via context, which
was added in the previous commit.

Pull Request: https://projects.blender.org/blender/blender/pulls/131676
2024-12-11 13:41:46 +01:00
Julian Eisel
f6a4d01703 UI: Allow passing named integers via context
Similar to 2fbf206491, but for integers (not strings). Essentially this
allows passing named integer values through UI abstractions in a clean
way.

I used 64 bit integers here, since space isn't an issue here, and it
fits common integer types (so we don't have to add APIs for multiple
integer types).

Planned to be used to fix #111463 (following commit).
2024-12-11 13:39:24 +01:00
Omar Emara
317be33e95 Fix: Memory leak in Keying node when only Edges output is used
The Keying node leaks memory when only the edges output is used. That's
because tweaked matte is computed in that case, but is never used nor
released because the other two outputs are not needed. To fix this,
release the tweaked matte if it is not used.
2024-12-11 12:18:18 +02:00
Richard Antalik
0aa653c05c Fix: VSE: Possible division by zero in retiming code
Strips with single frame content could be retimed, which would lead to
division by zero.

Check content length before adding retiming keys.

Pull Request: https://projects.blender.org/blender/blender/pulls/131725
2024-12-11 10:29:45 +01:00
Omar Emara
3e35d411be Fix: Compositor leaks memory in certain setups
The GPU and new CPU compositors leak memory when an output is connected
to multiple inputs inside the same pixel operation. That's because nodes
do not know that their multiple outgoing links are in fact going to the
same operation, so their initial reference count is more than the actual
reference count.

To fix this, we keep track of the reference count of pixel operation
inputs and release the inputs based on that reference count.
2024-12-11 10:45:48 +02:00
Clément Foucault
40b8ccefbe Fix: Overlay: Crash cause by grid enabled for nodetree areas 2024-12-11 09:40:14 +01:00
Richard Antalik
a4ca725d86 VSE: Improve retiming code readability
Add utility function to convert timeline frame to frame index.

This also fixes unreported incorrect math in
`SEQ_retiming_transition_key_frame_set()`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131659
2024-12-11 08:47:53 +01:00
Campbell Barton
918398f0fa Cleanup: rename vfont_get_data -> vfont_data_ensure
Use the term "ensure" when data is created on demand.
2024-12-11 17:34:01 +11:00
Campbell Barton
27eece6d49 Cleanup: reduce repitition in curve font access 2024-12-11 17:33:04 +11:00
Campbell Barton
139498738a Cleanup: improve comments & typo in ui_tooltip_from_vfont 2024-12-11 17:32:54 +11:00
Campbell Barton
44970c918a Fix tool-tips for fonts with relative paths
Relative paths were not expanded and would show "File not found".
Expand relative paths & remove the file check for the built-in font.
2024-12-11 17:15:09 +11:00
Campbell Barton
560b6e2831 Cleanup: spelling (make check_spelling_*) 2024-12-11 11:23:51 +11:00
Campbell Barton
e0f6a067c0 Cleanup: quiet undeclared function warning 2024-12-11 11:23:51 +11:00
Sean Kim
f10f278914 Cleanup: Rename & move SCULPT_handles_colors_report
Pull Request: https://projects.blender.org/blender/blender/pulls/131709
2024-12-11 01:22:36 +01:00
Hans Goudey
84c7684871 Geometry Nodes: Propagate vertex groups in join / realize instances nodes
Currently the realize instances code (which is also used by the join
geometry node) always creates generic attributes instead of vertex
groups. The expectation was that vertex groups would be replaced
by some form of generic attribute sooner rather than later. However,
it's clear that won't happen for some time, and this issue causes users
a lot of trouble. This commit preserves the vertex groups through the
operation. Any attribute name that was a vertex group on any of the
input meshes will become a vertex group in the result.

In the code this is a simple change because the attribute writer
abstraction allows writing to vertex groups as if the were just like
other contiguous arrays. In the future we could optimize the code
specifically for vertex groups.

This resolves the "bug" part of #99197 where the nodes remove vertex
groups. However, this doesn't change the fact that generating
primitive meshes in geometry nodes won't create vertex groups.
In general the property editor settings on the original mesh have
no effect on meshes created from scratch in geometry nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/131692
2024-12-11 01:17:23 +01:00
Clément Foucault
f8da7ecfe1 Cleanup: DRW: Move DRW_SHADER_FREE_SAFE and DRW_UBO_FREE_SAFE to GPU 2024-12-11 00:43:32 +01:00
Clément Foucault
9bd1a92778 Cleanup: DRW: Remove unused code 2024-12-11 00:38:10 +01:00
Clément Foucault
0ad4696125 Cleanup: DRW: Remove remaining of DRWTexture API 2024-12-10 22:47:46 +01:00
Clément Foucault
ad5efd4a5c Cleanup: Compositor: Use texture pool API directly 2024-12-10 22:42:53 +01:00
Clément Foucault
37f9ec7235 Refactor: Grease Pencil: Remove legacy texture pool API usage 2024-12-10 22:26:16 +01:00
Hans Goudey
363bc88ee7 Cleanup: Remove unnecessary unique_ptr usage for Line Art runtime
There is no need for this to be a unique pointer, the set can just be
stored directly.

Pull Request: https://projects.blender.org/blender/blender/pulls/131632
2024-12-10 22:05:54 +01:00
Hans Goudey
7baa22b49d Cleanup: Correct usage of std::unique_ptr in Line Art code
`.release()` is technically fine but semantically wrong here. First,
release is meant to take ownership from the unique_ptr, meaning
at best it's "weird" to not do anything with the pointer afterwards.
Second, the runtime struct with the unique_ptr was just default
constructed, which means the unique_ptr will be empty anyway.
2024-12-10 22:05:53 +01:00
Hans Goudey
7c97088fb2 Cleanup: Use proper type instead of void for line art runtime struct 2024-12-10 22:05:53 +01:00
Hans Goudey
282dd0c5c0 Cleanup: Fix copyright year in MOD_lineart.hh 2024-12-10 22:05:53 +01:00
Hans Goudey
03fd5fc58e Cleanup: Various C++ cleanups in MOD_lineart.hh
- C++ headers shouldn't have everything inside of `extern "C"`
- `typedef` and `struct` keywords are unnecessary in C++
2024-12-10 22:05:53 +01:00
Hans Goudey
2fd3a633db Cleanup: Remove unnecessary name copy when removing attribute
BKE_defgroup_listbase_name_find has a StringRef argument nowadays.
2024-12-10 14:34:03 -05:00
Hans Goudey
d3fdfe013d Cleanup: Remove unnecessary anonymous attribute checks
These come from the time when anonymous attributes weren't
just names with a different prefix.
2024-12-10 14:34:03 -05:00
Harley Acheson
93e8c231aa Fix #88236: When Tabbing in Block Skip UI_HIDDEN
When pressing Tab to move to the next input in the same block (and
Alt-Tab to move backward), we currently skip buttons that have the
UI_BUT_DISABLED flag. This PR makes these operations also skip buttons
that have UI_HIDDEN. This makes tabbing work better in places like the
color picker where we show/hide the RGB and HSV buttons depending on
mode.

Pull Request: https://projects.blender.org/blender/blender/pulls/131698
2024-12-10 20:13:28 +01:00
Jacques Lucke
14bb6cb62b Fix #129338: wrong tooltip for center option for text boxes
The tooltip used to say that the center is always the objects origin.
However, in the case of text-boxes, it's actually the center of the text box.

There might be valid use-cases to move the text box center to the
object's center, but it seems like the same can be achieved with offsets.
Also that would be a new feature that's out of scope of a bug report.

Pull Request: https://projects.blender.org/blender/blender/pulls/131693
2024-12-10 18:44:04 +01:00