Commit Graph

1108 Commits

Author SHA1 Message Date
Nathan Vegdahl
33b9d54abb Anim: add RNA Channelbag.slot property
This allows Python scripts to easily determine what Slot a Channelbag is
for. This is particularly important because we're trying to discourage
the use of Slot handles in the Python APIs, and before this the only
way to identify which Slot a Channelbag was for was via the Channelbag's
`slot_handle` property.

Pull Request: https://projects.blender.org/blender/blender/pulls/134053
2025-02-04 17:39:03 +01:00
Nathan Vegdahl
f84197f0b9 Anim: ensure correct type prefix when setting Slot.identifier
Previously it was possible to make the type prefix of a Slot's identifier get
out-of-sync with its actual target ID type, by setting the identifier via
Python.

This PR changes `Slot.identifier` assignment to ensure that the type prefix is
set to match `target_id_type`. This now makes it impossible for the identifier
prefix and `target_id_type` to get out of sync, since this API previously was
the only way to accomplish that.

When the prefix that the user attempts to set doesn't match the `target_id_type`
of the Slot, a warning is issued telling the user about the mismatch and that
the identifier has been set with the correct prefix instead.

Pull Request: https://projects.blender.org/blender/blender/pulls/133983
2025-02-04 15:46:22 +01:00
Nathan Vegdahl
eda2f11f7a Anim: change RNA Action.id_root to have backwards-compatible behavior
Most of the old Animato properties on an Action (e.g. FCurve list, Channel
Groups) already act as proxies for the data for the first slot in the first
strip of the first layer. (Say that three times fast!) However, this was not yet
the case for `Action.id_root`.

This PR changes `Action.id_root` to act as a proxy for the first Slot's
`target_id_type` property, both for reading and writing.

If the Action has no Slots, then reading always returns 'UNSPECIFIED', and
writing will create a Slot and set its `target_id_type`.

Note that the ability to write to the first Slot's `target_id_type` via
`Action.id_root` conflicts with `target_id_type` supposedly only being writable
when it's still 'UNSPECIFIED' (#133883). Although that's certainly a little
weird, practically speaking this doesn't break anything for now, and is a
temporary kludge to keep `id_root` working until we can remove it in Blender
5.0. `id_root` will be removed entirely in 5.0, resolving this inconsistency.

Pull Request: https://projects.blender.org/blender/blender/pulls/133823
2025-02-04 13:39:50 +01:00
Christoph Lendenfeld
358a0479e8 Anim: create pose assets to different libraries
Similar to how brush assets are created and managed this
PR allows to export pose assets into a different library.
Because of this there is a limitation to this where each
asset is stored in a separate blend file.
This may be lifted in the future as there are planned changes in
the design phase: #122061

### Create Asset

Now available in the 3D viewport in the "Pose" menu: "Create Pose Asset".
The button in the Dope Sheet will now call this new operator as well.

Clicking either of those will open a popup in which you can:

* Choose the name of the asset, which library and catalog it goes into.
* Clicking "Create" will create a pose asset on disk in the given library.

It is possible to create files into an outside library or add it in the current file.
The latter option does a lot less since it basically just creates the
action and tags it as an asset.

If no Asset Shelf **AND** no Asset Browser is visible anywhere in Blender,
the Asset Shelf will be shown on the 3D viewport from which
the operator was called.

### Adjust Pose Asset

Right clicking a pose asset that has been created in the way described
before will have options to overwrite it.
Only the active object will be considered for updating a pose asset

Available Options (the latter 3 under the "Modify Pose Asset" submenu):
* Adjust Pose Asset: From the selected bones, update ONLY channels that
are also present in the asset. This is the default.
* Replace: Will completely replace the data in the Pose Asset from
the current selection
* Add: Adds the current selection to the Pose Asset. Any already existing
channels have their values updated
* Remove: Remove selected bones from the pose asset

Currently this refreshes the thumbnail. In the case of custom
thumbnails it might not be something want

### Deleting an existing Pose Asset

Right click on a Pose Asset and hit "Delete Pose Asset". Works in the shelf
and in the asset library. Doing so will pop up a confirmation dialog,
if confirming, the asset is gone forever. Deleting a local asset is basically the
same as clearing the asset. This is a bit confusing because you get
two options that basically do the same thing sometimes,
but "Delete" works in other cases as well.
I currently don't see a way around that.

