WIP: Surface Deform Grease Pencil Modifier - Blender 4.0 #114142

Draft
Elisabetta Abbattista wants to merge 245 commits from bettiabba/blender:Surface-Deform-GP-Modifier-Blender-v4.0 into blender-v4.0-release

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

245 Commits

Author SHA1 Message Date
Elisabetta Abbattista 79fd6aff2e Added poll disabling bind ops in edit mode
buildbot/vexp-code-patch-coordinator Build done. Details
2023-11-01 12:05:31 +01:00
Elisabetta Abbattista 78e20abe64 Fixed BLI_sprintfN usage 2023-10-24 21:16:07 +02:00
Elisabetta Abbattista 6ff0ed6400 reinserted target face count 2023-10-24 20:54:52 +02:00
Elisabetta Abbattista acfe8680b9 at last arranged includes in a way that it builds successfully 2023-10-24 20:49:05 +02:00
Elisabetta Abbattista fff744c145 Merge remote-tracking branch 'origin/blender-v4.0-release' into Surface-Deform-GP-Modifier-Blender-v4.0 2023-10-24 17:39:29 +02:00
Elisabetta Abbattista 2203a646fd file name changed 2023-10-24 17:39:04 +02:00
Elisabetta Abbattista fabfc4d22a conversion to new blender 2023-10-24 17:38:55 +02:00
Elisabetta Abbattista 19c38719dc conversion to c++ 2023-10-24 17:38:32 +02:00
Elisabetta Abbattista 93e38595f9 changed file name 2023-10-24 17:06:04 +02:00
Elisabetta Abbattista f48b6d223f changed includes to C++ 2023-10-24 17:05:24 +02:00
Elisabetta Abbattista 6794d6c6dc updated includes to C++ 2023-10-24 15:10:45 +02:00
Elisabetta Abbattista 3ba61a2f78 fixed merge errrors 2023-10-24 15:10:15 +02:00
Elisabetta Abbattista 291dc69cd9 Merging Surdef in 4.0 2023-10-15 13:41:27 +02:00
Elisabetta Abbattista 74f782998b Bound keyframes are now the same color as the scrubbing region, to make it clear that they're locked. 2023-10-14 15:37:20 +02:00
Elisabetta Abbattista 8531098296 Now bound keyframes cant be deleted (: 2023-10-14 15:25:54 +02:00
Elisabetta Abbattista 4f6acddc78 Fix: empty layer sometimes preventing deformation of other layers 2023-10-14 15:13:58 +02:00
Elisabetta Abbattista 9bc41968a1 Fixed the locked frames warning, I had managed to mess it up lol 2023-10-14 15:08:24 +02:00
Elisabetta Abbattista 7acca89281 added "Bound frames are locked warning" 2023-10-14 15:05:57 +02:00
Elisabetta Abbattista 639e7eaf65 Fix: flase "strokes changed" error 2023-10-11 17:47:56 +02:00
Elisabetta Abbattista a82b0488de bake current frame now doesnt change the frame range setting anymore 2023-10-11 17:34:48 +02:00
Elisabetta Abbattista 494d6fa1c4 Fix: unbind current frame unbinded only the current layer 2023-10-11 17:21:39 +02:00
Elisabetta Abbattista 85735e2f87 fix: bake op sometimes baked on the wrong layer 2023-10-11 17:16:07 +02:00
Elisabetta Abbattista 82836a266f Fix: crash if extra unbound layers 2023-10-11 17:15:46 +02:00
Elisabetta Abbattista aa4ea08fb7 Merge remote-tracking branch 'origin/blender-v3.6-release' into Surface-Deform-GP-Modifier-Blender-v3.6
buildbot/vexp-code-patch-coordinator Build done. Details
2023-10-10 11:56:28 +02:00
Elisabetta Abbattista b8cb216c7e added BKE_mesh.hh
buildbot/vexp-code-patch-coordinator Build done. Details
2023-10-10 10:56:45 +02:00
Brecht Van Lommel cd89390b52 Build: update 3.6 libraries to address CVEs and bugs
buildbot/v360-code-daily-coordinator Build done. Details
And ignore a few CVEs that do not affect Blender.

openimageio 2.4.15
openssl 3.1.2
python 3.10.13
sndfile 1.2.2
webp 1.3.2

Ref #104895

Co-authored-by: Ray Molenkamp <github@lazydodo.com>
Pull Request: #112528
2023-10-09 14:24:37 +02:00
Elisabetta Abbattista 4f34c8881c fixed some oversights in bind all func that caused crash
buildbot/vexp-code-patch-coordinator Build done. Details
2023-10-08 16:58:04 +02:00
Elisabetta Abbattista 21b780dfb3 Some error messages are now visible. 2023-10-08 16:41:22 +02:00
Elisabetta Abbattista eef1277fb1 Now extra unbound strokes dont get mixed up in bound strokes 2023-10-08 15:54:13 +02:00
Elisabetta Abbattista 24e0aef0af small fix 2023-10-07 13:48:54 +02:00
Elisabetta Abbattista 0d51a05823 now bound keyframes cant be moved at al!! muahahah 2023-10-07 13:46:52 +02:00
Elisabetta Abbattista fbe7be4f5a Fix: scene had to be original for changes to take effect 2023-10-06 13:27:14 +02:00
Elisabetta Abbattista 40020cfb28 Bug fix: bake range baking all the frames as the first 2023-10-06 13:01:51 +02:00
Campbell Barton 49ef671e7b Fix #111186: Crash backtrace missing on Linux
buildbot/v360-code-daily-coordinator Build done. Details
Regression in [0] which caused `execinfo.h` not to be detected by CMake.

Setting a default variable for other platforms prevented the new
variable from being set.

[0]: f197b1a1f1
2023-10-05 20:33:27 +02:00
Brecht Van Lommel 2af8d246d8 UV: when finding the best packing method, use area as tie breaker
When multiple packing methods results in effectively the same bounds,
prefer the packer that uses the smallest area. When all islands can
easily fit this is usually the box packer instead of alpaca. The zigzag
method of the latter has a tendendcy to take up more area and rotate
islands.

Fix #110724: smart UV project unnecessarily rotates islands

Pull Request: #112295
2023-10-05 20:13:13 +02:00
Brecht Van Lommel 086c43152c UV: disable best fit rotation of all islands at end of UV packing
This has a tendency to place islands diagonally in the image which is
not usually wanted, even if it's maximimizing the number of pixels for
the island.

Fix #109906: UV unwrap packs island diagonally instead of straight

Pull Request: #112295
2023-10-05 20:12:07 +02:00
Bastien Montagne 5207c7e117 Fix mistake in previous cherry-pick (6d466e4b94).
buildbot/v360-code-daily-coordinator Build done. Details
Gotta love switches from C to C++... sorry for the noise.
2023-10-04 19:15:44 +02:00
Bastien Montagne 6d466e4b94 Fix (unreported) crash when deleting ObData while keeping their ShapeKeys.
buildbot/v360-code-daily-coordinator Build done. Details
Batch deletion of IDs could lead to deleting ObData ones while keeping
the related ShapeKeys.

Orphaned shape keys are not allowed anymore in Blender, they are checked
against in both file write and read code.

This would lead to assert (and crash) e.g. in the liboverride code.

This commit forcefully add shapekeys of deleted meshes, curves etc.,
when calling e.g. `BKE_id_multi_tagged_delete`.

Note that deleting the shapekey when deleting the obdata ID was already
implemented in single ID deletion (`BKE_id_delete` & co), in the
underlying private `id_free`. But this is skipped in `no main` case.
which is used by the batch deletion code for performance optimizations.
2023-10-04 18:50:59 +02:00
Brecht Van Lommel f6558e3a23 Build: support OpenColorIO 2.3
buildbot/v360-code-daily-coordinator Build done. Details
For Linux distributions or others that upgrade before we do.

Ref #113157

Pull Request: #113163
2023-10-02 19:55:51 +02:00
Brecht Van Lommel f41ea8637d Fix #109907: Cycles multiscatter GGX transmission artifacts
buildbot/v360-code-daily-coordinator Build done. Details
Due to correlation in LCG.
2023-10-02 19:05:46 +02:00
Philipp Oeser ba8cadad00 Bump version cycle to 3.6.5 RC
buildbot/v360-code-daily-coordinator Build done. Details
2023-09-26 11:52:17 +02:00
Philipp Oeser 21bfc5e7fe Bump version cycle to 3.6.4 release
buildbot/v360-code-daily-coordinator Build done. Details
2023-09-25 15:24:03 +02:00
Elisabetta Abbattista bd3ff83f15 more porting 2023-09-23 15:42:53 +02:00
Elisabetta Abbattista af623e6106 operators mess 2023-09-23 15:36:33 +02:00
Elisabetta Abbattista f984d0521d Fully converted ops page into cc, with the help of the regular surdef file 2023-09-23 15:02:50 +02:00
Elisabetta Abbattista a04aa98253 idk trying to make it cc 2023-09-22 16:08:50 +02:00
Elisabetta Abbattista eb4725eaa1 applied a part of the patch from 3.5 that I had forgot 2023-09-22 15:27:49 +02:00
Elisabetta Abbattista 279984845f stuff being now legacy 2023-09-22 15:13:48 +02:00
Elisabetta Abbattista 5a552ecb3c Applied patch from 3.5 2023-09-22 12:14:52 +02:00
Campbell Barton 37acb0cae8 Fix #112399: Memory leak with exceptions from scripts in the text editor
buildbot/v360-code-daily-coordinator Build done. Details
Regression in [0] caused the function to jump to the error in the text
editor not to restore the exception, using the trace-back being iterated
over instead of the original value.

[0]: 2d2baeaf04

Pull Request: #112708
2023-09-22 10:59:36 +02:00
Philipp Oeser a5c5ec6052 Fix #112397: modifiers.execution_time doesn't work on curve objects
The `ScopedModifierTimer` would work for "real" curve modifiers, but was
skipping geometry node modifiers.
Now move it up so geometry node modifiers are included.

Pull Request: #112420
2023-09-22 10:27:01 +02:00
Pratik Borhade 8eafc4e1d4 Fix #101550: Transfer Mode operator doesn't update outliner selection
Notifiers was sent to outliner for redraw but outliner was out of sync
due to missing flag which is required for syncing.
This will correctly set the select/active outliner element flags with
the help of Base in `outliner_select_sync_from_object`. So correct active
tree element will be highlighted in `outliner_draw_highlights`

Pull Request: #112370
2023-09-22 10:26:27 +02:00
Julian Eisel fa6261e53a Fix error in own previous fix (56781c80b7) 2023-09-22 10:14:38 +02:00
Philipp Oeser 681a8e2275 Bump version cycle to 3.6.4 RC
buildbot/v360-code-daily-coordinator Build done. Details
2023-09-22 10:02:43 +02:00
Thomas Dinges d3e6b08276 Release: Bump version cycle to 3.6.3
buildbot/v360-code-daily-coordinator Build done. Details
2023-09-21 08:06:55 +02:00
Hans Goudey 4709082e6e Fix #112590: Split edges crash with loose vertices
buildbot/v360-code-daily-coordinator Build done. Details
A mistake in the backport of be2df46afe caused a crash when
there are split edges in some cases. That was caused by changing from a
lambda in the 4.0 version of `IndexMask::foreach_segment` and the
regular iteration over the mask in 3.6. A return in 4.0 is equivalent to
a continue at the top level of the loop in 3.6.
2023-09-20 12:42:45 -04:00
Julian Eisel 71b55b491e Fix #111212: Crash in menu search when cursor is outside the window
buildbot/v360-code-daily-coordinator Build done. Details
When the mouse cursor is outside the window, it's expected to not have
an active area set in context on such screen level operators. Use the
existing context query that handles this case.

Pull Request: #112417
2023-09-15 16:01:02 +02:00
Falk David eba0d481bb Sim Nodes: Don't delete parent bake directory
The `OBJECT_OT_simulation_nodes_cache_delete` operator
would delete the parent bake directory. This could lead to catastrophic
loss of data if the user set their bake directory to a folder that
contains other files or folders.

This commit makes sure that only the "meta" and "bdata" folders get
deleted in the parent directory.

Pull Request: #110999
2023-09-15 15:16:39 +02:00
Jacques Lucke 048d4638af Fix #112123: only some vertex weights editable (Blender 3.6)
buildbot/v360-code-daily-coordinator Build done. Details
I couldn't reproduce the issue myself, but my guess is that this happened to work for me because freeing the pointer and then immediately allocating the same size again yielded the same pointer. This is allocator dependent behavior which depends on the platform.

A stable pointer is necessary so that `uiBut`s of different frames can be identified to correspond to each other.

In `main` that works already, because `Vector.resize` does not change the pointer if the size does not change.

Pull Request: #112360
2023-09-15 15:03:39 +02:00
Brian Savery (AMD) 2e1ab361c4 Cycles: support building with Windows ROCm 5.5 SDK
buildbot/v360-code-daily-coordinator Build done. Details
The official SDK was released, add correct paths for that version. The
old paths can be removed once the buildbot uses this SDK.

The SDK installer sets a HIP_PATH environment variable. This is used to
automatically detect the location when HIP_ROOT_DIR is not manually
specified.

Co-authored-by: Brecht Van Lommel <brecht@blender.org>
Pull Request: #110519
2023-09-14 19:14:37 +02:00
Brecht Van Lommel ce77d52673 Fix #112299: crash calling context.copy() in operator with popup
The context contained an invalid region pointer after closing the popup.
In the bug report this caused problems making a copy of context.property
which accesses the region, but doing other access to context.region was
a problem as well.
2023-09-14 19:11:31 +02:00
Jacques Lucke e55ca270e2 Fix: Simulation Nodes: assert when scrubbing the timeline with simulation
buildbot/v360-code-daily-coordinator Build done. Details
This issue only become visible in debug builds. I'm not aware of bad behavior
that this caused in release builds. Fixing this is necessary to test #112110 in a debug build.

Pull Request: #112363
2023-09-14 16:53:33 +02:00
Nate Rupsis 8c8d1fba6e Fix #100718: NLA Hold Forward Inconsistency
buildbot/v360-code-daily-coordinator Build done. Details
Fix #100718: NLA Hold Forward Inconsistency

Action Track with 'extrapolation=Hold Forward' behaves the same as 'Hold'.

For the Action Track, we now properly treat extrapolation Hold_Forward just like the rest of the NLA system.

Co-author Wayde Moss @wbmoss_dev

Pull Request: #112347
2023-09-14 16:00:33 +02:00
Jacques Lucke bafcafe995 Fix #111411: crash with group node that references linked-but-not-found group
buildbot/v360-code-daily-coordinator Build done. Details
These group nodes currently don't have a socket declaration for every socket.
Instead we just don't touch the sockets at all so that things have not changed
when the node group is found again.

Pull Request: #112373
2023-09-14 14:10:33 +02:00
Jacques Lucke 6116f8254c Fix #111166: crash when enabling render pass with equally named AOV
There were two issues:
* The check for conflicting AOVs was done after the Render Layer node
  was updated. This led to an unexpected state in the node.
* The check for conflicting AOVs did not work, because AOVs that already
  had the conflict-flag set were ignored.
2023-09-14 14:10:32 +02:00
Jacques Lucke 880a42467a Fix #112335: particle instance modifier outputs wrong attributes
This was caused by a mistake in 16fbadde36.
2023-09-14 14:10:32 +02:00
Falk David d2b12579f0 Fix #112068: Crash when loading converted curves
buildbot/v360-code-daily-coordinator Build done. Details
In 2788fa915b the `CurvesGeometry::blend_write` and `CurvesGeometry::blend_read` functions were added. Unfortunately, the commit also altered the writing logic and introduced a bug where loading a file with a converted `Curves` object would crash. See #112068.

This PR fixes the issue by making sure that `CustomData_blend_write_prepare` is called before `BKE_id_blend_write`, which is the root cause of the crash that happens on load.

The  `CurvesGeometry::blend_write` function is split into  `CurvesGeometry::blend_write_prepare` and `CurvesGeometry::blend_write`.

Pull Request: #112280

Pull Request: #112366
2023-09-14 13:41:18 +02:00
Iliya Katushenock e2f9c9892e Fix #112184: Adapt optimized case of Points of Curve node for domain
buildbot/v360-code-daily-coordinator Build done. Details
Fix mistake in 000e722c7d. If domain is not
the curve, then result should be adopted to domain.

Pull Request: #112185
2023-09-13 10:58:02 -04:00
Hans Goudey be2df46afe Mesh: Rewrite split edges algorithm
The new split edges code from e83f46ea76 started the use of
Mesh rather than BMesh as a performance improvement. However, the code
contained a complex loop used for de-duplicating edges that gave invalid
indices in some circumstances. That was fixed by b226c115e2,
but in turn that commit caused loose edges to be skipped. That was
fixed by 111e378366, however that caused another crash.

Long story short, the code is quite complex and the existing algorithm,
while an improvement from the original, is fiddly. For example, instead
of working with just the input and output states, it adjusted topology
data for an intermediate state halfway through the change.

Fixes #109236

**Goals**
- Only use topology maps from the input mesh. This should work better
  with future topology caching improvements (See !107816).
- Run de-duplication in a per-edge context to allow parallelization.
- Optimize for real world use cases when there is merging of new edges.
- Improve readability by making each step's inputs clear, improving naming,
  and separating functions.
- Improve handling of loose edges.
- Reuse existing edges for the first new split edges, simplifying
  edge attribute propagation.

**Tests**
New regression tests have been committed separately. Existing
tests were updated since the new code gives different indices.
2023-09-13 10:54:30 -04:00
Philipp Oeser 9a2f166307 Fix #112285: Sculpt Mode: Mask brush smoothing is broken
buildbot/v360-code-daily-coordinator Build done. Details
Mistake in cc01bb83f6.

Above commit tried to be smart about early out, but wasnt.
Now corrected.

NOTE: fix needs to go into 3.6 LTS

Pull Request: #112292

Pull Request: #112328
2023-09-13 16:31:46 +02:00
Philipp Oeser d06c761a9d Fix #112144: Graph Editor handle highlighting not working correctly
Mistake in 7c48196056.

Second handle was always drawn with positions of the first handle (when
it was highlighted).

Should be good for 3.6/3.3 LTS.

Pull Request: #112219
2023-09-13 15:32:31 +02:00
Philipp Oeser 57a58fb2b3 Fix #112028: Ctrl+Alt+Scroll not working on all selected objects
Regression from c51467cd4c.

Above commit made the IS_ALLSELECT_EVENT more strict and now excluded
mousewheel events.

Refining IS_ALLSELECT_EVENT even further (to respect mousewheel there)
is unfortunately not easily possible since mouswheel events are excluded
from `win->eventstate` (could only be retrieved from `win->event_queue`
but that is not reliable either since it might have events that are not
handled yet).

Possible solutions:
___
Adding mouswheel events to `win->eventstate`
- seemed to risky (could not forsee all possible consequences this would
have, e.g. double-click behavior)
___
Moving shortcuts for button array copy/paste from ALT to SHIFT
- downside: breaking user habits
- upside: additionally holding ALT could open the door for pasting on
all selected items
-- downside: without further work to make paste to multiple work better,
it would bring back #108096
___

So propose to do what was first suggested in #108270 as a third
solution:

Instead of refining IS_ALLSELECT_EVENT, bring it back to the state
before c51467cd4c (So `Ctrl + Alt + V` would still pass this test), but
specifically "filter out `Ctrl + Alt + V` right after in ui_apply_but().

Pull Request: #112095
2023-09-13 15:31:28 +02:00
Pratik Borhade 9fc217cedf Fix: Regression: Box select not working for GP/GPv3 channels
Caused by 62d9e55eec
Grease pencil channels are not added to the `anim_data` list when
`ANIMFILTER_FCURVESONLY` is set. So skip this filter-type when GP
animdata is present.

Pull Request: #111377
2023-09-13 15:30:48 +02:00
Philipp Oeser c6998872f0 Fix #112208: Vertex parenting index wrong with multiple splines
Caused by 346023b457.

Above commit made variables too local (starting index with zero in each
nurb of the curve/surface object, but we need the "overall" index).

Should be good for LTS.

Pull Request: #112222
2023-09-13 15:13:42 +02:00
YimingWu 8159bd90e5 Fix #111820: Missing type casting in XrGraphicsBinding.cc
The line `oxr_binding.egl.getProcAddress = eglGetProcAddress` supposedly
needs a type casting for it to compile successfully under llvm16.

Pull Request: #111915
2023-09-13 14:56:42 +02:00
Bastien Montagne e039442f27 Fix #111970: Regression: Crash with assertion after delete scene when some 3D Views have Local Collection enabled
This is a nasty gathering of several issues, main one being that 'local
collections' of 3DViews are still updated immediately instead of the
deferred update used for all other viewlayer cases.

The change in a16bcb6576 led to internal references to the Scene's
master collection to become invalid, which is the expected behavior.
But this turns the Scene's view_layers into invalid state too.

Ideally, there should never be resync of viewlayers of a scene being
deleted anyways.

For now, take the (hopefully!) safe approach of explicitely forbidding
any viewlayer update during ID deletion process, and deferring it at the
end of the process.

Note that this change may also give some marginal gerformance
improvements in some rare edge cases (like deleting a very heavy scene
with many collections and 'local collection' 3DViews ?).
2023-09-13 14:56:10 +02:00
Xavier Hallade fe8753f375 Cycles: oneAPI: increase windows min driver requirement to 101.4644
buildbot/v360-code-daily-coordinator Build done. Details
101.4644 has been released 2023-08-15 and fixes the Windows specific
issue #109282.

Pull Request: #112290
2023-09-12 17:37:13 +02:00
Campbell Barton b8ab67827d Fix error batch renaming light probes 2023-09-12 16:38:50 +02:00
Sergey Sharybin 3542d8ac06 Fix #109201: Consistent mapping boundaries of brush textures
This fix makes it so the circular brush is fitted into the square
texture. This seems to be the most straightforward way to resolve
confusion of the inter-dependencies between different brush and
texture options.

Pull Request: #110896
2023-09-12 16:24:59 +02:00
Leon Schittek a786b2981e Fix #111593: Auto-offset when inserting nodes on links inside frames
Apply auto-offset animation in relative steps to avoid issues, when
the parent space of the currently offset node changes.

Pull Request: #111637
2023-09-12 16:23:25 +02:00
Guillermo Venegas 2dd5d31946 Fix #110161: Crash on dragging a Speaker NLA strip
`NLASTRIP_TYPE_TRANSITION` was being used incorrectly as a flag, having
`NLASTRIP_TYPE_TRANSITION=1` and `NLASTRIP_TYPE_SOUND=3` in the enum
`eNlaStrip_Type`, when evaluating `NLASTRIP_TYPE_SOUND &
NLASTRIP_TYPE_TRANSITION` gives a invalid truish value.

Also `strips` that can't be placed were freed, but no removed from the
`strips list`, this will cause a error if the `strip` is at begin
or end of the list.

Pull Request: #110605
2023-09-12 16:19:12 +02:00
Xavier Hallade 0d557718eb Fix #111162: Overlay drawing issues due to shared library using fastmath
Cycles oneAPI kernel library was compiled using -ffast-math. The current
version of Clang makes it link to crtfastmath.o in that case, bringing a
static constructor that does set the FTZ/DAZ bits in MXCSR for the whole
program, leading to unwanted behavior with other components.
Instead of -ffast-math, we switch to a safer subset of compile flags.

Pull Request: #111708
2023-09-12 16:12:30 +02:00
Philipp Oeser f2fffc5390 Fix: Enter on the filebrowser filename label skips operator
Regression from c3dfe1e204.

Above commit put a dummy dragable button over the filename (well, to
allow dragging). Enabling drag ripples down to the button ending up in
the `BUTTON_STATE_HIGHLIGHT` state [which is still good of course].
However, `ui_do_but_EXIT` will then return `WM_UI_HANDLER_BREAK` which
then results in the filebrowser operator being skipped.

`ui_do_but_EXIT` already had a special case for file-browser drag button
[which would return `WM_UI_HANDLER_CONTINUE` instead]. Formerly this was
just the icon, now it is the icon and filename label. So in order to fix
this, remove the explicit check for the `but->imb` which will then
include the dragable label button in the exception for returning
`WM_UI_HANDLER_CONTINUE`.

Fixes #111645.

Pull Request: #111693
2023-09-12 16:11:51 +02:00
Philipp Oeser 24484053f5 Fix #111642: VSE glow code can overflow with small proxies
With such small proxy sizes (combined with a small blur radius), the
kernels `halfWidth` can get zero, which leads to a memory allocation of
same zero size and writing to that memory leads to overflow/crashes/can
only go downhill from there.

Now early out in such cases [which leads to
slightly different output -- well if the "buggy" output survives and
does not crash that is].

(alternatively we could just prevent the overflow and still let do
`RVBlurBitmap2_float` do stuff that it really shouldnt imo, see first version of the PR)

Pull Request: #111660
2023-09-12 16:11:11 +02:00
Philipp Oeser 2a7d6d182c Fix: Customdata merging does not check layer limit on destination
`LayerTypeInfo` can define a `layers_max()` function which determines the
maximum allowed number of layers.

Upon merging, this limit was respected from the source, but not on the
destination, so it was possible to exceed the max (if there were layers
on the destination already).

NOTE: `layers_max()` is currently only defined for legacy CD_MTFACE, but
we might want to enforce this for UVs / CD_PROP_FLOAT2 again.

This came up in #111608.

Pull Request: #111609
2023-09-12 16:03:51 +02:00
Hans Goudey c8c6f62cf3 Fix #109583: Avoid non-threadsafe writing to custom normals data
buildbot/v360-code-daily-coordinator Build done. Details
Currently, while calculating face corner normals, Blender retrieves
custom normal data with write access. When the the custom normals in a
single smooth corner fan don't match, they are reset to the average
value.

This behavior is very old, but it comes from when Blender didn't have a
strong idea of const correctness. Indeed, modifying custom normal data
while calculating normals isn't threadsafe, which is important because
normals are calculated for viewport drawing, for example. And in the
future, properly caching face corner normals (see #93551) will require
the ability to calculate normals on a properly const mesh.

The fix is to still use the average of custom normals in a fan, but
not write that back to the custom data array. In my testing the results
are the same. Setting custom normals still fills the same value for all
corners in a fan.

Pull Request: #110478

Pull Request: #112055
2023-09-06 22:19:08 +02:00
Jacques Lucke d59c8d195b Fix #111273: multiple vertex weight sliders show the same value (backport to 3.6)
buildbot/v360-code-daily-coordinator Build done. Details
The main annoying thing here is that this file is in C++ in `main` but still in C in 3.6.

Pull Request: #112015
2023-09-06 13:53:34 +02:00
Jacques Lucke 439e37466c Fix #111933: wrong rest position
buildbot/v360-code-daily-coordinator Build done. Details
This was caused by 56659f1510.
The line added by this patch was added by the reverted 82ca3d3604, but should not have been reverted. It was not obvious enough that two different things were changed by the same patch.

Pull Request: #111958
2023-09-06 13:26:35 +02:00
Germano Cavalcante d371c3c09f Fix #111548: Snap only working on some surface curve control points
buildbot/v360-code-daily-coordinator Build done. Details
The loop was ignoring ` nu->pntsv` in this case, resulting in only the
first point of each row being used for snapping.

This commit also simplifies the code by removing the no-snap limitation
when the curve only has 1 point.

This limitation existed because the curve is not visible in this case.

But this is contradictory for when the curve has loose points (which
are also not visible).
2023-09-05 12:07:26 -03:00
Germano Cavalcante ed8d18a3fc Fix #109454: Snapping from Tools doesn't work if Depth option is not `Surface`
Regression introduced in 69d6222481.

In that commit the `Depth` option of the placement started to override
the snap toggle. So only the `Suface` value had snap.

This commit also changes the behavior when triggering Placement.
Previously, snapping was forcefully enabled (in the case of `Surface`)
and snapping elements other than Face were used.

Now snap is only enabled if toggle is enabled.
2023-09-05 11:25:13 -03:00
Philipp Oeser e38e82249d Fix #111490: paint radius set to 1 (shift-smoothing but brush missing)
buildbot/v360-code-daily-coordinator Build done. Details
This affected sculpt, vertex- and weightpaint.

So attempting to (temporarily) switching to the smooth/blur tools from
another tool using the "Shift" shortcut can fail if the corresponding
smooth/blur brush is not found/missing [which was the case in the report
because the brush was deleted].

In this case, brushes dont really get switched, but blender would still
try to cache the size (because the smooth/blur brush temporarily uses
the same size as the previous brush) of the smooth brush in
`StrokeCache` (see `smooth_brush_toggle_on`). Then in
`smooth_brush_toggle_off` it was assumed brushes were actually switched
and the (non-existing) size of the (missing) smooth brush was applied to
the **actual** brush.

Now restructure code a bit so in the case of a missing brush we can
early out (without affecting the **actual** brush then).

Pull Request: #111516

Pull Request: #111977
2023-09-05 15:50:21 +02:00
YimingWu 6d0d07f0d8 Fix #111607: Do not unregister internal nodes
Registering a node with a `bl_idname` same as a built-in node will lead
to crash because `rna_Node_unregister` does not check `nt->rna_ext.data`
to see whether it's not null (which indicates whether this node is
registered with python or not). Now fixed.

Pull Request: #111615
2023-09-05 14:41:37 +02:00
Campbell Barton c3689c4235 Fix dangling pointer while scrubbing in the sequencer
SeqCache::last_key could be set to freed memory while scrubbing
two images in the sequencer.
2023-09-05 14:40:49 +02:00
Philipp Oeser 8dd151debc Fix: missing update when library override editable is toggled
If this is not a system override, this leads to the override actually
being reset (which might affect the 3Dview and most probably affects the
Properties Editor).

Now use the same modifiers as used elsewhere for resetting a library
override.

Pull Request: #111469
2023-09-05 14:37:17 +02:00
YimingWu c655db6185 Fix #111601: VSE strip modifier copy ensure unique name
Previously `SEQ_modifier_list_copy` in append mode does not ensure
unique strip name, which will result in duplicated names in target
modifier list, then `strip_modifier_remove(name="something")` can remove
the wrong one later on. Now fixed using `BLI_uniquename`.

Pull Request: #111602
2023-09-05 14:36:21 +02:00
Christoph Lendenfeld eb77eaa7d8 Fix: Memory leak in Graph editor keyframe jump
Introduced with #108549
Simply forgot to free the AnimData list

Pull Request: #111464
2023-09-05 13:49:26 +02:00
Bastien Montagne 282038ea03 Fix #111439: liboverride object cannot be made local from 3DView, if it has a local parent.
The code ensuring that an object (or obdata) is not made local if it is
used by linked data that is not tagged to be made local was blatantly
buggy, leading to over-detecting such cases.

Note that this code remains fairly fragile imho, think the whole Main
data-base of IDs should be checked, other data-types than Objects can
use objects! But this is for another day.
2023-09-05 13:44:23 +02:00
Campbell Barton 93cc31ab85 Cleanup: remove unused set callbacks from readonly RNA properties
Oversight in 8d9422cfe3.
2023-09-05 13:30:47 +02:00
Harley Acheson b9f78a0fcf Fix #110508: Text Object Select Attributes in Object Mode
Status of selected bold, italics, underline, and small caps requires
that the curve have an editfont object. Not checking for this works
interactively but can cause errors in Python. This PR adds explicit
getters and setters that check for editfont.

Pull Request: #110513
2023-09-05 13:23:48 +02:00
Philipp Oeser 557d3d7953 Fix #109427: Shortcut missing in animation editors channel context menu
Specifying the correct operator context (`INVOKE_REGION_CHANNELS` in
this case) is mandatory, otherwise looking up the shortcut in
`wm_keymap_item_find_props` will fetch the wrong region
(`RGN_TYPE_WINDOW` not `RGN_TYPE_CHANNELS`) and thus wont find the keymap
item in that region keymap.

This was already done for the other menus, not for the context menu
though.

Pull Request: #111376
2023-09-05 13:10:25 +02:00
Philipp Oeser 5f2ead7db0 Fix #94129: Unable to remove added keying set from context menu
Mistake in (7-year-old) f6c09eadf0.

The operator was just cancelled if the right button was found, instead
it should only cancel if the button is _not_ found.

Pull Request: #111373
2023-09-05 13:09:34 +02:00
Philipp Oeser 1aceeac984 Fix #111238: Arrow keys in some menus work in the opposite direction
Since menus are created flipped (from event handling point of view), the
root layout block needs to be flagged `UI_BLOCK_IS_FLIP`.
This was missing for a couple of `uiMenuCreateFunc`, namely:
- creating worspaces menu
- modifiers extra ops
- constraints extra ops
- GP modifiers extra ops
- GP Shader FX extra ops

Same fix as f51de2246c.

Not crtitcal, but could go into LTS I guess.

Pull Request: #111341
2023-09-05 13:05:52 +02:00
Harley Acheson dd7f974936 UI: Error Logging for Some Screen Operations
WM_report on the unlikely event when an area (smaller than minimums) is
within the combined operation bounds (close or join) and interferes.

Pull Request: #111280
2023-09-05 12:59:04 +02:00
Alaska ec1b417263 Fix #111277: NaN in Vector Displacement leading to render errors
Fixes NaN in Vector Displacement node caused by the normalization of
0, 0, 0 vectors.

This fixes both visual rendering issues and an "illegal address" error
on the GPU. The "illegal address" error came from the Light Tree
Sampling code not handling the NaN normals well, leading to weird code
paths being taken, eventually leading to a kernel_assert and a
user facing illegal address error.

Pull Request: #111294
2023-09-05 12:47:44 +02:00
Julian Eisel f420dabf8e Correction to b1b8091667: Use utility function
Avoid duplicated query.
2023-09-05 12:46:28 +02:00
Julian Eisel 63cad96833 Fix 106976: Crash when setting custom asset preview
When the temporary File Browser uses a maximized editor, it reuses the
File/Asset Browser under the cursor. When the file browsing action is
confirmed, the old editor state is restored but the file-list cleared,
so it fails to find the active asset and the ID it represents in
context.

Work around this by getting the ID before spawning the File Browser from
the operator.
2023-09-05 12:45:54 +02:00
Christoph Lendenfeld 3234da45a2 Fix #110053: Crash on linked animation data with drivers
When copying (CTRL+L->Animation Data) a driver between two objects
that are linked with library overrides, `AnimData` was not created.
This did crash Blender when it tried to use the `nullptr`

The reason it crashed is because the function
`DEG_id_tag_update()`
was never called.

Fix it by restructuring the code so the function gets called

Pull Request: #110795
2023-09-05 12:44:49 +02:00
Sergey Sharybin 452ec6c93e Fix #111165: Regression: Blender Crashes On Scene Switch
buildbot/v360-code-daily-coordinator Build done. Details
Fix missing depsgraph tag in the "Link Objects to Scene" operator.

Pull Request: #111215
2023-09-05 12:36:29 +02:00
Germano Cavalcante 5b7af751fa Fix Weld modifier generating invalid mesh
Bug identified in #110942.

In cases where the last corners of a polygon are out of context, the
`weld_iter_loop_of_poly_next` iterator skips these corners.

This means that some corners of the resulting mesh do not have the
value set, which can even result in infinite loops.

The solution was not simple. The iterator had to be practically redone
to not use the `loop_end` member (which caused the problem).

Fortunately the code is more simplified with this change.

Pull Request: #110982
2023-09-05 12:32:44 +02:00
Guillermo Venegas 42cc227fbd Fix #109081: Ensure NLA swap strips do not overlap each other.
When swapping strips, if the strips overlapped after the swap, one
of them would get deleted.  We now check if they would overlap
ahead of time, and simply abort the swap instead.

Pull Request: #109980

Pull Request: #111957
2023-09-05 12:27:13 +02:00
Philipp Oeser 1e4b5e5a3b Fix #110723: cant drop object name on object field/socket in node editor
Reason was a difference in poll functions (dropbox poll function vs.
operator poll function).

So the dropbox was actually recognized as being active (see
`dropbox_active`) but then when actually dropping, the corresponding
operator wasnt called (but instead another operator was).

In detail, the way `wm_handlers_do_intern` works, it checks all
dropboxes poll function if one succeeds it calls the dropbox operator.
But if that operators poll function fails, `wm_handlers_do_intern`
happily continues and "ends" the drop operations in a way we dont
actually get to the "real" dropbox & operator that was also recognized
as being active.

In the case of the report:
- dropbox for `UI_OT_drop_name` is active
- dropbox poll for `NODE_OT_add_object` (`node_object_drop_poll`)
succeeds though
- operator poll for `NODE_OT_add_object` (`node_add_object_poll`) fails
(it checks `UI_but_active_drop_name` already)

So in order to make this work, add the check for `UI_but_active_drop_name` to two dropbox poll
functions (and remove from the operator polls).

Probably good for LTS as well.

Pull Request: #110929
2023-09-05 10:01:26 +02:00
Johannes J. d9f12d5453 GPU: Fix signed/unsigned mismatches in shader code
This fixes a crash when switching to face selection mode in the UV
editor.

Pull Request: #111094
2023-09-05 10:00:31 +02:00
Harley Acheson c8573cb20a Fix #110085: Ignore Scroller Zone when on a Screen Edge
When the mouse cursor is between editors ignore scroller zones, which
overflow their areas, so that screen edges are always detected.

Pull Request: #110402
2023-09-05 09:59:37 +02:00
Campbell Barton 65f38fa010 Fix type checking error in recent fix for #110464
Correct type check from dce2368b8c.
2023-09-05 09:58:03 +02:00
Philipp Oeser 08bff72a0a Fix #110464: rna_idprop_ui_create() fails to create new string property
The `BPy_IDPropertyUIManager` takes different keywords for different
data types in its `update` methods.
Booleans and Strings only handle defaults and description while Floats
and Ints can handle additional stuff like min/max.
(see `idprop_ui_data_update_string` vs. e.g.
`idprop_ui_data_update_float`)

There was a different code path in `rna_idprop_ui_create` for bools
already (only passing a subset to `update`), now use this for string as
well since it matches.

Bug introduced in 8b9a3b94fc.

Probably good for LTS.

Pull Request: #110935
2023-09-05 09:57:15 +02:00
Christoph Lendenfeld 481d4fdaa1 Fix #110789: Apply NLA mapping when jumping to keys in the Graph Editor
The new keyframe jumping code for the graph editor did not respect the NLA strip offset.
This patch fixes that by applying `ANIM_nla_mapping_apply_fcurve`

Technical side note: `FCurve *` lost its constness due to that

Pull Request: #110790
2023-09-05 09:56:31 +02:00
Bastien Montagne 4cf03b28b3 Fix (partially) wrong RNA path for 'ViewShading' data.
This commit fixes the RNA path reported from the struct owned by the
Scene.display data. Paths generated for the View3D space remain
completely broken (but whole 'space' paths are broken anyway).
2023-09-05 09:47:36 +02:00
Aras Pranckevicius 19a16de5df OBJ: fix import of files with really large polygons (e.g. 7000 vertices in one poly)
Bug report #110948: a file with a polygon so large that a single line
is 140 kilobytes. The previous limit was 64kb, increase the read file
chunk limit to 256kb. Still not fully robust, would need a more
complex fix to support arbitrarily large line length limits.
2023-09-05 09:38:35 +02:00
Philipp Oeser c5fd621240 Fix #110721: "show_gizmo" does not switch off all gizmos
Not all gizmos were hidden when "show_gizmo" was disabled (most notably
python defined gizmos).
This was working in the 3DView and the Sequencer, but not respected in
the Clip Editor and Image/UV Editors.

Now check the flag prior to `WM_gizmomap_draw`.

Probably good for LTS.

Pull Request: #110932
2023-09-05 09:37:24 +02:00
Nathan Vegdahl 2fc04eaf43 Fix: ensure bones are on at least one layer on blend file reading
buildbot/v360-code-daily-coordinator Build done. Details
This is needed to avoid bones seemingly disappearing when reading
4.x files with bone collections.
2023-09-01 15:53:34 +02:00
Julian Eisel e2d4403497 Fix #111332: 4.0 files cannot be opened in 3.6, invalid region types
buildbot/v360-code-daily-coordinator Build done. Details
4.0 files now include asset shelf regions in 3D views. This region type is not
known to older Blender versions. So far, in such cases we would just change
the region type to be the first known region type and keep the region storage
otherwise. This was arbitrary, and in fact unsafe: the reused settings may
violate invariants/assumptions for a region type and worse, the
`ARegion.regiondata` can only be interpreted and correctly written to files
if the region type is known.

Make sure all invalid regions (regions where the type cannot be restored) are
removed on file read.

Pull Request: #111483
2023-08-29 13:52:16 +02:00
Hans Goudey 56659f1510 Revert "Fix #107185: Edit mode or existing attribute break rest position"
buildbot/v360-code-daily-coordinator Build done. Details
The commit that this reverts fixed the rest position attribute, which
wasn't added in edit mode, since the modifier evaluation is different.
The change was simple, but caused quite a few problems because it broke
the assumption in places that the evaluated result of the mesh modifier
stack in edit mode was also a BMesh rather than a mesh. In main this
has been resolved by a refactor, 91b27ab637, but that change
is too complex to backport to 3.6. As discussed in the most recent nodes
module meeting, this reverts the original fix. That does mean that
the rest position attribute won't function properly in edit mode.

Fixes #110136, #110925, #109301, #109432

This reverts commit 82ca3d3604.

Pull Request: #111396
2023-08-22 17:49:28 +02:00
Bastien Montagne 5b6106f71a Fix (unreported) invalid memory access in new 'newer blendfile version' code.
When choosing the new 'overwrite' option when trying to save a blendfile
from a newer version of Blender, it would cause invalid (use-after-free)
memory access.

Issue caused by the main commit (a1d7ec7139) of the new blendfile
compatibility handling. No idea how it was not detected earlier.

Many thanks to @weizhen for spotting the issue and doing some initial
investigation on it.
2023-08-22 17:36:40 +02:00
Bastien Montagne d9831a9a4b Fix #111235: invalid .blend file can crash on load.
buildbot/v360-code-daily-coordinator Build done. Details
Somehow the backport for 3.6 diverged from commits to main (4.0), and
the case were the DNA block would go missing would not anymore prevent
handling of further `is_minversion_older_than_blender` test in
`blo_decode_and_check`.
2023-08-21 16:15:33 +02:00
Philipp Oeser e362a2f0d4 Release: Bump to 3.6.3 - release candidate.
buildbot/v360-code-daily-coordinator Build done. Details
2023-08-17 11:27:24 +02:00
Brecht Van Lommel e53e55951e Build: fix OpenVDB Metal patch not applying cleanly
buildbot/v360-code-daily-coordinator Build done. Details
2023-08-16 18:43:50 +02:00
Thomas Dinges ffe9313875 Release: Bump version cycle to 3.6.2
buildbot/v360-code-daily-coordinator Build done. Details
2023-08-14 16:05:15 +02:00
Jason Fielder 934165f1c8 Fix #110372: Curve edit handles fixed in Metal backend
buildbot/v360-code-daily-coordinator Build done. Details
There were two separate issues occurring here:

With some other recent changes to curve handles, an early exit was
added when the handles should not display, however, this early exit
was not discarding geometry in the Metal implentation, but leaving
values undefined. Resulting in random geometry flickering on screen.
This may not previously have happened in certain modes if the vertex
buffers were zero-initialised up-front (which only happens with certain
debug flags).

Curve handle geometry generation would render incorrectly when
outputting triangleStrips IF the transparent border was disabled.

Authored by Apple: Michael Parkin-White

Pull Request: #110719

Pull Request: #111044
2023-08-11 13:40:55 +02:00
Christoph Lendenfeld e8d1afb909 Fix #109799: Smooth (Gaussian) introduces stepping
When keys were not perfectly on the frame, the index logic
would fail and duplicate data across 2 frames.
Using `round()` solves this. It does not add subframe support though.

Pull Request: #110059
2023-08-11 12:35:54 +02:00
Christoph Lendenfeld 2f2aecb507 Fix #109781: Linked datablocks are keyable
Add a simple check when inserting keyframes to ensure the data is not linked

Pull Request: #109813
2023-08-11 12:34:46 +02:00
Jacques Lucke 39d7f793f9 Fix #109460: vertex weight slider not working correctly (backported)
buildbot/v360-code-daily-coordinator Build done. Details
This is backported from cd74ba6413.

Pull Request: #111001
2023-08-10 14:52:19 +02:00
Jacques Lucke c040c59e3f Fix #110471: Normal Edit modifier screws up UVs (backported)
buildbot/v360-code-daily-coordinator Build done. Details
Backported 09b6eac5c4.

Pull Request: #110996
2023-08-10 13:43:06 +02:00
Philipp Oeser 4a3c3a5924 Revert "Fix #109460: vertex weight slider not working correctly"
buildbot/v360-code-daily-coordinator Build done. Details
This reverts commit ffcc828ced.
Seems Windows buildbot wasnt happy about this (it cherry-picked and built fine on linux)

Pull Request: #110973
2023-08-09 20:12:26 +02:00
Bastien Montagne 455683c838 Fix (unreported) collection 'readfile' expand incorrect assertion.
buildbot/vexp-code-patch-coordinator Build done. Details
Naming is bad and confusing, but the 'expander' code path from readfile
can also be used outside of the reading context (see e.g.
`BKE_blendfile_write_partial` code). So code cannot assume that it is
exclusively working on data freshly read from file.

This should be renamed - but should also be probably replaced by
proper usage of the more generic 'foreach_id' code anyway, see #105134.

Found while investigating #109588.
2023-08-09 18:35:08 +02:00
Bastien Montagne c426d5b084 Fix (unreported) missing handling of ViewLayer IDProperties in foreach_id code.
Yet another 'obviously' missing bit in foreach_id processing found and fixed.
2023-08-09 18:29:34 +02:00
Germano Cavalcante ec016f7c1b Fix #110821: Tracker resizing with S+S also resizes search area
Regression caused by 03f17c42d0

In that commit it was assumed that the hotkey modifier `S` had no
influence if we were already resizing.

But this is not the case in tracking. The second `S` has influence and
should not be filtered.

The solution is to add a conditional only to Trackers transformation.

This commit also fixed the canceling of this transformation which did
not revert the search area to its original value.
2023-08-09 18:25:24 +02:00
Jacques Lucke ffcc828ced Fix #109460: vertex weight slider not working correctly
#109460 was caused by the introduction of implicit sharing for custom
data layers (7eee378eccc8f87e17). Due to implicit sharing, the vertex
weight layer is now shared between the original and evaluated object in
object/weight paint mode, but not in edit mode because of bmesh. For
that reason, the original data has to be copied to be able to edit it, which
causes its pointer to change. `uiDefButF` can't deal with the situation when
the pointer changes on every redraw.

The solution is to just use an intermediate variable that is passed to the
`uiBut` and to update the vertex weight only when the intermediate value has
changed.

Pull Request: #109665
2023-08-09 18:15:51 +02:00
Richard Antalik d5bd58db88 Fix #110205: Separate images not working correctly.
Strip was removed from `seqbase` prior to calling
`SEQ_edit_remove_flagged_sequences()` which resulted in strip not being
actually removed, and it could be seen in timeline while being active.
2023-08-09 18:08:04 +02:00
Richard Antalik 84734cfe94 Fix #110333: Sound strip length not correct when opening old file
Commit `c9be925f7d` fixed files for studio, that were saved in incorrect
state. This also attempted to fix unaffected files.
In affected files `seq->startofs` did overflow. Sound strips are not
expected to have negative `startofs` and therefore fix in `c9be925f7d`
can be limited to broken files by checking `startofs` value.
2023-08-09 18:03:09 +02:00
Brecht Van Lommel 7180271d56 Fix #110615: missing GL dev packages in install_linux_packages.py
The build fails without these.

Pull Request: #110609
2023-08-09 17:57:22 +02:00
Jacques Lucke acd207794e Fix #110041: gizmo stuck in place when playing back animation
The new notifier triggers `WM_gizmomap_tag_refresh` in
`view3d_main_region_listener` which makes sure that gizmos
are updated when playback ends.
2023-08-09 17:56:45 +02:00
Campbell Barton d121ed4755 Fix #110627: crash on start with Wayland
Older versions of Wayland would crash on startup because of the
requested zwp_pointer_gestures_v1 version.

Resolve by supporting older versions.
2023-08-09 17:55:51 +02:00
Bastien Montagne fbcaf7bf6f Fix (unreported) minor bug in RNA/Liboverride apply code.
The wrong RNA pointers were passed (passing the root ones instead of the
ones actually owning the rna-path-resolved property).

This was likely a harmless mistake, since it only affected RNA
collections of IDs, afaik we currently don't have many (if any) of these
in non-ID RNA structures. The children collections and objects in a
Collection data-block RNA structure e.g. were not affected.

But the potential consequence of that bug would have been missing
automatic detection of some needed liboverride resyncs.
2023-08-09 17:55:06 +02:00
Bastien Montagne 6839c1c2ec File Browser: Add proper warning when trying to list content of invalid library.
buildbot/v360-code-daily-coordinator Build done. Details
In case a blend file opening fails (in the context of library content
listing, e.g. for linking or appending), the File Browser would just
show an emtpy window.

With the new comnpatibility policy, this will now become a fairly common
situation, which requires giving proper explanations to the user.

This commit re-uses and extends the system used to display errors
messages from the Asset browser.

Part of #109151 (PR !110109).

Pull Request: #110568
2023-08-09 17:39:07 +02:00
Bastien Montagne 1b1a9b80ae BKE_file: Add util to check if a given blend file is readable.
`BKE_blendfile_is_readable` attempts to open the given file path, and
return `true` on success, `false` on failure.

Part of #109151 (PR !110109).
2023-08-09 17:39:05 +02:00
Bastien Montagne 15f6e83319 Core: Implement new blendfile compatibility handling.
This implements the main aspects of changes to blendfile compatibility
as designed in #109151:
* Blender files which file minversion is newer than current Blender
  executable won't be loaded at all.
* Blender files which file version is newer than current Blender will
  triger systematic warning to user:
  * In the status info bar (lower right corner in default UI).
  * When attempting to save (overwrite) them.

This means that the file minversion becomes a hard limit, and not a
soft, warning-only as it used to be. Further more, forward compatibility
warning is now systematic (instead of depending on file minversion),
and more visible for users.

See also https://wiki.blender.org/wiki/Process/Compatibility_Handling
for details over the new policy.

Technically:
* Opening any file with a minversion newer than current Blender file one
  now triggers an early abort, with an error message reported to the user.
  This is handled by a new utils called from `blo_decode_and_check`.
* Any file newer than current Blender version sets a new
  `has_forward_compatibility_issues` flag in Main struct at read time.
* Status bar info area is turned into a template, which uses this flag
  to display special warning UI and tooltip when set.
* A new confirmation popup appears when user tries to save (overwrite)
  such a 'newer' blendfile, stating potential loos of data, and
  proposing by default to 'save as' instead.
* The 'quit unsaved' popup has also been updated to 'save as' instead of
  'save' when the edited file is has potential forward compitibility
  issues.

NOTE: For 3.6LTS, an additional hot-fix is applied on read file
minversion, to ensure that all files from early 4.0 develpment stages
remain readable in Blender 3.6LTS after this commit.

Part of #109151 (PR !110109).
2023-08-09 17:39:05 +02:00
Bastien Montagne 6f7e819b29 Reduce file minversion to 3.3 (sub 6) for Blender 3.6.
Required to make 3.6 files readable by 3.3 once the compatibility
changes are backported to the LTS releases.

Part of #109151 (PR !110109).
2023-08-09 17:39:05 +02:00
Bastien Montagne 991fd3baf4 BKE version: Add utils to get string out of numbers for blendfile version.
Since in rare cases there may be needs to expose file subversion here,
the following format was defined:

  <major>.<minor> (sub <subversion>)

Part of #109151 (PR !110109).
2023-08-09 17:39:05 +02:00
Campbell Barton 90458c6400 Fix #109720: load_post can't be used to initialize the driver namespace (3.6 LTS)
Regression in [0] changed the order of execution for the load_post
handler which previously (in 3.5x) ran before driver evaluation.

Calling either load_post/load_post_fail handlers after loading was
changed intentionally to simplify the code-path for calling handlers
however it meant the handler couldn't be used to setup drivers,
so restore the original logic.

Back ported to 3.6 from [1].

[0]: 46be42f6b1
[1]: c6725b935c

Pull Request: #110448
2023-08-09 17:31:06 +02:00
Germano Cavalcante 70a412d743 Fix #110259: snapping with Xray alpha 1.0 occludes edited geometry
The edited mesh is not occluded even with Xray alpha 1.0, but it still
occludes other meshes that are not in edit mode.

Therefore, to resolve, alpha is still considered in general occlusion,
but is ignored in occlusion of edited meshes.

Co-authored-by: Philipp Oeser <philipp@blender.org>
Pull Request: #110263
2023-08-09 17:24:12 +02:00
Sahar A. Kashi 52ab4025e5 Fix #109417: Cycles HIP RT crash with multi device rendering
A couple of checks were missing to handle the multi device rendering.

Pull Request: #110512

Pull Request: #110964
2023-08-09 17:12:53 +02:00
Brecht Van Lommel 91059762d2 Fix #110426: render hanging when drawing metadata in the image editor
Release must be called regardless if the returned image buffer pointer
is null.
2023-08-09 17:12:51 +02:00
Brecht Van Lommel 6d524405bd Fix #110170: Cycles CUDA cloud rendering artifacts with spatial splits
The fix in commit d9273d857 exposed a pre-existing issue in the code.
2023-08-09 17:12:51 +02:00
Joerg Mueller c560f83110 Fix #110336 Regression: Speaker ignoring of the starting position in NLA track
Porting fix from upstream:

Bugfix for reading an animated property with a negative time value.

This can now happen in SequenceHandle::seek.
2023-08-09 17:12:51 +02:00
Ray molenkamp 6ed75d8256 deps_builder: Update USD repo and hash
USD has recently renamed their repository from USD to OpenUSD leading
to a change in the URI for this dep and the hash for the previously
released USD 23.05 since the tarball now will have the source in the
OpenUSD-23.05 folder.
2023-08-09 17:12:51 +02:00
Philipp Oeser db9506aada Fix #110341: Appended text looses user after reload
Even if a text datablock was "used" by in the Text Editor, it would be
lost after save/reload if no fake user is set.

This is not in line with other datablocks if they are used by an editor
(e.g. images, clips, masks etc.).

Now handle this with `IDWALK_CB_USER_ONE` (instead of `IDWALK_CB_NOP`)
in `id_refcount_recompute_callback` >
`BKE_screen_foreach_id_screen_area` which re-ensures a user is set.

(Bit on shaky ground here, but this seems like this is how this is
handled for other editors "consuming" a datablock).

Pull Request: #110344
2023-08-09 17:12:51 +02:00
YimingWu bf1f132bc2 Fix #106139: Curvemapping clipping range variable error
Clipping should use `clipr`instead of `curr`.

`clipr` is for value clipping while `curr` is for curve view clipping,
misuse of these two can lead to output value being clipped by
viewing range. Now fixed.

Pull Request: #106164
2023-08-09 17:12:51 +02:00
Pratik Borhade 139a95c52f Animation: Fcurve Channel color band alignment
Colorband alignment of Fcurve channels broke after additional offset
value, which is added in d9f5ce2546

Pull Request: #109775
2023-08-09 17:12:51 +02:00
Xavier Hallade fd83fdf4f3 Fix #109771: deps_builder: crash in Embree HW BVH building
When an offline render was done side by side render preview, further
render preview updates requiring BVH to be rebuilt would trigger a
crash.
This will be fixed upstream the same way in Embree 4.2.

Pull Request: #109966
2023-08-09 17:12:51 +02:00
Martijn Versteegh 822b5d7a95 Fix #110164: Trigger spreadsheet redraw on animation pause
When playing and then pausing the animation the spreadsheet would show stale data,
not only during playback but also afterwards.

Pull Request: #110224
2023-08-09 17:12:51 +02:00
nutti 8e0d064538 Docs: Fix layout of bpy.types.Object Python API documents
Fix the layout of Python API documents of bpy.types.Object.
2023-08-09 17:12:51 +02:00
Harley Acheson 17adf2bad9 Fix #40059: Use Modifier Keys Between Windows on Win32
Use modifier keys that are pressed before activating a new window.
Allows call of `wm_window_update_eventstate_modifiers` on
`GHOST_kEventWindowActivate` by using `GetAsyncKeyState` instead of
`GetKeyState` in GHOST_SystemWin32::getModifierKeys, which retrieves
actual hardware state.

Pull Request: #110020
2023-08-09 17:12:51 +02:00
Harley Acheson 39a43bc997 Fix #109525: Improved Win32 Repeat Key Filtering
Allows Win32 key repeat filtering to support multiple simultaneously
repeating keys, as can happen with modifiers. Removes
m_keycode_last_repeat_key and instead checks current down status.

Pull Request: #109991
2023-08-09 17:12:51 +02:00
Harley Acheson 7665cf63c4 Fix #109886: Win32 AutoFocus Between Main Windows
Allow auto-focusing between multiple parent (main) windows when they
are immediately adjacent.

Pull Request: #109946
2023-08-09 17:12:51 +02:00
Sergey Sharybin 9ca57f266e Color management: Add alias for the "Linear Rec.709", ACES, ACEScg
buildbot/v360-code-daily-coordinator Build done. Details
Needed for the forward compatibility.

Ref #110685
Ref #110941

Pull Request: #110965
2023-08-09 16:51:51 +02:00
Bastien Montagne f63ca4f7a8 LibOverride: Fix persistent override property in some RNA pointer cases.
buildbot/v360-code-daily-coordinator Build done. Details
When the override property over a non-ID RNA pointer is not needed
anymore, remove it.

This case is a bit special, because the match does (potentially) detect
differences within the RNA structures pointed to by the property, yet
there should be no override rule for the property itself.
An override rule may have been created in a previous diffing if one of
the RNA pointers was null.

Note that while fairly rare, this is not a corner-case, as it affects at
least one (very common) RNA pointer: the 'animation_data' one.

This left-over rule (created when the liboverride is animated, while the
linked reference data would have no anim data, and becoming useless once
both have anim data) was harmless so far, but would become a problem
with up-coming changes related to #110067.

Pull Request: #109704
2023-08-09 14:34:32 +02:00
Bastien Montagne cc325ad1ba LibOverride: Remove an override property when it has no operations.
Update #BKE_lib_override_library_id_unused_cleanup to also clear the
property when all its operations have been removed, even if the
property itself was not tagged as unused.
2023-08-09 14:34:30 +02:00
Bastien Montagne 30943d710f LibOverride: Extend unittest to cover more advanced/complex cases.
These tests now have basic coverage of:
* Linking data and creating liboverride hierarchy from it.
* Linking that liboverride again.
* Creating liboverride of liboverride.
* Modifying data hierarchy in the library, and testing (recursive)
  resync of it.
* ID name collision handling (between modified linked data and
  existing overrides).
2023-08-09 14:34:30 +02:00
Bastien Montagne a6df000206 Fix (unreported) missing 'need resync' detection in overrides of overrides.
In case the reference data of a liboverride is aslo a liboverride, and
is already tagged for resync, the override of the override also needs to
be resynced.

Note that linked overrides are guaranteed to be processed by apply code
(and hence get checked for needed resync) before the liboverrides using
them.
2023-08-09 14:34:30 +02:00
Bastien Montagne 8c81327b84 LibOverride: Fix RNA API to access liboverride operation's flag.
This should have been an bitflag enum since the beginning.
2023-08-09 14:34:30 +02:00
Bastien Montagne 4bc512bc9d Fix (unreported) incorrect behavior of liboverride hierarchy fixing code.
Code in charge of fixing invalid liboverride hierarchy roots would be
too agressive in re-assigning new root in replacement of old one. When
the invalid initial case was a 'low-level' type of ID (like a nodetree
e.g.), it could 'contaminate' many valid data (objects etc.) and force
them into its own local hierarchy.

This commit fixes the issue by storing all 'processed as valid' IDs into
a set, and ensuring that once an ID has been put into that set, its
hierarchy root is not changed anymore.

in other words, it changes the old behavior of 'last encountered hierarchy
wins' to 'first encountered hierarchy wins'. Since higher-level types of
IDs (like collections or objects) are processed first, this is the
most logical behavior too.
2023-08-09 14:34:30 +02:00
Bastien Montagne 8736b6cc83 LibOverride: RNA Apply code: Work around potential duplicates in names of RNA collections of IDs.
While in theory RNA collections of IDs will have unique names in common
use cases, it can happen that there are naming collisions (due to a same
RNA collection having ID pointers to data from different libraries,
having the same name).

This situation is deadly for liboverride applying code, since it rely on
finding which item of the collection to modify by using its name.

To alleviate the problem, this commit changes the way items are searched
for, by adding an extra first check to find an item which matches both
the requested name and index.

While not perfect, this should reduce the breaking cases when production
files get dirty and start having complex mangling of override and linked
data naming.
2023-08-09 14:34:30 +02:00
Bastien Montagne 11c57f3016 LibOverride: Fix 'resync enforce' not working on RNA collections of IDs.
Code was only considering RNA pointer properties to IDs, but not the
case of RNA collections of ID pointers (like e.g. the Collections' `objects`
property).

This would result in 'resync enforce' fixing tool not working properly
e.g. on liboverride collections' objects.
2023-08-09 14:34:30 +02:00
Bastien Montagne db2d148239 LibOverride: Cleanup: Split log into dedicated output for resync code.
Helps filtering out walls of texts when debuging massive production
files.
2023-08-09 14:34:30 +02:00
Bastien Montagne cb31546c03 LibOverride: Reset object-parenting related properties in resync process.
When the parent ID pointer of an object is a 'system override' (i.e.
matches hierarchy-wise the parent of the linked reference object, or
actually use the same linked object), also clear potential liboverrides
for the other related parenting properties.

This is especially critical for the parent inverse matrix, otherwise if
it ever gets out of sync, in case of re-parenting in the lib data, the
offset would remain and move the liboverride child object into random
places.

NOTE: This may break some very specific workflows where users would rely
on actually overridden parent invert matrix. Not much to be done here,
there is currently no way to support both cases. This is not expected to
be a common use case.
2023-08-09 14:34:30 +02:00
Bastien Montagne 8362d4aa3d LibOverride: Fix RNA handling of object parent-related properties.
While setting the parent object itself already had its dedicated
liboverride apply function to avoid resetting other related properties
like the invert parent matrix, other related properties also had custom
setter callbacks with similar effect.

This commit fixes the propblem for the `parent_bone` and `parent_type`
properties by adding a custom liboverride apply callback for them too.
2023-08-09 14:34:30 +02:00
Joseph Eagar 93e71a4ce2 Paint: Fix drawing delay bug with paint modes
The paint code doesn't invoke `stroke->redraw`
on `INBETWEEN_MOUSEMOVE` events.  This causes
drawing lag on devices that tends to generate
more of them, like pen tablets.

The code no longer does this.  It does still exclude
inbetween events for updating the paint cursor.

I checked, and only the two paint modes (3d texture paint and image paint) actually
use `stroke->redraw`.  Both are implemented to only draw when necessary:

* `paint_2d_redraw` checks for `.need_redraw` flag on tiles.
* `paint_proj_redraw` checks `ProjStrokeHandle.need_redraw`.

I believe this may be the cause of #93796

Pull Request: #110119

Pull Request: #110954
2023-08-09 14:29:26 +02:00
Philipp Oeser a30bcc806d Fix #110021: Deform modifier binding can go wrong in certain stacks
This affected `Mesh Deform`, `Corrective Smooth` and `Laplacian Smooth`.

Exposed by 57ea827bfb (e5ec04d73c).

Evaluating the incoming mesh can be different in
`BKE_object_handle_data_update` as opposed to
`object_force_modifier_update_for_bind` due to different
`CustomData_MeshMasks` being used (the former used a handpicked set, the
later was still using `CD_MASK_BAREMESH`). But since moving many
relevant [to modifiers] data to attributes, this could lead to binding go
wrong (e.g. reporting a vertex count mismatch as reported in #110021
which was due to the fact that creases were not propagated and that
changed the output [also vertex count] of a subdivision modifier in the
stack).

Now use `CD_MASK_DERIVEDMESH` in `object_force_modifier_update_for_bind`
to get all relevant attributes for evaluation (this is not used in `BKE_object_handle_data_update`
to avoid a big performance impact there).

Also fixes #109626 afaict.

Should probably go into 3.6 LTS (maybe even 3.3 LTS).

Pull Request: #110095
2023-08-09 13:47:34 +02:00
Hans Goudey 4bb2402172 Fix #110107: Subdivide curves crash with empty input 2023-08-09 13:46:55 +02:00
Sietse Brouwer 0a10b8e82a Fix #109986: Crash when using GP grab tool on object with Subdivide modifier
The grab tool could crash when applied to a Grease Pencil object with a
Subdivide modifier (or any other modifier that changes the number of
points in strokes). This patch prevents the grab tool from crashing.

- Removed a grab tool exception that was no longer necessary.
- Added a missing null check.

Pull Request: #110078
2023-08-09 13:45:47 +02:00
Germano Cavalcante ea8f8fd50a Fix #109630: Grave and Single Quote keys not being detected on MacOS
The `UCKeyTranslate` function was being used wrong.

The `deadKeyState` param should use `kUCKeyTranslateNoDeadKeysMask`
instead of `kUCKeyTranslateNoDeadKeysBit` (optionally could also use
`(1 << kUCKeyTranslateNoDeadKeysBit`)).

