Prevent make links operator from creating links to sockets that are
already linked to a muted link.
The `SOCK_IS_LINKED` flag is used to check if there already is a link
connecting to the socket but when the link is muted, the flag wasn't set
leading to issues in parts of the code that used the flag to check
for any type of connected link.
This commit now also sets `SOCK_IS_LINKED` when links are muted and
adds an additional check in places where different behavior is expected
for muted links.
Pull Request: https://projects.blender.org/blender/blender/pulls/108375
Fix node link insertion during transform not working properly for
rotation and scale.
Inserting nodes by rotating or scaling...
* ...didn't offset the attached nodes.
* ...could lead to unfreed memory.
This commit fixes that by always calling the `NODE_OT_insert_offset`
operator at the end of the node transform operator rather than having
to explicitly append it into a macro operator for each transform
operator.
Pull Request: https://projects.blender.org/blender/blender/pulls/107460
The solution using `reverse_index_array` didn't work because it lost the
order that the corners were processed in (the order around the vertex).
This is important when setting custom normals because the process
sets sharp edges when the normal of the current and previous corner
is too different.
Because of how the Clip Editor managed region state for different view
modes before region polls were introduced (fa0f295b53), regions could be
written to files in a state that's not valid for displaying them. State
for clip editors written to files is corrected with versioning now.
The user count decrement and unassigning the action were split
between two different conditionals, which weren't guaranteed
to both execute/not-execute together.
Objects were excluded from the ID operation, as originally they had
their own entry in their own menu. Joys of nightmare tools handling in
the Outliner...
Painting weights in Grease Pencil with the auto-normalize option enabled,
gave unpredictable results when vertex groups with a weight of zero
were involved.
This patch resolves the issue. Vertex weights of zero are excluded from
auto-normalization. Which is a better fit for the Grease Pencil workflow,
where weights are mostly painted from scratch since the 'parent to
armature with automatic weights' operator doesn't give good results.
Pull Request: https://projects.blender.org/blender/blender/pulls/108524
Steps to reproduce were:
- Open File Browser, set it to Thumbnails display mode, disable filters
- Navigate to a directory with documents that have no preview
- Change Preferences > Themes > User Interface > Icon Colors > File
Folders to light and dark colors
- See how the type icons on top of the white document icon image get
changed unexpectedly. Only type icons drawn on top of folder icon
images should change.
When drawing the document type icons on top of the folder or document
image in the center of thumbnails, they would always use the folder icon
color (Preferences > Themes > User Interface > Icon Colors > File
Folders) to determine if they should be drawn with a light or a dark
color. It should only use that when drawing on top of a folder icon
image, and the color for document icon images otherwise.
When doing the second undo, the image wasn't properly marked for full
update.
There reason was that in some cases the partial_updater was
totally reconstructed: `first_changeset_id` and `last_changeset_id` were both 0.
While the `user_imp->last_changeset_id` was still its last value (e.g., 3).
The fix is to have the partial updater validator to check for the
last change set as well (it was only checking for the first change set).
This way we cover both scenarios when user_imp->last_changeset_id is out
of the range of the partial update history.
Pull Request: https://projects.blender.org/blender/blender/pulls/108533
Pasting MTex referenced Texture & Object data-blocks without any
check for their validity.
This isn't ideal as it doesn't handle re-allocated ID's,
it just prevents a crash referencing freed data-blocks.
Excessive memory pool bloating could occur for certain workloads in
Metal. Particularly those which continuously allocate increasingly
large buffers with minimal re-use of existing buffers.
New logic added to the memory pool flushes old buffers if they
have not been used for a set period of time. Timing is calibrated
against system resources and overall memory pressure.
Metal memory pressure will run higher than OpenGL, however,
this is an active decision to provide significant performance
improvements for scenarios which allocate lots of memory and
for keeping frames queued in flight without stalling on pending
GPU work.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/108083
Certain textures require explicit HOST READ support for reading
data back to CPU. Given the compute based texture read path may
be used for this, if format conversion is required, this flag should
also imply general texture read support.
This resolves a bug with GreasePencil fill which relies on this.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/108463
In case a part of an override hierarchy would still be linked data, and
there would be other liboverride hierarchies sharing usage of that same
linked data, trying to create a partial override of that linked data
into a hierarchy would create very unreliable results.
This commit now only process each ID at most once, to ensure that the
liboverride will only be put in one liboverride hierarchy.
This is only a partial fix, results now should at least always be
valid. However, due to inheritently broken Outliner code when it comes
to same data in more than one path of the tree, the place where
(hierarchy in which) the new liboverride will be created is currently
'random' and unpredictable from user perspective.
This commit contains some code to try to alliviate that (by enforcing
processing of the active elements first), but unfortunately this does
not work either.
- Do not remap local liboverrides from other hierarchies when a
liboverride hierarchy root is provided (such that in case a linked
data is overridden as part of one hierarchy, the new liboverride does
not get assigned to other liboverride hierarchies of the same reference
data).
- Do not attempt to instanstiate newly overridden collections or objects
when they are part of a hierarchy and not the root of that hierarchy
(as they can be sondiered as already handled through that hierarchy
processing). Avoids attempts to instantiate them when doing partial
liboverride into an already existing hierarchy.
When entering sculpt mode on an object without any color attributes and
starting to paint, the newly created color attribute was set active, but
not default (camera icon).
Now set it default as well.
Pull Request: https://projects.blender.org/blender/blender/pulls/108271
Follow up to [0], some material data wasn't accounted for.
- The embedded node-tree's owner_id wasn't set.
- Animation data (both the material & it's embedded node-tree).
- Updating depsgraph relations is needed when animation data is freed
as part of paste too.
Also report when paste fails.
[0]: 5b5a1e3581
Commented [0] (2.5x refactor that disabled many free functions),
for some reason this call was never re-enabled.
Add back the free call along with other clipboard buffers.
---
Cherry picked [1] from main as other fixes material clipboard
are difficult to validate when memory is leaking.
[0]: a1c8543f2a
[1]: cb0c4f04d4
Use a macro to make the ID-free switch more compact & use ID indices
for better readability. Also typedef the enum so missing types in the
switch will report compiler warnings.
When a file passed in from the command line failed to load,
blender would exit & save the quit.blend.
Resolve by adding a `do_user_exit_actions` to WM_exit_ex which is
false in backgrounds mode or when an error has occurred.
---
Back-ported [0] & [1] from main with fix [2] included.
[0]: c803ddab29
[1]: d7d1c524e3
[2]: d3d91b79e0
The "no custom" normal used to be stored inside the custom normal space
struct, now it's stored separately. Before the normal was modified, but
not the one in the normal space struct. Fixed by storing the original
before modification in a temporary variable.
2a56403cb0 changed the way bevel weights are stored in 4.0.
Add versioning for reading the new files that replaces the new generic
attributes with the old non-generic custom data layers. The code is
paranoid with lots fo checks I expect will typically not be necessary.
Small correction to word selection in Console. Start and end of
selection were in incorrect order so it displayed correctly but
did not copy to clipboard as expected.
Pull Request: https://projects.blender.org/blender/blender/pulls/108434
Baking simulations for an object with more than one geonodes modifier
creates cache folders for _all_ modifiers, even if some of them do not
actually have simulation zones. The simulations zones also don't need to
be connected to the output to generate cache folders.
This patch restricts cache folder generation to modifiers which actually
have simulation zones and use them.
Extra cache folders were created because executed modifiers were only
checking if a simulation state exists and not whether it contains actual
zone data (`sim_state->zone_states_.is_empty()`). The modifiers are
always executed if the object is evaluated by the depsgraph, which
happens if _any_ of the modifiers is time-dependent. Time dependency in
turn is enabled if a simulation zone exists in the tree, regardless of
whether it is used.
Checking for zone states in the cache output during baking lets us
decide if a cache folder is needed.
Pull Request: https://projects.blender.org/blender/blender/pulls/108278
- Pasting a material would free the materials local node-tree,
leaving it in the depsgraph which would then tag the freed ID
(from deg_graph_clear_id_recalc_flags).
- texpaintslot, gp_style pointers were copied into the clipboard without
being cleared or duplicated, allowing for freed memory access later on.
- A shallow copy from the cliboard into the material could also cause
these pointers to be overwritten and leak memory.
Resolve by calling material_free_data before performing a shallow copy
and adding material_clear_data which ensures these pointers aren't
copied into the clipboard.
WM_exit calls `exit(G.is_break == true)` which only makes sense in
background mode, pressing escape sets `is_break` which isn't cleared,
causing an error exit-code of 1 on exit.
This would print whenever 'bpy' was imported, because in this case
Blender's Python integration loads all modules immediately because it
can't import modules as needed via the inittab mechanism.
Also correct code-comments for why inittab can't be used.
Own regression caused by [0] made to ensure the string was initialized,
without accounting for it being static & reused between calls.
Replace static variables with a struct that's passed to the function,
this explicitly shares state between calls as this static variable use
depended on BKE_scene_multiview_view_prefix_get always clearing prefix
variables with a zero view_id so future calls would also be cleared.
While this non-obvious behavior could be documented,
use more straightforward logic.
[0]: bdad2c0595
When a blend file failed to load from the command line,
blender would load a blend file with the path set to the location
that could not be loaded.
Now the command line argument is only treated as a new file
if the file does not already exist. Failure to load a file that
is found always exists with an error.
On click-dragging, property value was not incrementing because new
`data->dragstartx` value is infinite/invalid (when startvalue=0). To
fix this, pick max value between `startvalue` and `log_min`.
Ref !107466.
Pinned islands with "Lock Position" were not interacting correctly
when the packing destination was not at the origin.
This could happen with "Pack To : Original Bounding Box", and also
when packing to a UDIM other than 1001.
Avoid BLI_path_slash_rfind for accessing file-names as NULL is returned
when the path has no slashes, use BLI_path_basename instead.
Also remove 2 cases where BLI_path_basename was inlined.
Does not happen very often, but that weak handling of copying linked
data as linked data currently can lead to an invalid namemap in Main.
This is a known issue, fixing it requires addressing #107847.
In the mean time, work around it by re-validating and fixing the namemap
after the problematic liboverride calls.
NOTE: only identified issue currently is the proxy conversion of linked
proxies. The other cases *should* be fine.
Found while investigating issues when opening the
`lib/tests/libraries_and_linking/libraries/main_scene.blend` file.
Logic in `main_namemap_validate_and_fix` could end up re-generating
a thousand of time the names of IDs because of an invalid assumption
about processed IDs being re-processable (in case they get renamed).
Also do not `CLOG_ERROR` when checking and fixing errors, if this code is
called to fix errors, it means errors are expected. Use `CLOG_INFO`
instead, or `CLOG_WARN` when the info is really important (like when IDs
had to be renamed).
And finally, simplify code clearing invalid namemaps, there is now a
function to handle this task, `BKE_main_namemap_clear`.
Issues & improvements found while working on readfile errors when
opening `lib/tests/libraries_and_linking/libraries/main_scene.blend`.
In readfile code, when looking up for an already existing Library ID
based on the filepath, the logic handling said file path was wrong.
NOTE: This probably does not have any effect in practice, but better be
safe than sorry.
Found while investigating issues when opening
`lib/tests/libraries_and_linking/libraries/main_scene.blend`.