main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00

318 Commits

Author SHA1 Message Date
d9273d8578 Fix Cycles growing BoundBox with empty BoundBox modifies the original BoundBox 2023-03-17 15:28:27 +01:00
f440b15630 Merge branch 'blender-v3.5-release' 2023-03-17 13:59:29 +01:00
2c9ba55c7f Fix #105849: crash when using link-swap with an existing link
The code didn't check if there was actually a link to displace.
2023-03-17 13:55:01 +01:00
8ded95c175 Vulkan: Clearing Storage Buffers
This PR adds support for `GPU_storagebuf_clear` and
`GPU_storagebuf_clear_zero` to the Vulkan backend. It also adds test
cases for all backends.

Pull Request: blender/blender#105487
2023-03-17 13:48:39 +01:00
0cb02ff3ba Merge branch 'blender-v3.5-release' 2023-03-17 12:46:16 +01:00
6d3ce8273a Fix #105363: Frame nodes can act wrong in transform system
When multiple nodes (Frame nodes included in the selection) are scaled/
rotated, the TransData location and center can get "wrong" due to the
fact that Frame nodes dont only use `locx`/`locy` for their
representation while drawing, but also `offsetx`/`offsety`.

So in order to use the "real" top-left corner in the transform system,
we have to respect `offsetx`/`offsety` when creating/flushing transform
data.

In addition to the file in the report, this patch was also tested to work
well with nested Frame nodes.

Pull Request: blender/blender#105400
2023-03-17 12:42:04 +01:00
6c6edaf513 PLY: Improve robustness and performance of the new PLY importer
Fixes:

* General:
- Was assuming that positions/normals/UVs are always `float`, and colors
  are always `uchar`. But e.g. positions are sometimes doubles, or colors
  are floats etc.
- Was assuming that `face` element is always just a single vertex indices
  property. But some files have more arbitrary properties per-face.

* ASCII importer:
- Was assuming that file elements are always in this order: `vertex`,
  `face`, `edge`. That is not necessarily the case.
- Was only handling space character as separator, but not other
  whitespace e.g. tab.
- Was not checking for partially present properties (e.g. if just `nx` is
  present but not `ny` and `nz`, it was still assuming whole normal is there).

* Binary importer:
- Was assuming that faces are always 1-byte list size and 4-byte indices.
- Was assuming that edge vertex indices are always 4-byte.

For the assumptions above, it often lead to either crashes, garbage data
or not detecting presence of a vertex component. E.g. binary importer was
just always reading 4 bytes for vertex indices, but if a file has 2 byte
indices then that would read too much, and then later on would start reading
garbage. ASCII importer was doing out-of-bounds reads into properties array
if some assumptions were not correct, etc.

Improvements:
- Some ply files use different property type names, e.g. `float32`,
  `uint16` or `int8` instead of `float`, `ushort`, `char`; now that is
  supported too.
- Handles `tristrips` element. Some files out there do not have `face` but
  rather has a triangle strip, internally using -1 indices for strip restarts.

Performance:

While doing the above fixes/improvements, in order to fix some things it was
more convenient to also make them more performant :) Now it avoids splitting
each ASCII line into a vector of `std::string` objects, for example, or
reading a binary file in tiny chunks.

Generally this is now 2x-4x faster than the previous state of C++ importer.

The code has changed quite a bit to achieve both the fixes and performance:
- Instead of separate files for ASCII and Binary reading, they are now both
  in `ply_import_data.cc/hh`. Reason is that all of the "find correct property
  indices" logic is the same between both (and that bit was mostly missing
  previously).
- Instead of using raw C++ `fstream` object and reading line by line (which
  in turn reads one byte at a time) or reading field by field, now there's a
  `ply_import_buffer.cc/hh` that reads in 64KB chunks and does any needed
  logic for the ASCII/header part to properly split into lines. This avoids
  all the mutex locking, locale lookups, C++ abstraction layers overhead
  that C++ iostreams have when doing a ton of tiny reads.

Tests:

Extended test coverage with new files (comitted in svn revision 63274).
11 new "situations", in both ascii and binary forms. Additionally, now also
has a Big Endian binary file to test; BE codepath was completely untested
before.

Overall reworked the tests so that they don't do the whole "load dummy
blend file, import ply file on top, go over meshes, check them", but rather
do a simpler "run ply importer logic that fills in PlyData structure, check
that". The followup conversion to blender meshes is fairly trivial and the
tests were not really covering that in a useful way.

Pull Request: blender/blender#105842
2023-03-17 12:20:41 +01:00
ac2f67dda0 Merge branch 'blender-v3.5-release' 2023-03-17 12:13:10 +01:00
1929862ad6 Fix #105688: Ignore modifier part of viewer path in pinned trees.
Viewer node paths usually start with the modifier, but in pinned
node editors the tree may not be used by the object in context.
In that case the modifier part of the path should be ignored.
The viewer node is always disabled in that case.

Pull Request: blender/blender#105826
2023-03-17 12:11:50 +01:00
6e2ea0b997 Merge branch 'blender-v3.5-release' 2023-03-17 12:06:00 +01:00
fa4acbd6be Fix #105757: Resizing images is not marking them as changed
Resizing an image via the operator did not mark it dirty
(`IB_BITMAPDIRTY` is needed to pick this up as being modified, if this is
not set, no warning/option is shown on file close).

Note that using RNA would already do this correctly (since it uses
`BKE_image_scale` -- which already calls `BKE_image_mark_dirty`
internally).

Pull Request: blender/blender#105851
2023-03-17 12:04:49 +01:00
b4e0e696fc Merge branch 'blender-v3.5-release' 2023-03-17 11:58:19 +01:00
24266fd68c Fix #105216: Clear Asset does not immediately redraw the outliner
While **marking** an asset would update the Outliner immediately (this
due to the fact that `ED_asset_generate_preview` indirectly took care of
a refresh), **clearing** an asset would not do this.

Now be explicit about this in the Outliner listener and consider asset
notifiers there.

Pull Request: blender/blender#105287
2023-03-17 11:55:03 +01:00
8bf4aa2fdc Merge branch 'blender-v3.5-release' 2023-03-17 11:17:40 +01:00
38688adaad Fix #105818: material preview invalid memory access reported by ASAN
Preview render depsgraphs are put in the depsgraph registry
concurrently with other threads. This was lacking a mutex lock
and a map value that remains unchanged when other elements of
the map are updated.

Pull Request: blender/blender#105839
2023-03-17 11:17:01 +01:00
0963ee559e Cycles: adjust resolution divider to achieve a more usable viewport
This changes the maximum viewport resolution divider for Cycles to
help users get a more responsive viewport.

This is done by changing the maximum viewport resolution divider
to a divider that aims to have the largest axis of the viewport
roughly equal to 128 pixels.

Depending on the circumstances, this change can result in a few
noticeable differences:
 - Users with slow hardware and a large pixel_size, or slow hardware
 and a low resolution screen, may observe a higher resolution viewport
 during navigation, making the scene more readable. However this comes
 at the cost of reduced responsiveness.

 - Users with slow hardware and a low pixel_size and high
 resolution screen may observe a lower resolution viewport during
 navigation, providing a more responsive viewport during navigation.

Along with that, how Cycles iterates through resolution dividers
is changed to promote quick transitions between resolution dividers.
Meaning users don't need to wait through as many iterations to get
from a low navigation resolution to a 1:1 viewport resolution.

Pull Request: blender/blender#105581
2023-03-17 11:15:58 +01:00
509a12eaac Treat -Wunguarded-availability-new as an error
This makes it so access to macOS SDK from newer versions than our
deployment target can be detected on a buildbot via failed build.

Pull Request: blender/blender#105595
2023-03-17 10:45:03 +01:00
da590428c3 Merge branch 'blender-v3.5-release' 2023-03-17 10:08:42 +01:00
aca3039740 Fix #104730: Suppress using anonymous UV layers for rendering
When an object has no UV layers and an anonymous UV layer is created,
the anonymous layer gets set as the default (render) layer. This is
very confusing because it then uses a hidden anonmous layer. This patch
suppresses the usage of anonymous layers for rendering.

Pull Request: blender/blender#105192
2023-03-17 09:42:54 +01:00
4892a132bc Python: Unable to use gpu.state.scissor_test_set.
`scissor_test_set` wasn't able to parse the arguments that were
passed correctly, due to incorrect control data during functino
registration.

This patch uses the correct control data during registration and
is able to parse arguments.

Ref: #104911

Pull Request: blender/blender#105850
2023-03-17 08:03:55 +01:00
e853a67efc Cleanup: use BKE_blendfile_* for functions defined in BKE_blendfile.h 2023-03-17 16:45:42 +11:00
3b8a050fc1 Cleanup: use function-style casts, ELEM & STREQ macros 2023-03-17 16:45:42 +11:00
976b17e415 Cleanup: remove redundant casts 2023-03-17 16:45:42 +11:00
b6b0bc4531 Cleanup: spelling in comments 2023-03-17 16:45:42 +11:00
01a29ebaeb Merge branch 'blender-v3.5-release' 2023-03-17 14:52:04 +11:00
c169f67dc1 Fix #103263: Touchpad gestures changing pivot point of rotation/zooming
Auto-depth is no longer reset during consecutive touch-pad motion.

Details:

- Add wmEvent::flag, WM_EVENT_IS_CONSECUTIVE to detect consecutive
  track-pad & NDOF motion events. Expose via RNA as Event.is_consecutive.

- Consecutive events are broken by button/key presses and mouse motion.

- Add `WM_event_consecutive_data_*` functions, so operators can store
  data between consecutive events.

- Add `ED_view3d_autodist_last_*` functions to access the last autodist
  pivot point for view operators to use.
2023-03-17 14:48:50 +11:00
f78f05c749 Refactor: U.dpi_fac -> U.scale_factor
A renaming of UI scale factors from names that imply a relationship to
monitor DPI to names that imply that they simply change "scale"

Pull Request: blender/blender#105750
2023-03-17 04:19:05 +01:00
e4eb9e04e0 Fix #105823: Crash While deleting retiming handles
Handle index operator property was exposed to user, which was
unintended. The property is validated only in invoke function.
2023-03-17 03:26:37 +01:00
025beb2cda Merge branch 'blender-v3.5-release' into main 2023-03-16 17:52:08 -06:00
e63f84de29 make.bat: adjust for recent submodule changes
the path for clang_format_paths.py changed when the submodules
moved but format.cmd was never updated for that.

the work previously done by check_submodules.cmd is now done by
make_update.py so this file can be removed.
2023-03-16 17:51:12 -06:00
aa2d8647c1 Merge branch 'blender-v3.5-release' 2023-03-16 23:19:59 +01:00
20a8bc1204 Fix #105455: GPU subdivision with textures corrupts display after undo
This is an issue revealed by the recent optimization in 4d3bfb3f41 to have
CPU and GPU subdivision topology both cached.

BKE_subsurf_modifier_subdiv_descriptor_ensure is what (re)creates the
topology refiner when needed. Invalidating the topology refiner on changes
must be done before it, otherwise we end up with an incomplete Subdiv that
either does not draw or draws incorrectly.

Pull Request: blender/blender#105844
2023-03-16 23:18:55 +01:00
9a8bfe8dd3 Cleanup: Make format
Simply adds a single blank line.
2023-03-16 14:23:40 -07:00
339e9deb72 Merge branch 'blender-v3.5-release' 2023-03-16 21:45:16 +01:00
f46fb8051d Fix #105778: Prevent invalid links with link swap
Remove swapped links when they link sockets that belong to
the same node.

