Commit Graph

44601 Commits

Author SHA1 Message Date
Pratik Borhade
a1fc2eb37a UI: Outliner: Support ctrl/shift operations for exclude collection
All restriction toggles supports:
- isolating active element with ctrl click
- Recursively set values to child when holding `shift`,

except "exclude" property. Now added support for `exclude` property in
this PR. When clicked on property of active collection, excute
`view_layer__layer_collection_set_flag_recursive_fn`.

Resolves #131366

Pull Request: https://projects.blender.org/blender/blender/pulls/131423
2024-12-13 12:20:25 +01:00
Julian Eisel
126d59efdd Fix: UI: Crash when trying to display invalid icon
Requesting an icon from an invalid icon ID was always handled
gracefully, resulting in the icon not being shown and an error print in
debug mode. 2b7a968909 caused a null pointer dereference in that case,
leading to a crash.
2024-12-13 11:33:37 +01:00
Pratik Borhade
3dfb7830a6 Fix #131705: Crash when ui created with prop_with_menu
button created from python (`ui_def_but_rna`) does not seem to assign
free/copy callbacks to the menu with rnaprop. So instead of an assert
check, assign callback functions in `ui_but_rna_menu_convert_to_menu_type`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131719
2024-12-13 11:19:13 +01:00
Campbell Barton
48bf2c08b7 Fix experemental preference use when "Developer Extras" is disabled
When "Developer Extras" is disabled, the experemental options
must not be used.

Some checks for experemental options weren't using the macro which
checks both are set.

Add comment to avoid this happening in the future.
2024-12-13 11:25:39 +11:00
Hans Goudey
da8ecea151 Refactor: Nodes: Move socket field status to array
Instead of storing an optional in the runtime data of each node,
move the field status for the socket to an array in the node tree's
runtime data. This wasn't possible before because selecting nodes
reordered nodes which caused too much cache recomputation.

The benefit is having less geometry-nodes specific data in the
node socket runtime struct, and a slight move to a more data-
oriented storage format.

Pull Request: https://projects.blender.org/blender/blender/pulls/131822
2024-12-12 23:52:39 +01:00
Sean Kim
e56c9fc342 Fix #131820: Sculpt brush strength visualization too large
Mistake in 0a6e7e9140

Pull Request: https://projects.blender.org/blender/blender/pulls/131823
2024-12-12 22:39:43 +01:00
Hans Goudey
cd7b901355 Cleanup: Remove unused Grease Pencil legacy functions 2024-12-12 16:17:08 -05:00
Jason Fielder
81f9df606a Fix #130700: Release Metal resources after each frame when rendering Python animations.
Rendering animations from Python scripts via `bpy.ops.render.opengl()`
did not trigger any of the notifications in the Metal back-end to
indicate a frame had been rendered and that the associated resources
could be released. This adds a call to GPU_render_step() after each
render. For the original asset in the bug report this reduces the high
memory watermark from 30gb to 13gb for 500 frames. 13gb is likely
still too high and therefore it is likely there are additional leaks
that need to be addressed so this should only be considered a partial
fix.

Authored by Apple: James McCarthy

Co-authored-by: James McCarthy <jamesmccarthy@apple.com>
Co-authored-by: Clément Foucault <foucault.clem@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/131085
2024-12-12 20:30:18 +01:00
Sybren A. Stüvel
7d5143e94c Revert "Refactor: Core, give the IDWALK_… enums an explicit name"
This reverts commit 3ef748789d. It was
landed too hastily, my apologies.

Pull Request: https://projects.blender.org/blender/blender/pulls/131813
2024-12-12 20:03:27 +01:00
Hans Goudey
4ca3f02601 Refactor: Nodes: Improve socket node lookup functions
- Use return values instead of return arguments
- Remove the socket index lookup which was only used once
- Always use the topology cache for node_find_node
- Improve the documentation
- Add a const version of node_find_node

Overall, I think always using the topology cache will give more
predictable performance. Though it may require more cache
rebuilds after the node tree is changed, in practice there are
plenty of other things that require that already. This way, code
that doesn't change the node tree will get better performance
without having to think about the caching.

Pull Request: https://projects.blender.org/blender/blender/pulls/131811
2024-12-12 18:04:36 +01:00
Sybren A. Stüvel
3ef748789d Refactor: Core, give the IDWALK_… enums an explicit name
Two commits that basically do the same thing for two `enum`s: give
them a name.

- the `IDWALK_…` enum → `LibraryForeachIDFlag`.
- the `IDWALK_CB_…` enum → `LibraryForeachIDCallbackFlag`.

