Commit Graph

99715 Commits

Author SHA1 Message Date
Leon Schittek
2ce5fc4a3e Fix #108336: Treat node sockets with muted links as linked
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
2023-06-03 12:34:58 +02:00
Leon Schittek
cc9c720aae Fix #103068: Link insert offset not working when rotating/scaling nodes
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
2023-06-03 12:29:57 +02:00
Hans Goudey
214da4b6b4 Fix #108039: Incorrect results when setting custom normals
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.
2023-06-02 21:18:12 -04:00
Julian Eisel
4832114d60 Fix #107870: Movie Clip Editor hangs in "Clip" view
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.
2023-06-02 18:19:23 +02:00
Nathan Vegdahl
f63c56e05c Fix: action's actual users and recorded user count could diverge
The user count decrement and unassigning the action were split
between two different conditionals, which weren't guaranteed
to both execute/not-execute together.
2023-06-02 16:03:26 +02:00
Bastien Montagne
d847851000 Fix #108285: Crash in Outliner when using RNA ID remapping API call.
RNA API call was not updated UI in anyway.
2023-06-02 15:26:04 +02:00
Bastien Montagne
5ce0f80ed6 Fix #108285: Remap Users operator doesn't work on Objects.
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...
2023-06-02 15:26:04 +02:00
Sietse Brouwer
a784a65dbe Fix #108473: unreliable auto-normalize results when weight painting in GPencil
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
2023-06-02 15:04:19 +02:00
Sietse Brouwer
25952b865d Fix #108475: no helpful tooltips for Vertex Paint tools in Grease Pencil
The tools in Vertex Paint mode in Grease Pencil were missing clear
descriptions. This patch adds them, based on the descriptions in
the manual.

