Commit Graph

99428 Commits

Author SHA1 Message Date
3a0d17ceea Cleanup: Correct commet about curves bounds
Missing from 97a8bb450c
2023-05-09 13:03:08 -04:00
3f44b24cf2 BLI: Use inline instead of static for bounds functions
Avoid instantiating the templates separately in every translation unit.
This saves 20 KB in my Blender binary. Also remove a timer mistakenly
committed.
2023-05-09 12:54:55 -04:00
d65d9f4b97 CMake/Windows: Install materialX render dll's when available
This is in preparation for the 3.6 library update landing on windows.
2023-05-09 10:21:32 -06:00
6323d56eb5 Mesh: Tag no loose verts and edges when converting from BMesh
This saves about 6 ms every update when in edit mode on a 1 million
face grid. For reference, the BMesh to Mesh conversion took 80 ms,
before and after the change.
2023-05-09 12:13:09 -04:00
8ce040cf1a Anim: avoid increasing NULL pointer
Avoid calling `next++` when `next` is `NULL`.

In practice this should be a non-functional change, but it avoids ASAN
messages.
2023-05-09 16:05:40 +02:00
263bf63509 Cleanup: Remove versioning for simulation zone socket identifiers
This was added temporarily during development.
Loading files created in the geometry-nodes-simulation branch (3.5.4
and older) will remove links from simulation zones, which need to be
added back manually.

Pull Request: blender/blender#107781
2023-05-09 15:15:40 +02:00
4436909c1d Workbench-Next: Fix shader compilation
Was a missing case from recent fix:
aa31d9be80
2023-05-09 14:37:13 +02:00
a68c78a3ee Vulkan: Don't Use Tiled Drawing
Similare to the Metal backend, Vulkan keeps data of the full texture
around as they will be executed by the same submission. So there are
no benefits to splice a texture into smaller parts, but adds overhead
as more commands are required to be processed.

Pull Request: blender/blender#107728
2023-05-09 14:12:44 +02:00
f9b5b0efd2 Fix #107583: HSV node gives differ from CPU compositor
The HSV node in the realtime compositor produces different values from
the CPU compositor in its identity settings.

This happens because the realtime compositor clamped the saturation
value after HSV correction, while the CPU compositor did not, so this
patch unifies that behavior. Additionally, negative values are now
clamped in both the HSV node and Hue correction node to also match the
CPU compositor.
2023-05-09 14:22:35 +03:00
322dab936f Build: fixes for OpenBSD
Pull Request: blender/blender#107666
2023-05-09 13:19:16 +02:00
8ba9d7b67a Functions: improve handling of thread-local data in lazy functions
The main goal here is to reduce the number of times thread-local data has
to be looked up using e.g. `EnumerableThreadSpecific.local()`. While this
isn't a bottleneck in many cases, it is when the action performed on the local
data is very short and that happens very often (e.g. logging used sockets
during geometry nodes evaluation).

The solution is to simply pass the thread-local data as parameter to many
functions that use it, instead of looking it up in those functions which
generally is more costly.

The lazy-function graph executor now only looks up the local data if
it knows that it might be on a new thread, otherwise it uses the local data
retrieved earlier.

Alongside with `UserData` there is `LocalUserData` now. This allows users
of the lazy-function evaluation (such as geometry nodes) to have custom
thread-local data that is passed to all the lazy-functions automatically.
This is used for logging now.
2023-05-09 13:13:52 +02:00
21e6677682 Fix renaming bookmarks stripping non-UTF8 characters 2023-05-09 20:33:47 +10:00
768948f51b Cleanup: correct strcpy use for RNA string access 2023-05-09 20:33:11 +10:00
c183962c5d Cleanup: quiet unused variable warnings in release builds 2023-05-09 20:32:13 +10:00
7f7804e62d Cleanup: use doxygen groups for BLI_string_tests 2023-05-09 20:32:13 +10:00
5532d05622 Anim: remove assumption of array_index order when blending quaternions
The pose library blending code assumed that quaternions would be keyed
in order of `array_index`. This is normally the case when creating a
pose asset, but when manually editing a pose asset Action this
assumption may not hold.

The code still assumes that all FCurves of a single quaternion are
sequential, i.e. are not inter-mixed with other keyed properties. They
just no longer have to be ordered by array index.

Ref: blender-addons/issues#104591
2023-05-09 11:26:27 +02:00
e8c660b855 Realtime Compositor: Implement Denoise node
This patch implements the Denoise node for the realtime compositor. The
denoiser executes on the CPU and we pay for the CPU<->GPU round trip to
memory, so this is not realtime, as one might expected. And is just a
temporary implementation until OIDN supports GPU execution.

This is different from the CPU implementation in that it doesn't use the
auxiliary passes if they were not provided, because using an inflated
buffer of an undefined value doesn't make much sense.

Pull Request: blender/blender#107375
2023-05-09 11:09:06 +02:00
43bee6ea69 Vulkan: Ensure Minimum Size of VKBuffer
In Vulkan it is not allowed to allocate a buffer of zero bytes. This
would generate an error. In Blender it is possible that a buffer is zero
bytes. For example when the draw manager is drawing instances and there
are no instanced in the scene.

