Commit Graph

131106 Commits

Author SHA1 Message Date
Campbell Barton
adb74ad0f3 Cleanup: follow convention for naming array lengths
In the context of meshes `totface` reads as if its the number of faces
in the mesh. This was infact the number of looptris however as this
is converted into a "bodyface" array, use that as the prefix.
2023-12-14 11:10:33 +11:00
Campbell Barton
173a4dfbb6 Fix invalid size of allocated looptris array
Regression in [0], moving to C++ types.

[0]: 321c1af26efe1dc79cb46b56a41bcc38646f2b36
2023-12-14 11:08:35 +11:00
Hans Goudey
cdb2f1e1ba Fix #116140: GPU subdivision ignores completely smooth shading
Extraction of data is done in a different order for GPU subdivision
drawing. The necessary normals domain of the mesh has to be
retrieved before that.
2023-12-13 18:59:28 -05:00
Harley Acheson
463dc4dbec Fix #116137: Overflow causing event time false positive warnings
The intent of `ghost_event_proc_timestamp_warning` is to give a console
warning when an event time is outside of an expected 5 second window
around the last time. However if an event happens within the first 5
seconds we get an overflow in a calculation and we get warnings for
normal times within the range.

Pull Request: https://projects.blender.org/blender/blender/pulls/116164
2023-12-13 22:45:50 +01:00
Brecht Van Lommel
ac753fe9ae Fix: Cycles assert with CPU denoiser 2023-12-13 22:27:46 +01:00
rajveermalviya
639de68aaa Fix eyedropper outside blender on mac
Support for picking colors from outside of the blender window on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/115187
2023-12-13 22:02:56 +01:00
Stefan Werner
fd8bb41224 Cycles: Enable HIP devices for OpenImageDenoise
This enables the HIP backend of OpenImageDenoise on supported devices.

Co-authored-by: Werner, Stefan <stefan.werner@intel.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/115854
2023-12-13 21:38:19 +01:00
Richard Antalik
f372ac6f61 VSE: Keep exiting retiming when changing speed
Add "Preserve Current Retiming" option to set speed operator. This
option is enabled by default. When changing speed of retiming segment,
the strip changes length instead of changing next segment speed.

Ref: #112343
2023-12-13 20:45:49 +01:00
Richard Antalik
5092fe60e6 VSE: implement selection of "linked" retiming keys
This feature improves workflow, where it is necessary to select all
retiming keys after one that is selected in order to change speed of
only 1 segment.

The feature is reusing `sequencer.select` "linked time" feature and
mapped Ctrl key.

Ref: #112343
2023-12-13 20:45:16 +01:00
Miguel Pozo
8e9ce4d03d Fix: EEEVEE-Next: Volume lighting
Fix socket_not_white and socket_not_black logic.
(Volume lighting would be disabled if any scatter channel was 0)
Remove unnecesary clamps.
2023-12-13 19:49:31 +01:00
Miguel Pozo
937c4ed2c4 Fix: from_up_axis sign
Same as 6c40adcc360b4971a031e52f0260ecc768ff110a
Fixes the case where up.z == 0
2023-12-13 19:27:30 +01:00
Bastien Montagne
60a9c8ee25 Fix #115486: Linked scenes disappear after reopening file.
Caused by 133dde41bb, it is expected behavior now for linked ID in
general, see also #105786 and #106321.

However, Scenes are a special case here, since they are almost never
(and should not be) indirectly linked by other data, and have (almost)
never any real user, unless they are active in one of the open main
windows.

So this commit essentially reverts the new behavior implemented
in #106321, for linked scenes only.

Should be backported to a potential bugfix release of 4.0.
2023-12-13 18:50:07 +01:00
Bastien Montagne
b840ba1f59 Fix (unreported) crash when trying to link/append while a linked scene is active.
Link/append code sets the scene pointer to `null` when the active
scene is a linked one, to avoid attempt to instantiate linked data
(objects or collections) into a linked scene, which is forbidden.

However, code was still calling some functions expecting a valid scene
pointer, leading to crash.

It is unclear when exactly this issue was introduced code wise. From a
user perspective, it seems to have been revealed between 3.6 and 4.0
release (bisect points at 00a36cbf24, which does not seem to be
directly related...).

In any case, the fix is trivial and safe, so should we do another 4.0
bugfix release, this commit should be backported.
2023-12-13 18:34:13 +01:00
Germano Cavalcante
f83180370a Fix #115590: UV window menus disappearing
Due to lack of forward compatibility, tool_settings.snap_uv_element
could return empty if a 4.0 file is opened in 3.6.

