Commit Graph

120055 Commits

Author SHA1 Message Date
Campbell Barton
db6cbcef5b Fix crash when texture bake cannot access evaluated mesh data
Baking could fail to access an objects evaluated mesh data (see #107426),
while the error remains, prefer an error instead of crashing.

Since the depsgraph runs Python callbacks I don't think we can
provide a guarantee the mesh data will available, so even if #107426
is fixed, it's reasonable to have a check here.
2025-01-21 17:56:01 +11:00
YimingWu
932fa1b8bf Fix #132113: Grease Pencil: Sort cache before draw_scene early return
`GPENCIL_draw_scene` uses `pd->tobjects.first == nullptr` to determine
whether to early return (draw nothing). When there's only "In Front"
grease pencil objects in scene, `tobjects.first` can be `nullptr` but
`tobjects_infront.first` is valid, in which case no grease pencil would
be drawn. Becase `gpencil_object_cache_sort` will link those two command
lists both to `tobjects` and allow `infront` ones to draw after others,
thus move it before the early return to allow drawing to proceed
normally.

Pull Request: https://projects.blender.org/blender/blender/pulls/132155
2025-01-21 06:54:21 +01:00
Campbell Barton
d1e3db71a6 Cleanup: use "_num" suffix instead of "tot_" prefix
Also group array with its length argument.
2025-01-21 16:51:41 +11:00
Campbell Barton
18783c5699 Cleanup: correct RST syntax, spelling & adjust quotes 2025-01-21 16:51:40 +11:00
Clément Foucault
5614d2543b Cleanup: Overlay: Simplify object_is_paint_mode condition
Follow up to #132159
2025-01-21 05:50:03 +01:00
RedMser
bd3bc46b42 UI: Use icons in UV Stitch Status Bar
Use icons and state highlighting to simplify the status bar display in
“UV Stitch” (UV_OT_stitch).

Pull Request: https://projects.blender.org/blender/blender/pulls/133269
2025-01-21 04:21:58 +01:00
Pratik Borhade
4450799673 Fix #125833: tooltip disappear on minor mouse movement
Slight displacement in mouse position triggers timer reset (pass=1).
With such condition, new redraw call to tooltip sets non zero timer
value (`r_pass_delay`) and `is_label=true` inside `ui_but_tooltip_init`.
This label boolean further skips drawing of description (for example, see:
`ui_tooltip_data_from_tool`).
To resolve this situation, inside timer_reset function keep `pass=0`
when tooltip region exists (i.e label is already visible on tooltip)

Pull Request: https://projects.blender.org/blender/blender/pulls/133258
2025-01-21 03:56:52 +01:00
Jonas Holzman
901119cf88 macOS: Main Window Title Improvements
Changes to the formatting of the OS window title for MacOS platform to
better follow their guidelines. Some refactoring, but there should be
no changes seen on other platforms.

Pull Request: https://projects.blender.org/blender/blender/pulls/132410
2025-01-21 03:17:50 +01:00
Jesse Yurkovich
3b08d8da22 Fix: Memory leak while clearing recent missing files
While the RecentFile struct itself was removed from the list of recent
files, the `filepath` field was not freed. Use the already existing
`wm_history_file_free` function to perform the cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/133354
2025-01-21 02:11:02 +01:00
Hans Goudey
b36eb69038 Geometry Nodes: Output proper face corner normals
Previously, when evaluated on the face corner domain, the normal input
node just returned the face normals, as if the mesh was completely flat
shaded. This ignores face and edge smoothness, and custom face corner
normals. In the past couple years the expected behavior of accessing
normals has become much clearer and this behavior is clearly a mistake
in retrospect.

This commit exposes the same face corner normals used everywhere else
in Blender when the node is evaluated on the corner domain. The old
behavior is accessible with a node property in the sidebar. There is
versioning so old files have the property set and get the same results.

This is split from !132583.

Pull Request: https://projects.blender.org/blender/blender/pulls/133340
2025-01-20 23:57:32 +01:00
Jacques Lucke
46ece39c1a Fix #133189: crash when hiding inline socket
Now the output socket checks if the corresponding inline socket that it should
be aligned with is visible.

This is an alternative to #133271 which had the problem that it resulted in
`flat_item::Socket` instances for which the input and output is `nullptr`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133325
2025-01-20 22:53:10 +01:00
Hans Goudey
8cb4d6aaab Cleanup: Unused variable with asserts off 2025-01-20 12:37:25 -05:00
Bastien Montagne
2d7068a0d3 Add file_path_map function to bpy.data.
Similar to `bpy.data.user_map`, it returns a mapping of IDs to all the
filepaths they use.

Fairly basic still, may need to be refined with more options to
control which filepaths are included etc.

Mainly intended to make handling of a production blendfile dependencies
more easy.

Also adds some basic testing of the new feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/127252
2025-01-20 17:39:25 +01:00
Pratik Borhade
012afaf318 Fix: Remove unused parameter from skip_strokes_with_locked_material
Mistake in 076663177f

Pull Request: https://projects.blender.org/blender/blender/pulls/133331
2025-01-20 17:29:32 +01:00
Julian Eisel
92a1ba2511 Fix: Assets: Custom library with empty path breaks catalog loading
With an asset library configured in the Preferences that had an empty
path, the catalog tree of the "Current File" asset library would be
empty. That is because the path-less library would incorrectly be
considered as containing the current file's path (`BLI_path_contains()`
returned true for the empty path).
2025-01-20 17:19:39 +01:00
Nathan Vegdahl
3ed2c2346d Fix #129540: allow stashing same Action with different Slots
Before slotted actions, it was only useful to stash an action once on a
data-block: that was all that was needed to keep the action's channels
associated with the data-block, and stashing it multiple times was redundant.
Therefore Blender would simply refuse to stash an action if it was already
stashed.