This commit also dispenses with accessing the keyAction, as this is not
crucial for determining the key.

Comments have also been added to better describe the code.

Pull Request: #109987
2023-08-09 13:44:51 +02:00
Iliya Katushenock bc486302fe Fix #99569: Socket type drawing of custom type in view template
Socket type drawing of custom type in view template.

Pull Request: #109871
2023-08-09 13:43:52 +02:00
Philipp Oeser 21a7605eea Release: Bump to 3.6.2 - release candidate
buildbot/v360-code-daily-coordinator Build done. Details
2023-08-09 13:24:19 +02:00
Sergey Sharybin 318aaa6d6b Add Linear CIE-XYZ D65 as alias to XYZ color space
buildbot/v360-code-daily-coordinator Build done. Details
It is needed to preserve forward compatibility with the changes
related to AgX.

Ref #110685
Ref #110913

Pull Request: #110924
2023-08-08 14:39:33 +02:00
Dalai Felinto c284cfcd08 Docs: Update RNA to user manual url map
buildbot/v360-code-daily-coordinator Build done. Details
2023-07-21 14:59:46 +02:00
Philipp Oeser 8bda729ef4 Release: Bump to 3.6.1 - release.
buildbot/v360-code-daily-coordinator Build done. Details
2023-07-17 14:50:48 +02:00
Hans Goudey edc1a09966 Revert "Fix #109236: Split Edges node skips loose edges"
buildbot/v360-code-daily-coordinator Build done. Details
This reverts commit b226c115e2.