This PR ensures that at least a single byte is allocated in order to not
fail later on.

Co-authored-by: Jeroen Bakker <j.bakker@atmind.nl>
Pull Request: blender/blender#107731
2023-05-09 10:20:54 +02:00
63cc5a1e61 Vulkan: Frame Buffer Flipping
Vulkan coordinate system is flipped compared to OpenGL. This PR
flips the drawing when drawn to the on-screen frame buffer.
Offscreen frame buffers are still drawn upside down.

The flipping is done by making the viewport of the framebuffer negative.

Pull Request: blender/blender#107743
2023-05-09 09:22:26 +02:00
4768348583 Sculpt: fix topology automasking not working when factor cache exists 2023-05-08 22:18:38 -07:00
47149d2532 Cleanup: order string size argument after the string
This is the convention almost everywhere.
2023-05-09 15:06:41 +10:00
788a57c6ef Cleanup: reserve the suffix 'len' for string length 2023-05-09 15:02:12 +10:00
c49a0fa474 Cleanup: remove redundant use of BLI_snprintf (no formatting args given)
The SNPRINTF macro isn't usable as it expectes at least one argument.
2023-05-09 14:08:19 +10:00
3958ae7241 Cleanup: use STRNCPY, SNPRINTF macros 2023-05-09 14:08:19 +10:00
2d99b935f3 BLI_string: add macros to wrap BLI_vsnprintf 2023-05-09 13:16:09 +10:00
e151425c5c Fix #107694: Assert adding custom normals to empty mesh 2023-05-08 18:41:06 -04:00
150943e084 Cleanup: Move remaining sculpt_paint files to C++
See #103343

Pull Request: blender/blender#107757
2023-05-08 23:48:38 +02:00
ce96abd33a Fix: Build error after simulation header cleanup
Making the geometry state's geometry public to remove
the accessors didn't work without the constructor.
2023-05-08 17:21:15 -04:00
2f349ce884 Cleanup: Add comments to simulation state header
Pull Request: blender/blender#107744
2023-05-08 21:42:38 +02:00
8e4e616a4b Fix #106023: File Browser Lists with Incomplete Previews
Ensure all File Browser list items get previews.

Pull Request: blender/blender#107698
2023-05-08 20:53:08 +02:00
819cd58864 Cleanup: Make Accumulate Attribute node more generic
Geometry Nodes strives to reduce template usage in code,
to use it only for extremely important loops or for template math
processing on attributes. Due to this, this pull request cleans up
to delete template classes and uses `convert_to_static_type` in
accumulate function directly.

Pull Request: blender/blender#104440
2023-05-08 20:36:12 +02:00
50d49e24c4 Asset Views: Decrease default preview cache size
This was set to a higher value than intended, because the actual caching
doubles the size internally. So it would keep up to 512 previews in
memory which is a bit excessive. See discussion in #107711.
2023-05-08 19:57:56 +02:00
07ac8cb15a Fix #107506: Depsgraph: non-geometry component is treated as geometry component
Pull Request: blender/blender#107509
2023-05-08 18:51:15 +02:00
527b21f0ae LibOverride: Restore local references to virtual linked liboverrides on resync.
When resyncing linked liboverride data, new IDs may be created that do
not exist in actual library file (since the lib file has not been resynced).

If such 'virtual linked liboverrides' data-blocks are used locally (e.g.
by adding such object to a local collection), on next file read they will be
detected as missing.

Now resync code will list such missing linked IDs that were
liboverrides, and try to re-use them when matching (by root name and
library) with newly generated virtual liboverrides.

The process may not be 100% perfect, especially a perfect one-to-one
remapping cannot be ensured if source data keep being changed over and
over (because of the order in which virtual linked liboverrides
generated by resync may change over time). However, in practice this
should fix the vast majority of issues, especially if sane naming
practices are used on IDs.

---------------

For the record, an attempt was made to write liboverride data together
with the placeholders for linked IDs in .blendfile. In theory, this
should ensure a perfect and fully valid re-usage of such IDs.

However, for this to work, not only the liboverride data of linked IDs need
to be written on disk, but also all ID references in this data has to be
considered as directly linked, to ensure that such liboverride data can
be re-read properly.

Otherwise, these placeholders would get a liboverride data with NULL ID
pointers, which is useless.

Such change feels way to intrusive for the very limited benefit, so for
now would consider current solution as the best option.

Pull Request: blender/blender#107144
2023-05-08 18:22:33 +02:00
0327d2c963 Add missing notifier when setting cursor.matrix
Add a notifier when setting `scene.cursor.matrix`. This was already in
place for `cursor.location` and `cursor.rotation`, but was still missing
for `cursor.matrix`, which caused the cursor to remain displayed in its
old transform.
2023-05-08 16:58:26 +02:00
8759ae1760 GPU: Initialize SRGB In TestCases
Vulkan test cases uses SRGB conversion. These test cases where failing
as the conversion table wasn't initialized.