This way the flags are type-safe, and it's known where values come
from. This is much preferred (at least by me) to just having `int
flags`.

Uses of `0` have been replaced with `IDWALK_NOP` and `IDWALK_CB_NOP`,
as those have the same value and are of the right type.

One invalid use of `IDWALK_NOP` was detected by this change, and is
replaced by `IDWALK_CB_NOP`. And another one in the opposite
direction.

This change might be incomplete; I gave the enum a name, fixed the
compiler errors, and then also updated assignments like `int cb_flag =
cb_data->cb_flag`. I might have missed some assignments to `int`
though.

No functional changes.

----------

I intend to land this PR as its two separate commits. I just put them in the same PR so the buildbot can handle them in one go, and we don't have a stack of highly relatled PRs.

In the future this could also apply to the `IDWALK_RET_…` enum. This one I left out, though, because a proper cleanup there would also have to include their ambiguity on whether they are bitflags (like the enums in this PR) or not. Their values and the code in `BKE_lib_query_foreachid_process()` implies they are bitflags, but in practice they are never or'ed together and just used as discrete values.

Pull Request: https://projects.blender.org/blender/blender/pulls/131803
2024-12-12 17:28:28 +01:00
Germano Cavalcante
ba6b4d4553 Fix: mixed snap not working on geometry generated by curves
`snap_polygon` and `snap_edge_points` were, for no reason, limited to
Mesh type Objects.
2024-12-12 13:10:36 -03:00
Laurynas Duburas
3cbeb8ff2b Curves: Remove usage of IndexMask::operator[] in transform
Removes usage of `IndexMask::operator[]` in transform
function `curve_populate_trans_data_structs`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131784
2024-12-12 15:36:24 +01:00
Hans Goudey
c3cc3c019d Fix #103785: Geometry Nodes attribute inputs aren't overridable
The "use attribute" and "attribute name" IDProperties were missing
the overrideable status and the static type status. This was an oversight
from when those tags were added.

This commit fixes the flag on new modifier properties as they're created
and applies versioning to old properties. It also fixes the poll of the toggle
input attribute operator so that it isn't possible on non-editable objects.

Pull Request: https://projects.blender.org/blender/blender/pulls/131768
2024-12-12 13:48:52 +01:00
Jesse Yurkovich
a6d4e91db8 Cleanup: USD: various non-functional changes
Tidy up:
- Use blender::Map and blender::Vector for newly created `prim_map`
- Leave bread-crumb comment for moving map creation outside of loop
- Expand UI tooltip for newly added export option

Pull Request: https://projects.blender.org/blender/blender/pulls/131770
2024-12-12 00:57:29 +01:00
Harley Acheson
fe6609c4eb Fix #111379: Allow Win32 Volume Names to Contain Characters > U+FFFF
When processing volume names for the File Browser sidebar lists we are
properly handling Windows "wide" characters (UTF-16) as long as they
are single wide characters, so below U+FFFF. For characters above this
value we get a pair of UTF-16, and end up trying to convert each to
UTF-8 as separate UTF-32 values. The result is blank output and a
console error that "surrogates not allowed." This PR just does this
conversion correctly using utfconv.

Pull Request: https://projects.blender.org/blender/blender/pulls/131763
2024-12-12 00:49:33 +01:00
Gilberto.R
8ceaaafde8 UI: Use consistent naming for mode toggle on undo history
Change name of OBJECT_OT_editmode_toggle to "Edit Mode" and name of
PAINT_OT_texture_paint_toggle to "Texture Paint Mode" to display in a
more consistent manner in Undo History.

Pull Request: https://projects.blender.org/blender/blender/pulls/112703
2024-12-11 21:29:43 +01:00
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
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
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
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
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
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
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
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
Harley Acheson
2b7a968909 Fix #80356: UI Icon Alpha Should Not Affect Matcaps & Studio Lighting
Changing Icon Alpha in Preferences / Themes / User Interface / Styles /
Icon Alpha is meant to change the opacity of the UI icons. It should not
change the opacity of the previews of Matcaps and Studio lights as this
changes the color because of mixing with the background. This PR just
skips this icon type when changing the alpha for this preference.

Pull Request: https://projects.blender.org/blender/blender/pulls/131690
2024-12-10 18:19:28 +01:00
Laurynas Duburas
8dcb76b6ad Fix #130688: Grease Pencil: Multiframe Editing not applying falloff for rotation & scale
Fixes rotation and scale in multi frame editing.

