Commit Graph

107102 Commits

Author SHA1 Message Date
Campbell Barton
e480b6a50c Fix error accessing the "__class__" on removed data
Accessing `__class__` on a removed object raised an exception, making
`isinstance(ob, cls)` unreliable. Always allow class access.

Resolves issue raised by blender/blender-addons!104958.
2024-03-11 20:23:26 +11:00
Philipp Oeser
a8b9a58608 Fix #54468: crash calling transform operators with incomplete regiondata
If we run into NULL `RegionView3D` `regiondata` [which e.g. happens if
we just set `bpy.context.area.type = 'VIEW_3D'` without further actions
in the text editor prior to calling the transform operator], we can make
it gracefully work just by using `t->spacetype = SPACE_EMPTY` in
`initTransInfo`.

Similar check is already done in ba229e3859 (marked /* running in the
text editor */).

Transform code is smart enough to have fallback code in place that sets
matrices etc.

Pull Request: https://projects.blender.org/blender/blender/pulls/119205
2024-03-11 09:27:32 +01:00
Campbell Barton
e09f08fa78 Fix #119202: Crash closing the area with a temporary context
When restoring a temporary context, account for changes to the context
made by actions (typically operators) in the script.

There was an incorrect assumption that an override which didn't change
the current context would also be unchanged when restoring the temporary
context's original values.
2024-03-11 17:34:25 +11:00
Campbell Barton
5fe0213659 Fix error that let a temporary context restore a removed region
Missing check from [0] allowed a removed region to be set when exiting
the temporary context.

[0]: 1ec10323ff
2024-03-11 17:13:10 +11:00
Jacques Lucke
b020173984 Fix #114120: support output attributes on instanced geometry in geometry nodes modifier
Pull Request: https://projects.blender.org/blender/blender/pulls/119016
2024-03-10 13:02:56 +01:00
Jesse Yurkovich
dfa8039b0d Fix: Memory leak from sculpt paint lasso
The early returns inside `sculpt_gesture_init_from_lasso` would cause
the `SculptGestureContext` to be leaked.

Pull Request: https://projects.blender.org/blender/blender/pulls/119233
2024-03-09 04:20:40 +01:00
Hans Goudey
7b25699333 Fix #119232: Crash on Generate Data Layers in DataTransfer modifier
"r_map" is null for the generate layers operator (rather than the modifier
evaluation). It should disable the creation of the "CD_NORMAL" layer too,
like the crease, bevel weight, sharp edge, and uv seam attributes above.
2024-03-08 20:55:43 -05:00
Jesse Yurkovich
88b335aa0f Fix #98572: handle the 'mirror' texture wrap mode for USD materials
Support for the texture extension mode of "mirror" was simply missed
from `925fb66693d`.