This PR initializes the conversion table and fix the Vulkan data
conversion tests.
2023-05-08 15:32:15 +02:00
7e79e0eec0 File Browser: Avoid filling file cache needlessly on auto-complete
This would iterate over all files and call the sneaky `filelist_file()`,
meaning each file would be added to the cache for a minor query. That's
plenty of unnecessary work and kinda defeats the purpose of the partial
cache design.
2023-05-08 15:01:00 +02:00
be19edf356 Cleanup: Add API comment on side-effect of file browser query function
`filelist_file()` is an easy way to do a bunch of unnecessary work and
fill the file browser caching for little reason. Unfortunately the
caching affects too many things to be a mere API implementation detail,
so rather be clear about this and point out alternatives.
2023-05-08 15:01:00 +02:00
c0ce427760 Cleanup: Move file cache lookup into function
The details on the file cache lookup just look confusing and make the
function look daunting. Encapsulate it into a function so it's trivial
to see what's going on
2023-05-08 15:01:00 +02:00
967cd7f99e Fix: Viewer node crashes when the editor is pinned and has no Object ID
This case was not properly handled by the previous fix in #107621.

The viewer node path function still assumes that the node editor space
has a valid ID pointer (`snode.id`) and that it is an `Object`.
The ID pointer can be null when setting a pinned node tree through the
python API, like so:
```Py
space.pin = True
space.node_tree = some_other_node_tree
```

In this case the `ED_node_tree_start` function is called without and ID
pointer, which is allowed! This patch makes sure that the viewer node
path function is only used with a valid object context.

Pull Request: blender/blender#107737
2023-05-08 14:52:06 +02:00
304e8a842d Fix: editor crashes during simulation bake
Fixes crashes in timeline and spreadsheet editors during simulation
nodes baking:
* Timeline tries to access the `states_at_frames_` list of the cache to
  determine which frames to draw as baked. This can collide with the
  baking thread. Needs a mutex to safely access the cache state.
  Note: the old point cache has a pre-allocated flag array
  `cached_frames` which the baking thread writes into while timeline is
  reading it concurrently - not thread-safe but harmless.
* Spreadsheet keeps a data pointer during drawing, which may become
  deallocated when the cache is updated. Common approach here is to use
  `G.is_rendering` to lock the editor while baking.

Pull Request: blender/blender#107621
2023-05-08 14:34:21 +02:00
f3be425e97 Fix Pose Library: crash when using partially-keyed quaternions
Remove the assumption that quaternions are always fully keyed in a pose
asset. Even though quaternions really should be fully keyed, better not
make Blender crash when this assumption doesn't hold.

If the quaternion is only partially keyed, the other components are taken
to be from the unit quaternion (`[1, 0, 0, 0]`) and the result is
normalized before blending into the existing pose.

This fixes blender/blender-addons#104591, which was reported against the
pose library add-on, but actually was caused by an issue in Blender.
2023-05-08 13:54:07 +02:00
3e888d77ba Geometry Nodes: Simulation calculate to frame operator
Adds a new operator that resets caches and then iterates from the start
frame to the current frame in order to update caches.

Pull Request: blender/blender#107627
2023-05-08 13:41:21 +02:00
b4fb17f11c Geometry Nodes: allow skipping frames during simulation
The maximum delta time is still capped to one frame even if multiple
frames are skipped. Passing in a too large delta time is mostly unexpected
and can reduce the stability of the simulation. Also it can be very slow
when the simulation uses the delta time to determine e.g. how many particles
should be added.
2023-05-08 13:10:30 +02:00
1f3fda16e6 Vulkan: Extract Correct UniformBuf Name From Interface
Fixes an issue as the uniformbuf name was incorrectly extracted
from the shader interface.

Pull Request: blender/blender#107736
2023-05-08 13:01:10 +02:00
3c2dc42712 Fix (studio-reported) crash in liboverride resync code after recent changes. 2023-05-08 12:46:03 +02:00
ae1c52b3f2 Cleanup: remove dead code 2023-05-08 11:48:01 +02:00
d8388ef36a Fix: avoid extra depsgraph evaluation when stopping animation playback
The `NC_SCENE | ND_FRAME` was originally added so that the sequencer
preview is redrawn so that the fps stops showing (2855485565).

Using this specific notifier has the side effect that it also causes a depsgraph
update in `wm_event_do_notifiers`. However, that is not necessary just to
trigger the redraw. Using the `NC_SPACE | ND_SPACE_SEQUENCER` notifier
also triggers the redraw without causing a depsgraph update.
2023-05-08 11:27:50 +02:00
8e9ada0079 Fix: force frame update only when starting animation timer
Otherwise this always causes an extra depsgraph update when
animation playback is stopped.
2023-05-08 11:27:50 +02:00
037b3f87bd Fix: scrubbing time always has extra update that is only used by sequencer
The sequencer has a feature where it only draws a preview while scrubbing.
This was introduced in 8abdc89912.
When scrubbing ends, the sequencer requires an extra update so that the
non-preview version is shown again.

This is only needed by the sequencer and hence the update should not be
done if the sequencer is not used.

Changing `screen->scrubbing` is moved out of the sequencer specific
functions, because it's used elsewhere as well.
2023-05-08 11:27:50 +02:00