Commit Graph

124174 Commits

Author SHA1 Message Date
Campbell Barton aa6414c8c8 Cleanup: format 2023-05-27 13:45:03 +10:00
Campbell Barton b18b7c1de1 make format: include tools/ as it's no longer a sub-module 2023-05-27 13:43:33 +10: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 4c5998ee0b Unittest: Add very basic 'old file loading' test.
Use existing `lib/tests/libraries_and_linking/library_test_scene.blend`
essentially as 'file loads without error' test. Also does very basic
proxy -> liboverrides conversion check.

This test could be extended a lot, but just opening this file already
allowed to identify three bugs in current 3.6/main code, and an issue in
an upcoming refactor of the readfile code...
2023-05-26 18:43:19 +02: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
Thomas Dinges ccd85688ed Update licence infos for OpenSSL. 2023-05-26 15:44:06 +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
Brecht Van Lommel 080484a5c8 Fix #108125: Cycles generates NaN in render passes with low roughness
Slightly increase threshold to avoid division by zero.
2023-05-26 12:18:06 +02:00
Christoph Lendenfeld e2a75814ac Animation: change Slider Popup menu hotkeys
Since the change in #106113 the Slider menu which was called with the D hotkey was no longer in any menu.
This made it really hard to discover.

Since there is now more than 1 menu popup, it needs more than 1 hotkey.
The idea is that the ALT key is used in combination with keys that are easy to reach with the left hand.
Right now it is ALT+S and ALT+D but if needed in the future it can be extended to f, w and e

Pull Request: https://projects.blender.org/blender/blender/pulls/107866
2023-05-26 09:03:08 +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
Campbell Barton f3677dce41 Cleanup: minor changes to the keymap
- Keyword only argument.
- Negate booleans with `not`.
2023-05-25 20:29:02 +10:00
Campbell Barton 09c2b327d7 Fix #107283: Drag Box Selection While (e.g. Transform) Tool is on
Regression in [0]. The only configuration that has changed is RMB select
with "Right Mouse Select" set to "Select & Tweak" (the default)
which now behaves as if [0] was reverted without reintroducing #99963.

[0]: 64dbfe714b
2023-05-25 20:29:02 +10: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 86b6aba437 LTS downloads: user friendly names and add Apple Silicon
arm download links were missing and user more friendly names for the
links to click on (instead of the bare filenames).

Pull Request: https://projects.blender.org/blender/blender/pulls/108180
2023-05-24 12:17:02 +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
Philipp Oeser 9511384442 Fix: editor naming in recent spreadsheet animation update commit
Followup to adb36b89c7.

"Spreadsheet Editors" > "Spreadsheet" (as this is what the spreadsheet
is called e.g. in the Editor type dropdown).

Pull Request: https://projects.blender.org/blender/blender/pulls/108186
2023-05-24 09:25:10 +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
Sergey Sharybin d1254519ad Fix make update for upstream workflow and missing branch in submodule
Fix the issue when upstream workflow is used and the addons fork does
not yet have the release branch. In this case create a local branch
which is based on the upstream/<branch> but does not track anything.

Typically with such workflow the local branches will track origin, but
since the origin does not have the branch yet it is not possible to
track it.

Test plan:
- Use upstream workflow
- Have a fork of addons, which does not have blender-v3.6-release
- Run make update

The error message:
```
Updating scripts/addons ...
git fetch origin
git fetch upstream
git checkout -t origin/blender-v3.6-release
fatal: 'origin/blender-v3.6-release' is not a commit and a branch 'blender-v3.6-release' cannot be created from it
make: *** [update] Error 128
```

Pull Request: https://projects.blender.org/blender/blender/pulls/108197
2023-05-23 17:49:43 +02: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
Michael Jones 4a26f51a55 Cycles: MetalRT: Metal binary archives don't support linked functions
This patch fixes an undefined behaviour where we were trying to use linked functions with binary archives. This isn't supported yet. At best this will fail silently, but this is not guaranteed in future. To fix this we simply disable binary archives if any linked functions are involved. The impact of this is that the `SHADE_SURFACE_RAYTRACE` and `SHADE_SURFACE_MNEE` kernels will fall back to the file system cache when MetalRT is enabled. The file system cache will occasionally be purged due to factors beyond Blender's control.

Pull Request: https://projects.blender.org/blender/blender/pulls/108176
2023-05-23 13:42:25 +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 93ca0444f3 Fix #108129: exception editing custom properties
Regression in [0], caused by the sub-type enum not containing NONE.

[0]: 6e2721da30
2023-05-23 10:50:36 +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