Commit Graph

99681 Commits

Author SHA1 Message Date
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
Christoph Lendenfeld
e233507efd Fix: Channel select keys doesn't add undo step
When double clicking a channel in the Graph Editor, it would select all keyframes but not create an undo step for that.

This is an issue when double clicking to select all keys and then applying an operator.
The redo panel would also revert the selection since it didn't have an undo step

Pull Request: https://projects.blender.org/blender/blender/pulls/107887
2023-05-26 17:00:22 +02:00
Jason Fielder
9e83211b8d Fix: Implement shared Metal Command queue to resolve sync bugs
Previously, each GHOST Context instantiated its own Metal device
queue. Commands are only synchronized within a queue, this was the
root cause of a number of flickering issues which had previously
been worked-around with synchronization primitives.

New solution uses a shared queue to simplify dependencies and
alleviate possibility of stalls and bugs when resources are modified
or shared across separate GPU command queues.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108223
2023-05-26 16:00:20 +02:00
Sybren A. Stüvel
001e012ea0 Fix crash when selecting all bones in armature
Pressing 'A' to select all pose bones in an armature caused a segfault,
as `id->override_library->runtime->tag` was checked while
`id->override_library->runtime` was `nullptr`. An extra check resolved
the crash.
2023-05-26 15:12:43 +02:00
Xavier Hallade
2533576802 EEVEE: Fix non-deterministic codegen preventing shader cache to work
used_libraries was iterated on to generate shader code depending on
pointers order, which was non-deterministic. It prevented shader caching
by graphics drivers to survive across reboots, as reported in
https://techgage.com/article/blender-3-5-performance-deep-dive-cycles-eevee-viewport/

Co-authored-by: Ray Molenkamp <github@lazydodo.com>

Pull Request: https://projects.blender.org/blender/blender/pulls/108289
2023-05-25 20:37:42 +02:00
Jacques Lucke
dc33a8e974 Geometry Nodes: expose simulation bake path in UI
Longer term we want to have a more centralized place where the bake
paths can be managed, but this is what we can still add in bcon3.

Pull Request: https://projects.blender.org/blender/blender/pulls/108220
2023-05-25 18:56:00 +02:00
Jacques Lucke
1621d790ff Fix #108120: graphic artefacts node editor during cycles render
The issue was that `is_rendering` was used as a proxy to check
whether the interface is locked. Locking the node editor during rendering
is not necessary, but it currently is necessary while baking, because
baking changes original data from a different thread.

The solution is to use the already existing mechanism to tell Blender
which regions should be locked when the interface is locked.
2023-05-25 11:24:45 +02:00
Jason Fielder
03e4325fa9 Fix: High resolution textures in Metal from Integer overflow
Resolve an issue where a high resolution texutre 16k x 8k
did not update in metal due to integer overflow of size parameter.

This patch contains several changes to address size correctness
across multiple use cases within the Metal backend.

Authored by Apple: Michael Parkin-White

Pull Request: https://projects.blender.org/blender/blender/pulls/108238
2023-05-25 08:50:14 +02:00
Campbell Barton
92b4e74985 Fix out-of-bounds read drawing bundles with custom-colors 2023-05-25 09:15:47 +10:00
Bastien Montagne
43a31d3c93 Fix #107913: Creation of liboverrides of Scenes should not be allowed.
It was still possible to create liboverrides of Scene IDs from the
Outliner.

Scenes are currently not officially supported, RNA API allows to create
them for experimental purposes, but UI should not.
2023-05-24 18:03:09 +02:00
Bastien Montagne
babdfc2294 Fix #107913: LibOverride: Hard Crash Opening Blender File with overriden active scene.
The main issue was the fact that if a Scene is overridden, it's content
will be fully invalidated when updating the liboverride at the end of
the file reading process. Since the FileData keeps a pointer to the
active view layer, it needs to be udated then.

As a side consequence, the liblinking of global data also needs to
happen before liboverrides are updated.
2023-05-24 18:03:09 +02:00
Bastien Montagne
43e6f110f4 Fix (unreported) ID copying code tagging embedded IDs as no-main data.
Embedded IDs (master collection of scene, etc.) do not exist in the Main
data-base. However, their tags should follow these from their owners. So
e.g. if a scene is in Main, its master collection should not be tagged
as no-main.

