1
1
Commit Graph

122540 Commits

Author SHA1 Message Date
e380d4aa5c Merge branch 'main' into gpencil-next 2023-03-17 17:25:58 +01:00
48496f1473 PLY: optimize new exporter (2x faster)
1) There was a logic error in FileBuffer where when it was trying to
   add a new 64kb chunk to hold output, it was adding an empty chunk,
   but making sure we have space capacity to hold 64 thousand chunks.
   So that was a bit of pointless juggling to get nothing good.
2) In UV_vertex_key, instead of trying to combine three members into
   a hash value, badly, by doing some ad-hoc shifts and xors, use
   get_default_hash_3 instead, which combines them way more properly.
   Also avoid copying the whole hash map object.

On my windows box (Ryzen 5950X, VS2022), exporting Stanford Lucy 3D
scan:
- Binary: 13.4 -> 5.4 sec
- ASCII: 29.3 -> 14.6 sec

So basically 2x faster for two tiny changes.
2023-03-17 17:01:09 +02:00
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