model/blend: drivers (object, object data, shape keys: variables, targets, keys, f-curve modifiers) and custom properties (objects, pose bones, bones) as data; f-curve modifiers on raw action curves; limit rotation use_legacy_behavior; 5.0 bone hide driver move for older files

This commit is contained in:
4DBug committed 2026-11-03 00:16:12 -06:00
1 parent b4e1ffebd4
commit a1a3971207
16 files changed
+2056 -605

No files matched your search

+28 -2
View File
@@ -962,7 +962,7 @@ cameras, lights, armatures, skins, shape keys and actions. Blender is z-up (`met
| Armatures | a joint node per bone (rest pose times the saved pose), one skin per deformed mesh; the rig data (bones, collections, colours, custom shapes, constraints) in `extras.blend`, see [Rig data](#rig-data) |
| Shape keys | morph targets (each key minus its relative key, times its vertex group's weights, as Blender evaluates them), named in `mesh.extras.targetNames`; muted keys have weight 0; every key's fields in `mesh.extras.blend.shape_keys` |
| Animation | the active action of each object, armature (pose bones) and shape key set, f-curves evaluated (constant, linear, bezier, easing; extrapolation) and sampled once per frame (`sampleStep`) into channels; time 0 is `meta.source.frameZero` at `meta.source.fps` |
| Not loaded | modifiers (listed per object in `meta.source.modifiers`, never applied), curves, text, metaballs, grease pencil, volumes, NLA strips, drivers, linked libraries; constraints are data only (never evaluated) |
| Not loaded | modifiers (listed per object in `meta.source.modifiers`, never applied), curves, text, metaballs, grease pencil, volumes, NLA strips, linked libraries; constraints and drivers are data only (never evaluated) |
```luau
local scene = assert(F.model.load(riggedBlendBytes))
@@ -988,7 +988,9 @@ 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) |
| 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) |
| 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) |
A colour is `{ palette, normal, select, active }`: `palette` is `"THEME01"` .. `"THEME20"` or `"CUSTOM"` (nil: the
@@ -1024,6 +1026,30 @@ Shape keys: `mesh.extras.blend.shape_keys` lists every key in file order (the ba
slider_max, mute, relative_key, vertex_group? }`, and `reference_key` names the basis. Actions on shape key values
become `weights` channels (clamped to the slider range).
Drivers and custom properties are data, never evaluated. Custom properties are `{ [name] = number | boolean | string |
array | table }` (groups nest; ID references give the ID's name; the pre-3.0 `_RNA_UI` metadata is left out). A driver
is an f-curve as in [actions](#rig-data) (`data_path`, `bone?` / `path` for `pose.bones["x"]...`, `array_index`,
`extrapolation`, `keys`, `modifiers`) plus `driver = { type, expression, use_self, variables }`:
- `type`: `"AVERAGE"`, `"SUM"`, `"SCRIPTED"`, `"MIN"`, `"MAX"`; `expression` for `"SCRIPTED"`.
- a variable: `{ name, type, targets }`, `type` one of `"SINGLE_PROP"`, `"TRANSFORMS"`, `"ROTATION_DIFF"`,
`"LOC_DIFF"`, `"CONTEXT_PROP"`; one target (two for the differences).
- a target: `{ id, id_type, data_path, bone_target, transform_type, transform_space, rotation_mode, context_property,
use_fallback_value?, fallback_value? }`; `id` is a node index for objects in the scene, else the ID's name;
`transform_type` `"LOC_X"` .. `"SCALE_AVG"`, `"ROT_W"`; `transform_space` `"WORLD_SPACE"`, `"TRANSFORM_SPACE"`,
`"LOCAL_SPACE"`.
- a modifier: `{ type, name, mute, influence, use_influence, use_restricted_range, frame_start, frame_end, blend_in,
blend_out }` plus its own fields: `GENERATOR` `mode`, `use_additive`, `poly_order`, `coefficients`; `FNGENERATOR`
`function_type`, `amplitude`, `phase_multiplier`, `phase_offset`, `value_offset`, `use_additive`; `ENVELOPE`
`reference_value`, `default_min`, `default_max`, `control_points`; `CYCLES` `mode_before` / `mode_after`,
`cycles_before` / `cycles_after`; `NOISE` `blend_type`, `scale`, `strength`, `phase`, `offset`, `depth`; `LIMITS`
`use_min_x` .. `use_max_y`, `min_x` .. `max_y`; `STEPPED` `frame_step`, `frame_offset`, `use_frame_start` /
`use_frame_end` with `frame_start` / `frame_end` its own limits.
The driver's value goes through its f-curve: the keys, then the modifiers; with neither, the value passes through 1:1
(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`).
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.