Commit Graph

689 Commits

Author SHA1 Message Date
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
Julien Duroure
6999f34ec1 glTF: Bump version to 4.4.42 after recent changes 2025-02-03 20:35:05 +01:00
Julien Duroure
c089c176cb Refactor: glTF: followup ActionKeyframeStrip.channels() rename
- Use slot identifier instead of slot handle
- Change API calls after changes in Blender (in PR #133868)
- Refactoring, avoiding duplicate functions

Pull Request: https://projects.blender.org/blender/blender/pulls/133915
2025-02-03 20:32:00 +01: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
Sybren A. Stüvel
fa2b131395 Fix #105216: Rigify (ui.py) console error, expected str not float
Use string formatting instead of the `+` operator, so that it doesn't
matter which exact type is used for the `rig_id` custom property.

Also reshuffle the code a bit to reduce indentation.

Pull Request: https://projects.blender.org/blender/blender/pulls/133967
2025-02-03 12:55:36 +01:00
Julien Duroure
8abac73cbd glTF exporter: avoid crash when no tracks are exported 2025-02-01 19:06:45 +01:00
Julien Duroure
196cda9eef glTF exporter: Fix typo leading to crash at animation export (nla track mode) 2025-02-01 19:05:14 +01:00
Julien Duroure
83f9ed8771 glTF: New way of registering UI for hooks
- Explicit registration for hook UI
- Added some example in upstream repo: https://github.com/KhronosGroup/glTF-Blender-IO/blob/main/example-addons/example_gltf_exporter_extension/__init__.py
2025-02-01 18:59:03 +01:00
Julien Duroure
cccd45e32a glTF exporter: Create output directory if not exists
This should happen mainly for Collection Exporter or using api
2025-02-01 18:55:46 +01:00
Julien Duroure
3d2f45b408 glTF: Collection Exporter: Set collection custom props as glTF Scene extras
As we are exporting Collection only, it makes sense that the collection customs props
can be exported as glTF Scene extras, as the scene includes only objects from the collection
2025-02-01 18:52:53 +01:00
Julien Duroure
6aae3004fc glTF exporter: add pre & post export hooks 2025-02-01 18:49:38 +01:00
Pablo Vazquez
6ea8297477 Extensions: Quick access to add-on folder
When developing and testing add-ons it can be useful to get to the
folder containing such add-on.

When Developer Extras is enabled, show a folder icon next to the
extension's path to quickly open it using the system file browser.

Also display it in the list of duplicate add-ons, if any, so user can
access them more conveniently.

Pull Request: https://projects.blender.org/blender/blender/pulls/128474
2025-01-30 11:18:53 +01:00
Sybren A. Stüvel
2440861afe Anim: fix 'Fix to Camera' poll function exception when camera is missing
The 'Fix to Camera' poll function was raising `NotImplementedError` when
there is no scene camera. That's now fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/133710
2025-01-28 14:13:53 +01:00
Campbell Barton
89d51c7535 Extensions: add an error when building an add-on without an init file
- Add a check that the file list includes an `__init__.*` path.
- Normalize paths so they can can be compared with string literals.
2025-01-23 15:28:02 +11:00
Julien Duroure
16f728cfe5 glTF exporter: Missed background check in previous commit 2025-01-22 09:19:32 +01:00
Julien Duroure
71d3e32974 glTF exporter: Tweak for action filter in Collection Export
Waiting a proper solution for props declaration:

- Filter now happen even if the list is not displayed
- Avoid spaming console with error, display a label saying what to do
2025-01-22 09:09:40 +01:00
Julien Duroure
748c91ce27 glTF exporter: add fallback interpolation option
Before, any sampled properties that are not keyed was exported with LINEAR interpolation
Now, user can choose the interpolation for these not keyed values (LINEAR or CONSTANT/STEP)

Example of not keyed properties: Deformation bones when animators animated other bones
2025-01-21 21:46:25 +01:00
Campbell Barton
0d0f8fa8f4 Cleanup: remove unused function in pose_library
Ref !133145
2025-01-21 23:06:29 +11: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
Sybren A. Stüvel
fc44eb910d Anim: Copy Global Transform, use slotted Actions correctly
The operators of the Copy Global Transform add-on now use slotted
Actions.

Pull Request: https://projects.blender.org/blender/blender/pulls/133308
2025-01-20 14:05:30 +01:00
Sybren A. Stüvel
84af3a41b0 Anim: Copy Global Transform, correctly restore scene after Fix to Camera
After using the Fix to Camera operator, restore the transform matrices
of the fixed-to-camera objects/bones. This is necessary as the
autokeying options (like 'Only Available') may limit the keys that are
set, and thus going to the original scene frame may not be enough to
restore the full transform.
2025-01-20 14:05:30 +01:00
Sybren A. Stüvel
04e9c5cca2 Anim: Copy Global Transform, remove unnecessary exception handling
No functional changes, as the documented reason the exception handling was
there isn't appliccable any more.
2025-01-20 14:05:30 +01:00
Sybren A. Stüvel
e8019814bd Anim: Copy Global Transform, fix MyPy warnings
No functional changes, except that a rare error case is now handled
correctly.
2025-01-20 14:05:30 +01:00
Julien Duroure
312289ca60 glTF export: fix recursivity check on gpu instances 2025-01-16 21:34:45 +01:00
Julien Duroure
4dccaf5fae glTF export: ignore variant extras 2025-01-16 21:29:37 +01:00
Julien Duroure
b71d8484e2 glTF exporter: make sure color is white if only alpha is used 2025-01-16 21:26:54 +01:00
Julien Duroure
96369594f4 glTF import: tweak option UI 2025-01-16 21:25:12 +01:00
Julien Duroure
3f68656c7a glTF export: add keep named node flag for gltfpack 2025-01-16 21:24:00 +01:00
Nika Kutsniashvili
89f829f736 Nodes: Node Wrangler: Remove "Frame Selected" operator
This operator was duplicating feature that already exists in core
Blender (`node.join`), and was not working great as well. So there is
no need to maintain this python operator, but to keep consistency for
users I kept the keymap and UI entry but assigned it to `node.join`
operator instead, so that users don't notice change.

I assigned keymap inside add-on and not in Blender core because people
who didn't use Node Wrangler have that key free, or have something else
assigned (and `node.join` is already mapped to Ctrl+J), so only Node
Wrangler users should have this keymap. We can change it and rename
built-in operator to Parent, instead of Join, and remap it to Shift+P,
but that's separate discussion.

Resolves #129404.

Pull Request: https://projects.blender.org/blender/blender/pulls/132758
2025-01-15 02:19:33 +01:00
Julien Duroure
d51282d732 Fix #132702: UI: glTF UI string capitilization 2025-01-13 17:12:54 +01:00
Julien Duroure
cf08594a8c Cleanup: glTF: format 2025-01-13 17:07:17 +01:00
Julien Duroure
cf08856ccd glTF: Manage slotted Actions
- At import => Create some multi-slot action if multiple node are impacted by the glTF animation
- At export =>
     - Multi-slot actions are exported as a single glTF animation by default
     - There is still an option to get back to previous feature, merging by track name instead of by action

KHR_animation_pointer is not part of this PR.
animation pointer data are still exported only when using full baking (NLA track or scene export mode).
Using animation pointer related slots for other mode will come in a second step, not planned yet (and will not be part of 4.4)

Some hooks definition changed, and some hook locations changed because of this new behavior.
Communication for hook devs still need to be done

PR: #132771
Pull Request: https://projects.blender.org/blender/blender/pulls/132771
2025-01-13 17:00:46 +01:00
Damien Picard
74f5fa55ac I18n: Disambiguate "Samples"
"Samples" is used in Rigify rig templates, as opposed to rendering.
2025-01-13 12:40:45 +01:00
Damien Picard
8ff8fc4859 I18n: Disambiguate "Floor"
Issue reported by Hoang Duy Tran.
2025-01-13 12:40:45 +01:00
Damien Picard
3029e9ccfe I18n: Disambiguate "Fix"
"Fix" is used in the unusual way of "make one object steady relative
to another", not "repair something".
2025-01-13 12:40:45 +01:00
Damien Picard
ac419231a8 I18n: Disambiguate "End"
"End" in "Clip End" can be better translated to something like "Far"
in some languages. Using the "Camera" context even when it's not
specifically a camera clipping (also affects light probes).

Issue reported by Gorazd-Gorup.
2025-01-13 12:40:45 +01:00
Christoph Lendenfeld
6b421326b6 Fix #131495: Pose Library error with enum values
Enums in Blender evaluate to a string, so trying to add them to a pose
failed with an error because FCurves only accept numbers.

The fix is to modify the data path and split the property name off.
By evaluating that we arrive at the bone, from which we can call `get(property_name)`
to get the int value.

Pull Request: https://projects.blender.org/blender/blender/pulls/132124
2025-01-07 10:41:40 +01:00
Campbell Barton
104c655fb7 Refactor: adjust the URL/file-system data iterators for extensions
The logic to generalize over downloading a URL or reading data from
the file-system included static values in the iterator along with the
data being read - so the caller could access the total expected size of
the data being read. While this worked, the result didn't read well.

Now these iterators yield the data being read, a new type has been
added for the caller to read the size hint from.

Also correct invalid doc-string.
2025-01-07 17:51:04 +11:00
Campbell Barton
2f309c10c5 Cleanup: replace Generator type with Iterator where appropriate 2025-01-07 10:10:25 +11:00
Campbell Barton
8a9bdeb943 Extensions: suppress resource leak warning on WIN32
Accessing the internal extensions command would warn that the processes
stdout wasn't closed on completion. While it's harmless at the moment,
ensure it's closed using a context manager.
2025-01-04 19:52:18 +11:00
Julien Duroure
2add9e8224 glTF: Revert last changes, as these changes are reverted in core too 2025-01-03 21:08:42 +01:00
Julien Duroure
eb09364030 glTF: Update after recent Blender changes on b43e2168e3 2025-01-03 15:24:54 +01:00
Sybren A. Stüvel
426d1683ee Import: explicitly create & assign action slots when importing BVH/FBX
Explicitly create & assign an action slot when importing animation data
from BHV and FBX files.

Ideally this fix wouldn't be necessary, and it's still my wish to have
stronger backward compatibility of the Python API. When/if we have that,
this commit could be reverted.

Fixes: #131305

Co-authored-by: Philipp Oeser <philipp@blender.org>
Pull Request: https://projects.blender.org/blender/blender/pulls/131360
Pull Request: https://projects.blender.org/blender/blender/pulls/131380
Pull Request: https://projects.blender.org/blender/blender/pulls/132549
2025-01-02 14:11:39 +01:00
Philipp Oeser
f32170aabb FBX export: always write edge crease (even if no subd modifier present)
This has come up a couple of times and it seems better to change the
implementation from blender/blender-addons@f1dd37b8ac [which only
exported edge creases when a subd modifier with enabled `Use Creases`
option was present] in a way that these are always exported (if present).

Also took the liberty to rename the variable name for the layer to
correspond to "crease".

Thx @mont29 for handholding on this one!

Fixes #131284

Pull Request: https://projects.blender.org/blender/blender/pulls/131419
2024-12-06 18:20:19 +01:00
Butterscotch!
e2ff0a45aa Fix BVH import bone tail calculation with multiple children
When importing a BVH file with a parent node that has more than one
child that have offsets within `0.001 * global_scale` of the parent
node, the length of the parent node is considered to be zero.

For example: A parent node with `OFFSET 0 -0.1077 0`, two children with
`OFFSET 0 -0.1074 0`, and a global scale of `1.0`, the parent node's
length would be considered zero, therefore adding `global_scale / 10`
(`0.1` in this case) to the y component of the offset. The resulting
tail offset would then be `OFFSET 0 -0.0077 0`.

Ref !105492
2024-12-03 23:30:10 +11:00
Julien Duroure
faaa12a101 glTF: Install Draco lib in the same directory as the glTF2 addon
This changes the location of the Draco library installation path.
The new location is at the root of addons_core/io_scene_gltf2 addon, as the library is created for this addon only.

This will solve issues where the gltf addon couldn't find the library in case of global python installation or custom script/lib paths

Pull Request: https://projects.blender.org/blender/blender/pulls/131080
2024-12-02 12:50:15 +01:00
Thomas Barlow
8ed98d592e Fix #127765: FBX Export: Incorrect materials with Geometry Nodes
Geometry Nodes can change the materials of the Object, for Mesh Objects,
the new materials are present in the evaluated Object, but for non-Mesh
Objects, the new materials may not be present until the evaluated Object
has been converted to a Mesh.

This patch fixes the materials in FBX export, with Apply Modifiers
enabled, of non-Mesh types with Geometry Nodes that change materials.
Rather than getting the materials from the evaluated Object, the
materials are now retrieved from the Mesh created from the evaluated
Object.

To support object-linked material slots, the materials on the new Mesh
are replaced at the same indices as the object-linked material slots.

Pull Request: https://projects.blender.org/blender/blender/pulls/130485
2024-12-02 10:44:00 +01:00
Thomas Barlow
d0d4fc45b3 Fix #123088: Workaround for Unity FBX import per-vertex normals issue
The FBX SDK specifies that normals should use the IndexToDirect FBX
reference mode. This mode allows data written to FBX to be deduplicated
by writing a separate array of indices into the deduplicated array of
data that can be used to reconstruct the full array of data.

When Unity imports per-vertex normals with the IndexToDirect reference
mode, it erroneously considers the imported mesh's normals invalid if
any of its normals were deduplicated. This issue is not present in other
external software that I have tested.

This patch modifies the export of per-vertex normals to not perform any
deduplication, avoiding the issue in Unity's FBX importer while
maintaining use of the IndexToDirect reference mode.

The add-on's patch version has been increased.

Pull Request: https://projects.blender.org/blender/blender/pulls/123186
2024-12-02 10:40:21 +01:00
Campbell Barton
d63dc070ef Fix error enabling extensions with an empty wheel list
Regression in [0] caused extensions with an empty wheel list
to raise an unhandled exception when extracting the Python
version from the wheel list.

Besides resolving this error, account for errors using the wheel
list since it isn't type checked in this code-path.

[0]: cfc10b0232565642afbfdc5a867f027640ce8274
2024-12-02 12:34:31 +11:00
Campbell Barton
b295fc9a9c Extensions: use replace exists with lexists to check a path can be used
Without this, a broken symbolic-link wasn't removed, causing renaming
to fail.
2024-11-29 13:01:03 +11:00