Commit Graph

105823 Commits

Author SHA1 Message Date
Jeroen Bakker
72d6ca3aff Vulkan: Fix Anisotropic Filtering Validation Error
When anisotropic filtering is enabled on a sampler its value must be
between 1 and 16. In blender it is possible to set a value lower than 1.
0 actually means that anisotropic filtering is disabled in Blender.
This would trigger a validation error in Vulkan.

Pull Request: https://projects.blender.org/blender/blender/pulls/117018
2024-01-11 11:12:35 +01:00
Jacques Lucke
a94146b82c Cleanup: move BKE_pointcloud.h to C++
Pull Request: https://projects.blender.org/blender/blender/pulls/116990
2024-01-11 10:54:47 +01:00
Andrew Oates
2e48712508 Fix #115829: Add Metal <-> OpenGL fallbacks for userpref
Starting with Blender 4.0, Blender refuses to load a userpref.blend file
that had been generated on a macoOS machine, exiting immediately with an
unsupported GPU error.  This is because when the userdef was written on
the macOS machine (assuming a recent version), it has gpu_backend set to
GPU_BACKEND_METAL (which is rejected).  The same is true in reverse.

Prior to commit cdb8a8929c there was a runtime fallback such
that the setting for Metal backend would be ignored on non-Metal
platforms.

This adds a check in blo_do_versions_userdef() for if gpu_backend is set
to an unsupported backend; if so, it is set to a default supported value
for the current platform (Metal on macOS, OpenGL otherwise).  This
replaces the current versioning check, as this isn't strictly related to
versioning.  The new logic handles the narrower versioning case (a macOS
user upgrading to 4.0+ with a userprefs selecting OpenGL) as well.

This should be future-proof for other GPU backends, as it only overrides
in the case of an unsupported value.  The logic could be generalized in
the future, perhaps.

Co-authored-by: Andrew Oates <andrew@andrewoates.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/116861
2024-01-11 09:30:34 +01:00
Campbell Barton
e904432a1f Fix #117015: Crash with subsurf mesh & loose edges in edit-mode
The result of bm_original_edge_get() was missing a null check,
all other callers check for null.
2024-01-11 18:19:20 +11:00
Campbell Barton
7a4f7a1d51 Cleanup: spelling in comments, comment blocks 2024-01-11 16:46:46 +11:00
Campbell Barton
d2c392dec6 Docs: add doc-strings for modifier mapping flags & edit-mesh cage 2024-01-11 14:07:36 +11:00
Campbell Barton
0c89e2d60e Fix #115169: Loop Cut overlay broken with Mirror Bisect Modifier
Oversight in [0] which assumed the cage meshes vertices were aligned
with the edit-mesh vertices which isn't always the case.

Check the cage mesh only has deformations applied before using it.

[0]: 29a338811c
2024-01-11 12:44:14 +11:00
Campbell Barton
d0359d066d UI: context menu support for changing menu & panel shortcuts
While the shortcuts would be shown for menus & panels,
there was no way to edit them from the context menu.

This was reported as a bug since moving "Undo History" from an operator
to a menu meant it was no longer possible to assign a shortcut from
the context menu.

Resolves: #97431.
2024-01-11 11:18:57 +11:00
Thomas Wilshaw
f79425fe82 Fix #116988: TIFF ignores compression type None
When saving an image as TIFF with compression type None, explicitly set
the OIIO ImageSpec attribute "compression" to "none" as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/117005
2024-01-11 00:56:40 +01:00
Brecht Van Lommel
eb747c5d20 Fix: invalid memory access in Hydra world and material export 2024-01-10 20:54:40 +01:00
Harley Acheson
4e0d604035 Fix #116950: Redraw Issues in Open Recent Previews
When drawing tooltips that include images the blend mode must be left
with GPU_BLEND_NONE, otherwise can interfere with later drawing. Also
slight refactor in that buttons with a custom tooltip function get a
"ui_tooltip_data_from-*" function like the other types.