Fixes #110005.

I have been working on a fix branch, but the problem was fairly
fundamental to the algorithm and the fix ended up being a rewrite
that I didn't quite finish yet, and I will be away next week. Since
the other bug is a crash rather than a change in behavior, better to
have the other bug than this one in the meantime.
2023-07-15 22:43:46 -04:00
Brecht Van Lommel a8b82bd89e Fix Cycles HIP RT kernel not rebuilding on changes
buildbot/v360-code-daily-coordinator Build done. Details
Changes to the kernel source would not update the HIP RT binaries, leading
to render errors due to the kernel being mismatched with Blender.

The code this was copied from was inside a macro that defines the sources
variable, but it's not defined here.

Ref #109418

Pull Request: #110073
2023-07-13 23:11:17 +02:00
Germano Cavalcante fc44305e72 Fix #109633: 'Project Individual Elements' for 'Vert/Edge Slide'
buildbot/v360-code-daily-coordinator Build done. Details
`Project Individual Elements` was never supported for `Vert Slide` and
`Edge Slide`, however, albeit erroneously, this option still affected
those operations.

In Blender 3.6 this situation of `Project Individual Elements`
affecting the result, has been "fixed". But users still preferred the
old behavior.

Therefore, instead of falling back to `Snap To Face`, support
`Project Individual Elements` for `Vert Slide` and `Edge Slide`.