However, now with slotted actions the user may legitimately want to stash an
action more than one time: if the action has multiple slots, the user may want
to keep the channels of multiple slots all associated with a data-block.  Doing
that requires stashing each action+slot combination separately.

This PR addresses this use case by now allowing each action+slot *combo* to be
stashed once. Stashing a given action+slot combo more than once per data-block
is still prevented, however, since that is still redundant.

Pull Request: https://projects.blender.org/blender/blender/pulls/133307
2025-01-20 16:11:08 +01:00
Pratik Borhade
076663177f Fix #132943: Grease Pencil: Don't erase strokes with locked material
For points with locked material, add them to `src_to_dst_points`
as in they are outside the eraser ring to avoid deleting these points.
A new function is introduced to deal with it.
For stroke eraser mode, pass true in Indexmask `strokes_to_keep`.

Pull Request: https://projects.blender.org/blender/blender/pulls/133137
2025-01-20 15:42:11 +01:00
Nathan Vegdahl
9f2ab9cba0 Anim: rename RNA Slot.id_root to Slot.target_id_type
The name `id_root` was not descriptive, and was just a hold-over from the
equivalent (now deprecated) property on the Action itself.  `target_id_type`
is more clear, reflecting that this is the type of ID the Slot is intended
to animate.

This PR also renames the corresponding `id_root_icon` to
`target_id_type_icon`.

Note that this PR updates the GLTF import/export core addon to adhere to
these name changes as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/133164
2025-01-20 15:24:08 +01:00
Nathan Vegdahl
bbfc49be83 Fix: audit and fixes for uses of Action.idroot
Did a pass through the code base to make sure the uses of `Action.idroot`
are correct in the context of layered actions.

I found and fixed one issue in Grease Pencil v2 -> v3 conversion code
where the idroot was being set to a non-zero value without checking if
the action was layered or not first. Other than that, I also cleaned up
a couple of dodgy-looking things I found.