This causes a Python error when trying to identify the element's icon.

Avoid this python error.
2023-12-13 13:54:18 -03:00
Miguel Pozo
6c40adcc36 Fix: GPU: from_up_axis
glsl sign can return 0.
Fixes surfels display when normal.z == 0.
2023-12-13 17:47:48 +01:00
Jacques Lucke
f7383cfe9b Geometry Nodes: use dynamic declaration for switch node
Follow up for 8149678d5e1d6e0d0066. Significantly reduce boilerplate
required for each type in the switch node.Forward compatibility in 4.0
provided by 0ea193bdb3ad710ff881.

Co-authored-by: Hans Goudey <hans@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/113413
2023-12-13 17:33:25 +01:00
Hans Goudey
65252564ee Fix #116025: Uninitialized value when versioning old node trees
Usually we expect new DNA values do be zeroed when we add them. But the
conversion to the interface format for 4.0 didn't clear the memory, so
behavior was different when updating old files. Fix that by using
`calloc` instead of `malloc`.
2023-12-13 11:24:39 -05:00
Miguel Pozo
7e4c2b2649 Fix: EEVEE-Next: DeferredProbelLayer emissive materials 2023-12-13 17:02:05 +01:00
Iliya Katueshenock
51bb3247b4 Fix #116144: Tag update relations for Active Camera node
Missed part of 75f160ee96b93b7438c4e5900e93d7332fa1d323

Pull Request: https://projects.blender.org/blender/blender/pulls/116152
2023-12-13 16:24:25 +01:00
Hans Goudey
96dff1d3ce Fix: Warnings and build error after previous forward declaration commit 2023-12-13 10:16:07 -05:00
Hans Goudey
e657aa2360 Cleanup: Move two mesh functions to C++ header 2023-12-13 09:50:47 -05:00
Hans Goudey
6a1009c9f8 Cleanup: Remove const for Span and by-value types in headers 2023-12-13 09:39:03 -05:00
Hans Goudey
30d95966d5 Cleanup: Forward declare some classes in mesh headers
Aiming to reduce cases of including headers in headers,
when the final definition might be unnecessary.
2023-12-13 09:18:39 -05:00
Hans Goudey
766b0ce820 Fix #116122: Frame Selected/All operators incorrectly frame view
`BKE_object_minmax` is expected to update the min and max, not just set them.
2023-12-13 08:40:21 -05:00
Hans Goudey
4c1817e76f Cleanup: Un-inline mesh data access functions
These shouldn't be called in hot loops at all, and mostly aren't
anymore anyway. Definining them outside of a header allows removing
the `BKE_customdata.hh` include from `BKE_mesh.hh`.
2023-12-13 08:40:21 -05:00
Hans Goudey
b52a071e7a Cleanup: Remove unnecessary Mesh C-API functions
Like mentioned in the docstrings, use the C++ API or access methods
in C++ code.
2023-12-13 08:40:21 -05:00
Philipp Oeser
65274dc096 Fix #116130: Mirrored custom normals broken again
Caused by c53e220aefe8

Above commit was working on the `mesh` (not the `result`) -- basically a
typo...