Pull Request: https://projects.blender.org/blender/blender/pulls/117001
2024-01-10 20:34:52 +01:00
Brecht Van Lommel
7271f303fe Cleanup: make format 2024-01-10 20:34:30 +01:00
Thomas Barlow
2b9aa55a03 RNA: Remove bitmask from BoolAttributeValue.value
Bool attributes are treated as contiguous arrays of `bool` rather than
using a bitmask.

Using a bitmask also disables raw array access, and with raw array
access, the property is faster to access through the Python API with
bpy_rna.cc#foreach_getset.

Pull Request: https://projects.blender.org/blender/blender/pulls/116997
2024-01-10 20:30:19 +01:00
Dyvine57
eca14d5b40 Nodes: add int and bool to shader nodegroups
These are handled as floats by Cycles and EEVEE.

Pull Request: https://projects.blender.org/blender/blender/pulls/115026
2024-01-10 20:09:37 +01:00
Hans Goudey
ba4d7fc2d9 Cleanup: Continue loop to corner rename in some mesh code
Change mesh normals code and mesh topology map functions.
2024-01-10 13:12:22 -05:00
Harley Acheson
5680ea2986 Refactor: "Warning" -> "Confirm" for Custom Confirmations
As suggested by Campbell, this changes structure, variable, and
callback names to use "confirm" terminology rather than "warning"
for code related to custom confirmations.

Pull Request: https://projects.blender.org/blender/blender/pulls/116992
2024-01-10 18:41:42 +01:00
Omar Emara
cbb738191e Compositor: Redesign Sun Beams node for CPU
This patch ports the new GPU implementation of the Sun Beams node to the
CPU compositor. Introduced in 9e358fcd44.
2024-01-10 19:36:52 +02:00
Miguel Pozo
c08ba9b0bd FIx: EEVEE-Next: Forward SSS shader compilation 2024-01-10 18:35:00 +01:00
Michael Kowalski
e57c17ea6e Fix #93052: USD import: wrong varying interpolation conversion
Change to map the USD "varying" interpolation type to Blender's
"Corner" domain type when importing mesh attributes.  This fixes
value count mismatch errors when importing USD attributes with
varying interpolation.

Note that, for meshes, "varying" and "faceVarying" interpolation
are essentially the same in practice.

Pull Request: https://projects.blender.org/blender/blender/pulls/116955
2024-01-10 18:33:09 +01:00
Falk David
6f66e6e3ba GPv3: Python API: Add materials collection property
This adds the `object.data.materials` collection property to access the grease pencil materials.
2024-01-10 18:32:27 +01:00
Thomas Barlow
992ec6487b RNA: Add missing raw types for DNA types
RNA raw types were missing for the int8_t, uchar (uint8_t),
ushort (uint16_t), int64_t and uint64_t DNA types types.

This adds the missing RNA raw types for all DNA types that can have
raw access.

Functional Changes

Properties with one of the new unsigned raw types will raise a Python
OverflowError in foreach_getset when attempting to read a negative
integer from bpy_prop_collection.foreach_set(). This is similar to the
existing behaviour of providing a Python int which is too large to
represent as a C long. The existing foreach_getset code will print
the OverflowError and then raise a TypeError instead.

CPython's signed integer parsing functions accept numeric types that are
not the Python int instances by calling their __index__() method.
CPython's unsigned integer parsing functions, however, only accept
Python int instances. To make foreach_getset accept the same
numeric types for unsigned raw types as it already accepts for signed
raw types, the unsigned integer parsing functions in py_capi_utils.h
have been updated to also call the __index__() method when given an
argument which is not a Python int instance.

Because the new unsigned integer parsing in foreach_getset is using
the PyC_ family of functions, which perform their own overflow checks,
the existing signed integer parsing has also been updated to use the
PyC_ family of functions for signed integer parsing. Previously,
OverflowError would only have been raised when the parsed integer was
too large to fit in a C long. With this patch, OverflowError will be
raised whenever the parsed integer is too large to fit in the property's
raw type. Integer properties already have well-defined maximum and
minimum values which should fit within the property's raw type, and enum
properties have a fixed number of values they can take depending on
their items. The bigger change here, is that setting bool properties
which use PROP_RAW_BOOLEAN will now only accept 0/False and
1/True.