Pull Request: https://projects.blender.org/blender/blender/pulls/133205
2025-01-20 15:21:53 +01:00
Nathan Vegdahl
7358f11a66 Cleanup: rename missed cases of action "slot name" to "slot identifier"
When previously renaming "slot name" to "slot identifier" in #130740
and #130911, some places in function parameters and code comments were
missed. This PR renames those missed cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/133301
2025-01-20 15:19:25 +01:00
Falk David
10632776b5 Cleanup: Grease Pencil: unused parameter warning
Caused by ff9992d77f.
The argument is not used/needed.
2025-01-20 14:00:56 +01:00
Philipp Oeser
f6b820ccb7 Fix #133296: Grease Pencil influence VG affects stroke but not fill
This was true for Opacity or Tint modifiers where influence vertexgroups
were having an effect on strokes, but were ignored for fills.

This was also the case for GPv2 / 4.2, but there is no apparent reason
for not doing this on fills (if we are doing it for strokes).

NOTE: it was actually in use if "Use Weight as Factor" was used (but
that only means weights should be used directly, otherwise [when used as
influence], weights should be multiplied).

Pull Request: https://projects.blender.org/blender/blender/pulls/133306
2025-01-20 13:33:56 +01:00
Pratik Borhade
ff9992d77f Fix #133240: Grease Pencil: Reset vertex color ignores selection mask
`Reset color attribute` operator currently removes the `vertex_color`
attribute from geometry. If selection exists, reset the color value to
1.0 instead of clearing the entire attribute.

Pull Request: https://projects.blender.org/blender/blender/pulls/133249
2025-01-20 12:58:34 +01:00
Pratik Borhade
131270cb5a Fix: Grease Pencil: Consider selection mask for fill material in vpaint
`apply_color_operation_for_mode` only deals with the selection mask if
vertex color mode is `Stroke` (or the attribute domain is `Point`).
Use similiar logic for `mode=Fill`(domain=`Stroke`).

Pull Request: https://projects.blender.org/blender/blender/pulls/133256
2025-01-20 12:58:09 +01:00
Omar Emara
d4189ee398 Fix #133225: File Output nodes fail inside node groups
The File Output node no longer works inside node groups since the
introduction of the new CPU compositor. This is explicit in the code, so
we just consider all file output nodes recursively to fix this issue.
2025-01-20 13:11:28 +02:00
YimingWu
a2dbe53a3c Fix #133013: Grease Pencil: Refined stroke attribute randomization
Randomization of stroke color(H/S/V), opacity, radius and rotation was
implemented using this formula:

`value = original_value * random(0~2)` (1)

Which was different from before Grease Pencil v3 rewrite:

`value = original_value + random(0~2)` (2)

This leads to different looks of the stroke. This PR fixes the problem
by implementing formula (2) for the randomization mixing to restore
original behaviour.
Also makes sure the values are correctly clamped to the expected ranges.

Pull Request: https://projects.blender.org/blender/blender/pulls/133032
2025-01-20 11:41:18 +01:00
Brecht Van Lommel
1fb83c551a Fix #132781: MaterialX node name conflict causes crash
Use BLI_uniquename_cb to check and fix naming conflicts, and keep track
of the potentially modified node names in a map.

Reserve the material name, so that later the output node can be renamed to it
without conflicts. Also make sure there are no conflicts with names auto
generated by MaterialX, by always naming nodes ourselves.

Pull Request: https://projects.blender.org/blender/blender/pulls/133234
2025-01-20 11:37:08 +01:00
Philipp Oeser
82ea972834 Fix #133295: Grease Pencil tint influence vertexgroup has no effect
The weights were only used when "Use Weight as Factor" was used (this is
wrong though, that button uses the weights directly, otherwise the
Factor has to be multiplied by the weights -- as done in all other
modifiers [and in 4.2])

