Numerical instability mainly comes from adding values together which have very
different magnitude. There are algorithms to keep the error small like "Kahan
Summation", however those are also slower because of additional code in the hot
loop. This patch implements a simpler approach that is slightly less accurate,
but still seems to solve the cases that people commonly run into while being
simpler and faster. The approach is to simply compute a couple partial sums
first, and to add those up in the end. The individual partial sums can also be
computed in parallel. Care has to be taken to maintain determinism with floating
point values.
If accuracy is still not enough for some use cases, we can revisit this later
and e.g. use doubles or a better summation algorithm.
Pull Request: https://projects.blender.org/blender/blender/pulls/132759
This uses the following accessor methods in more places in more places:
`is_group()`, `is_group_input()`, `is_group_output()`, `is_muted()`,
`is_frame()` and `is_reroute()`.
This results in simpler code and reduces the use of `bNode.type_legacy`.
Pull Request: https://projects.blender.org/blender/blender/pulls/132899
Using the `BKE_id_owner_get` during the node tree update can avoid having to
iterate over lots of data-blocks in common cases. Previously, the code had to
iterate over all potential owners of node group to find the correct one.
Pull Request: https://projects.blender.org/blender/blender/pulls/132903
Using `CLOG_INFO` and then reporting critical error is not very coherent,
nor practical, since INFO messages are not even displayed by default in
the console.
`object_is_paint_mode()` returns true for objects that are not in active
interaction mode. This results in drawing of overlays for each Grease
Pencil object. Now fixed with adjusted condition.
Pull Request: https://projects.blender.org/blender/blender/pulls/132159
When calling bpy.utils.expose_bundled_modules(), these modules are
added to sys.path.
This provides a solution/workaround to two problems:
* Using bpy together with packages like usd-core is problematic. Besides
crashing due to C++ symbol conflicts, it's just impossible to import
different versions of the same module, or to have distinct environment
variables for both. (#127132)
* Blender add-ons using these VFX modules do not currently work with
the bpy module.
This adds about 15MB to the bpy package.
Pull Request: https://projects.blender.org/blender/blender/pulls/133082
The newly added "tangent_pair" calculation functions meant the names
didn't read well in some cases, use this style of naming for clarity:
- BM_face_calc_tangent_from_*
- BM_face_calc_tangent_pair_from_*
It was possible two quads at right-angles to each other would accumulate
a "tangent" that was co-linear with the it's normal.
Resolve this by calculating two tangents for each face, then using the
accumulated tangent that's least co-linear with the accumulated normal.
Normalize the calculated values in createSpaceNormalTangent in
preparation for additional error checks that require the values
to be normalized earlier on.
- createSpaceNormalTangent now normalizes the resulting normal & plane.
- createSpaceNormalTangent_or_fallback has been added that initializes
the matrix even if the tangent or normal aren't usable
(this was previously being done inline).
- createSpaceNormalTangent now returns false if the final tangent
is zero length (this was previously unlikely but possible).
- Remove redundant vector normalize calls.
- Use "r_" prefixed return arguments, order them last.
Cleanup and enhance our export of the USD `extent` attribute.
This does the following:
- The existing `author_extents` function now uses recently added common
code to write out the extents attribute
- A new `author_extents` overload allows the use of Blender's native
bounds for the types that support it. We now use this rather than
asking USD to recompute it for us.
- Meshes will now have their extents correctly written during animations
- Curves will now have their extents written as they were not doing so
prior to this PR
- Hair, Lights, Points, and Volumes make use of the `author_extents`
functions now
Since Curves need their extents tested, this PR also moves the test from
C++ to Python. Python tests allow for faster iteration, are more
straightforward to write, and allow usage of the USD validator.
Pull Request: https://projects.blender.org/blender/blender/pulls/132531
- Support a null "subfolder_name" argument
in keeping with the rest of BLI_appdir functions.
- Use "test_path" utility to de-duplicate path joinging & checks,
this also means the paths will be logged.
- De-duplicate loop body for the last item.
The MSVC 2022 optimizer generates bad code for perlin_fractal_distorted
when perlin_fbm gets inlined leading to incorrect results and failing
tests that rely on perlin noise. For now just disable inlining for this
function for msvc2022 until we can get the compiler fixed.
This fixes the following failing tests on MSVC 2022:
- geo_node_curves_deform_curves_on_surface
- geo_node_geometry_delete_geometry_propogate_corner_attribute
- geo_node_utilities_field_on_domain_demo
Pull Request: https://projects.blender.org/blender/blender/pulls/133130
Mesh Edit Mode / Mesh Menu / Normals / Point to Target... operator
shows keymap entries on the area header and in the status bar. This PR
removes the area header drawing and improves the Status bar using the
current pattern, including showing statuses with reversed items.
Pull Request: https://projects.blender.org/blender/blender/pulls/131586
Allow user to remove the preview of an asset from the asset browser details region.
Additionally, user can now reuse the default icons after adding a preview.
Pull Request: https://projects.blender.org/blender/blender/pulls/132575
Asset shelves provide the `STORE_ENABLED_CATALOGS_IN_PREFERENCES` option in BPY
to decide if the enabled catalogs should be stored in the preferences or in the
asset shelf itself. Depending on the use case of the asset shelf one might make
sense over the other.
The brush asset operator to save changes would always activate a new catalog in
all asset shelves using storage in the preferences, ignoring the option. This
becomes more of an option if the code is reused, as proposed in
blender/blender!132857.
This replaces a `GHash` with `Map<blender::StringRefNull, BHead *>` which
simplifies using the type. Additionally, this patch also removes
`USE_GHASH_BHEAD` which not seem like it's worth having it nowadays (it was
always enabled anyway and I have never seen anyone disable it).
Pull Request: https://projects.blender.org/blender/blender/pulls/133057
The code relied on `disable_depth_test` to render without depth testing
on selection, but it was set at pre-draw, so it was always false when
calling `res.select_bind` inside the sync code.
There was also no code to tell in-front and regular objects apart, so
in-front objects were not prioritized.
The previous engine seemingly divided the depth of In Front objects by
100, so I'm reproducing the same behavior here.
Fix#131981Fix#132995
Pull Request: https://projects.blender.org/blender/blender/pulls/133020
When converting mesh to grease pencil, different face materials should
also be converted to grease pencil ones. This now works by converting
viewport display color diffuse_color from the mesh material to grease
pencil material fill color. Notes:
- If there are empty material slots in the mesh, faces assgined to these
material slots will be assgined to a new fallback white material in
the converted grease pencil fills.
- If original mesh does not have any material slots, a white material
will be created in the grease pencil object for the fills.
- If original mesh has multiple material slots of the same material,
they would be reduced to one material slot in the converted fills.
Pull Request: https://projects.blender.org/blender/blender/pulls/133087
This patch adds support to apply a pose asset to multiple armatures in pose mode at once.
In case there is a suitable slot for the armature, it will be used to read from, otherwise
the system falls back to slot 0.
Part of #131840
Pull Request: https://projects.blender.org/blender/blender/pulls/132601
This PR renames `bpy.types` that contain `Sequence` (and refer to a strip) to `Strip`.
The `bpy.types.Sequence` has already been renamed to `bpy.types.Strip` in
a previous PR. See !132179.
Additionally, this PR does some cleanup renamings in the sequencer
RNA files (e.g. `sequence` -> `strip`).
Part of #132963.
Pull Request: https://projects.blender.org/blender/blender/pulls/133054
One should be able to set the modifier `Highest` value lower then the
`Lowest`, in fact this is probably the more common usecase (getting high
values in the vertexgroup when something is close by and getting lower
values the further away from the target we get).
Now change code so we do exactly like we do for meshes.
NOTE: for grease pencil (as opposed to meshes), the Vertex Weight
Proximity modifier has a button to flip the output values, this can
probably stay for convenience.
Stumbled over this checking on #133055
Pull Request: https://projects.blender.org/blender/blender/pulls/133092
If I read code correctly, at least offset/translation and scale happen
in the Curve domain only in GPv3, so having vertexgroups influence per
point does not really make sense for this modifier.
Therefor, remove the influence vertexgroup from this modifier.
Pull Request: https://projects.blender.org/blender/blender/pulls/133102
Support differentiating between portable & system installations,
useful to properly locate relative paths which would not work
on system installations.
Ref !133143
Clarify the meaning `bpy.app.version_file`, by being more explicit in the
description of `bpy.app.version` and their differences.
### Old:
`bpy.app.version`
: The Blender version as a tuple of 3 numbers. eg. (2, 83, 1)
`bpy.app.version_file`
: The Blender version, as a tuple, last used to save a .blend file, compatible with ``bpy.data.version``. This value should be used for handling compatibility changes between Blender versions
### New:
`bpy.app.version`
: The Blender version as a tuple of 3 numbers (major, minor, micro). eg. (4, 3, 1)
`bpy.app.version_file`
: The Blender File version, as a tuple of 3 numbers (major, minor, file sub-version), that will be used to save a .blend file. The last item in this tuple indicates the file sub-version, which is different from the release micro version (the last item of the `bpy.app.version` tuple). The file sub-version can be incremented multiple times while a Blender version is under development. This value is, and should be, used for handling compatibility changes between Blender versions
Pull Request: https://projects.blender.org/blender/blender/pulls/133142
This fixes a rendering issue when local read enabled.
Before fix, the output image is too bright. This is due to incorrect load/store.
With this fix, the logic for attachment load/store ops with local_read on matches the logic with local_read off inside subpass_transition_impl...
Pull Request: https://projects.blender.org/blender/blender/pulls/133111
Regression in [0] that clamped the shape-key index when exiting
edit-mode but not when entering, causing the "Basis" shape not to
be treated as active when entering edit-mode, then treated as active
when exiting - overwriting it's values from the mesh.
Resolve by clamping on edit-mode enter & exit.
[0]: 225e3460d0
On Mac we can now pick colors from outside Blender windows, but this
requires pressing the "Enter" key. This PR just changes the status bar
so that on Mac OS it shows this information to the user.
Pull Request: https://projects.blender.org/blender/blender/pulls/133120
Have `eyedropper_color_sample_fl` return success, in case platform
sampling starts but is canceled (Async return on MacOS). Removes any
chance of returning black color on failures.
Pull Request: https://projects.blender.org/blender/blender/pulls/133124