Commit Graph

98363 Commits

Author SHA1 Message Date
Richard Antalik
bb1c503bee Fix 105824: Retiming remove gizmo size is fixed
Size was hardcoded to 14 pixels. Now it also conforms to strip size.
Minimum size is 40% of strip size, Otherwise it stays at 14px.
2023-03-18 05:33:35 +01:00
bonj
cf8640e7b5 Fix: Broken mesh to curve conversion
A recent refactor replaced the use of the `totpoly`
local variable where it shouldn't have.

Pull Request: https://projects.blender.org/blender/blender/pulls/105838
2023-03-18 03:49:38 +01:00
bonj
740c9204cc Cleanup: Simplify mesh to legacy curve logic
Changed `edge->v2` to `endVert` to make it consistent with surrounding code.
Removed the unused `totedges` variable.
Currently `totpoly` is also unused, but is fixed in a separate PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/105870
2023-03-18 03:49:25 +01:00
Hans Goudey
3eff28a158 Merge branch 'blender-v3.5-release' 2023-03-17 17:08:22 -04:00
Hans Goudey
d260cacc9d Fix #105577: Python MeshPolygon API allows negative material indices
This was lost in the refactor to store material indices in a generic attribute.
The attribute API still allows this, but that will be handled separately
since it's a more complex task. The existing API that already clamped
input values should still do that.
2023-03-17 17:07:44 -04:00
Brecht Van Lommel
ec08d03198 Merge branch 'blender-v3.5-release' 2023-03-17 20:40:26 +01:00
Brecht Van Lommel
97b0d8f72b Fix #105052: crash with sculpt automasking topology and mesh filter tool 2023-03-17 20:32:15 +01:00
Brecht Van Lommel
ef4485720c Fix crash in viewport with negative material indices
Other areas like blenkernel and Cycles clamp the material indices to be
positive so this should be consistent with them. There is still discussion
if material indices should be made impossible, but this at least avoids
crashing for the 3.5 release.

There was also an inconsistency in how sculpt mode handles material index
higher than the number of slots.

Ref #105577
2023-03-17 20:14:47 +01:00
Sergey Sharybin
74070a1c2c Merge branch 'blender-v3.5-release' 2023-03-17 18:12:20 +01:00
Christoph Lendenfeld
f4fd348d22 Fix: FCurve Bounds - return when can't be found
Originally this was added by #105179
This code was reverted by accident in #105177
2023-03-17 17:16:11 +01:00
YimingWu
11b16c4ae3 Fix #105640: LineArt: Default value for LRT_GPENCIL_MATCH_OUTPUT_VGROUP flag.
This flag is moved to a different variable but the default value is still placed on the wrong variable.

This fixes the default value assignment but due to the old flag bits are in conflict with used bits in the new flag variables, versioning changes are not included.

Pull Request: https://projects.blender.org/blender/blender/pulls/105852
2023-03-17 16:31:01 +01:00
Aras Pranckevicius
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
Jacques Lucke
f440b15630 Merge branch 'blender-v3.5-release' 2023-03-17 13:59:29 +01:00
Jacques Lucke
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
Jeroen Bakker
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: https://projects.blender.org/blender/blender/pulls/105487
2023-03-17 13:48:39 +01:00
Philipp Oeser
0cb02ff3ba Merge branch 'blender-v3.5-release' 2023-03-17 12:46:16 +01:00
Philipp Oeser
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: https://projects.blender.org/blender/blender/pulls/105400
2023-03-17 12:42:04 +01:00
Aras Pranckevicius
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: https://projects.blender.org/blender/blender/pulls/105842
2023-03-17 12:20:41 +01:00
Lukas Tönne
ac2f67dda0 Merge branch 'blender-v3.5-release' 2023-03-17 12:13:10 +01:00
Lukas Tönne
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: https://projects.blender.org/blender/blender/pulls/105826
2023-03-17 12:11:50 +01:00
Philipp Oeser
6e2ea0b997 Merge branch 'blender-v3.5-release' 2023-03-17 12:06:00 +01:00
Philipp Oeser
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: https://projects.blender.org/blender/blender/pulls/105851
2023-03-17 12:04:49 +01:00
Philipp Oeser
b4e0e696fc Merge branch 'blender-v3.5-release' 2023-03-17 11:58:19 +01:00
Philipp Oeser
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: https://projects.blender.org/blender/blender/pulls/105287
2023-03-17 11:55:03 +01:00
Brecht Van Lommel
8bf4aa2fdc Merge branch 'blender-v3.5-release' 2023-03-17 11:17:40 +01:00
Brecht Van Lommel
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: https://projects.blender.org/blender/blender/pulls/105839
2023-03-17 11:17:01 +01:00
Martijn Versteegh
da590428c3 Merge branch 'blender-v3.5-release' 2023-03-17 10:08:42 +01:00
Martijn Versteegh
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: https://projects.blender.org/blender/blender/pulls/105192
2023-03-17 09:42:54 +01:00
Jeroen Bakker
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: https://projects.blender.org/blender/blender/pulls/105850
2023-03-17 08:03:55 +01:00
Campbell Barton
e853a67efc Cleanup: use BKE_blendfile_* for functions defined in BKE_blendfile.h 2023-03-17 16:45:42 +11:00
Campbell Barton
3b8a050fc1 Cleanup: use function-style casts, ELEM & STREQ macros 2023-03-17 16:45:42 +11:00
Campbell Barton
976b17e415 Cleanup: remove redundant casts 2023-03-17 16:45:42 +11:00
Campbell Barton
b6b0bc4531 Cleanup: spelling in comments 2023-03-17 16:45:42 +11:00
Campbell Barton
01a29ebaeb Merge branch 'blender-v3.5-release' 2023-03-17 14:52:04 +11:00
Campbell Barton
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
Harley Acheson
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: https://projects.blender.org/blender/blender/pulls/105750
2023-03-17 04:19:05 +01:00
Richard Antalik
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
Brecht Van Lommel
aa2d8647c1 Merge branch 'blender-v3.5-release' 2023-03-16 23:19:59 +01:00
Brecht Van Lommel
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: https://projects.blender.org/blender/blender/pulls/105844
2023-03-16 23:18:55 +01:00
Harley Acheson
9a8bfe8dd3 Cleanup: Make format
Simply adds a single blank line.
2023-03-16 14:23:40 -07:00
Leon Schittek
339e9deb72 Merge branch 'blender-v3.5-release' 2023-03-16 21:45:16 +01:00
Leon Schittek
f46fb8051d Fix #105778: Prevent invalid links with link swap
Remove swapped links when they link sockets that belong to
the same node.

Pull Request: https://projects.blender.org/blender/blender/pulls/105809
2023-03-16 21:39:32 +01:00
Brecht Van Lommel
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
Jacques Lucke
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: https://projects.blender.org/blender/blender/pulls/105832
2023-03-16 17:52:03 +01:00
Julian Eisel
ee213f3c4d Merge branch 'blender-v3.5-release' 2023-03-16 15:58:34 +01:00
Julian Eisel
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
Julian Eisel
cb20f2cbf9 Fix build error after previous merge
Function was moved and renamed in 48814c25fd.
2023-03-16 15:27:27 +01:00
Julian Eisel
7317da80fe Merge branch 'blender-v3.5-release' (won't build, see followup) 2023-03-16 15:26:23 +01:00
Julian Eisel
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
Julian Eisel
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