This is more like how it worked previously.

Pull Request: #109656
2023-07-12 22:10:54 +02:00
Germano Cavalcante 05f4458f39 Fix #109565: Array modifier changes the Root vertex of Skin modifier
buildbot/v360-code-daily-coordinator Build done. Details
This commit applies the latest changes to the merge by distance code.
All are related to the `do_mix_vert_data` feature.

This feature is essential for fixing #109565.

The commits are (from newest to oldest):
- 36b2291610
- 7aa31c884d
- e9aba52f42
- 1457c0c533
- 113004687d
- 74772c6920
2023-07-12 16:41:49 -03:00
Germano Cavalcante 75e0aab868 Fix #109433: Snapping occluding objects even in wireframe mode
buildbot/v360-code-daily-coordinator Build done. Details
The internal `use_occlusion_test` option was only being removed if it
was in conjunction with the `Snap to Face` option.

Both test occlusion and Snap to Face are conflicting. In wireframe mode
the objects are not occluded, but Snap to Face can prevent them from
being snapped.

The solution is to prioritize snapping to other non-Face elements but
still allow "Snap to Face" in X-Ray mode.

Pull Request: #109445
2023-07-12 21:09:12 +02:00
Brecht Van Lommel bab9133412 Fix #109718: Cycles crash with persistent data and bpy.ops.render
buildbot/v360-code-daily-coordinator Build done. Details
Don't reuse freed context for subsequent render.
2023-07-12 18:18:04 +02:00
Bastien Montagne 3d2bae8a5d LibOverride: Fix diffing code not always cleaning unused operations.
buildbot/v360-code-daily-coordinator Build done. Details
In RNA collections cases, the cleaning code was buggy and could end up
never cleaning actually unused liboverride operations, resulting in
sometimes tens of garbage operations on e.g. Collection's objects list.