NOTE: this is somewhat also related to our ID tags sanitizing TODO task
(#88555).

Found while invesigating #107913.
2023-05-24 18:03:09 +02:00
Brecht Van Lommel
9419f5a289 Fix #107932: crash attempting to load invalid OpenVDB file path on macOS
Add catch all exceptions similar as was done for OpenEXR in #107184, and
also properly handle errors in Hydra delegate.
2023-05-24 17:47:27 +02:00
Hans Goudey
39780b39bd Fix #108226, #108219: Crash in mesh validation in importers
This line was removed by 7966cd16d6, the fix is
adding back the equivalent operation for poly offset indices.
2023-05-24 11:25:09 -04:00
Damien Picard
9f0807acd6 UI: Fix and improve a few messages
- Samplerate -> Sample rate: should be two words.
- "Falloff type the feather": typo.
- JPEG, OpenJPEG and JPEG 2000 are the official spellings of the
  respective projects.
- "... boundary of image(including ...": missing space.
- "Points in . direction (cannot be changed ...)":
  Plural, it is a collection of multiple points. Also do not use
  contraction for "cannot".
- The Bevel modifier's "Only Vertices" option was replaced by a
  Vertices mode in 2.90.
- "Metaball Types": affects one object, should be singular.
- "Metaball data-block to defined blobby surfaces": typo.
- "Wire Size": this option has nothing to do with wireframes, I suppose
  it's an old terminology.
- "... (for negative speed.)": remove trailing period.
- "Smooth factor effect": the prop describes a factor for an effect,
  not an effect for a factor.
- "... assigned to their vertices(ensures ...": missing space.
- "... used when faces have the ObColor mode enabled": ObColor is not
  used anywhere else in the UI (since Blender 2.50).
- "Effect Children": typo -> Affect.
- "Distort Min/Max": copy-pasted from another pair of properties.
- "... dismiss menu on release.(in 1/100ths of sec)": replace period
  with space.
- "resolution": field names should be capitalized.

Pull Request: https://projects.blender.org/blender/blender/pulls/108227
2023-05-24 16:33:33 +02:00
Philipp Oeser
c4f39eab88 Fix #108171: crash calling bpy.ops.uv.pack_islands
When the operator was executed directly (instead of being invoked as
from the UI), `stop`, `do_update` & `progress` were passed to the job
uninitialized, but `pack_islands_startjob` assigns to them (leading to
crash).

Now write protect in `pack_islands_startjob`.

Also fix memleak (missing call to `pack_islands_freejob`).

Pull Request: https://projects.blender.org/blender/blender/pulls/108185
2023-05-24 11:57:22 +02:00
Sergey Sharybin
3bc189a62e Add option to install copyright.txt
The file is specific for the builds created by the Blender Foundation
and strictly speaking should only be used by builds created on our
release environment.

This change introduces a CMake option which is disabled by default and
which will be enabled on our buildbot.

Ref #107295

Pull Request: https://projects.blender.org/blender/blender/pulls/108191
2023-05-24 10:07:19 +02:00
Campbell Barton
686ec6310c Fix potential buffer overflow with thumbnail URI creation on WIN32
Avoid unsafe strcat use.
2023-05-24 17:08:05 +10:00
Jacques Lucke
edf4cb8b67 Geometry Nodes: store path to simulation bake in modifier
This adds `char *simulation_bake_directory` to the nodes modifier. The path is automatically generated the first time the modifier is baked. It is _not_ automatically changed afterwards. The path is relative to the .blend file by default. For now, the path is not exposed in the UI or Python API.

This fixes issues where renaming objects/modifiers can cause the baked data to not work anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/108201
2023-05-24 08:45:31 +02:00
Campbell Barton
d56c38525c Fix flipped check for file-copy failure on OBJ export
The check for file-copy success was flipped,
document the return value.

Relocate move next to copy as they're related functions.
2023-05-24 16:31:39 +10:00
Campbell Barton
1f6b3c20c8 Fix potential buffer overflow for BLI_copy & BLI_path_move on WIN32
Avoid unsafe strcat use for file copy & move on WIN32.
Allocate the necessary space for the string.
2023-05-24 16:28:01 +10:00
Campbell Barton
574b2db317 Fix buffer overflow in BLI_path_abs on WIN32
Loading paths without a drive-prefix could overflow by 3 bytes.
Replace unsafe strcat with BLI_strncpy.
2023-05-24 13:33:27 +10:00
Campbell Barton
b5150ee8ea Fix potential buffer overflows in USD export & OpenEXR
- Don't use the source string length +1 as the size of the destination
  (USD export & IMB_exr_get_handle_name).
- Correct undersized buffer being passed into imb_exr_insert_view_name.
2023-05-24 12:32:47 +10:00
Chris Blackbourn
f96e108b63 UV: Complete options for rotation during uv packing
The rotation options are now:
* None
* Axis-Aligned (Blender 3.3 default)
   - Rotate to a minimal rectangle, either vertical or horizontal.
* Cardinal (new)
   - Only 90 degree rotations are allowed.
* Any
   - Blender 3.6 default.
2023-05-24 11:27:59 +12:00
Hans Goudey
34791dc37b Fix #108108: Remesh modifier crash with empty result
Caused by 7966cd16d6
2023-05-23 17:46:32 -04:00
Sonny Campbell
a127707cb4 USD Curve Export: Pinned CatmullRom Curve
In Blender the first and last points of a catmullRom curve are
treated as endpoints. To account for this in USD, we must set
the wrap attribute to 'pinned'. This lets the client know that
the first and last points are to be treated as points on the
curve, and that it needs to generate "phantom" points to account
for the start and end control points of a general catmullRom curve.

Related to #102376

Co-authored-by: DESKTOP-ON14TH5\Sonny Campbell <sonny.campbell@unity3d.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/108183
2023-05-23 19:18:17 +02:00
Hans Goudey
2262ea079b Fix #108034: Multires simple subdivide crash
Before 9f78530d80, the -1 coarse_edge_index values in the
foreach_edge calls would return false in BLI_BITMAP_TEST_BOOL,
which made them look like loose edges. BitSpan doesn't have this
problem, so the return for negative indices must be explicit.
2023-05-23 12:58:26 -04:00
Bastien Montagne
a4aee6a997 Fix (unreported) crash in blendkernel unittest in debug builds.
Some `ImagePartialUpdateTest` test are calling code that needs access to
a valid `G_MAIN`. So store the generated main there as part of the setup
step, and reset G_MAIN to its original value (should be NULL) in the
teardown step.

NOTE: Things like `ID_BLEND_PATH_FROM_GLOBAL` and
`BKE_main_blendfile_path_from_global` are pure evil. It may be necessary
in a very few small cases, but their current usages need a lot of strong
cleanup.

Pull Request: https://projects.blender.org/blender/blender/pulls/108189
2023-05-23 15:55:12 +02:00
Bastien Montagne
89bd7b6402 Fix #105889: LibOverride: Overrides of shape keys reset on resync.
The usual special ShapeKey case needs yet another extra corner case
special handling... See comments in code for details about that specific
issue.

NOTE: May be worth checking if this can be backported to 3.3 LTS too.
2023-05-23 15:06:48 +02:00
Campbell Barton
bceb1adb20 Fix potential buffer overflow in AssetList::setup
While in practice an overflow seems unlikely in this particular case,
internal path manipulation assume FILE_MAX_LIBEXTRA so passing in
smaller buffer sizes is error prone.
2023-05-23 11:30:52 +10:00
Campbell Barton
7d682fa107 Fix missing include 2023-05-23 10:18:02 +10:00
Chris Blackbourn
43fe7bec4f Cleanup: format 2023-05-23 09:38:47 +12:00
Chris Blackbourn
a569344a81 Fix: Build error from ae9ac99d2b 2023-05-23 09:38:07 +12:00
Chris Blackbourn
ae9ac99d2b Fix #108117: Crash in uv editor with hidden geometry
Many "UV island" style operations internally use #UvElementMap, including:

- Transform tools
- Smart-Stitch
- UV Pinch, UV Grab and UV Relax sculpt tools.

Normally, every UV in the mesh is included in the #UvElementMap.
However, with hidden geometry, only the visible geometry is included in the map. [0]
This change enforces stricter usage, reducing the chance of crashes in other areas.

Regression from [0] which was a fix for "UV Island calculation doesn't ignore hidden faces" [1].

[0]: 8f543a73ab
[1]: #99659

Pull Request: https://projects.blender.org/blender/blender/pulls/108130
2023-05-22 23:23:23 +02:00
Philipp Oeser
adb36b89c7 Fix #107988: Spreadsheet not updating when playing animation
Similar to other screen options, add one for Spreadsheet editors that
makes them update when playing animation.

NOTE: there are some editors that always update when playback was
invoked from an animation editor while others only do this when their
respective option is specifically set (think the later behavior fits the
spreadsheet better).

Pull Request: #108002
2023-05-22 15:15:22 +02:00