Pull Request: https://projects.blender.org/blender/blender/pulls/108522
2023-06-02 15:02:39 +02:00
Julian Eisel
a6e1caa1b2 Fix file/asset browser document type icons using wrong theme color
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.
2023-06-02 12:27:45 +02:00
Dalai Felinto
9d00d13767 Fix #108501: Image Editor glitch after texture painting undo
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
2023-06-02 11:09:38 +02:00
Campbell Barton
12240499ac Fix/workaround crash pasting MTex
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.
2023-06-02 13:37:58 +10:00
Jason Fielder
3788f70647 Fix #107704: Release infrequently used memory in Metal buffer pools
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
2023-06-01 15:48:30 +02:00
Jason Fielder
361b42d526 Fix #107766: Resolve Metal texutre usage issue for GreasePencil fill
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
2023-06-01 15:44:18 +02:00
Jason Fielder
c3f7b723b2 Fix #108500: Resolve Metal line loop emulation for armature limits
Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108512
2023-06-01 15:41:25 +02:00
Jacques Lucke
cf959c1a90 Fix: remove materials from simulation state in all cases
This was somewhat inconsistent before where materials sometimes worked
and sometimes did not (#108178). There is a design task for supporting materials
properly: #108410.

Pull Request: https://projects.blender.org/blender/blender/pulls/108411
2023-06-01 12:11:10 +02:00
Campbell Barton
db1344530f Cleanup: unused argument warning 2023-06-01 16:33:10 +10:00
Chris Blackbourn
f87f119c2f UV: Update ui for the uv pack islands operator
Reorder options and improve naming for UV Pack Islands

Update names of constants to match names in the UI.

Pull Request: https://projects.blender.org/blender/blender/pulls/108253
2023-06-01 01:45:07 +02:00
Chris Blackbourn
f78d1fd114 Fix memory leak during uv packing
Regression from [0].

[0]: 91020ccde1
2023-06-01 11:29:06 +12:00
Bastien Montagne
9f1a4a2e3f Fix (studio-reported) LibOverride from Outliner not working well.
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.
2023-05-31 15:31:45 +02:00
Bastien Montagne
12a52c03c8 Fix (unreported) liboverride creation glitches:
- 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.
2023-05-31 15:27:14 +02:00
Bastien Montagne
688e63f950 Fix (unreported) BKE add_collection allowed to add to liboverride.
Probably typo, should check if collection is a liboverride, not if its
liboverridable.
2023-05-31 15:12:03 +02:00
Philipp Oeser
eb4ea0b51d Fix #108266: sculpt auto created color attribute not set as render color
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
2023-05-31 15:00:39 +02:00
Aras Pranckevicius
e097415c2c Fix #107299: new PLY importer does not skip unknown custom data elements
Properly skip any unknown/unrecognized custom data elements,
fixes #107299.
2023-05-31 09:43:56 +03:00
Campbell Barton
5242f442a5 Fix crashes accessing freed memory from the material clipboard
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
2023-05-31 13:51:10 +10:00
Campbell Barton
f5ad77adbf Fix material copy-buffer memory leak on exit
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
2023-05-31 13:22:50 +10:00
Campbell Barton
12e5241876 BKE_main: simplify & update debugging block for tracking freed ID's
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.
2023-05-31 13:22:48 +10:00
Campbell Barton
19cd473518 Fix failure to cleanup temporary files with '--python-exit-code'
Note that handlers for the `ARG_PASS_FINAL` pass must always use WM_exit
instead of calling exit directly.
2023-05-31 12:35:22 +10:00
Campbell Barton
b2950b2ad7 Fix saving a quit.blend on exit when a file failed to load
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
2023-05-31 12:35:22 +10:00
Jesse Yurkovich
71079b7957 Fix #108381: Ensure ImageOutput is closed while IOProxy is still alive
Some file formats, like PNG, will perform additional writes inside their
`close` methods. So call close while the IOProxy is still alive.

Pull Request: https://projects.blender.org/blender/blender/pulls/108382
2023-05-31 03:00:33 +02:00
Hans Goudey
1551d7f033 Fix #108273: Mirror modifier resets copied custom normals
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.
2023-05-30 16:28:29 -04:00
Hans Goudey
ac4b76318a Fix #108330: Resample node crash with empty curves 2023-05-30 15:13:44 -04:00
Hans Goudey
f75af7cbf5 Mesh: Forward compatibility with generic bevel weight in 4.0
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.
2023-05-30 15:10:13 -04:00
Harley Acheson
8dc855e60a Fix #108403: Console Word Selection Clipboard Copy Incorrect
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
2023-05-30 19:51:38 +02:00
Lukas Tönne
292baa2a1d Fix #108262: Create cache folder only for modifiers with used sim zones
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
2023-05-30 12:25:22 +02:00
Campbell Barton
5b5a1e3581 Fix crash assessing freed memory when pasting materials
- 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.
2023-05-30 15:50:27 +10:00
Campbell Barton
0edb65c3eb Fix failure exit-code after pressing escape
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.
2023-05-30 12:42:42 +10:00
Campbell Barton
f6d5a9080b PyAPI: suppress 'bgl' warning for Blender as a Python module
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.
2023-05-30 11:53:37 +10:00
Campbell Barton
0a125fccf4 Fix sequencer multi-view context check
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
2023-05-30 10:11:46 +10:00
Richard Antalik
97d9e078b3 Fix #108094: VSE relative paths do not work with linked scenes
Use `ID_BLEND_PATH_FROM_GLOBAL` instead of
`BKE_main_blendfile_path_from_global`.

Pull Request: https://projects.blender.org/blender/blender/pulls/108251
2023-05-29 14:50:50 +02:00
Campbell Barton
21ef4276ee Fix potential buffer overflow in BLI_windows_get_executable_dir
GetModuleFileName size was 256 bytes greater then the argument given.
2023-05-29 20:33:43 +10:00
Brecht Van Lommel
e5c8b92e9c Fix outliner constraint disabling clearing unrelated flags 2023-05-29 11:38:30 +02:00
Campbell Barton
2d81e65703 Fix failure to load a blend file behaving as if a new file is loaded
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.
2023-05-29 11:52:23 +10:00
Pratik Borhade
19a9941816 Fix #107011: Support logarithmic scale when values are zero
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.
2023-05-29 09:48:57 +10:00
Campbell Barton
379ff4befd Fix incorrect help text for the default for script auto-execution
The default changed in [0] but the help text wasn't updated.

[0]: 412c043474
2023-05-28 14:59:59 +10:00
Chris Blackbourn
71d89dfa81 UV: Fix (unreported) uv packing with pinned islands and original bounding box
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.
2023-05-27 16:17:49 +12:00
Campbell Barton
6d03fde7db Fix potential NULL pointer de-reference from BLI_path_slash_rfind use
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.
2023-05-27 13:10:07 +10:00
Bastien Montagne
ff126ede17 'Fix' (unreported) issue that liboverride code can corrupt Main namemap.
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.
2023-05-26 18:43:19 +02:00
Bastien Montagne
e260bc64da Fix (unreported) broken 'fixing' code in ID name uniqueness handling.
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`.
2023-05-26 18:43:19 +02:00
Bastien Montagne
591936c7ed Fix (unreported) wrong logic in readfile lookup for existing library ID.
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`.
2023-05-26 18:43:19 +02:00