This was a fairly severe bug, since it could lead to very broken
overrides of collections in some cases when things start to get broken
in the production file, amplifying greatly initially small issues.
2023-07-12 16:55:17 +02:00
Philipp Oeser 3477c31c5f Fix #109802: Outliner "Blender File" view cant delete scene
buildbot/v360-code-daily-coordinator Build done. Details
`outliner_do_scene_operation` wasnt recursive, so it only acted on the
top-level `TreeElement` (which was fine for Scenes view, but failed in
`Blender File` view).

Now use an iterator that handles open subhierarchies as well.

Pull Request: #109810

Pull Request: #110011
2023-07-12 15:45:57 +02:00
Philipp Oeser 86420289e3 Fix #109822: Average Brush in Vertex Paint Mode is broken
Caused by 7a943428de

Looking at history, e.g. 575ade22d4 or prior, it seems the
"fallthrough" [related compiler warning was removed in 7a943428de] was
actually intended in the case of `VPAINT_TOOL_AVERAGE`.

So first, the average color is calculated and after that regular drawing
should happen with that color.

Now make this more clear by calling both `calculate_average_color` as
well as `vpaint_do_draw` before breaking.

Pull Request: #109971
2023-07-12 14:48:43 +02:00
Hans Goudey 60b25936fe Fix: Build error in rigid body code with bullet turned off
Caused by 9c9664c823
2023-07-12 14:42:43 +02:00
Philipp Oeser 9ba5d63ed7 Fix #109928: issues adding rigid bodies via just the world collection
Selecting a rigid body world collection is supposed to set up rigid
bodies for all of its mesh members (if they are not rigid bodies
already), expected result would be just the same as if `Object` > `Rigid
Body` > `Add ...` was used.

