Commit Graph

676 Commits

Author SHA1 Message Date
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
Campbell Barton
5fa0be491e Extensions: suppress noisy prints for extension wheel filtering
These messages could flood the output even when extension installation
succeeded. Only show them when Python debugging is enabled.
2024-11-29 10:27:03 +11:00
Campbell Barton
00255b9421 Correct error printing error in f03fba614d 2024-11-29 10:26:57 +11:00
Campbell Barton
f03fba614d Fix #130211: Unhandled error installing extensions when renaming fails
Add error handling for rare but possible failures on installation.

- Account for the destination extension directory being a file.
- Handle the exception if renaming the temporary directory fails.
2024-11-29 09:56:08 +11:00
Campbell Barton
76f9a08963 Fix failure to reinstall an extension uninstalling the extension
When an extension could could be removed but it's directory could be
renamed, the install operation would fail anyway.

Resolve by completing the installation when the directory can be moved.

Report as part of #129884.
2024-11-28 21:28:30 +11:00
Julien Duroure
373191ff2a glTF exporter: fix KHR_animation_pointer to use the right material when texCoord
We need to store the last version of the material, when all additional data are set
2024-11-28 09:41:35 +01:00
Julien Duroure
428ec6c1e3 glTF exporter: Fix crash when animation on not used material
(And when exporting using KHR_animation_pointer)
2024-11-28 09:38:28 +01:00
Julien Duroure
7ea11a4724 glTF exporter: Always bake scene animation
This way, we can handle drivers animation
2024-11-28 09:35:38 +01:00
Julien Duroure
f7a2d0095e glTF exporter: Fix debug logging
Set INFO level if user set debug to whatever value not used to set logging level
2024-11-28 09:33:22 +01:00
Julien Duroure
ba737a496c glTF exporter: Fix armature object keep channel option
When exporting bone animation, we also check animation on armature object itself
This check was not take into account what channel are really animated
2024-11-28 09:31:23 +01:00
Julien Duroure
5997886662 glTF importer: add option to not select created objects
So, when this operator is called by other scripts in mass, we avoid performance issue
2024-11-28 09:27:29 +01:00
Julien Duroure
f8766c5542 glTF exporter: UI fixes - disable option when not available
Some combination of options are not possible, so option should be grayed
2024-11-28 09:23:14 +01:00
Julien Duroure
dbb670c6d1 glTF importer: add option to import scene extras or not
As user may want to not overwritten them
2024-11-28 09:21:19 +01:00
Julien Duroure
90e09b93b5 glTF exporter: Fix crash with extra channel 2024-11-28 09:19:41 +01:00