Move the selection flag for pose bones, from the (edit)bone to the
pose bone.
Previously having multiple instances of armatures in pose mode at the
same time caused issues because selecting a pose bone on one armature
would automatically select it on all instances of it.
This is now fixed since the selection state is stored on the pose bone
(Object level) Doing so breaks API compatibility with 4.5 since the
RNA property on the Bone no longer affects the pose bone. Instead,
there is a new property on the pose bone for that.
Due to this change, some runtime flags for the transform system also
had to be moved to the pose bone. This is due to the fact that these
flags are used by the transform system to pass information between
functions. If we keep the flag at the bone level, this wouldn't work
with armature instances. See `bPoseChannelRuntimeFlag`
Fixes#117892
Pull Request: https://projects.blender.org/blender/blender/pulls/146102
Add a new constraint called "Geometry Attribute", which directly
samples vector, quaternion, or 4x4 matrix attributes from geometry and
applies these to an object's or bone's transform.
This can be used to transfer data generated by geometry nodes to the
object or bone level. By default the constraint will sample a vector
on the vertex domain. The default attribute is `position` for
simplicity, but the attribute value does not have to have anything to
do with neither the transform of the geometry object nor the geometry
itself.
Pull Request: https://projects.blender.org/blender/blender/pulls/136477
Support sync selection in the UV editor, with face-corner selection,
so it's possible to select individual UV vertices/edges in the UV editor
without UV's attached to the same underlying edge also becoming selected.
There is limited support for maintaining the UV selection when selecting
from the 3D viewport, common operations such as picking &
box/circle/lasso select support this, however other selection operations
such as "Select Random" or "Select Similar" will clear this data,
causing all UV's connected to selected mesh elements to become selected.
We may add support for additional operators as needed.
Details:
- UV Sync Selection is now enabled by default.
- In edit-mode the UV selection is stored in BMLoop/BMFace which are
written to custom-data layers when converted to a Mesh.
- To avoid unnecessary overhead - this data is created on demand.
Operators may clear this data - selecting all or none do so,
as there is no reason to store this data for a uniform selection.
- The Python API includes functions to synchronize the selection to/from
UV's as well as flushing based on the mode.
- Python scripts that manipulate the selection will either need to clear
this synchronized state or maintain it.
See:
- Design task: #78393.
- Implementation task: #131642.
Ref !138197
Add a function `bpy.data.file_path_foreach()` with a callback function
`visit_path_fn`:
```py
def visit_path_fn(
owner_id: bpy.types.ID,
file_path: str,
_meta: typing.Any,
) -> str | None:
return file_path.replace('xxx', 'yyy') or None
bpy.data.file_path_foreach(
visit_path_fn,
*,
subset=None,
visit_types=None,
flags={},
)
```
When the function returns `None`, nothing happens. When it returns a
string, the reported file path is replaced with the returned string.
`subset` and `visit_types` have the same meaning as `subset` resp.
`key_types` in `bpy.data.file_path_map()`. Since the latter parameter
doesn't affect keys in a map, but rather the visited ID types, I named
it `visit_types` instead.
`flags` wraps most of `eBPathForeachFlag` as `set[str]`, with their
prefixes removed. `BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN` becomes
`RESOLVE_TOKEN`, etc. `BKE_BPATH_FOREACH_PATH_ABSOLUTE` is excluded,
as it only affects a field in the C++ callback structure that is not
passed to Python at all. If it turns out to be useful at some point,
we can always add it.
`_meta` is for future use, and is intended to give metadata of the
path (like whether it's an input or an output path, a single file or
the first file in a sequence, supports variables, etc.). By adding
this to the API now, we avoid a breaking change when this feature is
actually implemented.
Design task: #145734
Pull Request: https://projects.blender.org/blender/blender/pulls/146261
Instead of modifying the active mesh in place, which means we can't
use the size of its data arrays when copying its data, and its caches
are immediately invalidated, copy data to a separate out-of-main
result mesh first. The only downside is that for a moment during
the operator the shape key array sizes will be out of sync with the
mesh size.
Also the custom data for multires layers wasn't copied properly
after the recent refactor that rewrote this code. Take the opportunity
to fix that too.
The motivation for this change is an improvement to copy different
kinds of custom normals properly to the joined mesh, which never
worked since free custom normals were introduced.
This contains a few changes to the expected results in the tests.
Those are edge cases, and the new results make more sense.
Adjust various unit tests so that they no longer use the legacy Action
API (which was deprecated in Blender 4.4 and will be removed in 5.0).
No functional changes.
This is part of #146586
Pull Request: https://projects.blender.org/blender/blender/pulls/147060
Crash seems to happen due to parallelized access of data in liboverride
diffing code (presumably when a same linked data is used as reference
for several local liboverrides?).
Since there is zero reason to actually create IDGroup properties there
(it's actually fairly bad, also adding useless overhead and trash data
in system IDProperties), add a new API to access a Pointer PropertyRNA,
`RNA_property_pointer_get_never_create`, which ensures that the call
never creates data, and simply returns `PointerRNA_NULL` instead.
Also reverts abd683fcb5 and re-enable liboverride unittests.
NOTE: This only addresses the case from the report, the current behavior
of `RNA_property_pointer_get` is simply wrong and needs to be rethought.
This is not a simple change though most likely. See also #147072.
Pull Request: https://projects.blender.org/blender/blender/pulls/146990
The motivation is to keep backward compatibility after deprecating
`material.use_nodes()` and `world.use_nodes`. For example the
following script would behave the same way in 4.5 and 5.0:
```python
mat = bpy.data.materials.new("My new mat")
mat.use_nodes = True
```
Pull Request: https://projects.blender.org/blender/blender/pulls/147052
The sequencer scene was set to the active scene in the window
in all cases. This is not great because we really only expect
the sequencer scene to be assigned when it was used.
The fix changes the versioning code to ensure that
1) The window has any VSE open.
2) The active scene uses an `Editing` struct (e.g. the user created
strips, or interacted in some way with the VSE).
This also changes back the test that checks for the usages
of IDs. Before this test had to include the workspace for
the default scene. Now this scene is no longer used
by the workspace, because the versioning that sets
the sequencer scene is no longer run.
Pull Request: https://projects.blender.org/blender/blender/pulls/147044
The changes:
1. Add `group_name` to the `channelbag.fcurves.new()` and
`action.fcurve_ensure_for_datablock()` RNA functions.
2. Add `anim_utils.action_ensure_channelbag_for_slot(action, slot)`.
3. Add `channelbag.fcurves.ensure()` RNA function.
This makes it possible to replace this legacy code:
```py
fcurve = action.fcurves.new("location", index=2, action_group="Name")
```
with this code:
```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.new("location", index=2, group_name="Name")
```
or replace this legacy code:
```py
fcurve = action.fcurves.find("location", index=2, action_group="Name")
if not fcurve:
fcurve = action.fcurves.new("location", index=2, action_group="Name")
```
with this code:
```py
channelbag = action_ensure_channelbag_for_slot(action, action_slot)
fcurve = channelbag.fcurves.ensure("location", index=2, group_name="Name")
```
Note that the parameter name is different (`action_group` became
`group_name`). This clarifies that this is the name of the group, and
not a reference to the group itself.
This is part of #146586
Pull Request: https://projects.blender.org/blender/blender/pulls/146977
Each name has to be unique within a group, so when renaming an idproperty, one
has to make sure that the parent group does not contain duplicates afterwards.
This patch raises a `NameError` when setting the name to one that exists
already. Alternatively, one could delete the already-existing property, but that
seems unexpected and the user should rather do that explicitly.
This also adds a new unit test for this case.
Pull Request: https://projects.blender.org/blender/blender/pulls/146892
Applies thin film iridescence to metals in Metallic BSDF and Principled BSDF.
To get the complex IOR values for each spectral band from F82 Tint colors,
the code uses the parametrization from "Artist Friendly Metallic Fresnel",
where the g parameter is set to F82. This IOR is used to find the phase shift,
but reflectance is still calculated with the F82 Tint formula after adjusting
F0 for the film's IOR.
Co-authored-by: Lukas Stockner <lukas@lukasstockner.de>
Co-authored-by: Weizhen Huang <weizhen@blender.org>
Co-authored-by: RobertMoerland <rmoerlandrj@gmail.com>
Pull Request: https://projects.blender.org/blender/blender/pulls/141131
This PR enables strip curve drawing when performing the workbench
rendertests. On Intel/vulkan the lines are to far off. Using strip will
reduce platform differences. Downside is that (basic) line rendering is not
covered anymore by a render test.
Pull Request: https://projects.blender.org/blender/blender/pulls/146820
This adds support for packed linked data. This is a key part of an improved
asset workflow in Blender.
Packed IDs remain considered as linked data (i.e. they cannot be edited),
but they are stored in the current blendfile. This means that they:
* Are not lost in case the library data becomes unavailable.
* Are not changed in case the library data is updated.
These packed IDs are de-duplicated across blend-files, so e.g. if a shot
file and several of its dependencies all use the same util geometry node,
there will be a single copy of that geometry node in the shot file.
In case there are several versions of a same ID (e.g. linked at different
moments from a same library, which has been modified in-between), there
will be several packed IDs.
Name collisions are averted by storing these packed IDs into a new type of
'archive' libraries (and their namespaces). These libraries:
* Only contain packed IDs.
* Are owned and managed by their 'real' library data-block, called an
'archive parent'.
For more in-depth, technical design: #132167
UI/UX design: #140870
Co-authored-by: Bastien Montagne <bastien@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/133801
For multilayer files it was only comparing the first pass, so any issues
with other passes would be missed.
Also don't clear the filename for multilayer file output nodes, as that
doesn't work when there are multiple such nodes all writing to the same
file name. This will be used in an upcoming EXR multipart writing test.
Ref #146650
Pull Request: https://projects.blender.org/blender/blender/pulls/146726
While adding more tests does add a tiny bit of overhead, having tests
within the 10s range is better to ensure a good distribution of them
over many threads. It also helps narrowing down the actual blendfile in
case of issues.
This commit renames the following DNA fields and corresponding RNA
properties to better represnt usage:
* `Brush.curve` to `Brush.curve_distance_falloff`
* `Brush.curve_preset` to `Brush.curve_distance_falloff_preset`
Pull Request: https://projects.blender.org/blender/blender/pulls/146254
When units were split into larger and smaller values, the larger
value is rounded and should not show trailing zeros.
Trailing zeros should only be used for the smaller unit.
Ref !140790
To help reduce confusion, remove this property as we believe it has
little to no actual utility. Visibility, instead, remains controlled
with the `evaluation_mode` option.
Ref #134012
See PR for discussion and description of what effect this option used to
have.
Pull Request: https://projects.blender.org/blender/blender/pulls/144600
The image log render tests uses an EXR that contains INF. Workbench
with specular enabled will mix these INFs, but there is a difference
in behavior between OpenGL and Vulkan.
In OpenGL mix(0.05, INF, 0.0) will result in INF
In Vulkan this results in NaN.
This should eventually be solved in the engine to ensure consistency.
For now we disable the render test and document the limitation.
Pull Request: https://projects.blender.org/blender/blender/pulls/146648
This commit bumps up the time delay while running these tests from
1/60th of a second to 1/6th of a second to ensure that the new window
is created prior to the rest of the test running while.
Pull Request: https://projects.blender.org/blender/blender/pulls/146309
Due to an incorrect assumption float buffers were converted to sRGB
values when uploading to an sRGBA8 texture. This is done when rendering
flames in workbench and resulted in to bright renders.
This PR removes sRGB encoding when uploading float values to sRGBA8 textures.
Fixes:
- render/openvdb/fire
- render/openvdb/principled_blackbody
- render/openvdb/smoke_fire
Pull Request: https://projects.blender.org/blender/blender/pulls/146636
A compiler/driver bug makes so that we can't rely on image atomics.
Adding a write that is never executed after the atomics tricks
the compiler to issue the correct synchronisation instruction.
This fixes a bunch of our render tests differences.
We will keep this workaround until this is fixed upstream.
Pull Request: https://projects.blender.org/blender/blender/pulls/146442
This commit adds a UI test that activates each of the default tools for
a mesh in Sculpt Mode and verifies that no Python errors are emitted
when the corresponding tool settings are displayed to the user.
Note that this does not test all of the default bundled brushes.
Pull Request: https://projects.blender.org/blender/blender/pulls/144397
"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.
This PR removes "Use Nodes" for object materials.
For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.
Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
- `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
- `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.
Forward compatibility:
Always enable 'Use Nodes' when writing blend files.
Known Issues:
Some UI tests are failing on macOS
Pull Request: https://projects.blender.org/blender/blender/pulls/141278
The File Output node always appends the frame number even if the render
is not an animation. This patch makes it such that the frame number is
only written if the render is an animation. The user can use a frame
variable to manually append the frame number if needed.
The command line rendering interface already uses animation rendering in
all cases, so it should not be affected. However, rendering using the
render.render() operator with animation=False will see the behavior
change, however, setting animation=False and start_frame and end_frame
to the same frame number should be sufficient to restore the old
behavior.
Pull Request: https://projects.blender.org/blender/blender/pulls/141209
This PR adds a check that batched tests do not surpass the Windows
command line limit of 32,767 characters (including the terminating null
character). This could previously happen if long path names were used.
Pull Request: https://projects.blender.org/blender/blender/pulls/145792
This adds a function that can turn an existing `bNodeTree` into an inlined one.
The new node tree has all node groups, repeat zones, closures and bundles
inlined. So it's just a flat tree that ideally can be consumed easily by render
engines. As part of the process, it also does constant folding.
The goal is to support more advanced features from geometry nodes (repeat zones,
etc.) in shader nodes which the evaluator is more limited because it has to be
able to run on the GPU. Creating an inlined `bNodeTree` is likely the most
direct way to get but may also be limiting in the future. Since this is a fairly
local change, it's likely still worth it to support these features in all render
engines without having to make their evaluators significantly more complex.
Some limitations apply here that do not apply in Geometry Nodes. For example,
the iterations count in a repeat zone has to be a constant after constant
folding.
There is also a `Test Inlining Shader Nodes` operator that creates the inlined
tree and creates a group node for it. This is just for testing purposes.
#145811 will make this functionality available to the Python API as well so that
external renderers can use it too.
EEVEE render tests were failing in aov_transparency. This is a known
file to be failing for Metal and AMD hardware. This PR increases the
fail threshold to let the test pass.
Pull Request: https://projects.blender.org/blender/blender/pulls/145917
* Store scene linear to XYZ conversion matrix in each blend file, along
with the colorspace name. The matrix is the source of truth. The name
is currently only used for error logging about unknown color spaces.
* Add Working Space option in color management panel, to change the
working space for the entire blend file. Changing this will pop up
a dialog, with a default enabled option to convert all colors in
the blend file to the new working space. Note this is necessarily only
an approximation.
* Link and append automatically converts to the color space of the main
open blend file.
* There is builtin support for Rec.709, Rec.2020 and ACEScg working spaces,
in addition to the working space of custom OpenColorIO configs.
* Undo of working space for linked datablocks isn't quite correct when going
to a smaller gamut working space. This can be fixed by reloading the file
so the linked datablocks are reloaded.
Compatibility with blend files saved with a custom OpenColorIO config
is tricky, as we can not detect this.
* We assume that if the blend file has no information about the scene
linear color space, it is the default one from the active OCIO config.
And the same for any blend files linked or appended. This is effectively
the same behavior as before.
* Now that there is a warning when color spaces are missing, it is more
likely that a user will notice something is wrong and only save the
blend file with the correct config active.
* As no automatic working space conversion happens on file load, there is
an opportunity to correct things by changing the working space with
"Convert Colors" disabled. This can also be scripted for all blend files
in a project.
Ref #144911
Pull Request: https://projects.blender.org/blender/blender/pulls/145476