This was caused by the 2 transmission event approximation we
do for object with non-null thickness. This follows cycles
by using the square root of the color.
Caused by bace4c9a29 which only
extracted normals at face corners. Solve by also extracting loose edge and
loose vertex normals. And change the BMesh extraction to not use the
face iteration of the MeshExtract system, just because that's simpler.
A unit test file was still using `out`, short for 'output', which was the
original name for what later became 'binding'. This is now updated, and
the variables are now named appropriately.
Pull Request: https://projects.blender.org/blender/blender/pulls/121273
Add an RNA enum property `AnimData.animation_binding` that lists all the
bindings available in `AnimData.animation`.
The list of bindings is filtered to only contain the bindings suitable
for the animated ID. This prevents assigning a 'camera' binding to a
mesh.
Un-assigning is done via an operator, represented as an 'X' button in
the interface.
The enum property contains up to two special items:
- "New" to create a new binding for the ID.
- "(none/legacy)" to indicate that this ID doesn't have a binding
assigned. This one is conditional, and only appears when it is
necessary.
These two special items are experimental, and mostly exist because we're
still evaluating things and building a better UI. It is intended that
the binding selector will become as close to the ID selector as
possible.
-----------
Note that this PR also contains #121268 as it builds up from that one, and I didn't want to wait with testing on the buildbot until that one lands.
The new Baklava panel:

Pull Request: https://projects.blender.org/blender/blender/pulls/121269
Rename "Move" to "Create" to match object collections operator and
because it is the first action performed right after.
Plus it is arguably the action with the most impact of the two.
Blender crashes when a File Output was created when the Use Preview
option of the render output settings was enabled. This is a regression
introduced in 931c188ce5, where the image format of the node was
initialized from the scene image settings, so the preview option was
carried over, yet it is not supported nor exposed to the user in the
File Output node. To fix this, ensure the file output code will ignore
previews.
Refuse to set the RNA property `AnimData.animation_binding_handle` when
`AnimData.animation` is nil.
When in a hypothetical future `AnimData.animation` would be set, the
binding handle would be ignored anyway, as it's only meaningful within
the context of a known animation. Refusing to set the binding handle in
cases where it is known to be meaningless may help to find bugs in
Python scripts.
Pull Request: https://projects.blender.org/blender/blender/pulls/121268
Implements another phase of #116901, this time for the `lines` and
`lines_loose` index buffers that store indices for wireframe drawing.
The key improvement is removing loose edge's dependency on the main
edge index buffer. That means for the majority of meshes with no loose
edges, edge index extraction can be completely skipped. Even when there
are loose edges, only the loose edges need to be extracted with
wireframe turned off.
Besides that improvement, there are more changes to use data-oriented
code with visible hot loops instead of the virtual function call design
used for the existing mesh extractor system. For this step I completely
replaced the `extract_lines` object, which is in line with the general
plan for this area.
Additionally, hidden edge filtering is done ahead of time using several
`IndexMask` operations. This means only indices for visible edges need
to be uploaded to the GPU, and no restart index stripping needs to be
performed on macOS.
On my usual test file with 1.9 million vertices, I observed an
improvement from 26 to 33 FPS with wireframe off, and from 9.15 to 9.5
FPS with wireframe on.
Pull Request: https://projects.blender.org/blender/blender/pulls/120720
A version of "Align Euler to Vector" with the rotation socket
instead of the vector Euler socket. Other than that, and a few
cleanups to use newer math functions, the node is the same.
The old node is just "Deprecated" for now. We could remove
it with versioning, but we can also wait to do that.
In a simple test this node is about 1.7 times faster than the old one.
Pull Request: https://projects.blender.org/blender/blender/pulls/118565
This cleans up some of the Animation/Binding API, and adds a distinction
between a binding's "name" and its "display name".
`name`: internal name that is unique within the `Animation`. As such, it
is also the key into the `anim.bindings` collection.
- To ensure the uniqueness, `name` is always prefxed with the ID
identifier, like `OBCube` and `CACamera`.
- A binding that was not created to animate a specific ID will be
called `XXBinding`.
`name_display`: display name that strips the first two characters, so in
the above examples would be `Cube`, `Camera`, and `Binding`.
### RNA setter behaviour
`name`: always sets the name, emitting a warning when the name's prefix
doesn't match the ID type of the Binding. This implicitly changes the
display name (as they are two views into the same string).
`name_display`: sets `name = prefix_for_ID_type + name_display`. So even
when the old name was `QQSomethingWeird`, setting `binding.name_display
= "NewName"` would effectively set `binding.name = "OBNewName"`
(assuming it was already bound to some object earlier).
Bindings now also **always have a name**. Previously it was possible to
create bindings named `""`, but that's no longer possible.
Bindings used to be **renamed automatically** when they were first
assigned, for example from `XXBinding` to `OBCube`. This behaviour has
been removed, as it could potentially cause confusion.
Pull Request: https://projects.blender.org/blender/blender/pulls/120941
The fix here is simple: we ignore the alpha channel in the bone theme
colors, setting it unconditionally to fully opaque. This is correct
because conceptually the bone theme colors are just RGB, not RGBA,
and the alpha channel doesn't always get set consistently.
Pull Request: https://projects.blender.org/blender/blender/pulls/121256
No functional changes expected.
This PR extracts the `IndexRange` of the `BeztMap` span and its `size()` call out
of the sorting loop. Doing this removes one `if` condition within the loop and gives a
small performance boost.
(Before: 0.93ms, After: 0.65ms average run of `sort_time_beztmaps`)
Pull Request: https://projects.blender.org/blender/blender/pulls/121267
No functional changes.
The enum entries of `BakeCurveRemove` used to
start with `REMOVE` which just doubled that word.
Removing that simplifies the enum entries.
This has been brought up by @dr.sybren in #120984
Pull Request: https://projects.blender.org/blender/blender/pulls/121258
The compositor used to have a feature that would calculate tiles for the viewer based on a custom order. Since the removal of the tile based compositor, this code is unused.
Pull Request: https://projects.blender.org/blender/blender/pulls/121176
No functional changes.
This PR moves the following public functions to animrig:
* sample_fcurve_segment
* bake_fcurve
* bake_fcurve_segments
The `bake_fcurve_segments` also gets a docstring and its comments have been
updated to follow the style guide.
Pull Request: https://projects.blender.org/blender/blender/pulls/120984
The guard clauses elsewhere in the function clearly indicate that
`r_driven` should be passable as a nullptr if the caller doesn't need
it, but there is one place where the guard clause was missing.
Discovered while working on #120936.
Pull Request: https://projects.blender.org/blender/blender/pulls/121253
`PROP_ICONS_CONSECUTIVE` is set for `use_onion_skinning` property with the
help of `RNA_def_property_ui_icon`. In this case, `but->iconadd` will
handle the other icon for "toggle" button types. So just use
`ICON_ONIONSKIN_OFF` when drawing the onion skinning button in dopesheet.
Resolves#121232
Pull Request: https://projects.blender.org/blender/blender/pulls/121254
Resolves offset error when building index buffers on device for
cuves/hair strips using Triangles instead of TriangleStrips.
Authored by Apple: Michael Parkin-White
Pull Request: https://projects.blender.org/blender/blender/pulls/121218
This is a performance improvement when moving a bunch
of keys on the same `FCurve` in heavy scenes.
When moving keys in such a way that the `BezTriple` array of the FCurve
has to be sorted, the pointers of `TransInfo` also have to be updated.
This used to happen by doing a nested loop over all `BeztMap` and all `TransData2D`.
There was a bit of optimization with the
`blender::Vector<bool> adjusted` which stored if a `TransData2D` has been fixed yet.
But in general the complexity was still `BeztMap.size() * TransData.size()`.
There are two optimizations that can be done here.
* Skip any BeztMap if `old_index == new_index`.
If the Key is not going to move any pointers to it will still be valid.
* Use a `Map<float *, int>` built beforehand to quickly get
the `TransData2D` that needs updating instead of searching.
The `int` in this case is the index to the `TransData2D` array.
Doing this reduces the complexity to `BeztMap.size() + TransData.size()`.
Measurements of `beztmap_to_data`
| - | Before | After |
| - | - | - |
| Moving 1 key of 1 FCurve | ~24000 ns | ~5800ns |
| Moving ~1000 keys of 1 FCurve | 17ms | 0.02ms |
Measurements of `remake_graph_transdata`
| - | Before | After |
| - | - | - |
| Moving 1 key of 279 FCurves | 290ms | 22ms |
| Moving ~300 keys of 279 FCurves | 82 **SECONDS** | 80ms |
Test file used
https://download.blender.org/ftp/sybren/animation-rigging/heavy_mocap_test.blend
The deeper technical explanation.
`TransInfo` has an array of `TransData`.
`TransData` has pointers to the float arrays of a `BezTriple`.
The `BezTriple` array is sorted by swapping data,
meaning the `TransData` will now point to the wrong data in the array.
This has to be updated and we can do that by using the `BeztMap`.
This is all under the assumption that `BeztMap` is sorted in the exact
same way as `BezTriple` otherwise this method will fail.
But by doing it the same way, we can know at which
index the `BezTriple` is before and after sorting.
Now we just need to find the corresponding `TransData`.
That can be done by comparing pointers. The `BeztMap` stores the
`BezTriple` it represents and from it we can
get the pointers to its `vec` 0, 1 and 2. (key and handles)
Pull Request: https://projects.blender.org/blender/blender/pulls/120816
On windows the OpenGL backend of the UHD630 driver (but could also be other
GPUs that use the same driver) reports of supporting `GL_ARB_multi_bind`.
But when enabling it can result in incorrect bindings and report errors
about unsupported internal texture formats. These are internal driver issues.
Might also fix#107642 as it shows the same error message. EEVEE-Next
relies more on using the same binding slot for the same texture in order
to reduce actual bindings which makes this more prominent.
Pull Request: https://projects.blender.org/blender/blender/pulls/121062
This changes the menu switch socket to use the socket-items system
(`NOD_socket_items.hh`) that is already used by the simulation zone, repeat
zone, bake node and index switch node. By using this system, the per-node
boilerplate can be removed significantly. This is especially important as we
plan to have dynamic socket amounts in more nodes in the future.
There are some user visible changes which make the node more consistent with
others:
* Move the menu items list into the properties panel as in 0c585a1b8a.
* Add an extend socket.
* Duplicating a menu item keeps the name of the old one.
There is also a (backward compatible) change in the Python API: It's now
possible to directly access `node.enum_items` and `node.active_index` instead of
having to use `node.enum_definition.enum_items`. This is consistent with the
other nodes. For backward compatibility, `node.enum_definition` still exists,
but simply returns the node itself.
Many API functions from `NodeEnumDefinition` like
`NodeEnumDefinition::remove_item` have been removed. Those are not used anymore
and are unnecessary boilerplate. If ever necessary, they can be implemented back
in terms of the socket-items system.
The socket-items system had to be extended a little bit to support the case for
the menu switch node where each socket item has a name but no type. Previously,
there was the case without name and type in the index switch node, and the case
with both in the bake node and zones. The system was trivial to extend to this
case.
Pull Request: https://projects.blender.org/blender/blender/pulls/121234
This fixes an issue with the error messages that keying
can produce where they couldn't be translated.
To make translation possible, two things changed:
* use of `RPT_`
* simplified string formatting
Pull Request: https://projects.blender.org/blender/blender/pulls/121112
This integrates the functionality for `parallel_for_weighted` from 9a3ceb79de
into `parallel_for`. This reduces the number of entry points to the threading
API and also makes it easier to build higher level threading primitives. For
example, `IndexMask.foreach_*` may use `parallel_for` if a `GrainSize` is
provided, but can't use `parallel_for_weighted` easily without duplicating a
fair amount of code.
The default behavior of `parallel_for` does not change. However, now one can
optionally pass in `TaskSizeHints` as the last parameter. This can be used to
specify the size of individual tasks relative to each other and relative to the
grain size. This helps scheduling more equally sized tasks which generally
improves performance because threads are used more effectively.
One generally does not construct `TaskSizeHints` manually, but calls either
`threading::individual_task_sizes` or `threading::accumulated_task_sizes`. Both
allow specifying individual task sizes, but the latter should be used when the
combined size of consecutive tasks can be computed in O(1) time. This allows
splitting up the work more efficiently. It can often be used in conjunction with
`OffsetIndices`.
Pull Request: https://projects.blender.org/blender/blender/pulls/121127
On this level it makes sense to have a single `add_item` function
because the operator does not take any parameters. It's also
mostly the same for different kinds of socket items except
for one line.
This requires adding a destructor and deleting move and copy assignment
for SculptSession, because (for now at least) we want to keep the PBVH
as an opaque type (though with one exception for including pbvh_intern.hh
in paint.cc for the SculptSession destructor).
Pull Request: https://projects.blender.org/blender/blender/pulls/121227
Make the recently added option descriptions a bit more consistent with
each other.
Small layout change to not have so much spacing between the 2 related
export options and move them under the existing options.
Pull Request: https://projects.blender.org/blender/blender/pulls/121198
This has some benefits:
* Nodes with dynamic socket amounts can remain more self-contained
(2 fewer files to edit with this patch).
* It's easier to reuse existing C++ code, reducing redundancy.
One new thing I'm doing here is to define operators in node files. It seems
reasonable to register operators that belong to a node together with that
node. Without this, code spreads out further than necessary without any real benefit.
This patch affects the simulation zone, repeat zone, bake node and index switch node.
The UI is slightly affected too. Since we had the UI defined in Python before,
it wasn't possible to integrate it into the node properties panel. That is possible
now and looks better anyway. The previous UI was an artifact of technical limitations.
Pull Request: https://projects.blender.org/blender/blender/pulls/121178
PR #118581 changed strip text color to be the same as active strip
theme outline, which been widely regarded as a bad move. Revert
text color to white just like it was before.