Pull Request: https://projects.blender.org/blender/blender/pulls/133297
2025-01-20 11:36:17 +01:00
Brecht Van Lommel
da1497af5e Refactor: MaterialX: Add NodeGraph wrapper around MaterialX graph
Pull Request: https://projects.blender.org/blender/blender/pulls/133234
2025-01-20 11:26:10 +01:00
Jeroen Bakker
781aeb1b3f Fix #133155: Vulkan: Initial uniform buffer upload failing
In some cases the initial uniform buffer upload fails. Using the
indirect upload (via render graph) does succeed. This PR uses the
render graph approach.

Pull Request: https://projects.blender.org/blender/blender/pulls/133293
2025-01-20 11:00:27 +01:00
Eric Cosky
292b0c74d3 Fix #133239: Corrected inconsistent use of calloc/free vs new/delete to fix crash when disabling VR preview
Code at the XR actionmap level is using calloc/free, but later when
conditions trigger WM_operator_properties_alloc in
`windowmanager\intern\wm_operators.cc` it is using MEM_new, which is
the mismatch. XR actionmap code needed to be modified to be compatible
with the allocators it is using.

Pull Request: https://projects.blender.org/blender/blender/pulls/133274
2025-01-20 10:46:08 +01:00
Jonas Holzman
5472ffeae3 Fix: UBSan division by zero runtime error in intern/shrinkwrap.cc
This error would occur because the quadratic equation solving code didn't
check for `a` being non-zero. Fixed by adding the additional check. This
can be tested and reproduced using the `ShrinkwrapTargetNormalProject2`
`modifiers` test.

Pull Request: https://projects.blender.org/blender/blender/pulls/133273
2025-01-20 10:05:34 +01:00
Campbell Barton
723cd87d49 Cleanup: quiet compiler warning 2025-01-20 17:10:21 +11:00
Campbell Barton
ad7a6495ac PyDoc: use "note" directive for bpy.props
Also minor rewording & adjust indentation.
2025-01-20 16:34:47 +11:00
Campbell Barton
4507c9fcc2 PyDoc: add bpy.types.PropertyGroup to registration doc-strings
Ref !133233

Co-authored-by: Jonathan Plasse <jonathan.plasse@eilbek-research.de>
2025-01-20 16:12:11 +11:00
Campbell Barton
ddae7cd966 PyAPI: expose bpy.types.bpy_prop_collection_idprop
Expose the IDProperty sub-class of `bpy.types.bpy_prop_collection`,
needed for API doc generation but should have been exposed for
completeness.
2025-01-20 15:47:08 +11:00
Pratik Borhade
a9b863be43 Fix #58333: Box select missing status bar key for deselect
Allow mouse release events to be included on status bar.

Pull Request: https://projects.blender.org/blender/blender/pulls/133182
2025-01-20 03:54:56 +01:00
Harley Acheson
5a452884fc UI: Improve Status Bar Display for GP Lines
When adding Grease Pencil lines, circles, curves, etc this PR updates
how the status bar shows options. No big changes just substituting
icons for text.

Pull Request: https://projects.blender.org/blender/blender/pulls/133279
2025-01-20 02:35:01 +01:00
Campbell Barton
d42b425ea9 Fix #131062: Active tool does not sync in Texture Painting workspace
Resolve an error where the brushes from the image/3D viewport
where shared but the tool was not. Causing the brush not to match
the appropriate tool when both an image & 3D viewport were displayed.

Resolve the issue by adding support for a "pending" tool,
a tool ID which is to be used.

This accounts for cases where it's not known if the requested tool
exists and uses the same code paths for initializing tools as is done
for initializing on file load for e.g.

Ref !133085
2025-01-20 11:21:33 +11:00
Campbell Barton
90b03d2344 Cleanup: spelling in comments 2025-01-20 11:19:23 +11:00
Richard Antalik
5394cb7514 Fix: VSE retiming key python API not defined on all strip types
API was defined only for movie strips. Define is also for Scene, image
and sound strips.