Doing it via just the world collection had the following issues though:
- calculating mass would crash on such a freshly created rigid body
objects (be1b32e4e4 falsely assumed `ob->rigidbody_object` is always
present on evaluated objects -- without tagging for depsgraph updates
this is not the case though)
- rigid body simulation would not work even on these freshly created
rigid body objects

Now tag bmain relations and object transforms for update to make both of
these work (following code in `BKE_rigidbody_add_object` that is used
when adding these through `Object` > `Rigid Body` > `Add ...`)

Pull Request: #109961
2023-07-12 14:42:16 +02:00
Jorijn de Graaf fba02d14a7 Fix #109040: Don't calculate homogenous offset if viewspace offset is 0
Users were reporting offset issues when the retopology overlay
was disabled. The reason those issues were happening is because of
`vs_offset = min(vs_offset, vs_z * -0.5);`.
That line is necessary for proper functioning of the retopology
overlay, but causes issues at lower offset values (such as zero, when
the retopology overlay is disabled).

Fixes #109640

Pull Request: #109657
2023-07-12 14:32:43 +02:00
Jorijn de Graaf 41782dfd52 Fix #109662: Overlay: Always use 0 for retopo min offset when disabled
Using 0.0015f as minimum value on Apple makes sense when the retopology
overlay is enabled.
When disabled however, this will cause the shader to think the overlay
is enabled when it's not, affecting the color of faces.
Therefore the offset when disabled should always be zero.
I've removed the unnecessary define and shortened the name of the other
one.