Now that PROP_RAW_CHAR parsing is using PyC_Long_AsU8,
signed char buffers ("b" format) have been updated to no longer be
considered compatible with PROP_RAW_CHAR, matching the behaviour of
the other unsigned types only being considered compatible with unsigned
buffer formats.

The int64_t and uint64_t types can currently only be used by bool
properties (see IS_DNATYPE_BOOLEAN_COMPAT and the other macros in
RNA_define.hh), but bool properties only have raw access when they do
not use a bitmask and it doesn't make much sense to use an entire 64
bits just for a single bool property, so PROP_RAW_INT64 and
PROP_RAW_UINT64 are expected to be unused.

Performance Changes

Providing raw types allows for faster access through
rna_access.cc#rna_raw_access, especially when a buffer compatible with
the property's raw type is passed through from
bpy_rna.cc#foreach_getset.

Before this patch, the bpy.types.Keyframe.handle_left_type property
did not have raw access, so foreach_getset would fall back to
PROP_RAW_INT being the compatible type and then use the slower loop in
rna_raw_access.

With this patch, the bpy.types.Keyframe.handle_left_type property has
raw access with the PROP_RAW_UINT8 type. Using a buffer compatible
with this raw type can use the faster memcpy loop in
rna_raw_access. Using a Python list will iterate the list into an
array whose type matches PROP_RAW_UINT8, which will also use the
faster memcpy loop in #rna_raw_access.

Pull Request: https://projects.blender.org/blender/blender/pulls/115761
RNA raw types were missing for the int8_t, uchar (uint8_t),
ushort (uint16_t), int64_t and uint64_t DNA types types.

This adds the missing RNA raw types for all DNA types that can have
raw access.

Functional Changes

Properties with one of the new unsigned raw types will raise a Python
OverflowError in foreach_getset when attempting to read a negative
integer from bpy_prop_collection.foreach_set(). This is similar to the
existing behaviour of providing a Python int which is too large to
represent as a C long. The existing foreach_getset code will print
the OverflowError and then raise a TypeError instead.

CPython's signed integer parsing functions accept numeric types that are
not the Python int instances by calling their __index__() method.
CPython's unsigned integer parsing functions, however, only accept
Python int instances. To make foreach_getset accept the same
numeric types for unsigned raw types as it already accepts for signed
raw types, the unsigned integer parsing functions in py_capi_utils.h
have been updated to also call the __index__() method when given an
argument which is not a Python int instance.

Because the new unsigned integer parsing in foreach_getset is using
the PyC_ family of functions, which perform their own overflow checks,
the existing signed integer parsing has also been updated to use the
PyC_ family of functions for signed integer parsing. Previously,
OverflowError would only have been raised when the parsed integer was
too large to fit in a C long. With this patch, OverflowError will be
raised whenever the parsed integer is too large to fit in the property's
raw type. Integer properties already have well-defined maximum and
minimum values which should fit within the property's raw type, and enum
properties have a fixed number of values they can take depending on
their items. The bigger change here, is that setting bool properties
which use PROP_RAW_BOOLEAN will now only accept 0/False and
1/True.

Now that PROP_RAW_CHAR parsing is using PyC_Long_AsU8,
signed char buffers ("b" format) have been updated to no longer be
considered compatible with PROP_RAW_CHAR, matching the behaviour of
the other unsigned types only being considered compatible with unsigned
buffer formats.

The int64_t and uint64_t types can currently only be used by bool
properties (see IS_DNATYPE_BOOLEAN_COMPAT and the other macros in
RNA_define.hh), but bool properties only have raw access when they do
not use a bitmask and it doesn't make much sense to use an entire 64
bits just for a single bool property, so PROP_RAW_INT64 and
PROP_RAW_UINT64 are expected to be unused.

Performance Changes

Providing raw types allows for faster access through
rna_access.cc#rna_raw_access, especially when a buffer compatible with
the property's raw type is passed through from
bpy_rna.cc#foreach_getset.

Before this patch, the bpy.types.Keyframe.handle_left_type property
did not have raw access, so foreach_getset would fall back to
PROP_RAW_INT being the compatible type and then use the slower loop in
rna_raw_access.