Part of design #131840

Pull Request: https://projects.blender.org/blender/blender/pulls/132747
2025-02-04 11:29:05 +01:00
Campbell Barton
6fcd84721c Cleanup: quiet some warnings from check_pep8 target 2025-02-04 14:51:17 +11:00
Sybren A. Stüvel
226486aa91 Refactor: Anim, rename and adjust ActionKeyframeStrip.channels()
Rename `ActionKeyframeStrip.channels()` to `.channelbag()`, and change
its first parameter from `slot_handle` to `slot`.

This is to be consistent with `ActionKeyframeStrip.channelbags`, which is
the array of channelbags in the keyframe strip. Having a function that's
singluar makes sense for finding a single element in the array.

The change from using the slot handle to using the slot is to be consistent
with `.channelbags.new(slot)`. Furthermore, the Python API should be using
slot handles as little as possible (they're basically meaningless numbers).
Using the slots directly is preferred. If that's not possible, it is
recommended to use the slot identifier (`slot.identifier`) instead, as that
can be used to look up the slot (`action.slots[slot_identifier]`).

This breaks the glTF add-on, which will be fixed in !133915.

Pull Request: https://projects.blender.org/blender/blender/pulls/133868
2025-02-03 20:19:00 +01:00
Jesse Yurkovich
6c11811710 Cleanup: USD: Use the SdfPath type rather than a std::string
Instead of converting to a string immediately, only convert to a string
when necessary, like for trace logging. This reduces the size of the
`USDPrimReader` base class by 24 bytes, makes several Vectors and Maps
smaller at runtime, and reduces some unnecessary string allocations and
conversions in various other places.

The recently added python Hook `get_prim_path` dictionary will now
contain `SdfPath` objects rather than strings; removing the string
conversion cost when calling other USD APIs like `GetPrimAtPath` which
take in `SdfPath` objects to begin with.

This also makes the code a bit more self explanatory since the type
makes it clear what kind of path you are dealing with.

Pull Request: https://projects.blender.org/blender/blender/pulls/133954
2025-02-03 18:44:07 +01:00
Nathan Vegdahl
978011fe43 Anim: use legacy names for data created via legacy APIs
Previously, when use of the legacy Action APIs (specifically the `fcurves` and
`groups` properties) caused a new Slot to be created, it would be named "Slot".

This PR changes things so that Slots created that way are named "Legacy Slot",
just like Slots from upgraded legacy Actions.

The rationale is that Slots created in this way are expected (by the code that
created them) to be used as if the Action were still a legacy Action, and it's
good to reflect that in the name of the data. This also makes it clearer to
users when e.g. scripts and addons they're using may not yet have been updated
to fully work with Slotted Actions.

For consistency, this PR also names Layers created in the same way "Legacy
Layer", the same as Layers from upgraded legacy Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/133888
2025-02-03 14:48:39 +01:00
Nathan Vegdahl
b5005cd99c Anim: make RNA Slot.target_id_type writable when not yet specified
When loading old blend files, versioned Actions can end up having a slot with an
'UNSPECIFIED' `target_id_type`. Assigning the slot to an ID will then set the
slot's `target_id_type` to match the type of the ID, but there was previously no
way to directly set it via Python if needed.

This PR changes the writability of `target_id_type` to match the extent of its
mutability when assigning a slot to an IDs. Which is to say, it can be set if
it's 'UNSPECIFIED', but not otherwise.

RNA doesn't have a good way to represent this, so we accomplish this with a
custom set function that simply ignores the write if the slot's `target_id_type`
isn't 'UNSPECIFIED'. This isn't ideal, but is the least-bad solution at the
moment.

Pull Request: https://projects.blender.org/blender/blender/pulls/133883
2025-02-03 13:01:47 +01:00
Jesse Yurkovich
3c9a71b46f Fix #132465: Align Alembic/USD crease values with that of OpenSubdiv
In order to better interop with the broader Alembic/USD ecosystem, align
the crease values we export with what we believe is expected by native
OpenSubdiv, a 0-10 range.

On import we will translate the native OpenSubdiv range back into
Blender's 0-1 range.

To account for SubD assets produced by Blender before this change, a
compat check is put in place for both Alembic and USD to use the old
methodology when encountering such files. The compat check makes use
of the Blender version we place inside the format's metadata fields. Old
assets loaded into a new Blender will look ok. New assets loaded into an
old Blender would need to be reworked.

Pull Request: https://projects.blender.org/blender/blender/pulls/132582
2025-02-03 04:38:58 +01:00
Alaska
ce4722a954 Cleanup: Use RenderReport variation in Cycles render tests
In ea7d07098b, the RenderReport base
class was reworked to work better with test variations.

This commit reworks the Cycles render tests file to use the new
variation system for Hardware Ray tracing and OSL tests, avoiding the
custom system put in place in previous commits.

Pull Request: https://projects.blender.org/blender/blender/pulls/133813
2025-02-03 04:16:27 +01:00
Brecht Van Lommel
7f0f8b0e46 Tests: Use descriptive name for tests in reports category 2025-02-01 13:03:39 +01:00
Brecht Van Lommel
4c2fb20e93 Tests: Fix and workaround Metal difference for Storm
* Disable Metal multisampling to match OpenGL.
* Block list all image half/float tests, these can all fail randomly.
* Blocklist tests failing due to issues in OpenUSD Metal implementation.
2025-02-01 13:03:39 +01:00
Sean Kim
f87dd03eb5 Tests: Raise error if global and output directories match
When a given render test defined in CMakeLists.txt with a `--outdir`
parameter ends with a trailing slash, the resulting global report
overwrites the specific test's report. This is because `os.path.dirname`
for a path that ends in a slash returns the same directory, for example,
`os.path.dirname('foo/bar/') => 'foo/bar'

To avoid tests being able to put the report into a weird state, this
commit normalizes the `--outdir` path to strip trailing slashes.

Pull Request: https://projects.blender.org/blender/blender/pulls/133791
2025-01-31 22:31:43 +01:00
Sybren A. Stüvel
f97c54ff76 Anim: emit liboverride on slot handle when action is changed
Emit a 'diff' for the `animdata.slot_handle` property whenever the
`.action` property is changed through a library override.

The slot handle is only meaningful within the context of the assigned
action. So when a liboverride changes the assigned action, the slot
handle should also get an override.

This is necessary even when the numerical value of the slot handle
happens to be the same in both actions, as the newly chosen slot is
different from the slot that was chosen in the library file.

This applies to direct Action assignment, NLA strips, and Action
constraints.

Pull Request: https://projects.blender.org/blender/blender/pulls/133727
2025-01-31 15:43:34 +01:00
Sybren A. Stüvel
815337a7da Anim: add ensure parameter to KeyframeStrip.channels(...) RNA function
Add `ensure` boolean parameter to the `ActionKeyframeStrip.channels()` RNA
function. Passing `ensure=True` will ensure the channelbag for the given
action slot handle exists. This makes it more straight-forward to create
F-Curves for a slot regardless of whether there already was a channelbag
for those F-Cuves:

```python
strip = action.layers[0].strips[0]
slot = action.slots[0]

# Old:
channelbag = strip.channels(slot.handle)
if not channelbag:
    channelbag = strip.channelbags.new(action_slot)
ob_loc_x = channelbag.fcurves.new('location', index=0)

# New:
channelbag = strip.channels(slot.handle, ensure=True)
ob_loc_x = channelbag.fcurves.new('location', index=0)
```

Pull Request: https://projects.blender.org/blender/blender/pulls/133678
2025-01-31 15:16:10 +01:00
Sean Kim
0ca96421b9 Tests: Fix "opengl_draw" tests
The opengl_draw_tests.py render test had a number of issues when
running, likely due to test data restructuring:
* Invalid CMakeLists.txt specification preventing tests from being added
* Invalid parameters to the `screenshot` function

This commit fixes both issues as well as renames the related files and
folders to better indicate their usage.

Pull Request: https://projects.blender.org/blender/blender/pulls/132838
2025-01-30 18:44:23 +01:00
Sean Kim
2e7db9c167 Fix: Remove missed device parameter
Missed in ea7d07098b

Pull Request: https://projects.blender.org/blender/blender/pulls/133794
2025-01-30 05:44:20 +01:00
Alaska
ea7d07098b Tests: Disable --cycles-device arguments on non-Cycles tests
This commit reworks the RenderReport base class to avoid adding
`--cycles-device` device arguments to non Cycles tests.

This reduces some warnings that can show up with EEVEE and
Workbench tests that accidentally used these arguments.

Pull Request: https://projects.blender.org/blender/blender/pulls/133724
2025-01-30 04:15:27 +01:00
Sean Kim
aee2add84a Tests: Error on no test files being found for render_report.py
This commit checks the total number of files being processed for
rendering tests and causes it to emit a failure if none are found. This
has the benefit of loudly failing if there is a configuration error
instead of succeeding.

Pull Request: https://projects.blender.org/blender/blender/pulls/133691
2025-01-29 23:53:31 +01:00
Jesse Yurkovich
7f5965716d USD: Add additional test for scene instancing Import
This pairs with the recently added Export test and reuses the same
.blend file. While there happens to be an instancing related rendering
test, that happens to cover Import, it's better to have a direct test
for it.

Future improvements to both Export and Import to account for the recent
"hidden layer" visibility bug would be good to do as a follow-up.

Pull Request: https://projects.blender.org/blender/blender/pulls/133782
2025-01-29 23:15:39 +01:00
Howard Trickey
b2998848c5 Fix #109765 - Prevent Dissolve Edges from dissolving verts...
that are unrelated to the selected edge,
See https://projects.blender.org/blender/blender/issues/109765 .
This comes from PR https://projects.blender.org/blender/blender/pulls/131645
by jcwenger.
2025-01-29 16:26:46 -05:00
Jesse Yurkovich
a6ad8f4fd9 Cleanup: USD: Pass struct by ref and add more tests for scaling options
- There's only a few unit conversion options, just test all of them
- Use reference instead of pointer when passing export settings struct
- Organize scaling struct fields to keep similar options together

Pull Request: https://projects.blender.org/blender/blender/pulls/133774
2025-01-29 20:03:36 +01:00
Michael Kowalski
319c64205d USD: Scene graph instancing export
Refactored USD instancing export to support instanceable references.

With this change, it's now possible to instance object hierarchies and
geometry types other than meshes (e.g., curves, point clouds, etc.).

No longer marking mesh prims as instances in
USDGenericMeshWriter::write_mesh().

USDTransformWriter::do_write() now marks the Xform as instanceable
with a reference to the prototype's Xform when the Blender object is
an instance.

In USDAbstractWriter::mark_as_instance() the target prim is now marked
as instanceable.

Added AbstractHierarchyIterator virtual functions include_data_writers()
and include_child_writers() to allow pruning children of instanceable Xforms
in AbstractHierarchyIterator::make_writers(). These functions return true
in the base class implementation, so that the iterator behavior for Alembic
exports is unaffected.  In the USDHierarchyIterator subclass, these functions
are overridden to return false if instancing is enabled and the objects are
instances.

Added virtual function AbstractHierarchyIterator::should_determine_duplication_references()
which returns true if duplication references should be resolved for children
of a given context.  This function is overridden in USDHierarchyIterator to
skip processing children of instances, which is more efficient for USD export,
since children of instances are pruned during traversal for writing.  For nested
instances where the original prototype is not included in the export, this also
avoids designating a duplicated object parented to an instance as "the original",
which would cause USD errors since defining a prim under an instance
proxy is not allowed.

Extended logic in `AbstractHierarchyIterator::determine_duplication_references()`
to identify prototypes.

Added new function `HierarchyContext::is_prototype()`.

Disallowing merging with parent for instances and prototypes, since
the Xforms cannot be discarded in those cases.

Extended `USDWriterAbstract::ensure_usd_material()` with special logic
to ensure materials for prototype prims are defined in the subtree of the
prototype.  This helps ensure the hierarchical encapsulation requirement
for prototypes and is required by certain renderers (e.g., Houdini's Karma)
for instance materials to render.

Added a new `process_scene_graph_instances()` function to ensure
prototypes are exported as abstract prims.

Added python tests test_export_native_instancing_true and
test_export_native_instancing_false.

Pull Request: https://projects.blender.org/blender/blender/pulls/131707
2025-01-28 15:51:56 +01:00
Aras Pranckevicius
f5c2aecd8b Tests: emit more information in import tests templates
- Bone matrices,
- Material viewport settings (colors, backfaces etc.)
- Improved handling of relative paths of material images

Pull Request: https://projects.blender.org/blender/blender/pulls/133658
2025-01-27 18:19:04 +01:00
Sybren A. Stüvel
dd67b355ee Anim: do not set slot ID type when Action is linked
When an action slot does not have an ID type, and it is assigned to some
ID, the slot is bound to that ID's type. This now no longer happens when
the Action is linked, because linked data should not be modified.

Pull Request: https://projects.blender.org/blender/blender/pulls/133670
2025-01-27 17:51:23 +01:00
Hans Goudey
e05a1871db Fix #133551: Crash accessing scene.tool_settings.uv_sculpt
After e3894f0a07, the UV sculpt
struct doesn't inherit from Paint anymore.

Pull Request: https://projects.blender.org/blender/blender/pulls/133655
2025-01-27 14:51:22 +01:00
Jesse Yurkovich
d4c2d73864 USD: Add test coverage for parent-child transforms during animation
Makes use of recently added test data to ensure proper handling of child
objects, with animated transform constraints, parented to other objects
who also have animated transform constraints.

Also uses the `colored_print` module to better segment the test output.

Pull Request: https://projects.blender.org/blender/blender/pulls/133600
2025-01-26 04:43:16 +01:00
Alaska
d2930e6285 Cycles Tests: Enable Principled BSDF OSL tests
The Principled BSDF tests were previously disabled when testing
with OSL as there was a noticeable difference in noise between SVM
and OSL when mixing/layering materials.

This commit enables the Principled BSDF OSL tests, but with a increased
threshold for failure so we can test for major regressions with the
Principled BSDF OSL implementation.

Pull Request: https://projects.blender.org/blender/blender/pulls/133530
2025-01-25 01:57:03 +01:00
Bastien Montagne
a3d9bdad6b Tests: Add simple script accessing (almost) all RNA properties.
Only runs on factory startup file, so not all possible paths are
covered. But should reduce likeliness of issues like #133551 in the
future.
2025-01-24 18:35:31 +01:00
Aras Pranckevicius
342235616a Tests: emit more details in import test .txt templates
- Animation keyframes now contain left/right handle information
- More fcurves are emitted
- Material textures emit whether their colorspace is "data"
- More files in fbx test coverage

Pull Request: https://projects.blender.org/blender/blender/pulls/133526
2025-01-24 10:24:33 +01:00
Alaska
ddd83226b8 Cycles tests: Remove outdated comment
There was a comment in the Cycles test suite blocklist about UDIM
textures rendering incorrectly. 

This has since been fixed (1) so remove the comment from the blocklist.

(1) 82cc0a3eff
2025-01-24 08:28:48 +01:00
Falk David
b9f253564e VSE: Python API: Deprecate sequence properties and replace with new ones
This PR adds new RNA properties that deprecate and replace any `sequence` property.
The old prooperties are still there and fully functional, but the description is changed
to indicate that these will be removed in the future and that the new properties should
be used instead.

| Deprecated property | Replacement property |
| --------------------------------- | ----------------------------------- |
| `context.active_sequence_strip` | `context.active_strip` |
| `context.selected_editable_sequences` | `context.selected_editable_strips` |
| `context.selected_sequences` | `context.selected_strips` |
| `context.sequences` | `context.strips` |
| `SequenceEditor.sequences` | `SequenceEditor.strips` |
| `SequenceEditor.sequences_all` |  `SequenceEditor.strips_all` |
| `MetaStrip.sequences` | `MetaStrip.strips` |

Previously, rna paths for animation data on strips started with `sequence_editor.sequences`.
This PRadds versioning for the rna paths to make sure to use
the new naming scheme. This does mean that in previous versions of blender,
the animations don't show but the data is not lost (even if the file is saved in the older version).

Also do some cleanup of existing python scripts inside the source to use the
new properties.

Part of #132963.

Pull Request: https://projects.blender.org/blender/blender/pulls/133156
2025-01-21 11:30:20 +01:00
Bastien Montagne
d251f8af30 Tests: Add 'with ASAN' knowledge to Linux release checks.
Builds with sanitizer will get addition asan/ubsan libraries linked in,
these need to be allowed in the static binaries check.

Pull Request: https://projects.blender.org/blender/blender/pulls/133319
2025-01-21 09:40:50 +01:00
Bastien Montagne
2d7068a0d3 Add file_path_map function to bpy.data.
Similar to `bpy.data.user_map`, it returns a mapping of IDs to all the
filepaths they use.

Fairly basic still, may need to be refined with more options to
control which filepaths are included etc.

Mainly intended to make handling of a production blendfile dependencies
more easy.

Also adds some basic testing of the new feature.

Pull Request: https://projects.blender.org/blender/blender/pulls/127252
2025-01-20 17:39:25 +01:00
Nathan Vegdahl
9f2ab9cba0 Anim: rename RNA Slot.id_root to Slot.target_id_type
The name `id_root` was not descriptive, and was just a hold-over from the
equivalent (now deprecated) property on the Action itself.  `target_id_type`
is more clear, reflecting that this is the type of ID the Slot is intended
to animate.

This PR also renames the corresponding `id_root_icon` to
`target_id_type_icon`.

Note that this PR updates the GLTF import/export core addon to adhere to
these name changes as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/133164
2025-01-20 15:24:08 +01:00
Alaska
786a601cc8 Tests: Enable OptiX OSL window test
The window coordinate test was on the block list due to the
world shader rendering it incorrectly.

This has since been fixed, so this test can be removed from the
blocklist.

Ref: blender/blender#123012
Ref: blender/blender@4f0aef1fde
2025-01-20 05:06:13 +01:00
Alaska
f85ff21ed0 Tests: Add render tests for texture nodes
Enable render tests in the `texture` folder.

Ref #123012
2025-01-19 00:52:22 +01:00
Bastien Montagne
b802c328b5 Refactor: Tests: bl_blendfile: Use unittest module instead of asserts.
Pull Request: https://projects.blender.org/blender/blender/pulls/133217
2025-01-17 21:05:39 +01:00
Jesse Yurkovich
1ceaaeeff7 USD: Write extents out for Curves and more consistently for other types
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
2025-01-17 03:28:13 +01:00
Jesse Yurkovich
49ae7ffc9c USD: Support additional animated Basis Curves data during import/export
Export
Like we do for Mesh and PointCloud, export any "velocity" attribute on
the Point domain as native USD "velocities". While testing, a few
additional blender-internal attributes were discovered being exported
which are now excluded during export.

Import
Add the cache modifier as appropriate when we detect that UsdBasisCurve
data is animated. This includes time-varying positions, widths,
velocities, and general attribute values. Before this PR, only the
positions were considered. And like Export, the native USD "velocities"
attribute is now processed.

Adds test coverage as well.

Pull Request: https://projects.blender.org/blender/blender/pulls/133027
2025-01-15 23:29:42 +01:00
Bastien Montagne
7fb3179c1f Add tests for bpy.data.user_map.
These are based on data generated for liblink tests, so part of this
code is also refactored to move data generation into `bl_blendfile_utils.py`.

NOTE: Work done also to add tests to upcoming filepath mapping utils
(see !127252).

Pull Request: https://projects.blender.org/blender/blender/pulls/133110
2025-01-15 18:13:32 +01:00
Aras Pranckevicius
1ad083dabf Tests: Add FBX import tests, switch OBJ/PLY/STL import tests to the same machinery
"Expected textual data output" comparison based tests for FBX,
OBJ, PLY, STL import.

- There's a tests/python/modules/io_report.py that can produce
  a "fairly short text description of the scene" (meshes, objects,
  curves, cameras, lights, materials, armatures, actions, images).
  About each object, it lists some basic information (e.g. number
  of vertices in the mesh), plus a small slice of "data" (e.g.
  first few values of each mesh attribute).
    - Custom import parameters, if needed, can be provided by
      having a sidecar .json file next to imported file (same
      basename, json extension), that would have a single json
      object with custom arguments.
- Add FBX test coverage, with 46 fairly small files (total size 3.8MB)
  covering various possible cases (meshes, animations, materials,
  hierarchies, cameras, etc. etc.).
- Switch OBJ/PLY/STL import tests to the above machinery, remove C++
  testing code.

Pull Request: https://projects.blender.org/blender/blender/pulls/132624
2025-01-15 05:52:15 +01:00
YimingWu
9d509de52a Grease Pencil: Convert from mesh to Grease Pencil
Convert mesh objects to grease pencil, optionally preserve mesh faces as
filled shapes, and convert crease edges into strokes. Following options
are available:

- Whether to convert faces to filled strokes.
- Stroke thickness.
- Stroke offset (Using normal direction to lift strokes out of mesh
  surfaces).

Note that "Crease Angle" option from legacy grease pencil is not ported
to this implementation. This option is deemed more suitable for using
geometry nodes to achieve.

Resolves #126480

Pull Request: https://projects.blender.org/blender/blender/pulls/131854
2025-01-14 08:28:52 +01:00
Jesse Yurkovich
75f3fab268 USD: Add test for the export_texture_mode option
Add tests covering the PRESERVE and KEEP export_texture_mode options.

Pull Request: https://projects.blender.org/blender/blender/pulls/132885
2025-01-10 06:34:27 +01:00
Bastien Montagne
4032b853c3 RNA: Add basic tests for the path_from_id() function.
Simply load factory startup file, and recursively iterate over
all (valid) `POINTER` and `COLLECTION` properties of all IDs.

NOTE: A few cases are currently returning invalid rna paths (at least
from quick look), these are skipped for now.

Pull Request: https://projects.blender.org/blender/blender/pulls/132809
2025-01-09 16:46:37 +01:00
Sybren A. Stüvel
63adbb19fb Anim: Always name the slot "Legacy Slot" when versioning legacy Actions
When creating Action Slots for legacy Actions, always name those slots
"Legacy Slot". Before this commit, the slot was named after the ID that
is animated by the Action; this matches what Blender will do when
animating that ID from scratch.

The old versioning behaviour caused issues when dealing with legacy
Actions: if there are multiple Actions in a file (for example multiple
run cycle animations) and only one of those was assigned to the
character (the rest has a fake user), Blender would only name that one
action slot after the character. The "fake user" Actions would just be
get a slot named "Slot".

This causes issues when toggling between the different Actions, as
Blender will not automatically assign a slot when switching from the
character- named one to the "Slot" one.

Ref: #129563, #130261

Pull Request: https://projects.blender.org/blender/blender/pulls/131425
2025-01-07 15:34:53 +01:00
Sybren A. Stüvel
c6d6efaaa2 Fix #132606: ActionSlots can be created with too long names
The max length of the RNA property `ActionSlot.identifier` was set
incorrectly. The setter code did manage the length properly, but the
getter was checking agains that incorrect max length, and rightfully
complained.

Pull Request: https://projects.blender.org/blender/blender/pulls/132691
2025-01-06 13:55:07 +01:00
Omar Emara
b3623feab2 Compositor: Support node integer sockets
This patch adds support for using integer sockets in compositor nodes.
This involves updating the Result class, node tree compiler, implicit
conversion operation, multi-function procedure operation, shader
operation, and some operations that supports multiple types.

Shader operation internally treats integers as floats, doing conversion
to and from int when reading and writing. That's because the GPUMaterial
compiler doesn't support integers. This is also the same workaround used
by the shader system. Though the GPU module are eyeing adding support
for integers, so we will update the code once they do that.

Domain realization is not yet supported for integer types, but this is
an internal limitation so far, as we do not plan to add nodes that
outputs integers soon. We are not yet sure how realization should happen
with regards to interpolation and we do not have base functions to
sample integer images, that's why I decided to delay its implementation
when it is actually needed.

Pull Request: https://projects.blender.org/blender/blender/pulls/132599
2025-01-06 10:09:26 +01:00
Campbell Barton
4f1817cc18 Cleanup: declare __all__ for Python scripts
Declare all to make public public API's explicit and
help detect unused code.
2025-01-06 16:45:36 +11:00