Pull Request: https://projects.blender.org/blender/blender/pulls/131634
2024-12-10 17:21:06 +01:00
Falk David
612be514c6 Grease Pencil: Add lasso/box erase operators in draw mode
In Blender 4.2 in Grease Pencil draw mode it was possible to
erase strokes using box and lasso gestures.

Under the hood, these were just using the selection operators
that had special deletion handling if the object was in draw mode.

Rather than hacking this into the selection operations, this adds
two new operators:
* `grease_pencil.erase_lasso`
* `grease_pencil.erase_box`

When using one of the erase operations with auto-key, the previous
keyframe will be duplicated to the current frame (for the drawings
that are affected by the eraser).

They are mapped to the same shortcuts than the selection
operators in Blender 4.2.
* Lasso erase: `Ctrl`+`Alt`+`RMB`.
* Box erase: `B`.

This is part of #130518.

Pull Request: https://projects.blender.org/blender/blender/pulls/131504
2024-12-10 11:50:05 +01:00
Lukas Tönne
d6e78d05c9 Transform: Crazyspace support in edit mode for Curves and Grease Pencil
Edit mode for curves and Grease Pencil was using the plain object transform for
all points without support for individual crazyspace transforms. This patch adds
support for the local rotation matrices, so editing curves on top of modifiers
converts offsets into original geometry space.

