model/blend: vertex and triangle parents, parent_type / parent_bone / parent_vertices / matrix_parent_inverse, widget flags, modifier stacks with Blender's type names and the armature modifier's settings

This commit is contained in:
4DBug committed 2026-11-03 04:57:53 -06:00
1 parent a9874e9f54
commit 2c2a52e4b3
11 files changed
+1003 -405

No files matched your search

+18 -2
View File
@@ -972,7 +972,7 @@ assert(scene.meta.up == "z" and #scene.skins == 1 and #scene.animations == 1)
local tube = scene.meshes[1].primitives[1]
assert(tube.attributes.JOINTS_0 and tube.attributes.WEIGHTS_0 and #tube.targets == 1)
assert(scene.materials[1].name == "Skin" and scene.materials[1].roughness > 0.69)
print(src.modifiers.Tube[1].type) -- Armature (not applied)
print(src.modifiers.Tube[1].type) -- ARMATURE (not applied)
```
### Material graphs
@@ -1007,7 +1007,7 @@ hold the saved pose.
| joint node `extras.blend` (Bone) | `bone = true`, `length`, `deform`, `use_connect`, `show_wire`, `hide`, `head_local` / `tail_local` (armature space), `roll` (radians, armature space), `collections` (names, in collection order), `color`, `inherit_scale` (`"FULL"`, `"FIX_SHEAR"`, `"ALIGNED"`, `"AVERAGE"`, `"NONE"`, `"NONE_LEGACY"`), `use_inherit_rotation`, `use_local_location`, `use_relative_parent`; b-bones: `bbone_segments`, `bbone_x`, `bbone_z`, `bbone_easein` / `bbone_easeout`, `bbone_rollin` / `bbone_rollout`, `bbone_curveinx` / `bbone_curveinz` / `bbone_curveoutx` / `bbone_curveoutz`, `bbone_scalein` / `bbone_scaleout` (3 numbers), `bbone_handle_type_start` / `_end` (`"AUTO"`, `"ABSOLUTE"`, `"RELATIVE"`, `"TANGENT"`), `bbone_custom_handle_start` / `_end` (bone names), `use_endroll_as_inroll`, `bbone_mapping_mode` |
| joint node `extras.blend` (pose bone) | `rotation_mode` (`"QUATERNION"`, `"XYZ"` .. `"ZYX"`, `"AXIS_ANGLE"`), `lock_location` / `lock_rotation` / `lock_scale` (3 booleans), `lock_rotation_w`, `lock_rotations_4d`, `custom_shape` (node index, or the object's name when it is not in the scene), `custom_shape_transform` (bone name), `custom_shape_translation` / `custom_shape_rotation_euler` / `custom_shape_scale_xyz`, `use_custom_shape_bone_size`, `custom_shape_wire_width` (4.2+), `ik_stretch`, `lock_ik_x/y/z`, `use_ik_limit_x/y/z`, `ik_min_x/y/z`, `ik_max_x/y/z`, `ik_stiffness_x/y/z`, `pose_color`, `constraints`; the stored basis `location`, `rotation_quaternion` (w, x, y, z), `rotation_euler`, `rotation_axis_angle` (angle, x, y, z), `scale` |
| armature node `extras.blend` | `bone_collections`: `{ name, visible, parent? }` (parent by name; files before 4.0 get Blender 4.0's conversion: a `Layer N` collection per used layer, then one hidden collection per bone group) |
| any object node `extras.blend` | `constraints` (object constraints), `hide_viewport`, `hide_render` (when set), `props` (the object's custom properties), `drivers` (the object's), `data_drivers` (its armature's or mesh's) |
| any object node `extras.blend` | `parent_type` (`"OBJECT"`, `"ARMATURE"`, `"LATTICE"`, `"BONE"`, `"VERTEX"`, `"VERTEX_3"`), `parent_bone`, `parent_vertices` (0-based; `parent_vertices_unresolved = true` when the parent is no mesh: then parented to the object), `matrix_parent_inverse` (column-major), `widget = true` on custom shape objects, `modifiers` (below), `constraints` (object constraints), `hide_viewport`, `hide_render` (when set), `props` (the object's custom properties), `drivers` (the object's), `data_drivers` (its armature's or mesh's) |
| joint node `extras.blend` (properties) | `props`: the pose bone's custom properties (`pose.bones["x"]["name"]`), `bone_props`: the bone's (`bones["x"]["name"]`), kept apart as Blender keeps them |
| mesh `extras.blend` | `shape_key_drivers`: the drivers of the mesh's shape keys (`key_blocks["x"].value`, ...) |
| `scene.meta.blend` | `widgets`: every custom shape object `{ name, type, node?, mesh? }` (objects outside the scene's collections get a mesh without a node; edge-only meshes as `"lines"` primitives); `bone_color_sets`: the default theme's `THEME01` .. `THEME20`; `actions`: every action in the file (below) |
@@ -1069,6 +1069,22 @@ The driver's value goes through its f-curve: the keys, then the modifiers; with
(Rain's drivers have two linear keys (0, 0) and (1, 1), or a generator). Files before 5.0 get Blender 5.0's move of
`bones["x"].hide` drivers from the armature data to the object (`pose.bones["x"].hide`).
Parenting follows Blender's object matrix. A bone parent makes the object a child of the joint node: the joint is
the bone's head frame (rest x the stored or animated pose), and the object's local matrix is the bone-tail offset
(0, length, 0) x `matrix_parent_inverse` x its own basis, so it follows the joint's animation. A triangle parent
(`VERTEX_3`) puts the frame Blender builds from the three vertices (their centre, `tri_to_quat`) under the parent
node; a single vertex parent (`VERTEX`) takes only the vertex's position, not the parent's rotation or scale, so the
child's local matrix is exact for the parent's saved transform (an animated parent rotation is not compensated). Vertex
positions are the parent mesh's own, before modifiers and shape keys. Armature and lattice parents are plain object
parents (the deformation is the skin or the lattice modifier). A skinned mesh's node transform does not move its
vertices (glTF skinning), so a bone-parented node that is also skinned follows the skin only.
`modifiers` lists the stack in order as `{ type, name, show_viewport, show_render }` with Blender's type names
(`"ARMATURE"`, `"SUBSURF"`, `"MIRROR"`, ...); `ARMATURE` adds `object` (node index or name), `use_vertex_groups`,
`use_bone_envelopes`, `use_deform_preserve_volume`, `use_multi_modifier`, `vertex_group`, `invert_vertex_group`. The
same lists are in `meta.source.modifiers` by object name. A mesh with an Armature modifier (or an armature parent of
type `ARMATURE`) becomes a skin from its vertex groups, as before; the other settings are data.
Joint nodes model the plain parent chain: Blender's inheritance settings (`use_inherit_rotation`, `inherit_scale`,
`use_local_location`) and b-bone deformation are data for an evaluator, not applied to the joints or skins.