Pull Request: blender/blender#105809
2023-03-16 21:39:32 +01:00
f234d2d440 Subdivision: remove info message that GPU subdivision being used
This is the normal case, it's only when both CPU and GPU subdivision is used
that the user needs to be informed that performance is suboptimal.
2023-03-16 19:48:55 +01:00
34f3893831 BLI: support recursive usage of Vector
This makes it possible to use `Vector` recursively if the inline buffer
has 0 size. Any other inline buffer size does not work, because then
the type would be embedded in itself which does not make sense.

Pull Request: blender/blender#105832
2023-03-16 17:52:03 +01:00
ee213f3c4d Merge branch 'blender-v3.5-release' 2023-03-16 15:58:34 +01:00
a958ae36e8 Fix #104305: Crash in node editor with large asset libraries
Various UI code would store the `AssetHandle` in a way that turns out to
be unsafe. The file-data is part of the file browser caching system that
releases file-data when a certain maximum of items is in the cache. So
even while just iterating over the assets, earlier iterated asset
handles may become invalid. Now asset handles are really treated as
volatile, short lived objects.

For the asset-view, the fix was more involved. There we need an RNA
collection of asset-handles, because the UI list code requires that. So
we create a dummy collection and get the asset handles as needed by
index. This again meant that I had to keep the index of the collection
and the asset-list in sync, so all filtering had to be moved to the UI
list.
I tried duplicating the file-data out of the cache instead, but that
caused problems with managing the memory/ownership of the preview
images.

`AssetHandle` should be removed and replaced by `AssetRepresentation`,
but this would be an even more disruptive change (breaking API
compatibility too).

Fixes #104305, #105535.

Pull Request: #105773
2023-03-16 15:40:31 +01:00
cb20f2cbf9 Fix build error after previous merge
Function was moved and renamed in 48814c25fd.
2023-03-16 15:27:27 +01:00
7317da80fe Merge branch 'blender-v3.5-release' (won't build, see followup) 2023-03-16 15:26:23 +01:00
55811b2919 Assets: Add function to query data-block library path from asset
No user visible change.

This is needed for #105773, but will cause conflicts in the main branch,
so committing it separately.
2023-03-16 15:25:00 +01:00
d1b8a827a6 Refactor: Avoid unsafe strcpy in library path utility function
Make sure the expected max-length for the string is respected.

Suggested by Bastien in #105825.
2023-03-16 15:07:27 +01:00
b80f6c4017 Cleanup: Improve comment on library path utility function
Suggested by Bastien in #105825.
2023-03-16 15:07:27 +01:00
48814c25fd Cleanup: Move blend file path utilities out of blenloader module
These are not really about reading or writing .blend files, they are
general utilities for file-names/paths. Having to link to the
blendloader library just for these utilities is annoying.
Moved them to `BKE_blendfile.h` now, in agreement with Bastien.

Pull Request: #105825
2023-03-16 15:07:27 +01:00
4fba59c55d Fix #105803: Cycles slow light tree build when previewing shader nodes
When linking a texture directly to the material output, it's likely being
done for the purpose of previewing. In that case, bias the heuristic towards
not building a light tree, as it's likely not needed and slow on dense meshes.
2023-03-16 14:58:47 +01:00
8bb411ad1a EEVEE Next: IrradianceCache surfels debug display
Add a surfels debug pass to aid with the GI implementation development.

Pull Request: blender/blender#105802
2023-03-16 14:14:33 +01:00
bb0ee9fdb4 Fix tiny file browser highlight offset on retina screens
While this was just a single pixel off, it was a bit notable since the
highlight wasn't centered correctly. Now retina and non-retina screens match
visually.
2023-03-16 12:48:56 +01:00
5e0cc9d277 Cleanup: Silence Unused parameter warnings.
- blender::gpu::GLContext
- blender::gpu::VKContext
2023-03-16 09:44:09 +01:00
a25cc51db9 Cleanup: Spelling in previous commit. 2023-03-16 08:55:45 +01:00
3d9d67594c GPU: Add GPU frame capture support.
Adds two modes of GPU frame capture support for
enhanced debugging. GPU frame capture begin/end
allow instantaneous frame capture of all GPU commands
within the capture boundary.

GPU frame capture scopes allow several user-defined capture
regions which can wrap key parts of code. These scopes are
exposed to connected GPU tools allowing the user to manually
trigger a capture of a known scope at the desired time.

This is currently integrated with the Metal backend for
support with Xcode.

Related to #105591

Pull Request: blender/blender#105717
2023-03-16 08:54:05 +01:00
397f6250a5 Merge branch 'blender-v3.5-release' 2023-03-16 08:28:21 +01:00
7bdd82eca0 Metal: Resolve Race Condition in Memory Manager
Fix race condition if several competing threads are inserting Metal
buffers into the MTLSafeFreeList simultaneously while a new list
chunk is being created.

Also raise the limit for an MTLSafeFreeListChunk size to optimize
for interactivity when releasing lots of memory simultaneously.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105254
2023-03-16 08:25:15 +01:00
d3409f2159 Fix: Uncached Metal Materials not Being Released
Optimized node graphs do not get cached and were
not correctly freed once their reference count reached
zero, due to being excluded from the GPUPass garbage
collection.

Also suppress Metal shader warnings, which are prevalent
during material optimization.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105795
2023-03-16 08:19:32 +01:00
94855119da Fix: Metal validation error when shader has no uniforms
Metal buffer binding validation would trigger an error
when a given shader had an empty PushConstantBlock.
This patch removes the default uniform code gen if
no uniforms are present, to avoid any possible issues
with buffers being bound to a shader where the destination
data block is size zero.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105796
2023-03-16 08:10:38 +01:00
ac6a70e5f8 Fix #104012: Selection crash with AMD on Metal
Crash when selecting objects on AMD platforms running
Metal. This was caused by shader compilation warnings
being treated as errors in macOS 10.15. Wrapping
compilation failure with success check resolves error.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105739
2023-03-16 08:03:15 +01:00
b96f8ac9fe Fix #105606: Metal texture upload regression
immDrawPixels performs significantly slower in Metal
than OpenGL. This was caused by two main factors. Firstly,
the additional overhead of tiled texture update, where all
memory needed to be kept in flight for each update, but
caused update to take a slow path. Avoiding tile update
with Metal is more efficient for both memory pressure
and GPU pipelining.

Secondly, on AMD platforms, the staging buffer used
for temporary texture data was page-faulting when
several texture updates would occur within one frame.
This is due to limitations of allocating one large contiguous
memory chunk. Using the Metal buffer pool for staging
data is more efficient.

Authored by Apple: Michael Parkin-White

Pull Request: blender/blender#105794
2023-03-16 07:59:22 +01:00
ebad816057 Merge branch 'blender-v3.5-release' 2023-03-16 17:20:28 +11:00
d3e37d3ed2 Fix #105224: Node editor NDOF pan changes RGB colors
Disable NDOF changing colors for 2D views since it conflicts with
panning.
2023-03-16 17:17:33 +11:00
b6caf5980e Merge branch 'blender-v3.5-release' 2023-03-16 04:47:15 +01:00
1ad3fa09c9 Fix #90389: No labels in scrubbing area with small FPS
Maximum distance of lines in screen space is limited. This limit seems
reasonable for FPS higher than 1, but UI allows to set 0.01 FPS with
soft. even lower values are possible.

This patch allows for normal operation within soft limits and labels are
still visible and quite usable within hard limits.

Pull Request: blender/blender#104849
2023-03-16 04:42:27 +01:00
bad85fe8c7 Cleanup: Avoid keeping mesh normals references after dirty tag
Without assumptions of a mesh's direct ownership of its normals,
this was error prone, since normals could potentially be reallocated
when they are tagged dirty or retrieved with write access.
2023-03-15 21:39:50 -04:00
896360de1f Cleanup: remove GCC warning pragma
I'm no longer able to generate a warning with GCC 12.2.1.
2023-03-16 11:46:56 +11:00
42380ea996 Cleanup: use static declaration, quiet undeclared warning 2023-03-16 11:24:14 +11:00
64304b4e27 Fix invalid enum passed to BKE_id_attribute_search 2023-03-16 11:24:11 +11:00
f2a05c3e4e Cleanup: Remove unused pbvh function declarations 2023-03-15 20:13:34 -04:00
0fe006eec5 Merge branch 'blender-v3.5-release' 2023-03-15 16:12:47 -07:00
d7a68a9de8 Fix: Correct several messages in the UI
- Show/hide mask layers: the tooltip was confusing from a user's
  perspective, because they should not be expected to know what a hide
  flag is.
- Active Spline -> Active Point: likely a copy and paste error.
- Geo Nodes face is planar node: forgotten article.
- Axes, plural instead of axis for the viewport preferences. Here
  there are several usages of axis or axes. Since they refer to
  coordinate axes I believe they should be plural, even though the
  property `mini_axis_type` is still wrong.

-----
![image](/attachments/7ccdc72d-1e83-4c22-b8e9-c3b7c5fcf629)
![image](/attachments/746015bc-23e1-49bc-8828-df07d7605048)
![image](/attachments/61c58766-a8f5-4a90-b862-c9b57c44c355)

Pull Request: blender/blender#105814
2023-03-16 00:12:29 +01:00
09cff506c1 Fix #89630: Hide backfaces when using using the "Alpha Blend" blend method
For proper display, backfaces should be hidden when using the "Alpha Blend" blend method:
https://docs.blender.org/manual/en/dev/render/eevee/materials/settings.html#blend-mode

See the mentioned bug for various examples.

Pull Request: blender/blender#105585
2023-03-16 00:10:26 +01:00
7ee0bf671e Cycles: use 8-bit type for number of ray hits when possible
INTEGRATOR_SHADOW_ISECT_SIZE is lower than 256 for GPUs, this allows
using only a 8-bit type for storing intersection counts there.
2023-03-15 22:01:48 +01:00
f9922b7074 Cycles: Use ray->tfar in Embree filter functions
This allows to tell embree to stop intersecting beyond the distance
when max number of hits is reached.
2023-03-15 22:01:48 +01:00
1a580dbfdd Cycles: Use IntegratorShadowState directly in Embree filter functions 2023-03-15 22:01:48 +01:00
b97a6daa9a Cycles: Use geometryUserPtr from Embree filter functions arguments
This saves calls to rtcGetGeometryUserData.
2023-03-15 22:01:47 +01:00
59a083e948 Cleanup: format 2023-03-16 09:34:38 +13:00
c38fe87127 UV: Improve UV Packing efficiency with non-square aspect ratio
Improve pre-conditioning of UV Islands before passing them to the UV Packing API.

Pull Request: blender/blender#105784
2023-03-15 21:29:31 +01:00
f6c70755d1 Measure Tool: reduce snap overhead
No functional changes.

This is just a micro-optimization to avoid updating `prev_point` and
calling `ED_gizmotypes_snap_3d_data_get` when snapping is not enabled.
2023-03-15 17:14:57 -03:00
b79ad1f93f Merge branch 'blender-v3.5-release' into main 2023-03-15 17:14:42 -03:00
4cd102bb73 Fix #105664: measure tool ignoring snap on first click
The bug only happened in wireframe mode.

Originally the `const bool use_depth` indicated when projection should
be done on invoke.

Later it started to indicate when to snap on invoke.

But with keymap snap detection, using this `use_depth` is no longer
correct.
2023-03-15 17:14:23 -03:00
b21537d215 Cleanup: Wrap C++ normal accessors with C functions
Implement the two cached normal accessors with C++ methods
directly. This avoids dealing with raw pointers and reduces the
amount of casting necessary.
2023-03-15 15:57:27 -04:00
4aa2a3522e Cleanup: Store cached mesh normals with Vector
Avoids manually allocating and freeing the data in some cases,
clarifies ownership, and gives extra safety with the sizes.
2023-03-15 15:57:27 -04:00
17a53d6647 Cleanup: Tweak mesh normal accessors documentation
Just reference the C++ functions in the C API, and make the wording
a bit more concise.
2023-03-15 15:57:27 -04:00
f9132e2bbf Cleanup: Remove redundant mesh normals dirty tag function
Since normals are derived data, it's always a change to something
else that will cause them to change, like the winding order of a face
or vertex positions. So it's clearer to use tags for those things
directly. It's correct to remove the tag in one place since dirty is
the default state of a new mesh.
2023-03-15 15:57:27 -04:00
2daf6c69be Merge branch 'blender-v3.5-release' 2023-03-15 14:05:29 -04:00
d7ac2a177a Cleanup: Use spans and C++ type to access mesh normals
Also rename some variables to use names consistent with elsewhere.
2023-03-15 14:03:05 -04:00
d9c2fb9ae2 Cleanup: Remove mesh validation of cached normals
This validation dates back to when vertex normals were stored in
the `MVert` type (before cfa53e0fbe). Since normals
are all calculated in the same place, and aren't saved in files, this
isn't relevant anymore-- they can just be recalculated.
2023-03-15 14:03:05 -04:00
e7295efb4b Fix #105791: Alembic procedural ignores materials
When creating the bounding box mesh for the viewport replacement,
copy the material from the original mesh. I'm not sure if Cycles is
meant to load materials from the original mesh or the Alembic file
itself, but either way, this should be a harmless change and fixes the
issue in the report.

Pull Request: blender/blender#105798
2023-03-15 19:01:53 +01:00
1fc892744c GPU: Fix: Use 2 slots for each UDIMs texture instead of 4
Create GPUNodeLinks for tiled_image and tiled_image_mapping together, to ensure they are the same texture.

See blender/blender#105661 (comment) for context and a more in-depth explanation.

Pull Request: blender/blender#105772
2023-03-15 17:58:25 +01:00
f518591abc Merge branch 'blender-v3.5-release' 2023-03-15 17:42:00 +01:00
72d64c35aa Cleanup: Basic C++ style for file_draw.cc
See #103343.
2023-03-15 17:40:00 +01:00
b9af4f6748 Cleanup: Remove unused headers in file_draw.cc 2023-03-15 17:40:00 +01:00
1bbb8b679f Cleanup: Move file_draw.c to C++
See #103343.
2023-03-15 17:40:00 +01:00
f6f2f4f264 Fix #105681: Sculpt trim generates smooth shaded faces
Caused by 5876573e14. We need to use the old default here
explicitly.
2023-03-15 12:32:45 -04:00
fee6238d33 Fix #105323: Compositor: Crash when using color-ramp with b-spline
... or carnidal interpolation with only 2 color stops.

This was triggering an incorrect path due to missing optimisation cases.
Just fall back to the unoptimized case fixes the assert.
2023-03-15 17:30:29 +01:00
ed4e0b559a Merge branch 'blender-v3.5-release' 2023-03-15 12:14:13 -04:00
1b34c466bc Fix #105711: Regression: Clone Tool in Image Editor not showing Stencil
This was likely caused by a bad merge when doing the uniform name
patching for Metal.
This also fix the same issue for active UDIM tile overlay which wasn't
reported.
2023-03-15 17:14:08 +01:00
c6878d5e82 Fix #103021: Metaballs have jagged normals
eaa87101cd made evaluated metaballs become meshes
for render engines. This exposed the normals calculated by the metaball
tessellation directly, whereas before they were recalculated later.

There are two fixes: not using the metaball tessellation normals at
all and calculating them with the standard Mesh code path instead,
or switching a define in the metaball code to use a more mesh-like
vertex normal accumulation. Since the results are very similar
(see attached renders), use the second solution, which should
be less expensive.

Pull Request: blender/blender#105799
2023-03-15 12:13:08 -04:00
19ca2e905e UI: Increase the size of the "Open Recent" list
Increase the default value for the maximum number of recently-opened
files from 10 to 20. Also change the user's preference on version bump
to this new value if their current value is exactly the old default.

Pull Request: blender/blender#105703
2023-03-15 17:09:36 +01:00
4f18022f80 Fix #105775: Make "Add > Fur" node setup stable with deformation
Move the deform curves with surface node group to last so it affects the
final generated curves consistently (though this will have a negative
performance impact), and make the generate and interpolate modifiers use
the surface mesh's rest positions.
2023-03-15 12:09:13 -04:00
c0e757a713 UI: Add scroll to sidebar tabs
When the height of the editor couldn't fit the sidebar tabs, they would shrink
to a size too small to read the tab label.

This change matches the behaviour with the Properties Editor navigation bar,
by introducing the following improvements:
* Avoid truncating tab labels.
* Allow scrolling when tabs don't fit.

Behaviour is similar to how scrolling works in the Properties Editor navigation
bar, supporting mouse wheel up/down and MMB, and switching tabs with
`Ctrl+Wheel Up/Down`.

Pull Request: blender/blender#105355
2023-03-15 16:45:11 +01:00
81818b797b Merge branch 'blender-v3.5-release' 2023-03-15 11:18:02 -04:00
6a96a151be Fix: Dyntopo attribute data warning doesn't work
My PR blender/blender#104535
was committed as 88f9c55f7f and the logic was changed
while adding support for face sets, making the logic incorrect and
the warning system disfunctional.

Restore the logic from the original PR with added support for face sets,
fix const correctness issues, improve variable naming, and remove a
check for empty names, since all attribute-type layers should have
names in a valid mesh.

Fixes #105780
2023-03-15 11:14:50 -04:00
c3dfe1e204 File Browser: Make full file name label draggable
Previously only the icon of a file could be dragged in the list display
modes, the name label would invoke box select. This made dragging quite
finicky. I've seen this cause quite some frustration, especially when
the file browser is used as a regular editor to drag data from into
other editors.

Instead follow the Outliner (and some other file browsers like the macOS
one): Dragging on empty space invokes box select, dragging on the name
or icon invokes drag & drop of the item.

The hitbox for the dragging is the width of the string, and the full row
height. So there's no space between rows to do box-select from, it
always triggers dragging. This is based on feedback during testing.

Note that 1e9564864c and 6da512f0bc were needed to prepare this change.

Pull Request: #104830
2023-03-15 16:03:00 +01:00
9332f27702 Fix #104124: Grease Pencil fills cover the lines below when drawing
The switch from `stroke_start` to `vertex_start` in 8c6d4aa103 forgot
to also update `iter->stroke_index_last` which also needs to use
`vertex_start`.

Pull Request: blender/blender#105797
2023-03-15 15:59:23 +01:00
2b78441c09 Merge branch 'blender-v3.5-release' 2023-03-15 13:59:10 +01:00
ffb120c560 Fix #105661: (Regression) Materials can use fewer images than before
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).