Pull Request: #109658
2023-07-12 14:30:58 +02:00
Iliya Katushenock 696b1804dd Fix #109885: Check if BVH tree is null in correct place
The `BKE_bvhtree_from_pointcloud_get` function have requirements for
input point cloud argument and initialization of `BVHTreeFromPointCloud`
can be skipped. Due to `BVHTreeFromPointCloud` is not initialized by
default constructor, it can contains garbage data. To check if tree is
initialized field of `BVHTreeFromPointCloud`, return argument shouldn't
be ignored. `[[nodiscard]]` attributes is added.

Pull Request: #109892
2023-07-12 14:22:14 +02:00
Pratik Borhade 1795598c59 Fix #109898: Incorrect behavior when moving objects to linked collection
Do not move objects to a collection which is linked from another file.

Pull Request: #109957
2023-07-12 14:10:56 +02:00
Jason Fielder 937c72cf89 Fix #109389: Resolve Z-fighting artifacts in Metal
Resolves z-fighting artifact on Apple Silicon.

Authored by Apple: Michael Parkin-White

Pull Request: #109922
2023-07-12 14:10:17 +02:00
Jason Fielder d9ae68b9e3 Fix #106905: Increase OS version requirement for Metal on Intel
Certain feature requirements unsupported by older OS builds
caused failures when running Intel GPUs on older OS's.

This patch increases the minimum required OS version
to one which covers devices supporting all required features.

Authored by Apple: Michael Parkin-White

Pull Request: #109921
2023-07-12 14:09:27 +02:00
Campbell Barton 906128e9e7 Fix #109952: Unknown engine warning only shown when loading from a popup
Displaying the warning on file load depended on `wm->winactive`
being set, and didn't work when loading a file from the file-open
window or when loading files using a command-line argument.

Resolve using the first window as a fallback.
This happens to resolve #109770, although not freeing timers on exit
is likely to be an issue under other circumstances.
2023-07-12 14:08:51 +02:00
rBrenick be09111784 UI: Grey out ShapeKey list entry on mute
At a glance, it can be hard to see if a Shape Key has been muted or not.
This change greys out all the UI elements, instead of just the current value number.
All the functionality still works the same, purely a visual change.

Pull Request: #109857
2023-07-12 14:08:05 +02:00
Sergey Sharybin b831ef579b Fix #109887: Adding driver from python might crash
Originally was noticed when adding drivers to a rigid body., but
it could potentially happen with any configuration.

The reason for the crash was that the ID which was modified was
not tagged as such.

Modifying drivers from the interface are likely tagging for updates
from the operator. This change makes it so the python function also
does tagging.

It is not really how one would design the system nowadays, but it
is how the Blender historically handles such cases. A bigger refactor
is possible to move tags to the places where modification actually
happens, but it seems to be a better idea to tackle it as a separate
project which will be considered no-functional-changes.

Pull Request: #109895
2023-07-12 14:07:25 +02:00
Campbell Barton aef44c2d50 Fix invalid address-of operator (hidden by a cast)
While in practice this didn't cause problems,
it's misleading & unnecessary.
2023-07-12 14:06:46 +02:00
Campbell Barton 8142195f29 Fix memory leak when there are unexpectedly more than MAXSEQ strips 2023-07-12 14:05:58 +02:00
Guillermo Venegas 9383f4d067 Fix #109532: Added missing conversion from wl_fixed to int in Wayland
When blender is not focused and a selection is executed
with the mouse, since there is no conversion from `wl_fixed` to `int`,
the bounds of the selection can cause the selection box to be too large,
causing `draw_select_framebuffer_depth_only_setup` to fail when create
`g_select_buffer.texture_depth`.

Ref !109834
2023-07-12 14:05:15 +02:00
Brecht Van Lommel 155e1830bd Fix #103918: Cycles point cloud motion blur artifacts on the GPU
Change storage to consistently put xyz + radius in the motion blur attribute.

Pull Request: #109830
2023-07-12 14:03:49 +02:00
Hans Goudey 99d7e9fb55 Fix #109471: BMesh to Mesh conversion invalid UV boolean attribute data
First we copied the entire BMesh custom data layout to the Mesh, then we
decided not to copy some boolean layers like UV pinning if every value
was false. But that left the layers uninitialized. Instead, copy the
custom data layout _after_ finding which layers to skip.
2023-07-12 13:58:39 +02:00
Nikita Sirgienko a81dccceaf Cycles: Fix Out-Of-Bounds issues during Embree BVH building 2023-07-12 13:58:01 +02:00
Nikita Sirgienko ab457ae62e Cycles: Embree: Resolve padding-related issue during buffer creations 2023-07-12 13:57:22 +02:00
Campbell Barton 59ab70b594 Fix sequencer image cache holding references to freed keys
In some cases, freeing the image cache keys would not update
next/previous links - causing future updates to reference freed memory.

Also assert the `last_key` is never points to freed memory.
2023-07-12 13:56:39 +02:00
Campbell Barton fa2a28e96d Fix use-after free while transforming sequence strips
Resolve use after free & potential double-free introduced in [0].

[0]: fd51d2f97c
2023-07-12 13:54:29 +02:00
Brecht Van Lommel 5283ef4ce5 Fix #109562: Cycles HIP device not found on Debian
Try loading ROCm 5.x libraries specifically, as the .so without version
is only part of the development package.