With this patch, #98572 should be completely fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/118947
2024-03-08 23:23:58 +01:00
Hans Goudey
c4bf2d43e7 Fix #116395: Auto smooth versioning modifier added unnecessarily
As mentioned in new code comments, the auto smooth behavior in 4.0 was
to skip sharp angle tagging when the evaluated mesh had custom normals.
There was already a check for custom normals on the original mesh (we
can't access the evaluated mesh from versioning code). But that didn't
handle cases where custom normals were created by modifiers (the normal
edit and weighted normal modifiers). Now skip adding the new modifier
when those modifiers come last in the stack. Alternatively we could
check if they existed in the stack at all, but that seems a bit more
risky.
2024-03-08 16:09:05 -05:00
Jacques Lucke
1cca960677 Fix #103985: crash when using viewer node on curves with gpu subdivisions
The `cache.curves_cache.proc_attributes_buf[i]` is independent of the subdivision level.
Therefore it's not freed when the subdivision level changes currently. However, the
check assumed that when no attribute was changed, the final subdivided buffer is
non-zero, which is not true when the subdivision level changed.

Now directly check whether the attribute is cached already.

Pull Request: https://projects.blender.org/blender/blender/pulls/119216
2024-03-08 18:33:35 +01:00
Pratik Borhade
2191cbf7f5 Fix #119106: Set Action in outliner does not update the animation
This is due to the missing depsgraph update

Pull Request: https://projects.blender.org/blender/blender/pulls/119112
2024-03-08 12:24:03 +01:00
Pratik Borhade
021565d867 Fix #119142: Skip linking collection inside another linked collection
When linking a collection from library, it can be linked inside another
linked/overrided collection if it is selected in outliner. This can be
prevented by linking with editable parent collection.

Pull Request: https://projects.blender.org/blender/blender/pulls/119144
2024-03-08 12:23:19 +01:00
Campbell Barton
738c1b6ca9 Docs: correct typo & terms in --help text 2024-03-08 20:57:56 +11:00
Omar Emara
8cf8b54332 Fix: Viewport Compositor depth has low precision
The depth pass of the Viewport Compositor has low precision if the
precision of the node tree is set to Auto. To fix this, we always
expose the depth pass in full precision.
2024-03-08 11:55:23 +02:00
Christoph Lendenfeld
4d958ca19a Fix: View in Graph Editor not working when object is unselected
The new operator "View in Graph Editor" (#114407) only looked at the selection
when generating the FCurve bounds.

This failed in certain cases if things are not selected, or not selectable.
The simplest example is to key the emission strength of the world settings and
try to view that.
This was mentioned by Jonathan Lampel on the PR #114407

The fix is to also resolve the bounds of the animation data on the button.
This means for a few FCurves the bounds might be calculated twice but it
doesn't change the overall result.

This has another side effect though:
The Graph Editor might zoom into an area where there is no FCurve
visible because the thing is not selected so it isn't shown.
This issue existed before if filters were applied, but is now more pronounced
since by default the Graph Editor doesn't show unselected objects.

A warning is raised when at least one of the FCurves that are viewed is not
visible with the current filter settings. The view will still zoom into that area.

Pull Request: https://projects.blender.org/blender/blender/pulls/118658
2024-03-07 17:15:02 +01:00
Philipp Oeser
5d1d447c2b Fix #114552: Copy material to selected crash on object lacking slot
Caused by 9c1da81a4c.

This happened in the case where objects shared the same data and slots
are assigned to object and receiving object did not have a material slot
yet.

Then, `ob->matbits` may be NULL, now just check for this, too.

Pull Request: https://projects.blender.org/blender/blender/pulls/119161
2024-03-07 15:43:47 +01:00
Philipp Oeser
1f62fca321 Fix #116339: "Show Hidden Objects" operator's options missing
The property is actually there, but was marked PROP_SKIP_SAVE |
PROP_HIDDEN in 4234cddda9

This PR removes this again (with the consequence that shortcuts/menu
entries will now remember the select setting from the last time).

This is now in line to how editmode does this (the "Reveal Hidden"
operator).

Pull Request: https://projects.blender.org/blender/blender/pulls/119153
2024-03-07 11:31:41 +01:00
Philipp Oeser
d5fe4c40ed Fix #79961: Outliner Data API crash with a MeshSkinVertex in editmode
When in mesh editmode, skin_vertices point to bmesh customdata, the
skin_vertices data is empty since custom data is stored per element
instead of a single array there (same es UVs etc.).

Fix similar to 3e2619b3e7, 5179b8236b (basically disallowing the
access in editmode).

Pull Request: https://projects.blender.org/blender/blender/pulls/119149
2024-03-07 11:30:58 +01:00
Hans Goudey
d196046a3a Fix: Zeroed transform with asset object drag & drop
In future files from 4.2, `object_to_world` is moved to a runtime struct
and therefore isn't saved in files. It was always considered runtime information
though, since it's built by depsgraph evaluation and copied back to the original
object. Therefore to have the proper data in `object_to_world` we need to
evaluate the depsgraph.

This partially solves #118694, but there is still an issue with the snap cursor
system never running before using the `plane_omat` value.
2024-03-06 12:24:08 -05:00
Brecht Van Lommel
d08f63e7cb Fix #116956: Bake multires crash with simplify subdivision
Ignore simplification for the purpose of baking. Thanks to Philipp for
suggesting the fix.
2024-03-06 17:56:34 +01:00
Brecht Van Lommel
ee98482b44 Fix #119058: Crash with OpenGL render and 3D viewport lock rotation 2024-03-06 17:46:08 +01:00
Hans Goudey
0106514669 Fix #107232: Creating builtin attributes in edit mode can cause crash
For example, creating the "position" attribute with the wrong name or type
could crash Blender when exiting edit mode. This is because some data isn't
stored as attributes in Blender, and the attribute API doesn't work very well
with BMesh.

Two parts to the solution:
- Remove builtin attributes with incorrect domains or names when
  converting from BMesh to Mesh.
- Add error messages when creating builtin attributes in edit mode. It's still
  possible to create name-convention attributes, because Blender should be
  able to handle different types and domains for them.

Pull Request: https://projects.blender.org/blender/blender/pulls/119110
2024-03-06 16:16:43 +01:00
Hoshinova
bbb14b95bb Fix: Crash when creating Noise Texture node with link-drag-search
Fix crash when creating a Noise Texture through dragging and releasing
another output and connecting it to the "Gain" or "Offset" sockets.

Pull Request: https://projects.blender.org/blender/blender/pulls/119097
2024-03-06 15:42:22 +01:00
Bastien Montagne
bb00621965 Fix recent regression preventing animation on any linked data.
Regression in 427eed292d.

Root of the issue was that animation system was using a single same
check to decide if an F-Curve/driver was valid to use to animate some
data, and whether user can create/edit animation for that data.

Both cases are actually different, since e.g. linked data is not
user-editable, but it can still be animated (either by related linked
Actions, drivers defined in the linked data, or some more hackish
changes like py API/RNA scripting).

This commit now defines two checks:
 * `RNA_property_animateable`: whether a RNA pointer & propoerty is
   animateable, based on their types and definition.
 * `RNA_property_anim_editable`: whether a specific data referenced by
   the RNA pointer and property is effectively user-editable.

The new `driveable` check added by 427eed292d is also renamed to
`RNA_property_driver_editable` (since the basic type-based
`RNA_property_animateable` is also valid for drivers currently).

Pull Request: https://projects.blender.org/blender/blender/pulls/119089
2024-03-06 10:02:53 +01:00
Omar Emara
bfec649bd9 Fix #119043: Compositor crashes with intricate setup
The Realtime Compositor crashes with intricate node setups. That's
due to hardware limitations where shaders can't have as many output
images as needed by the compositor shader operations. To fix this, we
recursively split shader operations until their output count fits the
hardware limitation.

Pull Request: https://projects.blender.org/blender/blender/pulls/119075
2024-03-06 07:25:05 +01:00
Harley Acheson
49c723e117 Fix #118765: Show Startup Popup Warning on Main Window
During startup, popup block warnings should be displayed on the main
window, not a child window even if it is active.

Pull Request: https://projects.blender.org/blender/blender/pulls/119096
2024-03-05 21:16:35 +01:00
Hans Goudey
90fb838416 Fix: Geometry Nodes Sort Elements node crash with nested instances
Typically nodes that edit instances only change the top level of
instances. As an oversight, that wasn't done in the sort elements node.
This causes problems as the top level of instances are reordered and
nested instances are edited. As the top-level is replaced, its
contained geometry sets (the nested instances) are deleted.

To fix, only reoder the top-level instances in this node.
2024-03-05 14:18:29 -05:00
Hans Goudey
6181341bad Fix #119091: Incorrect path for WM context RNA property
Mistake in 61fb2b17c8
2024-03-05 11:57:22 -05:00
Hans Goudey
7b94e61f09 Fix #119047: Avoid copying captured attribute to itself
The "capture field on geometry" utility is used in many places to store
the result of field evaluation as an attribute. There is a special case
for when an attribute already exists with the same name, data type, and
domain. But when exactly the same attribute was stored, it would assert
because it ended up copying an array to itself. Arguments for those copy
functions aren't supposed to alias each other.

As a fix, clarify the logic a bit to return earlier in this case.
Also remove a redundant case handling the same thing later on
in the function.

Pull Request: https://projects.blender.org/blender/blender/pulls/119063
2024-03-05 17:32:09 +01:00
Sean Kim
4d8dad056c Fix #119070: Fix crash in sculpt menu lasso tool
This PR adds an extra check to exit from sculpt gesture code early to
avoid attempting to allocate a 3 * (UINT_MAX - 1) amount of elements
inside the trim gesture code.

Pull Request: https://projects.blender.org/blender/blender/pulls/119073
2024-03-05 15:50:40 +01:00
Philipp Oeser
8c3b85d666 Fix #84848: Specific Rig Crashes blender when going into pose mode
The armature reported had two bones with a `bMotionPath` but its lengths
are zero (which causes trouble in `motion_path_cache` drawing code due
to 0 allocations).

Not exactly sure how we got there, something like
`animviz_verify_motionpaths` should take care of this already in current
code, but this might be from a time where there were not enough sanity
checks.

So now early out in `motion_path_cache` if we encounter such a
"corrupted" motion path.

Pull Request: https://projects.blender.org/blender/blender/pulls/119081
2024-03-05 13:15:18 +01:00
Philipp Oeser
959595069d Fix #95411: Collada export crashes if temporary file is not accessible
This can happen e.g. when relative "//" is in Preferences > File Paths >
Temporary Files is used.

Now catch the corresponding COLLADASW::StreamWriterException
and cancel export then.

NOTE: 51126fab33 might have prevented the most common case
to run into this crash (but there might be other cases still so being safe
here does not hurt)

Pull Request: https://projects.blender.org/blender/blender/pulls/118958
2024-03-05 13:14:45 +01:00
Bastien Montagne
1906ee76ba Fix (studio-reported) IDproperties of liboverrides not being animatable.
Regression from 427eed292d, in IDProperty case the 'ensured' PropertyRNA
pointer is some sort of empty template, and cannot be used for many
things.

Instead of calling `rna_ensure_property` twice for each call to
`RNA_property_animateable`, rather add an optional parameter to static
helper `rna_property_editable_do`, and call it directly from
`RNA_property_animateable`.
2024-03-05 11:53:06 +01:00
Bastien Montagne
6adf5adb7f Fix LibOverride asserting when same RNA path changes type.
Although rare (and not recommended!), it can happen that a same exact
RNA path points to a different type of data.

This can come from an update of the code itself, but this is very
unlikely and discouraged.

However, geometry nodes and their 'modifiers' interface have made it way
more easy to create such conflicting situation, since users are free to
re-arrange and edit the nodes and their 'public' interface as they
want...

Found out while investigating some unrelated issues in some studio Gold
production files (namely,
`pro/shots/090_joining_whale/090_0130/090_0130-anim.blend` r2110
exhibits such issue for `OBGEO-mika-body`
`modifiers["RIG-GN-mask-clothing"]["Socket_3"]`, where the RNA type
changes from integer to bool).
2024-03-05 10:03:44 +01:00
Campbell Barton
8842982dbd Docs: note the temporary directory will be ignored unless it exists
Other minor changes:

- Remove reference to `TMP` environment variable in the `--help` text
  as this isn't a posix standard and is noted as something that may be
  removed in the future.
- Show WIN32 `TEMP` when showing all help text so it will be included
  in the user manual.
2024-03-05 10:19:16 +11:00
Iliya Katueshenock
fa229c5753 Fix #119019: Geometry Nodes: Split to Instances wrong field interface
Input fields should propagated on input geometry.

Pull Request: https://projects.blender.org/blender/blender/pulls/119032
2024-03-04 16:57:28 +01:00
Sebastian Parborg
a8cc2e4d96 Fix: Add missing iostream include
Without this include compilation would sometimes fail
2024-03-04 16:50:47 +01:00
Raul Fernandez
3c6a9cb5a5 Fix #117824: Sculpt color filter crash
Fix for Sculpt: Color Filter crash #117824

This change fixes the crash due to invalid active color layer
in the Undo/Redo stack when redoing from the original state.

Previously when performing a redo to a filter color state from the
original state, it cased a crash because
&((SculptUndoStep *)us_iter)->active_color_start did not contain valid
color data in the original state.
In this PR we check if is the original state and use the
&((SculptUndoStep *)us_iter)->active_color_end instead which is
de correct data to use.

- [x] Fix color update  when redo from initial state

Pull Request: https://projects.blender.org/blender/blender/pulls/118885
2024-03-04 16:31:52 +01:00
Bastien Montagne
afb5cb440b Fix/tweak UI messages (typos etc.). 2024-03-04 11:17:55 +01:00
Campbell Barton
51126fab33 BLI_tempfile: ensure the temporary directory is absolute
While unreported, there is nothing preventing CWD relative temporary
directories being used. Resolve asserts & errors if the CWD changes at
run-time.
2024-03-04 12:20:44 +11:00
Guillermo Venegas
8f68dfe0c2 Fix #119000: File handler extension check should be case insensitive
Allows case insensitive extension match.

Pull Request: https://projects.blender.org/blender/blender/pulls/119018
2024-03-03 22:50:51 +01:00
Pratik Borhade
5f70bd0e46 Fix #116435: Rotate Vector node on a link connects wrong sockets
`sock_rotation` has higher priority (6) than the vector socket (4).
Hence inserting node between vector-vector link joins thorugh "rotation"
socket (`get_main_socket()` / `get_main_socket_priority()`).
This can be fixed by making "vector" input socket as default for link.

But this will break the link creation when node is inserted between
rotation-rotation link. It seems rotation is converted to vectors so
perhaps make sense to make "vector" as default socket for link.

Pull Request: https://projects.blender.org/blender/blender/pulls/116550
2024-03-03 00:38:34 +01:00
Jacques Lucke
cce2b6671e Fix #114110: background dots clipping in node editor
The clipping was introduced because it looked a bit like the dots are
above the scrollbar. However, the clipping looks worse and the dots
are actually below the scrollbar. If we don't want stuff to be visible
through the scrollbar, it should be more opaque.
2024-03-03 00:34:16 +01:00
Jacques Lucke
e72bf54791 Fix #118926: missing transform relation when using Object/Collection Info node
This was probably accidentally broken when we moved the rna code into node files.

Pull Request: https://projects.blender.org/blender/blender/pulls/119017
2024-03-02 23:59:48 +01:00
Jacques Lucke
65083472ec Fix: issue in previous commit
Many tests started failing after 173c41c1c0
due to memory leaks.
2024-03-02 23:56:37 +01:00
Jacques Lucke
173c41c1c0 Fix #114946: Mesh.clear_geometry should not clear required built-in attributes
Pull Request: https://projects.blender.org/blender/blender/pulls/119012
2024-03-02 21:40:03 +01:00
Jacques Lucke
cc891aa699 Fix #115583: multiple sharing info for same data after reading file
It's possible that multiple custom data layers share the same underlying data.
This data is only written once (per data-block) currently. However, when reading
the data again, two separate `ImplicitSharingInfo` were constructed which
referenced the same underlying memory. The fix is to reuse previously created
`ImplicitSharingInfo` that manage the same data.

Pull Request: https://projects.blender.org/blender/blender/pulls/118991
2024-03-02 20:10:34 +01:00
Richard Antalik
58a9acb016 Fix #118486: Prevent emitting error when adding VSE strips
When adding strips that generate image on their own, while 3 or more
strips are selected, it emits error. This was caused by incorrect
handling of this case in `seq_effect_find_selected()`. If effect has no
inputs, function should return early.

Pull Request: https://projects.blender.org/blender/blender/pulls/118866
2024-03-02 18:34:00 +01:00
Bastien Montagne
da101d8cdb Fix #118300: Broken liboverride data can crash Blender on load.
Second issue reported in the comment was caused by some shapekeys
flagged as embedded liboverride data, when their owner ID (Mesh e.g.)
is not a liboverride at all.

The `BKE_lib_override_library_validate` called on file read was only
covering real liboverride IDs, which where then supposed to take care of
their own embedded data. But since the owner ID is already a full
non-override ID, its embedded data ended up never being properly
sanitized.

Most likely more corruption data from quite old files and/or deprecated
experimental features.
2024-03-02 16:17:41 +01:00
Jacques Lucke
4a81fe8180 Fix #115755: rename enum from type to rotation_type to resolve name collision
`type` is a built-in property already.

Pull Request: https://projects.blender.org/blender/blender/pulls/118990
2024-03-01 23:57:33 +01:00