Pull Request: blender/blender#105770
2023-03-15 13:58:28 +01:00
c31ba08f76 Fix #105661: (Regression) Materials can use fewer images than before
Skip explicit binding location for samplers in OpenGL when not needed, since drivers can usually handle more sampler declarations this way (as long as they're not actually used by the shader).

Pull Request: blender/blender#105770
2023-03-15 13:37:19 +01:00
30e517c3ca Merge branch 'blender-v3.5-release' 2023-03-15 13:07:26 +01:00
c4d6f766de Fix #105180: "All" asset library includes subfolders of current file
The loading for the "All" asset library would include the "Current File"
library as if it were a regular asset libray on disk. Instead make sure
the latter is loaded properly first and is skipped when recursively
reading on disk libraries.
2023-03-15 13:06:39 +01:00
254e3e133f Cleanup: format 2023-03-15 18:24:34 +13:00
559898709f Fix issues with retiming API
Ensure retiming data when operator is used, fix math for setting
retiming handle timeline frame.
2023-03-15 03:19:30 +01:00
089e8a1887 Cycles: Fix Metal API validation error (use uint instead of ushort)
This PR fixes an error that is given when Metal API validation is enabled. The compute grid can exceed 65536 threads so `ushort` is not sufficient for `metal_grid_id [[threadgroup_position_in_grid]]`.

This PR also fixes OS version warnings ([Cycles Metal: Unguarded access to newer macOS features #105630](blender/blender#105630))

Pull Request: blender/blender#105763
2023-03-14 22:05:55 +01:00
99506b3d73 Fix: Crash in weighted normal modifier
Mistake in 1dc57a89e9
2023-03-14 15:00:33 -04:00
7b66168bcb Merge branch 'blender-v3.5-release' into main 2023-03-14 18:19:53 +01:00
a7cd6de244 Fix Cycles missing light from multiple distant lights with different visibility 2023-03-14 18:19:12 +01:00
ee18b625ca Fix: Edit mesh face corner color operators always use first layer
The operator went through quite a bit of trouble to pass a color
attribute index to the operator, but then it always used the offset
from the first layer of the active color attribute's type.

Also remove the "copy domains temp" API function, which
generalized this more than necessary, and exposed the internals
of the custom data system a bit more than we would like.
2023-03-14 12:03:46 -04:00
3785dc8043 Fix #105146: Gpencil select does not work with Layer transforms
The transformations were applied two times and the old fix was wrong because it needs to use the evaluated point, not the original one. Also I did a small code cleanup.

Pull Request: blender/blender#105202
2023-03-14 16:57:46 +01:00
13ae75f545 Cleanup: Use C++ array type in skin modifier
This quiets a false positive (I think) allocation size warning for me.
2023-03-14 11:33:32 -04:00
90076b543b Cleanup: Remove two redundant color attribute functions
The two removed BKE functions were at a mid-level of abstraction
that doesn't make total sense in this API. Removing them is also
helpful in the general effort to have the attribute system rely less
on `CustomData` internally.
2023-03-14 11:33:32 -04:00
6d1cd997a2 Fix #105726: Driver Editing Popover Menu Closing
Allow specifying a specific region to check for active button. This is
required in some circumstances, like Driver Popover.

Pull Request: blender/blender#105746
2023-03-14 16:27:23 +01:00
92b607d686 CustomData: add separate function to add layer from existing data
This simplifies the usage of the API and is preparation for #104478.

The `CustomData_add_layer` and `CustomData_add_layer_named` now have corresponding
`*_with_data` functions that should be used when creating the layer from existing data.

Pull Request: blender/blender#105708
2023-03-14 15:30:26 +01:00
b06d522427 Fix potentially-uninitialised local variable
Very unlikely this caused any actual issue, but in theory it was possible.
2023-03-14 14:36:05 +01:00
258678916f Geometry Nodes: use lazy-function directly for switch node
This changes the Switch node so that it is implemented directly as a lazy-function,
instead of as a normal geometry node which uses `GeoNodeExecParams`. This improves
the design of the layered execution api, where different nodes can be implemented
at a proper different abstraction level. The simplest kinds of nodes are implemented
as multi-function, then there is `GeoNodeExecParams` and more specialized nodes are
implemented as lazy-function. The switch node is special in the sense that it currently
needs extra behavior in the lazy-function graph generation anyway.

`GeoNodeExecParams` can be simplified as well, because the Switch node was the only
one that used the `lazy_` methods.

We could consider adding back lazy-input functionality to normal geometry nodes
as it becomes necessary. Ideally, that could be integrated with the node declaration.

Pull Request: blender/blender#105696
2023-03-14 14:09:29 +01:00
96c6349cbf Fix #103605: Metal barycentric coordinate compilation failure
Fix support for Wireframe and parametric nodes by resolving
compilation failures surrounding barycentric coordinates.
A final missing part of the Metal implementation for barycentric
coordinates was missing.

Feedback also addressed to move barycentric calculation out
of code-gen and into surface_lib.

Authored by Apple: Michael Parkin-White

This also resolves #103606.
Ref #96261

Pull Request: blender/blender#105740
2023-03-14 08:23:02 +01:00
ce34024681 Merge branch 'blender-v3.5-release' 2023-03-14 16:09:44 +11:00
4ff3cd2476 Fix error building on Linux 2023-03-14 16:09:08 +11:00
51e5417bd3 Fix #105678: Crash assigning Image.pixels to an undersized sequence
Now only dynamic function parameters that use ParameterDynAlloc support
dynamically sized parameters arrays.

Add tests for both dynamic arrays that don't support resizing
(Image.pixels) and dynamic sized arguments using
(VertexGroup.add(index=[..])).

Regression in [0] which extended support for dynamic sized function
arguments.

[0]: dfb8c5974e
2023-03-14 16:00:24 +11:00
8929ed75d4 Image: Add OIIO support APIs
This adds a new set of APIs supporting the loading and saving of image
formats through OIIO. It makes use of the recent IOProxy work in OIIO
to align with the existing Blender image loading/saving machinery.

The support code here has been prototyped to work with ~7 of our image
formats so far. It includes centralized handling of `IB_test`,
`IB_mem`, and `IB_metadata` flags, which the existing code did not
handle consistently or at all depending on the format.

The PSD format (`format_psd.cc`) is included since the prior location
of the code has been restructured away. It serves as an example of how
the loading code typically flows for all the other formats.

Pull Request: blender/blender#105519
2023-03-14 04:42:17 +01:00
19565469c8 Merge branch 'blender-v3.5-release' 2023-03-14 13:41:43 +11:00
1c88bf6ce1 Fix #105715: Freeing the edit-mesh causes future access to fail
The BPyBMesh in `BMesh::py_handle` was invalidated but not cleared,
causing future access to return a 'dead' bmesh.
2023-03-14 13:36:54 +11:00
84b66c5a9c Cleanup: format, add missing CMake header 2023-03-14 12:53:37 +11:00
bc6985a6c1 Cleanup: doxygen comments 2023-03-14 12:51:37 +11:00
2a1a9307a7 Cleanup: spelling in comments 2023-03-14 12:36:49 +11:00
548d599dda Merge branch 'blender-v3.5-release' 2023-03-14 12:20:17 +11:00
708e84df90 Fix #105721: Fix crash accessing driver variables & targets
- DriverVariable.name update function passed DriverVar to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverTarget.name update function passed DriverTarget to
  BKE_driver_invalidate_expression as a ChannelDriver.

- DriverVariable.type update function DriverVar accessed ChannelDriver,
  clearing a flag.

This was exposed by [0] however this issue existed beforehand.

[0]: c26566ad27
2023-03-14 12:16:22 +11:00
46da66f4df Fix: Uninitialized boolean arrays in mesh conversion
In practice this probably didn't cause bugs, but it would have
caused extra copies of the UV helper layers. The layers are only
needed if we find true values. Mistake in 0fe0db63d7.
2023-03-13 17:32:20 -04:00
1dba915dff Merge branch 'blender-v3.5-release' into main 2023-03-13 15:35:42 -03:00
98bfa8d458 Fix 'use_occlusion_test' option not having effect on wireframe
This is a non-recent regression that strangely went unreported.

It is expected that when snapping, only visible elements are considered
which does not include faces in wireframe mode.

This works like this before, and this change doesn't appear to have
been intentional.

Ref #105664
2023-03-13 15:34:39 -03:00
f92bacee94 Cleanup: use macro for 'SCE_SNAP_MODE_GEOM'
One of the advantages of separating this enum member from the others is
because mixing several members in a single one hinders debugging since
in this case the IDE does not define which enums were set.

Also separating this item makes it more readable as `SCE_SNAP_MODE_GEOM`
is not a snap mode but a combination of modes.
2023-03-13 15:34:26 -03:00
cf2c9fe186 Vulkan: Add initial VkPixelBuffer.
VKPixelBuffer is used by external render engines to allocate buffers
using the same GPU backend that Blender runs in.

In a later stage we should test what exact binding flags are needed. I
expect that it should be able to use as a transfer buffer to copy the
pixels over to a texture using transfer commands.

Pull Request: blender/blender#105741
2023-03-13 19:25:18 +01:00
2788fa915b Refactor: CurvesGeometry read/write function
This add the`CurvesGeometry::blend_read` and `CurvesGeometry::blend_write` methods
and uses them in the `curves_blend_read_data` and `curves_blend_write` functions.

No functional changes.

Pull Request: blender/blender#105737
2023-03-13 18:42:51 +01:00
ca2bf2f3a0 Fix #105625: GPencil sculpt crash with subdivide modifier
The created point hasn't a original point in the original stroke, so
must use only the valid points.

Pull Request: blender/blender#105627
2023-03-13 18:04:25 +01:00
69c6158cc8 Fix #105589: GPencil Paste duplicate active frame
The active frame is pasted always, so if multiframe is
copying the strokes don't need copy the active frame again.

Pull Request: blender/blender#105605
2023-03-13 18:02:36 +01:00
08fd5747d2 Python API: implement ViewLayer.aovs.remove
Implement ViewLayer.aovs.remove by adding a new RNA function to call
the internal BKE_view_layer_remove_aov.

Resolves #99259

Pull Request: blender/blender#105646
2023-03-13 17:29:19 +01:00
d3cfb2e20e Fix: Failing assert for meshes with no faces
It's okay if the normals span is empty when there are no faces
2023-03-13 11:40:22 -04:00
0b68e609fc Fix 105271: Luminance Matte not Working on NVIDIA.
Issue was that the clamping parameters were not in
the correct order. This leads to undefined behavior
and also lead to small artifacts on other platforms.

Pull Request: blender/blender#105735
2023-03-13 16:07:17 +01:00
097492b326 Merge remote-tracking branch 'origin/blender-v3.5-release' 2023-03-13 15:24:19 +01:00
6e4bcb7c87 Fix #100659: "Add F-Curve Modifier" applies only to Active F-Curve
In most places where it appears in a menu, the operator would already
apply to all selected F-Curves. Now it is done consistently and explicitly
from all menu items. The default of the operator is now also set to 'all
selected', so that it also behaves like that when called from the operator
search menu.
2023-03-13 15:23:57 +01:00
2ae9526cd9 Cleanup: Small changes in Mesh BMesh conversion
Tweak variable naming, remove a few unnecessary comments,
remove a timer accidentally committed previously.
2023-03-13 09:20:15 -04:00
0fe0db63d7 Mesh: Optimize BMesh to Mesh conversion with UV maps
The BMesh to Mesh conversion does some checks to the UV helper
attributes like selection to avoid copying them to the mesh if they
don't contain any meaningful data. However, it does this by looping
over all faces for every UV map, not in parallel, so it takes up a large
portion of the total time in the conversion. This commit moves that
to the existing similar checks.

On a 1 million face mesh with 3 UV maps, for me this improved the
conversion runtime by 75%, from 174ms to 99ms. Before the serial
loops took 88ms out of the total. Combining them with the existing
loop over faces only increased its runtime from 29 to 40ms.
2023-03-13 09:07:52 -04:00
ea50dbe615 Merge remote-tracking branch 'upstream/blender-v3.5-release' 2023-03-13 13:00:48 +01:00
84bcc1abfe Updated translations from svn trunk (r6385). 2023-03-13 12:59:46 +01:00
2bd88340bd Fix compiler warning 2023-03-13 11:57:03 +01:00
c6d6a3517e I18n: extract add-on bl_info warnings
Some add-ons choose to use the `warning` field in the `bl_info`
dictionary. This is potentially useful info, which should be shown to
the user translated.

This commit extends `dump_addon_bl_info()` from the i18n utils add-on,
to add this field to the message extraction.
2023-03-13 11:19:42 +01:00
4238080568 Cleanup: Remove gpu prefix in gpu test cases.
The _gpu_ prefix is redundant as they are inside a namespace
and run as part of a test suite that already contain the name
gpu. (GPUOpenGLTest)

This patch also moved the texture test cases to its own
compile module.
2023-03-13 11:14:17 +01:00
93bb443086 Fix: failing test in debug build due to wrong span size 2023-03-13 10:55:48 +01:00
df0c2693b6 Refactor: Rename grease pencil files to legacy
This renames the `BKE_gpencil_*` as well as the `DNA_gpencil_types.h`
files to indicate that it's the legacy grease pencil.

Pull Request: blender/blender#105597
2023-03-13 10:42:51 +01:00
6567ff558c Fix: Failing test case due to resource lifetime.
When a shader is bound it should outlife the pipeline. In one
test case where only the shader data was accessed it also bound
the shader. This isn't needed as the shader data should be
retrieved without binding the shader.

This change fixes the issue by not binding the GPU shader.
2023-03-13 09:54:57 +01:00
a26203bb3e Fix: Incorrect version code.
Patch version was increased, but the file subversion should have
been increased.

Also fixes previous incorrect patch versioning code as it didn't
add all 'version code until next subversion bump goes here.' after
version bump.
2023-03-13 08:38:04 +01:00
cbc73a1e05 Cleanup: Make mesh function static 2023-03-12 17:35:50 -04:00
03fffc08b6 Cleanup: Fix unused variable warning in release builds 2023-03-12 17:34:01 -04:00
050e08e5f0 Cleanup: Remove unused UI handlers function
Unused after c402b3f52f
2023-03-12 17:33:23 -04:00
68ec41d00e Cleanup: Remove unused mesh function
The function set bits in a bitmap for all the edge indices in a face.
With future changes to mesh topology storage though, this level
of abstraction won't be as helpful anyway.
2023-03-12 17:32:26 -04:00
1dc57a89e9 Mesh: Move functions to C++ header
Refactoring mesh code, it has become clear that local cleanups and
simplifications are limited by the need to keep a C public API for
mesh functions. This change makes code more obvious and makes further
refactoring much easier.

- Add a new `BKE_mesh.hh` header for a C++ only mesh API
- Introduce a new `blender::bke::mesh` namespace, documented here:
  https://wiki.blender.org/wiki/Source/Objects/Mesh#Namespaces
- Move some functions to the new namespace, cleaning up their arguments
- Move code to `Array` and `float3` where necessary to use the new API
- Define existing inline mesh data access functions to the new header
- Keep some C API functions where necessary because of RNA
- Move all C++ files to use the new header, which includes the old one

In the future it may make sense to split up `BKE_mesh.hh` more, but for
now keeping the same name as the existing header keeps things simple.

Pull Request: blender/blender#105416
2023-03-12 22:29:15 +01:00
5669c5a61b Mesh: Parallelize BMesh to Mesh conversion
This is very similar to ebe8f8ce71, but applies the same
changes to conversions to non-evaluated meshes meant for original
data. The function also handles shape keys, UVs, selection history,
"scan the database" object vertex index remapping, and multires fixes.
Those operations are handled in parallel with the other conversions now.

Similar to before, the improvement is better the more attributes/data
contained in the BMesh. This time I observed an improvement of 50%
(182ms to 123ms) for a large grid mesh with many attributes, and 20%
for a large grid mesh with less data. Shape keys, selection, hiding, and
multires data should have less of a detriment to performance now too.

One remaining thing to improve is the recently added UV selection/pin
handling. This should be moved into the first single-threaded loop over
faces, or changed further.

Pull Request: blender/blender#105602
2023-03-12 21:50:14 +01:00
4096bcfb25 I18n: extract math node operation type header messages, fix another
- The Math node lost the headers of its operation type menu in
  ee985fa925 , because a translation context was assigned to the RNA
  property, but the headers declaration was not updated to extract the
  messages with matching contexts.
- The message "Group Input" had a trailing space, which can be added
  after translation.
2023-03-12 16:01:56 +01:00
e2030fbc33 Fix: Add missing default versioning for retopology overlay color
This is something we missed in #104599.
Without it, the default color isn't always set.
Thanks to user roman-13 for pointing out the problem,
and thanks to Hans Goudey for telling me the solution.

Pull Request: blender/blender#105539
2023-03-12 09:33:52 +01:00
adfffb7d32 Fix: normalize matrix before converting to euler
Without this, Blender aborts due to an assert.
2023-03-12 05:55:06 +01:00
54c9f972df Merge branch 'blender-v3.5-release' 2023-03-11 08:33:50 +01:00
7d22b11352 Fix #105601: Remove duplicates when inserting links into multi inputs
Fix a regression that allowed to create several links between an
output socket and a multi input socket either by inserting
links or using the link swap feature.

This regression was caused by the link swapping feature
introduced in commit 89aae4ac82.

Pull Request: blender/blender#105631
2023-03-11 08:27:56 +01:00
b06edc2897 Cleanup: UV: simplify uv packing API.
Rename `struct ::UVPackIsland_Params` to
`class blender::geometry::UVPackIsland_Params`

Brings us closer to an "algorithm" style API.

No functional changes.
2023-03-11 14:59:58 +13:00
e56fe42aab Cleanup: format 2023-03-11 14:25:46 +13:00
eaa5a439b5 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:33 +11:00
622c911534 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:31 +11:00
e7b21403d2 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:28 +11:00
65d8f9e140 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:26 +11:00
0ea8e59151 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:24 +11:00
12e8664f96 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:22 +11:00
3c8b749a38 Merge branch 'blender-v3.5-release' 2023-03-11 12:01:19 +11:00
fe58ccfafb Mesh: compact edit-mesh undo data in parallel (address #105046)
Multiple user actions performed quickly could be blocked by undo
compacting memory - if the background compacting task was not complete
when the next undo step was pushed.

Notes:

- This and recent improvements to BLI_array_Store gives over ~2x speedup
  compared with 3.3x, over 10x compared with 3.4x.
  A sub-surfaced cube with the modifier applied was used for testing
  (~1.5 million polys), both randomized & non-randomized verts/edge/faces
  were used to avoid the sub-surface memory layout biasing the results.
  Tested transforming ~1/3rd of the mesh and inverting selection.

- Without compacting mesh-data in parallel, the optimizations to
  BLI_array_store can give similar performance to 3.3x, however there
  are still cases where performance isn't quite as good - so compact the
  arrays in parallel to ensure performance is at least as good as 3.3x.

Resolves #105046.
2023-03-11 11:58:09 +11:00
16968ccec7 BLI_array_store: improve hash accumulation for each memory chunk
The method of accumulating values to create a hash for each chunk has
been improved for ~16% better distribution of the resulting hashes.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:58:08 +11:00
7a5cb3b470 BLI_array_store: improve hash for smaller values (including booleans)
Accumulating hashes with a byte/boolean array didn't include enough
information for a useful hash, creating hashes with many collisions.

This is the root cause of a performance regression since 3.3 where
mesh data (used for storing edit-mesh undo steps) was changed to store
selection in a boolean array, creating a bottleneck de-duplicating
chunks of that array for edit-mesh undo's custom-data de-duplication.

Resolve by increasing hash accumulation for arrays with smaller elements,
so each chunk of memory (a candidate for de-duplication) isn't as likely
to have hash collisions.

`char` (single byte) arrays now accumulate 22 values instead of 7, it's
taking more values into account was necessary as these are effectively
bits in the case of boolean arrays, 2-byte values accumulate 32 bytes,
4-byte elements accumulate 44 bytes, larger structs accumulate
`sizeof(type) * 7` bytes (as before).

Also ensure the accumulation read-ahead never exceeds the chunk size -
technically a fix although this would only happen when passing a small
`chunk_count` to BLI_array_store_create (in the range of 1-16) so this
didn't happen in practice.

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:56 +11:00
1b10883498 BLI_array_store: use uint32_t instead of uint64_t for hash storage
Use uint32_t since it's sufficient for hashing, using an int64_t was
especially inefficient when allocating an int64_t for every boolean
(when compacting an array of booleans).

Improve performance of array de-duplication, see: #105046.
2023-03-11 11:57:54 +11:00
2bfe9b50c6 Fix error freeing NULL if BArrayStore_AtSize is empty
Calling BLI_array_store_at_size_clear on an BArrayStore_AtSize
which was not used would attempt to free a NULL pointer.
2023-03-11 11:57:08 +11:00
412c62f62e Cleanup: rename BChunkList::total_size -> total_expanded_size
Use this name to avoid confusion between expanded & compacted sizes.
2023-03-11 11:57:06 +11:00
ce70e0055f Cleanup: improve/correct doc-strings, use doxygen formatting 2023-03-11 11:57:04 +11:00
c402b3f52f Fix #63890: Allow Eyedropper and Other Operations in Popovers
Allow some operations on contents of popovers, like resetting to
defaults and use of the eyedropper.

Pull Request: blender/blender#105387
2023-03-11 00:36:39 +01:00
4d5a3c9932 Merge branch 'blender-v3.5-release' into main 2023-03-10 16:55:04 -03:00
3baccee0af Pass BitVector by reference in lambda
This is a fix for the previous commit d7c023eb25.

Before, every time the lambda was called, a copy of the BitVector was
made. This was very inefficient.

Now this has been fixed by passing the BitVector by reference (&) in
the lambda function.
2023-03-10 16:54:40 -03:00
3f0853264f Merge branch 'blender-v3.5-release'
Conflicts:
	source/blender/geometry/intern/mesh_merge_by_distance.cc
2023-03-10 16:09:02 -03:00
d7c023eb25 Fix #105583: crash when weld modifier checks for duplicate polygons
In very specific cases, during intersection testing, `intersect` can
add polygons already checked as duplicates in the buffer that
corresponds to the rest of polygons that can form groups of duplicates.

As the buffer cannot have repeated indices, re-adding, even
temporarily, these duplicates can cause a buffer overflow.

While this may have some impact on performance, it's difficult to
predict these cases and thus add a buffer pad.

So the solution is to check if they are already duplicated.
2023-03-10 16:07:32 -03:00
e7a3a2c261 Fix custom normals not normalized in Cycles shader nodes 2023-03-10 19:29:27 +01:00
e7b0a23283 Fix (unreported) broken ID remapping code, and improve efficiency.
Commit ea97bb1641 introducing the GHash mapping between objects and
their CollectionObject items in a Collection broke ID remapping of
collections's objects. Release builds would 'work', but debug builds
would assert in several ways when opening complex production files.

The root of the issue was a bad/missing handling of the 'duplicate case'
(several CollectionObjects pointing to a same Object).

While fixing the code was possible, it turned out to require disabling
to much safety checks. Further more, there was an opportunity to improve
efficiency of the related code in ID remapping (the pos-processing
checking for NULL and duplicates in collections objects lists).

This commit introduces a new 'dirty' tag for CollectionObject lists and
their ghash mappings.

This tag is set by the `foreach_id` callback when the `ob` pointer of a
CollectionObject is changed, and it is detected as (potentially)
breaking the consistency of that data.

This tag is then used by a new `BKE_collections_object_remove_invalids`
call, to only check and fix collections tagged as dirty, instead of all
the collections in the given Main. It replaces the previous
`BKE_collections_object_remove_nulls` and
`BKE_collections_object_remove_duplicates` functions.
The speed-up is about an order of magnitude for the clean-up code
itself, which gives 2-3 percent speed-up on resynching a complex
production file e.g.

This commit also includes some cleanups and re-organization of related
code.
2023-03-10 18:52:01 +01:00
111038062a Cleanup: Remove unused node function declarations 2023-03-10 12:26:55 -05:00
4f56b02a0c Fix #95105: Unclamp draw size of the frame node's label
Fix issues with the display of frame node labels, that made them
harder to read for people with low vision or on high dpi displays:
* Unclamp the size of text that is drawn in the frame node
  so all sizes can be displayed consistently at all zoom levels
  and independet of the UI scale.
* Account for the label when calculating the frame node's
  bounds, so child nodes don't obscure the label.

Pull Request: blender/blender#104555
2023-03-10 18:24:22 +01:00
9b354e9433 Merge branch 'blender-v3.5-release' 2023-03-10 17:59:02 +01:00
55281c0eed Fix #105638: image.pixels.foreach_set() does not update displayed image
Pull Request: blender/blender#105639
2023-03-10 17:58:13 +01:00
9f76a21677 Merge branch 'main' of projects.blender.org:blender/blender 2023-03-10 21:16:59 +05:30
577fd9add5 Merge branch 'blender-v3.5-release' 2023-03-10 21:11:09 +05:30
c2fdbcca3c Fix #102317: Any action triggers expansion of all ViewLayers
Don't expand view layer elements if element is previously used
This is similar as done for other display mode (eg. scene, library override)
Pass view_layer ID instead of scene as argument in `outliner_add_element`

Old Differential Revision: https://archive.blender.org/developer/D16661

Pull Request: blender/blender#104862
2023-03-10 16:37:04 +01:00
3ea36e9134 Merge branch 'blender-v3.5-release' 2023-03-10 16:26:29 +01:00
382a54aefb Fix #101374: enable edge panning for move operators in menus
This patch enables edge panning for the operators where there was
a mismatch in behaviour between using the shortcut `G` and the
"Move" operator exposed via the menu and operator search.

Commit 19da434e9c introduced a `view2d_edge_pan` property which
was activated for the translate operators invoked when pressing G in
the default keymap.
The property is not enabled by default, to avoid it getting in the
way in some cases, so the "Move" operators exposed via the menus
didn't have edge panning. This lead to inconsistent behavior between
moving via the shortcut or via the menu.

Pull Request: blender/blender#104482
2023-03-10 16:22:48 +01:00
466eb426ed Extern: Update TinyGLTF to include fix for CVE-2022-3008
The use of wordexp(3) permits arbitrary code execution from manually-crafted
glTF files. See https://github.com/syoyo/tinygltf/issues/368 for more details.
In practice this shouldn't be an issue for Blender since the GlTF data isn't
manually crafted but from the OpenXR runtime (a bit like a driver). But
updating the library to include the fix is not a big deal anyway.

Note that the warning that required the local modification is no longer present upstream since
  0bfcb4f49e

Pull Request: blender/blender#105536
2023-03-10 14:56:35 +01:00
a60626ab0b Cycles: Workaround for MetalRT crash when building pipelines
Workaround for a crash when `addComputePipelineFunctionsWithDescriptor` is called *after* `newComputePipelineStateWithDescriptor` with linked functions (i.e. with MetalRT enabled). Ideally we would like to call `newComputePipelineStateWithDescriptor` (async) first so we can bail out if needed, but we can stop the crash by flipping the order when there are linked functions. However when addComputePipelineFunctionsWithDescriptor is called first it will block while it builds the pipeline, offering no way of bailing out.

Note that this only has an impact when the "MetalRT (Experimental)" option is checked.

Pull Request: blender/blender#105629
2023-03-10 12:36:58 +01:00
4805a54525 BLI: Math: Move rotation types template out of math::detail
The reasoning is that the detail namespace is not to be used
outside the module itself. But one might want to use different
number types with these templates.

The `Base` suffix was chosen in order to be consistent with `MatBase`
and `Vector` naming convention.
2023-03-10 11:48:15 +01:00
2e03352492 Refactor: fcurve bounds functions
Refactor the following functions and cover with tests

* `BKE_fcurve_calc_bounds` - used to get the `rctf` bounding box of an fcurve
* `BKE_fcurve_calc_range` - used to get only the x-range, potentially faster when not needing y extents

`get_fcurve_end_keyframes` has been replaced with `get_bounding_bezt_indices` - dealing with indices allows to iterate over that range later

### BKE_fcurve_calc_bounds
* pass in an `rctf` instead of float pointers
* extract logic to get bounds into separate functions

### BKE_fcurve_calc_range
* removed the parameter `do_min_length` it was always false, and this function shouldn't concern itself with clamping.
Calling code can do that if the return bool is false
* use function to get x bounds separated from `BKE_fcurve_calc_bounds`

Pull Request: blender/blender#105177
2023-03-10 11:33:11 +01:00
a6b8bdaa45 Cycles: oneAPI: fix AoT compilation when triggered from makepkg (archlinux)
Archlinux faced an issue with AoT compilation: https://bugs.archlinux.org/task/77554
These were due to compiler flag strings handling going wrong when cmake
calls the custom command. It ended up moving quotes around, leading flags to
get passed to the main compiler instead of the graphics compiler and trigger
the following error: "Unrecognized build options: -ze-opt-regular-grf-kernel".

Pull Request: blender/blender#105615
2023-03-10 11:07:02 +01:00
bcd99bcb5b Cycles: oneAPI: fix linking for when icpx compiler is used
When compiling from MSVC environment, libs such as libircmt.lib weren't
found, we need to set the path to these in LIB environment variable.
2023-03-10 11:07:01 +01:00
219be2e755 BLI; Math: Remove Normalized template parameter for some conversion
Always expect normalized matrix input as per API design.
2023-03-10 10:20:22 +01:00
896ba33336 GHOST: use logging for GHOST_NDOFManagerUnix
Even for debug builds, NDOF info on startup is unnecessarily noisy.
2023-03-10 13:12:27 +11:00
d64dfc4333 Cleanup: spelling in comments 2023-03-10 12:58:10 +11:00
ecc3e8c751 Cleanup: format, sort CMake file lists 2023-03-10 12:50:17 +11:00
10f06221c1 Cleanup: UV: simplify uv packing
Remove dependency on boxpack_2d in public API.

Brings us closer to full rotation in UV Packing.

No functional changes.
2023-03-10 13:56:33 +13:00
d474732f91 Cleanup: UV: simplify types
No functional changes.
2023-03-10 12:59:26 +13:00
66b4a4427b Sculpt: Edit face set operator improvements
* Last operator panel now works
* Added a strengh property for fairing modes
* Now works when called from a menu (added OPTYPE_DEPENDS_ON_CURSOR
  to operator type flag).
2023-03-09 15:43:05 -08:00
d795c00b88 Sculpt: Fix #105557 Bugs in new sculpt menu entries
Note: the wrong hotkeys are still displayed for
move/rotate/scale, for some reason the base view3d
keymap values are being used.
2023-03-09 15:20:22 -08:00
bd3c6801da Cleanup: BLI: Rotation: Remove unneeded type forward declarations 2023-03-10 00:02:53 +01:00
3982aa922e BLI: AxisAngle: Fix wrong constructor
The constructor was using the incorrect cast to VecBase3.
Also removes a redudant cast.
2023-03-10 00:02:53 +01:00
610cb16d5d BLI: AxisAngle: Make axis normalization mandatory
This moves out the normalization as per math API design (no implicit
normalization of inputs).
2023-03-10 00:02:53 +01:00
f70171e9c6 Cleanup: format 2023-03-10 11:00:18 +13:00
caf90c6a90 Fix #105587: Triangulated shading in sculpt mode
The function to upload the normals uses an optimization to avoid
checking the smooth status or face normal of the triangle is part
of the same face. The smooth status needs to be initialized before
the loop for that to work.

Also do a bit of cleanup:
- Decrease variable scope
- Fix the reversed incorrect naming of `smooth`
- Retrieve mesh data at the start of the function
2023-03-09 14:44:25 -05:00
68a142ee7b Fix #105524: Texture paint broken after recent cleanup
eb68334b58 replaced the pointer to looptris with a span
but left the variable for the number of looptris unset at zero. Fix by
using the size of the span instead.
2023-03-09 14:25:53 -05:00
0fe1a02055 Merge branch 'blender-v3.5-release' 2023-03-09 13:50:29 -05:00
4912695e00 Fix #105610: Missing "Amount" validation in duplicate elemnts node
The count wasn't clamped above zero in some newly optimized code.
Instead of adding it there, move the clamping to the field network,
similar to some other nodes. That makes it so the rest of the code
doesn't have to deal with the clamping, and should be faster in the
single-value case.
2023-03-09 13:49:16 -05:00
af5a115f65 GPU: Refactor API for Clearing Storage Buffers
The previous API for clearing storage buffers was following the OpenGL
api. OpenGL has many options to support for data conversions, striding
and sizzling. Metal and Vulkan don't have these features and we have to
deal it ourselves.

Blender internally only uses a tiny subset for what is possible in
OpenGL. Making the current API to difficult to implement on our future
platforms as we had to implement all cases, most even not used at all.

By changing the API we make future development easier as we only need
to implement what we are actually using.

**New API**

`GPU_storagebuf_clear(GPUStorageBuf* ssbo, uint32_t clear_value)`

Related issue: #105492

Pull Request: blender/blender#105521
2023-03-09 18:46:28 +01:00
ffcd8e6b02 Eevee-next: Use compute shader to clear clipmaps
Clearing of clipmaps is the only place in Blender that uses non
uniform data (not all components of the cleared data to be exact
the same).

Vulkan has only the possibility to clear buffers using a single
uint32_t. There were two solutions:
- Add compute shader to Vulkan backend.
- Make Eevee-next responsible to clear the clipmaps.

When fixing this in the Vulkan backend it could lead to other issues
as the backend isn't aware what is exactly required and might overwrite
active bindings. We chose to make it a responsibility of Eevee-next
as there it is clear what is needed.

Related issue: #105492

Pull Request: blender/blender#105560
2023-03-09 18:28:05 +01:00
28a581d6cb BLI: Rotation C++ API
This patch re-implement the whole C rotation API into a more type
oriented C++ API. See the #104444 design task for more details about
the goals.

The list of C to C++ equivalent syntax can be found attached.

This adds `AngleRadian`, `AngleCartesian` and `AngleFraction` as
different angle types with the same interface. Each of them have
specific benefits / cons. See inline documentation for detail.

This adds `Axis` and `AxisSigned` class wrapped enums to increase type
safety with axes selection.

This adds `CartesianBasis` to represent orthonormal orientations.

Added a weight accumulation to dual-quaternions to make normalization
error proof. Creates the overhead of summing the total weight twice
(which I think is negligible) and add an extra float.

Named the dual-quaternion `DualQuaternion` to avoid naming ambiguity
with `DualQuat` which come up quite often (even with namespace).

Pull Request: blender/blender#104941
2023-03-09 18:15:22 +01:00
f9c627b275 Mesh: Set bounds eagerly for cube and grid primitive nodes
For mesh primitives, the bounds can be calculated trivially in advance
with negligible cost. In case they are needed later on, setting them
eagerly can save the calculation later on. For large meshes, this can
save tens of milliseconds before drawing.

Pull Request: blender/blender#105266
2023-03-09 18:11:53 +01:00
0fd026d0b4 Sequencer: Use Same Sampling As Rendering.
When subsampling was introduced in VSE it was disabled during
editing. Only when rendering it was enabled. This lead to
cache being different between editing and rendering. Leading
to confusion.

This PR will enabled the subsampling when editing. This way
it is more consistent.

Pull Request: blender/blender#105612
2023-03-09 18:02:17 +01:00
10cf02d26b Fix #104466: Resolve smooth lines in Metal.
Caused by replacement of Macro with uniform
in overlay edit mesh vert shader.

Pull Request: blender/blender#105609
2023-03-09 17:04:00 +01:00
a8819481cb Merge branch 'blender-v3.5-release'
Conflicts:
	source/blender/modifiers/intern/MOD_array.cc
2023-03-09 16:53:06 +01:00
e699bd780c Cleanup: silence unreferenced param warning in MSVC
This warning appears when the `WITH_BULLET` option is off.
2023-03-09 12:50:07 -03:00
b7679addd2 cmake/win32: Fix building with WITH_VULKAN_BACKEND
The shader libraries were not hooked up yet in cmake for windows since
when the shaderc libs landed there was no code yet that used it.

It's required now, so this change adds the missing bits.
2023-03-09 08:41:17 -07:00
8b2556e8d8 Fix (unreported) crash in Array modifier in case of empty mesh.
Return early the input mesh in case it is fully empty.
2023-03-09 16:36:56 +01:00
15dd622a63 Fix (unreported) crash in clnors with empty mesh.
Do not try to allocate zero-size memory from memarena.
2023-03-09 16:34:27 +01:00
ebc062191c LibOverride: Do not assert on invalid resync situation.
Some checks here are really critical and should assert, but that one is
more an indication that something is not going right, though data itself
should still be mostly valid, so better warn the user with a LOG
warning, than be silent in release builds, and crash in debug ones.
2023-03-09 16:31:07 +01:00
b0037c5c6b Texture Painting: Fix Seam Bleeding of Non-Manifold Sections of Mesh
Fix seam bleeding of non-manifold sections of the mesh, by copying pixels
that are covered by the brush stroke.

As manifold parts are already handled, the pixel copying solution can be
very straight forward.

* Pixels are copied from the same tile. So we don't need a mechanism that
  copies and merges pixels from other tiles.
* Pixels are copied from the closest pixel that is being painted on. We
  don't need to consider that that pixel can be in different areas of the
  tile.

When we copy a pixel, we find the closest pixel in UV space that is being
directly influenced by a paint brush. We also look for the second closest
pixel, which is still a neighbor from the closest pixel. We can mix both
pixels together and store it in the destination. A mix factor is calculated
using the closest non manifold edge as a guidance.

The result of this step is a list of copy and mix commands that can be
executed to fix the seam bleeding for non-manifold sections of the mesh.

| Destination | Source 1 | Source 2 | Mix factor |
| ----------- | -------- | -------- | ---------- |
| 1780,1811   | 1780,1810| 1779,1810| 0.000000   |
| 1781,1811   | 1781,1810| 1782,1811| 0.168627   |
| 1828,1811   | 1828,1810| 1827,1811| 0.156863   |
| 1829,1811   | 1829,1810| 1828,1810| 0.188235   |
| 1830,1811   | 1830,1810| 1829,1810| 0.188235   |
| 1831,1811   | 1831,1810| 1830,1810| 0.188235   |
| 1832,1811   | 1832,1810| 1831,1810| 0.188235   |
| 1833,1811   | 1832,1810| 1832,1810| 0.000000   |

In the end we go over this list mix the sources and store the result at
the destination.

```
tile_buffer[destination] = mix(tile_buffer[source_1],
                               tile_buffer[source_2],
                               mix_factor);
```

**Encoding**
When using a large textures or large seam margins this table can grow
large and reduce performance as data retrieval is slower, than the
operations it has to perform. To improve the performance we encode the
table so less data retrieval needs to be done.

* first `DeltaCopyPixelCommand` is delta encoded from
  `CopyPixelGroup#start_destination` and `start_source_1`. The others
  are delta encoded from the previous `DeltaCopyPixelCommand`.
* For performance reasons PixelCopyGroup#pixels are ordered from
  destination (left to right) for each row a new group would be created
  as the delta encoding most likely doesn't fit. When pixels cannot be
  delta encoded a new group will also be created.

**Compression rate**
When using Suzanne the compression rate is around 36% when using a seam
margin of 4 pixels. The compression rate may vary depending on seam
margin and model. For Suzanne the compression rate was around 36% for
various resolutions.

| Resolution | Margin | Decoded size | Encoded size | Compression |
| ---------- | ------ | ------------ | ------------ | ----------- |
| 2048x2048  | 4 px   | 353.052      | 128.101      | 36%         |
| 4096x4096  | 4 px   | 700.140      | 255.137      | 36%         |
| 8192x8192  | 4 px   | 1.419.320    | 513.802      | 36%         |
| 2048x2048  | 8 px   | 721.084      | 193.629      | 26%         |
| 4096x4096  | 8 px   | 1.444.968    | 388.110      | 26%         |

Pull Request: blender/blender#105336
2023-03-09 16:11:01 +01:00
f27d6b9640 MSVC: lower C4100 warning level from 4 to 3
The C4100 warning is related to unused formal parameters in functions.

Enabling it better aligns with "-Wunused-parameter" option in other
compilers.

While suppressing it with `__pragma(warning(suppress:4100))` is not the
same as using `__attribute__((__unused__))` in GCC or Clang, it is
still preferable to use it over completely hiding the warning.

This ensures consistent warning behavior across compilers and improves
code quality by addressing unused function parameters.

(Note that some warnings in Windows-specific code have already been
silenced in 7fcb262dfd)

Pull Request: blender/blender#105534
2023-03-09 16:05:48 +01:00
85fb63f99c Cleanup: Move functions in BMesh Mesh conversion
These functions will be useful to speed up the edit mode to object
mode conversion too, move them above that so they can easily be
used for that case later.
2023-03-09 09:41:26 -05:00
d21b9a4bb6 Vulkan: Warn Developer When Layer Not Found.
Currently a developer that starts blender with `--debug-gpu` or
runs the GPU test cases can receive an error when not the full
VulkanSDK is installed.

The VulkanSDK isn't required for normal developement and
therefore it is better to show it as a warning.

NOTE: VulkanSDK is adviced to use when developing in the Vulkan
backend as it contains tools that helps/speed up the development
and validation during development.

Pull Request: blender/blender#105599
2023-03-09 14:55:40 +01:00
85a70e9756 Fix memory leak with button tooltip callback and decorator buttons
Decorator buttons would be skipped when setting the tooltip data for all
buttons in the layout, but the duplicated data would still be marked as
used, so not freed.
2023-03-09 14:38:51 +01:00
3b900048f1 Animation: Move Graph Editor settings to User Preferences
Move two settings that were previously in the "View" menu of the Graph Editor into User Preferences.

It has been mentioned in the meeting by Luciano Muñoz Sessarego that it would be good to move that to the preferences so you can set it once and then forget about it.

The Settings moved are:

    Only Selected Curve Keyframes
    Use High Quality Display

Pull Request: blender/blender#104532
2023-03-09 14:15:23 +01:00
0239eee1c6 Fix build error on Windows introduced in 46be42f6b1 2023-03-09 13:48:14 +01:00
7edb3ab5e0 Merge branch 'blender-v3.5-release' 2023-03-09 13:16:15 +01:00
dcfc9629c2 Fix OptiX TLAS being built with invalid traversables when a geometry is empty
The traversable handle of a BLAS may be zero when the relevant geometry
is empty (no triangles/curves/points/...), as no BLAS is built in such cases.
It is not correct to attach a zero handle to a TLAS, so filter out such instances.
2023-03-09 13:15:08 +01:00
560314b7fd Merge branch 'blender-v3.5-release' 2023-03-09 11:21:27 +01:00
a4fd2d10c1 Fix #105571: crash when connecting invalid node group to multi input
Invalid nodes are not added to the lazy-function graph. Therefore, their
outgoing links are also not added, which implies that the targets need
some default value.
2023-03-09 11:19:59 +01:00
c20bf8d61e GPU: Replace old shader tests with shader builder.
Both the shader_builder and existing shader tests eventually
tested the same aspects. shader_builder is more modern and
handles more cases.

The old shader test requires a full backend in order to run
This commit replaces the old tests to just use the
shader builder for validation.

Shader builder can still be run at compile time, this is
just a convenience to have as a test case as well for CI/CD.

Ref: #105482
2023-03-09 10:40:57 +01:00
0ad06cd39d Vulkan: Automap Buffers.
It is recommended to map buffers once and not each time the
mapped memory is needed. This patch will map the buffer when
created and unmap the buffer when the buffer is freed.

This patch will reduce the overhead where the Vulkan driver or
the virtual memory manager needs to be accessed.

Pull Request: blender/blender#105588
2023-03-09 09:27:42 +01:00
c77b78ad53 Fix: restore margin offset for UV packing
Regression caused by b1185da403
2023-03-09 18:15:11 +13:00
9d3edb7e9a Cleanup: clear the linked list pointers for wmWindow::event_last_handled
While this doesn't cause any bugs, these may reference freed memory
so it's best to clear them as the event is no longer in a list.
2023-03-09 15:57:08 +11:00
09ba0210d9 Docs: note wmWindow::event_last_handled is for event queue handling only 2023-03-09 15:57:08 +11:00
7dcc040118 Merge branch 'blender-v3.5-release' into main 2023-03-09 01:33:14 -03:00
495a6ec6cc Fix #105579: weld modifier crashes when merging n-gons
The correction bbc6bb3468 was still wrong because there it was
disregarded that `vert_ctx_len` does not necessarily indicate merges in
the same polygon.

Therefore, it is not safe to rely on `vert_ctx_len` to count possible
new polygons.

NOTE: It might be worth preempting part of the
`weld_poly_split_recursive` logic to identify what the new polygons are
in advance. But this can be left for a future refactor.
2023-03-09 01:32:29 -03:00
434526f3fc Cleanup: use doxy sections 2023-03-09 14:53:44 +11:00
39ab104761 Cleanup: remove invalid copy-pasted comments 2023-03-09 14:53:44 +11:00
ea913d40a2 Cleanup: format 2023-03-09 16:33:05 +13:00
25d2a4f948 Merge branch 'blender-v3.5-release' 2023-03-09 13:16:39 +11:00
f4c6ad5eb3 Fix RNA path functions not escaping strings, using single quotes
Add doc-string to RNA_def_struct_path_func to avoid this in the future.
2023-03-09 13:14:57 +11:00
c10377cf08 Cleanup: rename 'ok' to 'success' in file reading, double-quote paths
- Both success & ok were used for file reading, use the clearer name.
- Paths were single/double quoted, use double quotes for print/reports.
- Rename `path` to `filepath` / `dirpath`.
2023-03-09 12:11:40 +11:00
46be42f6b1 PyAPI: extend save/load handlers, optionally take a filepath argument
Add a filepath argument to load/save pre/post.
Also add save_post_failed and load_post_failed handlers so it's always
possible to for the pre handlers to run a matching post action.

This makes it possible to know the filepath of the blend file mean
loaded/saved as well as supporting running an action when load/save
operations fail.

When loading and saving the startup-file, the path argument is set to
an empty string.

Details:

New RNA types were added to support storing primitive values in
PointerRNA. Primitive{String/Int/Float/Boolean}RNA. These will likely
only be used in some limited cases, in the case of BKE_callback_exec it
allows strings to be included as part of the PointerRNA **pointers
argument.

Ref !104769.
2023-03-09 12:05:30 +11:00
1cc072b1a7 Cleanup: remove redundant filepath access in WM_OT_save_mainfile 2023-03-09 12:04:37 +11:00
b3625e6bfd Cleanup: comment blocks 2023-03-09 10:39:49 +11:00
56d2298271 Fix #105435: Pause Win32 Auto-Focus During Text Entry
Don't allow the hover of mouse to auto-raise another window while you
are entering data into a text or number input.

Pull Request: blender/blender#105446
2023-03-08 22:20:34 +01:00
60f35207d4 Fix: Hide ".uv_seam" attribute in UI
The attribute, like the other attributes that start with `.` is not
supposed to be displayed in the spreadsheet or the attribute list
by default. This was missing from the commit that added the attribute.
2023-03-08 11:41:36 -05:00
27b9ce6ab6 Mesh: Avoid writing unnecessary attributes
When writing in the legacy mesh format, some attributes don't need to
be written since they're written as flags or legacy struct types.
2023-03-08 11:41:36 -05:00
1354e3108b const_cast no longer needed for ntreeIsRegistered. 2023-03-08 17:38:15 +01:00
7d7190de74 Merge branch 'blender-v3.5-release' 2023-03-08 17:36:59 +01:00
1b398dbad0 Fix build error: ntreeIsRegistered requires non-const pointer. 2023-03-08 17:35:22 +01:00
5876573e14 Mesh: Move face shade smooth flag to a generic attribute
Currently the shade smooth status for mesh faces is stored as part of
`MPoly::flag`. As described in #95967, this moves that information
to a separate boolean attribute. It also flips its status, so the
attribute is now called `sharp_face`, which mirrors the existing
`sharp_edge` attribute. The attribute doesn't need to be allocated
when all faces are smooth. Forward compatibility is kept until
4.0 like the other mesh refactors.

This will reduce memory bandwidth requirements for some operations,
since the array of booleans uses 12 times less memory than `MPoly`.
It also allows faces to be stored more efficiently in the future, since
the flag is now unused. It's also possible to use generic functions to
process the values. For example, finding whether there is a sharp face
is just `sharp_faces.contains(true)`.

The `shade_smooth` attribute is no longer accessible with geometry nodes.
Since there were dedicated accessor nodes for that data, that shouldn't
be a problem. That's difficult to version automatically since the named
attribute nodes could be used in arbitrary combinations.

**Implementation notes:**
- The attribute and array variables in the code use the `sharp_faces`
  term, to be consistent with the user-facing "sharp faces" wording,
  and to avoid requiring many renames when #101689 is implemented.
- Cycles now accesses smooth face status with the generic attribute,
  to avoid overhead.
- Changing the zero-value from "smooth" to "flat" takes some care to
  make sure defaults are the same.
  - Versioning for the edge mode extrude node is particularly complex.
    New nodes are added by versioning to propagate the attribute in its
    old inverted state.
- A lot of access is still done through the `CustomData` API rather
  than the attribute API because of a few functions. That can be
  cleaned up easily in the future.
- In the future we would benefit from a way to store attributes as a
  single value for when all faces are sharp.

Pull Request: blender/blender#104422
2023-03-08 15:36:18 +01:00
10eab0a12c Fix: crash executing geometry nodes on undefined node tree type
Node tree updates can crash if the tree contains a node group that points at an "undefined" tree type.
This can happen if the tree is linked from a library and the path is lost,
or if a custom (python) tree is used and the script is not run.

The fix is to check if the node group type is valid ("registered") and return an empty list otherwise.

Pull Request: blender/blender#105564
2023-03-08 15:31:50 +01:00
2f04f8882f Merge branch 'blender-v3.5-release' into main 2023-03-08 11:17:12 -03:00
bbc6bb3468 Fix #105556: weld modifier crashes when merging N-gons
The logic for counting possible new polygons was incorrect.
2023-03-08 11:16:25 -03:00
b9649c2e72 Eevee: fall back to Diffuse BSDF before proper implementation of Hair BSDFs
Co-authored by @fclem
2023-03-08 15:05:58 +01:00
2282272787 Overlay: Adjustment of the max value of "Edge Width" from 5 to 32.
The first implementation based the max value on what seemed reasonable.
It was therefore limited it to 5.
I received a request from a user in the first already merged #104741
to allow a higher max value.

Thus I adjusted the max value to be the same as the max value used for
"Vertex Size", 32.

Pull Request: blender/blender#105544
2023-03-08 15:01:46 +01:00
6398c9cd7f Cleanup: Remove unused GPU subdivision function declaration 2023-03-08 08:05:36 -05:00
25016b56ef EEVEE Next: Tag shadowmap usage for transparent object volumes
Render the transparent object bounds to a low-res frame-buffer and ray-march the
bounds volume, tagging shadow tiles along the way.

The bounds volume is inflated by half a pixel as a conservative rasterization
alternative, to ensure the tiles needed by all LOD0 pixels get tagged.

The bounds are rendered with front face culling and then the fragment shader
ray-marches against the bounds volume.
Each ray-marching step size equals the world space size of the pixel at the step
depth.
The step bounding sphere radius is also sent to the shadow usage tagging library
to ensure the whole step volume is tagged.

Pull Request: blender/blender#104580
2023-03-08 13:51:24 +01:00
53bb713eda Refactor: Rename OB_GPENCIL and ID_GD
This renames the `OB_GPENCIL` object type and the `ID_GD` to `OB_GPENCIL_LEGACY` and `ID_GD_LEGACY` respectively.
There is no change for the user.

Pull Request: blender/blender#105541
2023-03-08 12:35:58 +01:00
a736f1d638 BLI: Math: Support more vector swizzling and add alignment static assert
Sergey said it was faaaaaaaaaaaaiin.
2023-03-08 11:21:12 +01:00
63a05f1e18 Vulkan: Fix Shader Compilation Issues.
Fixes recent introduced shader compilation issues.
- `sampler` is a reserved keyword in Vulkan GLSL.
2023-03-08 11:10:05 +01:00
b1185da403 Fix #102843: Add UV Packer with O(nlogn) performance
Adds a novel "Alpaca" UV packing strategy for fast packing
of UV island AABBs without rotation.

Pull Request: blender/blender#105393
2023-03-08 20:39:27 +13:00
4fb2c9a407 Cleanup: use system native slashes in PLY, OBJ tests, studiolights
Use native paths to avoid issues comparing paths, see: #103385.
2023-03-08 15:50:02 +11:00
4787384d9d Cleanup: use BKE_area_find_region_type utility function 2023-03-08 15:50:01 +11:00
3a1d5e6032 Cleanup: surround expressions in defines by parenthesis 2023-03-08 15:49:59 +11:00
7896ebec12 Cleanup: make undeclared function static 2023-03-08 15:49:57 +11:00
5c5650f0f8 Cleanup: UV: Rearrange functions in cpp files to improve type safety
No functional changes.
2023-03-08 05:43:15 +01:00
809a336a3d Merge branch 'blender-v3.5-release' 2023-03-07 20:06:05 -05:00
d6d2e98e5e PyAPI Docs: Fix Broken link to source files
With the move to Gitea the URI for line numbers changed from `$1234` to `#L1234`.

The change also removes a superfluous space character from the generated RST syntax.
2023-03-07 20:03:07 -05:00
b228e5b118 Cleanup: run clang-format on a few files 2023-03-07 16:54:18 -08:00
e67c27e172 Merge branch 'blender-v3.5-release' 2023-03-08 01:50:08 +01:00
02fb607520 Fix Freestyle fill range by selection error when there is no active camera
When trying to use the Fill Range by Selection operator, in the
Distance from Camera Freestyle modifier, the operator fails if no
camera is active in the scene.

Before getting the data from the camera, check that it is defined, and
return otherwise.

Pull Request: blender/blender#105475
2023-03-08 01:46:51 +01:00
7fcb262dfd Cleanup: resolve some unreferenced parameter warnings in MSVC
When the warning level is set to 4, some unreferenced parameter
warnings can appear

This commit resolves some of those warnings.
2023-03-07 21:39:44 -03:00
da65b21e2e Sculpt: Add Transform, Trim, and Mesh Filter operators to Sculpt menu
Hello, this is a small PR to check that my understanding of #102427 is correct before moving on to the rest of the issue.
This PR contains the updated UI of the `Sculpt` menu only. Other menus will be submitted for review later.

Currently exposed operators:
* Move
* Rotate
* Scale
* Box Trim (Trim Mode ="Difference")
* Lasso Trim (Trim Mode ="Difference")
* Box Add (Trim Mode ="Join")
* Lasso Add (Trim Mode ="Join")
* Line Project
* Smooth
* Surface Smooth
* ~~Scale (Could be left out?)~~
* Inflate
* Random
* Relax Topology
* Relax Face Set Boundaries
* Sharpen
* Enhance Details
* Erase Displacement

The original issue specifies `Relax Face Set Boundaries` and `Erase Displacement`. I'm not quite sure if this is done in the UI code or somewhere else.

Reviewed By: Joseph Eagar & Julian Kaspar
Pull Request: blender/blender#104718
2023-03-08 01:18:21 +01:00
d46a0f5a1a Cleanup: UV: simplify #uv_parametrizer_construct_end
No functional changes.
2023-03-08 10:29:07 +13:00
d41a1e1806 Cleanup: UV: simplify types
No functional changes.
2023-03-08 10:16:07 +13:00
8faeccf6e5 Fix #105496: Incorrect solidify modifier materials after recent cleanup 2023-03-07 16:11:01 -05:00
a97cae3efc Fix: VSE retiming off by 1 error 2023-03-07 22:10:00 +01:00
cf39e077b3 Cleanup: Remove useless function
`seq_time_strip_original_content_length_get()` was created initially for
purposes of retiming, but it just returns `seq->len`.
2023-03-07 22:10:00 +01:00
894dcfbb41 Cleanup: format 2023-03-08 09:50:03 +13:00
655623ce08 Merge branch 'blender-v3.5-release' 2023-03-07 15:41:15 -05:00
281f383c23 Fix #105430: Curves pick select selects multiple objects
Pick select is only meant to change a single element from a single
data-block. However, the operator worked on each object individually
rather than first finding the closest point, then processing the
selection. Change the operator to find the closest point across all
objects, then deselect if necessary, then select the closest point.

Pull Request: blender/blender#105495
2023-03-07 21:39:46 +01:00
314db1bcab Merge branch 'blender-v3.5-release' 2023-03-07 15:24:29 -05:00
ea80e14464 Fix: Logic error in check for curves selection
The code always assumed the selection array was on the curve domain.
Introduced in 33cbd063d3.
2023-03-07 15:24:20 -05:00
58401a85cd Merge branch 'blender-v3.5-release' 2023-03-07 15:07:01 -05:00
fefb35988c Fix #105518: Crash in edit mode with cage editing
The attributes used for rendering were retrieved from the wrong mesh,
since `mr->me` and `me` weren't the same.
2023-03-07 15:03:50 -05:00
0b05baeaf3 Cycles: oneAPI: fix linking for when icpx compiler is used
When compiling from MSVC environment, libs such as libircmt.lib weren't
found, we need to set the path to these in LIB environment variable.
2023-03-07 21:01:59 +01:00
66eedc542b VSE: Use flag for strips with single frame of content.
Previously `SEQ_transform_single_image_check` function was used to check
if image or effect strip has only one frame of content. Now these strips
are flagged with `SEQ_SINGLE_FRAME_CONTENT`.

While previously this was implicit property of strip, benefit of having
explicit flag is that this property can be decoupled from strip length.
2023-03-07 20:34:24 +01:00
5ab49afe8d Cleanup: Fix warning in skin modifier
Pull Request: blender/blender#105542
2023-03-07 19:33:49 +01:00
78e8c6649d Fix unreliable PLY regression test
At a random the bf_io_ply_tests would fail in one of the fixtures.

The root of the issue was that the exporter parameters were used
uninitialized, causing the mesh to be triangulated in some of the
runs and not be triangulated in other runs.

This change makes it so PLYExportParams is always zero-initialized,
so that this solves this issue, and that adding fields to it in the
future will not re-introduce the issue.

Pull Request: blender/blender#105537
2023-03-07 18:59:02 +01:00
d11874bf21 Merge branch 'blender-v3.5-release' 2023-03-07 18:29:30 +01:00
ec1a76d9cd Fix (unreported) potential invalid usage of Main relations cache.
`library_foreach_ID_link` should only use Main ID relations cache if no
'special' relations flag is set.
2023-03-07 18:25:50 +01:00
d0918c5c7f Assets: Add License and Copyright meta-data
As per #105300, this adds optional "license" and "copyright" meta-data
to assets.

Pull Request: blender/blender#105318
2023-03-07 18:22:43 +01:00
cbf569523c Realtime Compositor: Implement bicubic interpolation
This patch implements the bicubic interpolation option in the transform
nodes. The path merely reuse the code in the shader image texture and
adds bicubic variants to the domain realization shader.

Pull Request: blender/blender#105533
2023-03-07 18:02:20 +01:00
393d5aac59 Ignore build files for VS and VS Code
Git: Add VS/VSCode litter to .gitignore

Neither regular VS nor VS Code can't seem to keep themselves from
littering in the source folders.

This change adds some common litter to .gitignore file to provide some
relief for developers using these editors/IDE's
2023-03-07 17:38:34 +01:00
023524765a Merge branch 'blender-v3.5-release' 2023-03-07 17:35:05 +01:00
68e7004e5e Fix ffmpeg warnings due to missing header include 2023-03-07 17:33:08 +01:00
8f1136e018 Cycles: Use async Metal PSO compilation to avoid std::terminate on exit
When running unit tests or other fast completing renders, forced crashes can occur if there are any slow, outstanding PSO compilation requests (due to the `std::terminate` fall-back case in `~ShaderCache`).

This patch eliminates the need for this shutdown hack by using of the async version of `newComputePipelineStateWithDescriptor` when creating a PSO for the first time. In doing so, we are able to explicitly respond to app shutdown instead of waiting for the pipeline to finish compiling (..and then timing out and force-crashing). We still use the blocking version of `newComputePipelineStateWithDescriptor` when loading from an archive, as this can handle loading from a corrupted archive gracefully. Finally, we move `addComputePipelineFunctionsWithDescriptor` to *after* the PSO is built (as this will trigger a full blocking compile if the PSO has not yet been built, which would bring back the original issue).

Pull Request: blender/blender#105506
2023-03-07 17:08:30 +01:00
d31083583c Fix 105449: Resolve selection in Metal backend
MTLFramebuffer's viewport was not correctly updated when
updating attachments. Behaviour modified to be consistent
with OpenGL.

Authored by Apple: Michael Parkin-White

Ref #96261

Pull Request: blender/blender#105529
2023-03-07 16:00:23 +01:00
ae47a9b2b8 Fix #93953: Translation double displayed in panel header
After ed870f87b9, panels headers displayed inside panels had their
label duplicated when translations were enabled. This is because a
string comparison was made against the original message, instead of
the translated message.

Pull Request: blender/blender#105151
2023-03-07 14:23:55 +01:00