With this patch, the bpy.types.Keyframe.handle_left_type property has
raw access with the PROP_RAW_UINT8 type. Using a buffer compatible
with this raw type can use the faster memcpy loop in
rna_raw_access. Using a Python list will iterate the list into an
array whose type matches PROP_RAW_UINT8, which will also use the
faster memcpy loop in #rna_raw_access.

Pull Request: https://projects.blender.org/blender/blender/pulls/115761
2024-01-10 18:19:24 +01:00
Brecht Van Lommel
5cc0c0671e Fix: build error when not using unity build 2024-01-10 18:06:28 +01:00
Miguel Pozo
31d8a6514f Fix: EEVEE(Legacy): Broken dielectric material shading
sss_radius r and g are already used for occlussion workarounds.
Use only sss_radius.b for flagging sss as disabled.
Regression from 2942147079.
2024-01-10 17:59:20 +01:00
Miguel Pozo
f2bc8108ef Fix #116964: EEVEE(Legacy): Crash during render
Fix shader compilation.
Update and add missing functions pre-declaration.
2024-01-10 17:55:29 +01:00
Hans Goudey
66dc0ebf2e Fix #104926: Object Info node doesn't give negative scale
The previous behavior was giving a completely negated scale
if any of the object's original scale values was negative. Restore that
behavior here.

Pull Request: https://projects.blender.org/blender/blender/pulls/116989
2024-01-10 17:35:53 +01:00
laurynas
0d964f91a2 Curves: Add extrude operator
Adds extrude operator to new curves. Press key E in edit mode to invoke.
It works correctly on Bezier curves also, but result is weird as there is no
way to control Bezier handles interactively. Currently operator works the
same way as in old curves.

Algorithm idea is same as in https://archive.blender.org/developer/D15524

Pull Request: https://projects.blender.org/blender/blender/pulls/116354
2024-01-10 17:26:54 +01:00
Miguel Pozo
bbf1e506f8 Fix: EEVEE: Fix crash on start
Add missing function pre-declaration.
Partially fixes issue ##116964.
(Render no longer crashes, but shading is broken)
2024-01-10 16:30:50 +01:00
Miguel Pozo
0681d79611 Fix: EEVEE-Next: Crash on start
Regression from 93b3553697
eevee_sampling_lib is still needed for sample_cylinder
2024-01-10 15:53:37 +01:00
Jacques Lucke
522f9c9834 Volumes: improve tree access token api
There was one functional issue with the previous API which was its
use in `VolumeGrid<T>::grid_for_write(tree_token)`. The issue was
that the tree token had to be received before the grid is accessed.
However, this `grid_for_write` method might create a copy of the
`VolumeGridData` internally and if it does, the passed in `tree_token`
corresponds to the wrong tree.

The solution is to output the token as part of the method. This has two
additional benefits:
* The API is more safe, because one can't pass an r-value into the methods
  anymore. This generally shouldn't be done, because the token should
  live at least as long as the OpenVDB tree is used and shouldn't be freed
  immediatly.
* The API is a bit simpler, because it's not necessary to call the
  `VolumeGrid.tree_access_token()` method anymore.
2024-01-10 15:20:29 +01:00
YimingWu
991902cb28 GPv3: Subdivide operator
Subdiv operator for GP3 implemented using the new curves and array APIs.

Compared to the old one, this implementation added a "keep_shape" property
so we could take advantage of the improved `smooth_curve_attribute()` function.

Pull Request: https://projects.blender.org/blender/blender/pulls/116740
2024-01-10 15:16:30 +01:00
Omar Emara
9e358fcd44 Compositor: Redesign Sun Beams node
This patch redesigns the Sun Beams node. The old implementation produces
unexpected results with an arbitrary alpha channel, due to the use of a
step count normalization instead of a weighted normalization. The
quality is also questionable due to the use of nearest neighbour
interpolation as well as a low resolution integration.

This patches redesign the node to be a simple line integration towards
the source, limited by the maximum ray length. The sampling resolution
covers the entire path of the integration and the image is sampled using
bilinear filtering, producing smoother results. No alpha is introduced.