For Curves objects these matrices are currently only computed by the surface
deformation node, so editing on top of a surface deformation is the only case
that works currently.
For Grease Pencil the armature modifier is supported and more should be added
in future (see overview task #131599).

Pull Request: https://projects.blender.org/blender/blender/pulls/131619
2024-12-10 10:16:56 +01:00
Urko Mauduit
0a6e7e9140 Fix #129527: Unified brush strength does not update cursor visualization
Pull Request: https://projects.blender.org/blender/blender/pulls/131145
2024-12-10 07:00:29 +01:00
Richard Antalik
eea1a65821 Fix: VSE: assert when strips are too short
When handle tweaking is enabled and strips are short, hovering over them
would trigger assert in `mouseover_strips_sorted_get()`, because more
than 2 strips would be picked. Sorting was done just by swapping strips
if order was incorrect

Use `std::sort()` instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/131594
2024-12-10 02:24:53 +01:00
Hans Goudey
dabca8d5ee Fix #131323: Compositor missing "Unassigned" node group assets
When there were no "Assigned" assets, the add menu would also skip
the "Unassigned" assets. Needs a correction to an early return check.
2024-12-09 17:13:49 -05:00
Harley Acheson
d8358edc1b Fix #131561: Adjust for Width of Modifiers in Status Bar Items
Some Status Bar icons differ in width, like "Ctrl". For these items we
have to add a spacer before the next item. Unfortunately there is one
code path where this does not happen for modifiers even though it does
for the main icon. This PR fixes this and removes the chance of icons
overlapping on the status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/131584
2024-12-09 20:18:49 +01:00
Philipp Oeser
c67e96e8ea Fix #131585: UV translation wrong in header when constraints are used
For a bit of (somewhat related) history, check 8d590e4b86.

The real problem here is that for non square images, the
`applyAspectRatio` works with "wrong" vectors if translation constraints
(`CON_APPLY`) are used. Then, the passed vector might actually have axis
changed, e.g. constraining to the Y axis does not hold the Y translation
value in dvec[1], but in dvec[0]. This is expected by design, but
`applyAspectRatio` is not aware of this and does wrong things.

The easy way around this is to actually call `applyAspectRatio` before
the `CON_APPLY` stuff takes place.

NOTE: future improvement might be to split (or rename)
`removeAspectRatio` / `applyAspectRatio` becaues these functions also
handle the "conversion" to pixel values which is not obvious atm.

Pull Request: https://projects.blender.org/blender/blender/pulls/131608
2024-12-09 19:55:43 +01:00
Iliya Katueshenock
aba0174b48 Sculpt: Simplify sphere mesh filter code
Function itself is 25% faster since no more need for a branch/matrix
/addition vector math. Meaning of the code is the same.

Pull Request: https://projects.blender.org/blender/blender/pulls/131556
2024-12-09 18:14:57 +01:00
Iliya Katueshenock
8a97d33733 Cleanup: Sculpt: Outdated comment
This notes no more relevant since 583ae8990c

Pull Request: https://projects.blender.org/blender/blender/pulls/131541
2024-12-09 16:25:25 +01:00
Pratik Borhade
fa0c927e76 Fix #131597: Grease Pencil: Active pivot point doesn't work in edit mode
Grease Pencil never had an "active" point/stroke. So similar to like in 4.2,
use objects location as pivot when `active` is selected.

Pull Request: https://projects.blender.org/blender/blender/pulls/131603
2024-12-09 15:21:06 +01:00
Nathan Vegdahl
454677ad49 Fix: use unspecified idroot when duplicating Action from Action Editor
With Slotted Actions, an Action's `idroot` should always be zero,
corresponding to "unspecified". However, there was still some old
leftover code that, when duplicating an Action via the Action Editor,
would set the new Action's `idroot` to either OB or KE, depending
on the editor mode.

In addition to now being incorrect, this was also tripping an assert
elsewhere in the code when trying to then assign that duplicate action
to an ID.

This commit simply removes the outdated code, which is no longer needed,
leaving the `idroot` as the default (unspecified).

Pull Request: https://projects.blender.org/blender/blender/pulls/131601
2024-12-09 15:16:38 +01:00
Pratik Borhade
03b2fc744e Grease Pencil: Add layer channel color property
This adds a `channel_color` property to layers.
The color is stored in the tree nodes.
It's currently used by the dopesheet for the channel colors.

Resolves #130370.

Pull Request: https://projects.blender.org/blender/blender/pulls/130512
2024-12-09 14:11:29 +01:00
Jacques Lucke
b6e1afb6e1 Fix #108719: correct link is shown as invalid
The issue was that the links was tagged as invalid for one render engine,
because it does not support the output pass. However, switching back
to Cycles did not make the link valid again.
2024-12-09 14:05:07 +01:00
Jacques Lucke
289962911c Fix #131577: missing node tree updates after duplicating tree 2024-12-09 13:42:47 +01:00
Aras Pranckevicius
074df4ceeb GPU: ensure viewport does not use uninitialized images (#119685 and others)
GPUViewport is creating a bunch of framebuffer textures for itself, but
some space types never initialize/use them. E.g. Sequencer, Nodes etc.
only ever use the "overlay" texture. Eventually when viewport is
"drawn", it combines this uninitialized texture data and then only by
luck it happens that most of the time it is black. But not always!

The textures were only cleared (right now) on Metal backend, under
GPU_clear_viewport_workaround as if it was some driver workaround. Stop
doing that, and just clear them always.

However, there was seemingly a performance issue on OpenGL, when this
clear was being done. At least on my machine (Win10, Geforce RTX
3080Ti), the overhead of doing the clears is measurable, and is caused
by usage of GL4.4 glClearTexImage instead of a framebuffer clear. As if
glClearTexImage makes "pixel data to exist" on the CPU side and then
later on binding this framebuffer sends off that data to the GPU, or
somesuch.

More details in the PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/131518
2024-12-09 13:23:18 +01:00
Laurynas Duburas
b68be2aedd Fix #131451: Crash moving Grease Pencil points
Proportional editing expects `IndexMask` from all Bezier points not only from selection as it affects not only selected curves.
Therefore `selected_editable_strokes` changed `editable_strokes` and initialized with `retrieve_editable_strokes`.

Pull Request: https://projects.blender.org/blender/blender/pulls/131519
2024-12-09 12:48:02 +01:00
Lukas Tönne
0d8f040c8b Fix #130945: Grease Pencil: Crazyspace support in sculpt mode
Grease Pencil v3 did not have crazyspace support yet. Without this sculpting on
deformed geometry (e.g. on top of an armature modifier) will yield incorrect
offsets because the tool writes to original data based on deformed positions.

This patch adds computation of local deformation matrices which are stored in
the `GeometryComponentEditData`. Those matrices are then used to convert local
deformation of the evaluated geometry back to a deformation of the original
geometry. All the relevant sculpt tools support the crazyspace correction now,
using the `compute_orig_delta` helper function.

Computing the deformation matrices should happen alongside modifier evaluation
for any deforming modifier. This has been implemented for the armature modifier,
others can be added.

A fallback implementation for curves could also be added for modifiers that
don't have an easy way to calculate local transformation. A "natural"
orientation for both the original and deformed positions is calculated, then the
difference yields deform matrices. For meshes the approach is to use the surface
normal and a stable tangent space. For curves the common local coordinate frame
based on parallel transport might be used.

Currently crazyspace correction for the _Clone_ tool does not work because of
#131496.

Pull Request: https://projects.blender.org/blender/blender/pulls/131499
2024-12-09 12:33:44 +01:00
Sean
46cd7afcda Grease Pencil: "Set Start Point" operator
Adds back the operator to change the start point on cyclical strokes.
Behaves the same way as in 4.2.

Pull Request: https://projects.blender.org/blender/blender/pulls/128540
2024-12-09 11:04:16 +01:00