This required minor refactoring of how RNA collection type is defined.

Pull Request: https://projects.blender.org/blender/blender/pulls/133103
2025-01-19 21:21:36 +01:00
Richard Antalik
30f3eaa2a5 Fix #133167: Scene snapping settings confilict with VSE
Enabling `use_snap_rotate` in 3D viewport caused rotation in sequencer
to apply snapping. Rotation snapping was using mixed snapping functions,
which aren't implemented in sequencer.

Ignore affect rotation/scale tool setting property and force increment
snapping to be used with these transform modes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133272
2025-01-19 20:56:56 +01:00
Brecht Van Lommel
4f72b8b3ff Math: Protect against using inplace min/max on pointers and references
As happened before, see #132918.

Pull Request: https://projects.blender.org/blender/blender/pulls/133261
2025-01-19 12:31:16 +01:00
Brecht Van Lommel
627114ee54 UI: Viewport Render Animation operator using jobs system
Instead of the old time cursor, this will now show a progress bar in the
OS taskbar or dock, as well as the main window status bar. Along with the
job name and cancel button.

Pull Request: https://projects.blender.org/blender/blender/pulls/133174
2025-01-19 07:30:50 +01:00
Harley Acheson
8953cc5045 UI: Improved Initial Message for Mesh Bisect
When first starting the Mesh Bisect operator, the Status Bar shows
"LMB: Click and drag to draw cut line". This PR just changes that to
show the message with an icon instead. And adds "Cancel".

Pull Request: https://projects.blender.org/blender/blender/pulls/133244
2025-01-19 00:49:52 +01:00
Pratik Borhade
5726a998a0 Fix #133151: Display "Depth" in status bar for inset operator keymap
Depth property of inset operator had wrong text displayed in status
bar. Should be "Depth" instead of "Tweak". Was changed in error in
commit 42a8947eb1.

Pull Request: https://projects.blender.org/blender/blender/pulls/133230
2025-01-18 19:35:44 +01:00
Sietse Brouwer
0db41a88b5 Fix: Grease Pencil: Uninitialized attribute values when drawing strokes
When drawing strokes in Grease Pencil, some (custom) attribute values
stayed uninitialized. This was due to a tiny bug in the Draw operator
initializing only some attribute values of newly drawn stroke points
to their default value and not all of them.
This PR fixes that.

Pull Request: https://projects.blender.org/blender/blender/pulls/133216
2025-01-18 09:02:00 +01:00
Sean Kim
6100023527 Cleanup: Remove unused sculpt_automask variables and functions
Pull Request: https://projects.blender.org/blender/blender/pulls/133223
2025-01-18 04:04:12 +01:00
Sean Kim
baffd174c8 Paint: Allow executing 3D paint operators without location
In Sculpt, Vertex Paint, and Weight Paint, the operator used while
painting (`SCULPT_OT_brush_stroke`, `PAINT_OT_vertex_paint`, and
`PAINT_OT_weight_paint`) can currently be executed in python as they
define `exec` methods. However, each of them has a implicit dependency
on the `OperatorStrokeElement` struct containing a `location`
corresponding to the object space location of the stroke daub.

This limits the usefulness of the operator in non-interactive
situations, as determining the actual location of a stroke on a 3D
object requires access to the Paint BVH to perform a raycast and project
the mouse from 2D region space into object space.

To allow users to define a stroke in region space coordinates, this
commit adds a new parameter to the associated operators,
`reproject_stroke` which indicates whether or not the current `location`
data should be discarded and replaced with newly calculated positions.

Ref: #132960

Pull Request: https://projects.blender.org/blender/blender/pulls/132974
2025-01-18 02:17:47 +01:00
Miguel Pozo
0a72db9f94 Fix #133198: Overlay-Next: Texture Paint workspace crash
Regression from 1406b9e656
Ensure it matches the Overlay Legacy behavior.
2025-01-17 22:59:39 +01:00