Pull Request: https://projects.blender.org/blender/blender/pulls/116787
2024-01-10 14:30:58 +01:00
laurynas
70fe812ef1 Curves: Add "As NURBS" option to draw tool
Add an option to output curves as NURBS instead of Bezier. The same
fitting algorithms are used. The only difference is that the drawing
result is a NURBS curve with Bezier knot mode, instead of a native
Blender Bezier curve.

Pull Request: https://projects.blender.org/blender/blender/pulls/116696
2024-01-10 13:59:59 +01:00
Campbell Barton
d9d9b12e79 Fix error in mirror modifier UI only checking X axis bisect 2024-01-10 23:45:07 +11:00
Campbell Barton
59dc67974a PyAPI: support returning non ID types when accessing Context.property
Previously accessing properties without an associated ID would return
None, even when the non-ID data was available.

Ref !116981
2024-01-10 23:43:29 +11:00
Clément Foucault
20ccaa9d67 Fix: EEVEE-Next: HiZ: Wrong specialization constant default value 2024-01-10 22:46:43 +13:00
Clément Foucault
baa7f15476 Cleanup: EEVEE-Next: Remove unused random noise in lightprobe_eval
This is not needed as we want a noiseless evaluation.
2024-01-10 22:46:43 +13:00
Clément Foucault
01eef7dc56 EEVEE-Next: Enable subgroup optimization on Metal
This doesn't seem to offer a lot of benefit but it is the
way it should be.

Other area could make use of this later and the
implementation could be supported at the gpu module level.
2024-01-10 22:46:42 +13:00
Clément Foucault
93b3553697 EEVEE-Next: Remove sampling_lib from ray_generate_lib
Avoid top level dependency.
2024-01-10 22:46:42 +13:00
Clément Foucault
b24591baed EEVEE-Next: Split lightprobe volume eval to its own file
Simple cleanup to reduce dependencies in code.
2024-01-10 22:46:42 +13:00
Aras Pranckevicius
19b33496b2 Tests: add IMB_transform tests
Related to PR #116628, ensure the behavior is covered by tests.

Pull Request: https://projects.blender.org/blender/blender/pulls/116959
2024-01-10 08:56:25 +01:00
Pratik Borhade
edd9b377dd Fix #116924: Sculpt undo crash and missing update
Crash is due to accessing higher index of 0 sized array. Fix this by
changing the size of vector.
Missing update seems to be due to wrong PBVH node flags and typo.

Pull Request: https://projects.blender.org/blender/blender/pulls/116935
2024-01-10 08:23:25 +01:00
Campbell Barton
5b9dcbdb8c Cleanup: remove use of scoped defer to ensure memory is freed
Using a single free call is simple and reduces the generated code side.
2024-01-10 14:21:04 +11:00
Campbell Barton
15843b46ab Fix #116854: context.property access crashes when properties have no ID
Missing checks in [0] which didn't account for UI properties without an
ID or failure to create the property path.

[0]: 6ba0346797
2024-01-10 13:46:22 +11:00
Campbell Barton
60e74d1ef7 UV: restore axis alignment support for Smart UV Project
Regression from porting "Smart UV Project" from Python to C
[0] which removed UV island alignment support.

Restore support by adding X/Y aligned rotation to UV pack. Vertical axis
alignment is the default for smart project matching previous behavior.

Resolves #116355.

[0]: 850234c1b1
2024-01-10 12:31:38 +11:00
Campbell Barton
7dce0d7768 Cleanup: suppress invalid warning from GCC 2024-01-10 10:10:47 +11:00
Campbell Barton
65b82c617a Cleanup: use colon after doxygen parameters 2024-01-10 10:04:14 +11:00
Campbell Barton
7020b33e14 Cleanup: remove outdated comment 2024-01-10 10:04:13 +11:00
Campbell Barton
e1f04aee4b PyAPI: remove code for Python 3.10 2024-01-10 10:04:10 +11:00
Campbell Barton
4d9063739c Cleanup: use RNA_STACK_ARRAY define, avoid extra loop 2024-01-10 10:01:40 +11:00
Campbell Barton
edfc566ab9 Unbreak debug build 2024-01-10 10:00:38 +11:00