Pull Request: https://projects.blender.org/blender/blender/pulls/116134
2023-12-13 13:51:56 +01:00
Jacques Lucke
5519a48702 Cleanup: remove unnecessary alias 2023-12-13 13:46:21 +01:00
Jacques Lucke
3370228ae8 Geometry Nodes: rename ValueOrField to SocketValueVariant
Doing this in preparation for also supporting volume
grids in the same type (#115270).

At some point we could also actually use an `std::variant` in this
type, but that would change behavior without futher changes.
2023-12-13 13:40:40 +01:00
Jacques Lucke
1a4f4104d1 Cleanup: rename dynamic paint specific volume grid
Doing this to avoid name clashes with the more used `VolumeGrid` type.
2023-12-13 13:13:15 +01:00
Bastien Montagne
f01bc93bcf Cleanup: Move BKE_blendfile headers to CPP. 2023-12-13 12:36:45 +01:00
Bastien Montagne
fb8bf8b0c8 LibOverride: Modify automatic handling of which IDs to override in a hierarchy.
The previous behavior, fairly rough, was simply considering all
Collections and IDs found as part of the root's hierarchy as to be
overridden.

The new behavior is based on a specific tag added to some ID usages.
Currently, these are only the links from a Collection to its Objects
and children Collections, and the link from an Object to its parent.

The goal of this huge reduction of the 'automatically overridden' set of
data in a hierarchy is to avoid creating liboverrides for 'utils' data,
e.g. a collection used as source of data by a GeometryNode generating
some parametric geometry (Blender Studio use-case: some form of LOD
handling).

In general, it means that only Collections and objects part of the
collection hierarchy of the root collection are now overridden.

This should not change in the typical recommended use-case so far (where
there is a clear root collection to the whole overridden hierarchy, and
it contains all related collections and objects).

But this should allow much less overhead (and viewport pollution, due to
the current principle that local (and therefore liboverridden) objects
have to be instanciated in a Scene) for more complex setups.

Note that the initial idea/change is fairly simple and easy to
implement, but it creates some additional complexity in the partial
resync code, since now some linked data may not be detected as needing
a liboverride anymore when processing a sub-hierarchy, while it would
require it when processing the whole hierarchy.

This required adding some more processing to the util functions which
define which ID should be overridden. It essentially creates a
'reference set' of all reference IDs that should be overridden when
the whole hierarchy is considered, and use this as additional input to
decide which ID to override when processing a sub-hierarchy for the
partial resync.

Pull Request: https://projects.blender.org/blender/blender/pulls/115853
2023-12-13 11:58:54 +01:00
Omar Emara
048f70e7c2 GPU: Add function for setting float array uniforms 2023-12-13 12:52:49 +02:00
Omar Emara
123da3412b Cleanup: Move Cryptomatte node defines into enums 2023-12-13 12:40:34 +02:00
Omar Emara
931c188ce5 Compositor: Refactor File Output node
This patches refactors the compositor File Output mechanism and
implements the file output node for the Realtime Compositor. The
refactor was done for the following reasons:

1. The existing file output mechanism relied on a global EXR image
   resource where the result of each compositor execution for each
   view was accumulated and stored in the global resource, until the
   last view is executed, when the EXR is finally saved. Aside from
   relying on global resources, this can cause effective memory leaks
   since the compositor can be interrupted before the EXR is written and
   closed.
2. We need common code to share between all compositors since we now
   have multiple compositor implementations.
3. We needed to take the opportunity to fix some of the issues with the
   existing implementation, like lossy compression of data passes,
   and inability to save single values passes.

The refactor first introduced a new structure called the Compositor
Render Context. This context stores compositor information related to
the render pipeline and is persistent across all compositor executions
of all views. Its extended lifetime relative to a single compositor
execution lends itself well to store data that is accumulated across
views. The context currently has a map of File Output objects. Those
objects wrap a Render Result structure and can be used to construct
multi-view images which can then be saved after all views are executed
using the existing BKE_image_render_write function.

Minor adjustments were made to the BKE and RE modules to allow saving
using the BKE_image_render_write function. Namely, the function now
allows the use of a source image format for saving as well as the
ability to not save the render result as a render by introducing two new
default arguments. Further, for multi-layer EXR saving, the existent of
a single unnamed render layer will omit the layer name from the EXR
channel full name, and only the pass, view, and channel ID will remain.
Finally, the Render Result to Image Buffer conversion now take he number
of channels into account, instead of always assuming color channels.

The patch implements the File Output node in the Realtime Compositor
using the aforementioned mechanisms, replaces the implementation of the
CPU compositor using the same Realtime Compositor implementation, and
setup the necessary logic in the render pipeline code.

Pull Request: https://projects.blender.org/blender/blender/pulls/113982
2023-12-13 11:08:03 +01:00
Philipp Oeser
105db1a06e Fix #115907: Select similar edge direction skips opposite direction
As I dont quite get the logic of "enforcing a positive quadrant" from
b38be905154b (which broke the previous behavior of 2.79 which was
capable of handling reversed edges as well -- there might be ways to
make that work though), now use the alternative approach of storing the
flipped direction in the kdtree as well.

This has a slight performance hit (only noticable at ~500k edges), but I
believe correctness beats performance here.

Pull Request: https://projects.blender.org/blender/blender/pulls/115951
2023-12-13 10:30:48 +01:00
Kenzie
3f485c8bf3 Geometry Nodes: add support for blackbody shader node
This adds the existing Blackbody shader node to geometry nodes, with the
same functionality.

Pull Request: https://projects.blender.org/blender/blender/pulls/114768
2023-12-13 10:10:06 +01:00
Omar Emara
23df139aaf IMB: Read single-layer XYZ channels as a combined image
Currently, the OpenEXR reader can't read single-layer XYZ images as a
combined image. Single-view images will only read the X channel, while
multi-view images will interpret the Z as a depth image and the Y and Z
channels will be treated as float passes.

This patch allows the reading of XYZ channels as combined images. For
single-view images, we just extend the RGB-like channel names we match
to contain XYZ. For multi-view images we only treat the Z channel as a
Depth one if no X and Y channels exists, since the Z in this case is
part of the XYZ image.

Pull Request: https://projects.blender.org/blender/blender/pulls/115290
2023-12-13 10:01:10 +01:00
Omar Emara
356480fabb Realtime Compositor: Add static cached images
The Realtime compositor currently relies on the GPU cache in image IDs.
That cache only supports single layer images, so multi-layer images will
be acquired without a cache, introducing significant IO bottlenecks for
the GPU compositor.

This patch ignores the image GPU cache and stores the images in the
static cache manager of the compositor. Draw data was introduced to the
image ID for proper cache invalidation, like other IDs such as masks.

The downside is that the cache will no longer be shared between EEVEE
and the compositor. But realistically, images are not typically shared
between materials and compositors.

This is just a temporary solution until we have proper GPU storage
support for image buffers.

Pull Request: https://projects.blender.org/blender/blender/pulls/115511
2023-12-13 09:50:42 +01:00
Campbell Barton
a56d0c700c Fix GHOST/Wayland handling of out-of-order time-stamps
From what I can tell time-stamps are supposed to be monotonic
however with LIBDECOR & GNOME click events after resizing the window
can cause this to happen.

Resolve by only considering the value wrapped when the new time-stamps
wrapped difference is less than the unwrapped difference.
Also skip wrapping when the current offset is closer to the current time
than it would be with the offset applied.
2023-12-13 14:58:58 +11:00
Campbell Barton
c9a810db58 WM: correct error printing for suspicious time-stamps
Future/past were swapped & include the literal uint64 value as it's
useful to know the invalid value when debugging.
2023-12-13 14:58:58 +11:00
Clément Foucault
4aff321af5 Fix: EEVEE-Next: Broken surfel lighting
This was caused by #113257 which removed the
simple ltc evaluation usage. This in turn
caused a precision issue for the cases where
V == N and surfel lighting was one of them.

Adding a special case fixes the issue.
2023-12-13 04:06:37 +01:00
Jesse Yurkovich
a7ed0e25ca USD: Apply MaterialBindingAPI to Curves with materials
For Curves having materials, make sure to apply the MaterialBindingAPI
to their prims during export.

Pull Request: https://projects.blender.org/blender/blender/pulls/116078
2023-12-13 03:07:29 +01:00
Clément Foucault
7f8763d823 Fix: EEVEE-Next: OpenGL errors in probe capture
Was caused by missing / incorrect bindings.
Reuse the same gbuffer setup for all deferred
layer to avoid this problem later on.
2023-12-13 02:47:40 +01:00
Clément Foucault
ac11ccd2bd EEVEE-Next: Add Translucent BSDF support
This adds support for Translucent BSDF.

This also fixes a bug to allow correct
shadowing.

The input normal had to be set back to
non-inverted in the node function to allow
for correct interpretation of the Normal
by Screen Space Reflections.

This add the necessary optimization
and code deduplication to hybrid deferred
and forward pipeline.

Pull Request: https://projects.blender.org/blender/blender/pulls/116070
2023-12-13 02:19:19 +01:00
Campbell Barton
7ad2c71a0a Cleanup: remove redundant clamp with BLI_str_utf8_offset_from_index 2023-12-13 12:14:47 +11:00
Campbell Barton
2d171aa612 Tests: ensure BLI_str_utf8_offset_from_index index is logically clamped
Callers to this function were clamping the index which isn't necessary.

Update doc-string & tests to reflect this.
2023-12-13 12:14:29 +11:00
Hans Goudey
768cd9b763 Cleanup: Remove inline functions and extra includes from draw extraction 2023-12-12 20:08:30 -05:00
Hans Goudey
79ade784b8 Cleanup: Move draw_manager_text.h to C++ 2023-12-12 19:49:26 -05:00
Clément Foucault
c1130ee782 Cleanup: EEVEE-Next: Avoid use of float math when needed 2023-12-13 01:17:00 +01:00