Thanks to Lee Ringham investigating and proposing this solution.
2023-07-12 13:53:40 +02:00
Bastien Montagne 0a13a7841c LibOverride: Fix potential minor issues in RNA liboverride handling code.
buildbot/v360-code-daily-coordinator Build done. Details
2023-07-11 15:57:45 +02:00
Bastien Montagne c6a22bd3a6 LibOverride: Expose 'match reference' status flag in RNA API. 2023-07-11 15:57:28 +02:00
Bastien Montagne 80a2abbecc LibOverride: Add debug util to print out liboverride data.
No functional changes here.
2023-07-11 15:57:09 +02:00
Bastien Montagne f6b06a854d Fix (unreported) potential crash in 'make override' Outliner tool. 2023-07-11 15:56:00 +02:00
Hans Goudey 7538127a58 Fix #109691: Edge crease not handled in complex solidify
buildbot/v360-code-daily-coordinator Build done. Details
a8a454287a which moved edge creases out of `MEdge` only
retrieved the result data array if the mesh had vertex creases. Before
the processing always happened though. So process the result creases
if the input has edge creases too.
2023-07-05 16:42:56 -04:00
Hans Goudey 0f510f3ae9 Fix #109745: Mesh poly normals RNA accessor returns vert normals
buildbot/v360-code-daily-coordinator Build done. Details
Copy and paste mistake in b21537d215.
2023-07-05 11:07:57 -04:00
Sergey Sharybin 1f779f1df2 Fix #109570: Error when using collection parameters in drivers
buildbot/v360-code-daily-coordinator Build done. Details
This was unintentionally fixed in the main branch for the 4.0 series
in the 61ed5b3d24. Initially the commit seemed to not be leading to
any functional changes, but turns out it did fix a real use-case.

This commit is the minimalistic change extracted from the original
commit, making it safe to be ported to the 3.6 LTS.

Pull Request: #109727
2023-07-05 11:45:59 +02:00
Jesse Yurkovich b89548add0 Fix #109442: Match previous behavior when loading BC5 DDS images
buildbot/v360-code-daily-coordinator Build done. Details
Prior to using OIIO for image loading, DDS files were hard-coded to
always treat files with BC5/ATI2 compression as normal maps[1].

This basically means that the B channel would be reconstructed from the
R,G channels in a particular way. There is a non-standard header flag
(coming from tools like NVTT and various others) that can also be used
to indicate if such processing should take place, and OIIO understands
that flag and acts appropriately.  However, not all files have that flag
set.

This patch reverts to the hard-coded behavior to match prior versions.
If the user has explicitly set the OIIO environment variable to say
otherwise, we will respect that setting instead.

[1] https://projects.blender.org/blender/blender/src/branch/blender-v3.5-release/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp#L870

Pull Request: #109541

Pull Request: #109694
2023-07-04 13:55:19 +02:00
Sergey Sharybin 472e9c37b5 Fix #109550: Cycles: OptiX not able to render without CUDA toolkit
Happens with specific GPUs like  NVIDIA A100-SXM4-40GB. They use the
compute capability 8.0, which is not explicitly compiled as a cubin,
and since 7fca0ee76a the PTX is not suitable for it either.

The safest solution is to revert the change to a known good state,
and re-iterate as needed.

Revert "Cycles: Increase the compute model for the PTX kernel"

This reverts commit 7fca0ee76a.

This change would need to be cherry-picked to the 3.6 LTS.

Pull Request: #109636
2023-07-04 13:14:41 +02:00
Bastien Montagne 7880ae7c78 Fix toggling of liboverrides between editable and non-edtiable with "Make" tool in the Outliner.
regression from 43a31d3c93.

Found while investigating #109513.
2023-07-04 13:13:57 +02:00
Bastien Montagne 9f6a4d0c06 Fix (unreported) missing viewlayer sync call in Outliner liboverride tool. 2023-07-04 13:13:14 +02:00
Bastien Montagne 8073325ddc Fix #109590: Outliner: Assert in outliner_collect_objects_to_delete. 2023-07-04 13:12:31 +02:00
Philipp Oeser 866d43ae9d Fix #109455: NLA editor tracks widgets backdrop is too small
Caused by d9f5ce2546 which moved the NLA solo button to the right, but
didnt make the backdrop behind the right-hand-side widgets bigger. So
the first widget seemed "transparent" over the channel name.

Now make the backdrop bigger if the solo button is drawn.

Pull Request: #109498
2023-07-04 13:11:48 +02:00
Germano Cavalcante c1b2e25c2d Fix #109577: Wireframe edge factor is sometimes random
In some situations the loop value might not be set.
2023-07-04 13:11:06 +02:00
Hans Goudey cbcbba23d5 Fix #109523: Crash applying modifier with shape keys
We can't take the ownership of the data of a CustomDataLayer by simply
swapping the pointers anymore, since the data is owned by the layer's
implicit sharing info. Since shape keys don't support implicit sharing
(yet?), just duplicate the layer data instead of taking ownership of it.
2023-07-04 13:10:10 +02:00
Bastien Montagne 5590993f95 Update `credits_git_gen` tool to also parse co-authors in commit messages,
Co-authors listed following the `Co-authored-by:` format in a commit
message will be automatically added to the list of contributors.

Further more, it is now possible to overwrite authors informations from
git commits with embedded data, in case it is necessary to correct some
commit's author information after the commit has been pushed.

Implements #109438.

Pull Request: #109468
2023-07-04 13:05:59 +02:00
Germano Cavalcante 122d380a7c Fix #109519: Orbit Around Selection resets pivot if nothing is selected
Caused by 968ecf6f8b.

The value of the last pivot of the view should not be changed if there
is no selection.

The variable is static precisely because of this.
2023-07-04 13:05:16 +02:00
Philipp Oeser d990e01342 Fix #109302: baking UDIM displacement normalization wrong
Since UDIM baking support in 6787cc13d4, the normalization of
diplacement heights was always based on the min/max height detected in
the _last_ tile, which could lead to clipping if the last tile had very
subtle (or no) displacement.

Now getting the min/max is spread across all images.
This also takes the first thread into account for getting the min/max (which for some reason was skipped).

Pull Request: #109409
2023-07-04 13:04:15 +02:00
Philipp Oeser 18ae7eb689 Fix #109198: Enum properties don't display text in Dope Sheet sliders
`uiDefAutoButR` (or actually `uiDefButR_prop` > `ui_def_but_rna` later
down the line) has this behavior when "" string is passed in, it will
not display text on or next to the button.
This is of course desired in most scenarios -- it might even be desired
for non-icon enums in certain cases (though this is already a bit harder
to find cases for), so changing behavior in said functions is probably
not what we want.

The behavior - from the dopsheet sliders - would seem like a bug though.

Passing NULL (instead of "") to `uiDefAutoButR` results in properly
displaying the chosen item on the dropdown for enums, but for other
property types it would then show the property ui name alongside the
button (which is not what we want in the dopsheet, UI names are already
drawn there separately).

So now, pass "" or NULL conditionally (depending on property type
`PROP_ENUM`).

Pull Request: #109205
2023-07-04 13:03:38 +02:00
Campbell Barton f825a346fc Fix dropping files onto the window under Wayland in some cases
Dropping files from gnome-web onto Blender failed because the
URL data didn't end with a newline.
2023-07-04 13:02:46 +02:00
Campbell Barton 45bf61f131 Fix property tags dummy enum value holding a reference to stack memory
Also update the doc-string to include a warning about this.
2023-07-04 13:00:06 +02:00
Bastien Montagne 6adfd2ae39 Fix (studio-reported) crash when using 'Clear' on a liboverride hierarchy in the Outliner.
Usual issue of modifying the data hierarchy while iterating on it in its
outliner representation. And usual fix for this problem (only store data
to be processed during the iteration over Outliner data, and perform the
actual operation in a single call afterwards).

This commit also tries to improve a bit the 'Clear' process when applied
to a bunch of IDs, by iterating several times over the list of IDs to
clear, and only processing 'liboverrides leaves' first. That way, if
clearing a liboverride leaves turn other liboverrides into leaves, then
can also be processed that way, instead of just being reset.

Note that this is a naive and quite imperfect solution though
(dependency islands cannot be handled that way e.g.), this feature needs
a complete re-write at some point to be more complete and consistent.
Don't think this is high priority though, as it is not really that
useful in practice afaik.

Note: This should be backported to 3.6 LTS (and maybe 3.3 LTS if
applicable).
2023-07-04 12:59:09 +02:00
Philipp Oeser 7fe112c56d Pyhon API: Add animation playback pre/post handlers
Since d8388ef36a, the "frame_change_post" handler could not be used
anymore to detect when animation playback stopped.

This functionality is needed by certain addons though and is generally
usefull to have, so this is now added.

Related reports : #109168, #109218

Pull Request: #109232
2023-07-04 12:57:55 +02:00
Bastien Montagne 596d4ff55f Fix #109004: Append: in Localize All case, LibOverrides does not behave properly.
The root of the issue was that when localizing all linked data, it makes
no sense (and there is no way) to keep liboverrides, since some linked
data would then remain linked.

The solution is then to clear any override data from localized IDs.
While simple in theory, this adds a noticeable amount of complexity to
the 'append' process, as now some IDs should remain linked, and some
should be forcefull copied (instead of directly made local), such that
the liboverride reference data remains valid.

NOTE: Appending without `Localize All` remains unchanged here, and will
keep the liboverrides untouched, since in that case having some linked
data as result of the append operation is expected.

This fix should be backported to the 3.6 LTS.
2023-07-04 12:54:16 +02:00
Bastien Montagne ce7cde954e IDManagement: Add option to 'make local' code to clear liboverride data.
In some cases, when making a linked liboverride data local, the
liboverride data should be preserved (and therefore produce a local
liboverride data).

However, it implies that the data is not really, fully made local, since
it has (critical) dependencies to linked data.

This new option allows 'make local' code to also clear any liboverride
data in the processed ID, making it effectively fully local.

Preliminary step to solve #109004.
2023-07-04 12:53:52 +02:00
Philipp Oeser eeec5e6822 Fix #108171: bpy.ops.uv.pack_islands crash
Originally caused by edc12436c6, the fix c4f39eab88 also had a mistake
unfortunately (double free of `UVPackIslandsData` since it already
called `pack_islands_freejob`).

Pull Request: #109377
2023-07-04 12:52:44 +02:00
Philipp Oeser a39bf0e693 Release: Bump to 3.6.1 - release candidate.
buildbot/v360-code-daily-coordinator Build done. Details
2023-07-04 12:22:12 +02:00
Hans Goudey c7fc78b81e Fix: Crash in 3.6 when loading mesh edge crease from 4.0
buildbot/v360-code-daily-coordinator Build done. Details
In 3.6, the legacy to current mesh format conversion of edge creases
would crash when loading a file from 4.0, because it expected there to
be an `MEdge` array, which doesn't exist in 4.0. This didn't happen
previously because edge creases were stored in the same format for 4.0.
Other "legacy to current" format conversions have similar null checks,
it was just missing here.

Pull Request: #109386
2023-06-27 10:08:18 +02:00
Thomas Dinges fad70313d9 Release: Bump to 3.6.0 - release.
buildbot/v360-code-daily-coordinator Build done. Details
2023-06-26 20:03:44 +02:00