merge ws/blendrig2

This commit is contained in:
4DBug committed 2026-11-02 23:58:36 -06:00
commit b4e1ffebd4
15 files changed
+1683 -560

No files matched your search

+264 -39
View File
@@ -163091,7 +163091,8 @@ __FILES["model/blend"] = function()
-- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour -- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour
-- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights; -- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights;
-- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into -- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into
-- channels; rig data (bone collections / layers, colours, custom shapes, pose settings, constraint stacks) as extras. -- channels, and every action's raw f-curves in meta.blend.actions; rig data (bone collections / layers, colours,
-- custom shapes, pose settings, constraint stacks) as extras.
-- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes, -- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes,
-- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances. -- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances.
@@ -163124,6 +163125,7 @@ type DecodeOptions = {
scene: string?, -- a scene by name (default: the file's current scene) scene: string?, -- a scene by name (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves and keys in meta.blend.actions (default true)
resolve: ((uri: string) -> any)?, -- external images resolve: ((uri: string) -> any)?, -- external images
files: { [string]: any }?, files: { [string]: any }?,
maxBytes: number?, -- decompressed size limit (default 2^31) maxBytes: number?, -- decompressed size limit (default 2^31)
@@ -163245,6 +163247,54 @@ local function curve(f: Blend.File, fc: Blend.View): Curve?
return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods } return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods }
end end
-- an action's f-curves: the legacy list, or (4.4+ layered actions) the channel bags of the strips of every layer whose
-- slot handle matches (handle nil: the first layer's first strip's first channel bag)
local function fcurves(f: Blend.File, act: Blend.View, handle: number?): { Blend.View }
local list: { Blend.View } = act:list("curves", "FCurve")
if #list > 0 or not act:has("layer_array") then
return list
end
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (handle == nil or (bag:num("slot_handle") or 0) == handle) then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
if handle == nil then
return list
end
end
end
end
if handle == nil then
return list
end
end
end
if handle == nil then
return list
end
end
return list
end
function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?) function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not adt then if not adt then
return nil, nil return nil, nil
@@ -163253,41 +163303,8 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not act then if not act then
return nil, nil return nil, nil
end end
local list: { Blend.View } = act:list("curves", "FCurve")
if #list == 0 and act:has("layer_array") then
local handle = adt:num("slot_handle") or 0
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (bag:num("slot_handle") or 0) == handle then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
end
end
end
end
end
end
end
local out: { Curve } = {} local out: { Curve } = {}
for _, fc in list do for _, fc in fcurves(f, act, adt:num("slot_handle") or 0) do
local c = curve(f, fc) local c = curve(f, fc)
if c then if c then
table.insert(out, c) table.insert(out, c)
@@ -163296,6 +163313,67 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
return out, act:idName() return out, act:idName()
end end
-- ------------------------------------------------------------------------------------------------ raw actions
local INTERPOLATION: { [number]: string } = {
[0] = "CONSTANT", [1] = "LINEAR", [2] = "BEZIER", [3] = "BACK", [4] = "BOUNCE", [5] = "CIRC", [6] = "CUBIC",
[7] = "ELASTIC", [8] = "EXPO", [9] = "QUAD", [10] = "QUART", [11] = "QUINT", [12] = "SINE",
}
local EASING: { [number]: string } = { [0] = "AUTO", [1] = "EASE_IN", [2] = "EASE_OUT", [3] = "EASE_IN_OUT" }
local HANDLE: { [number]: string } = { [0] = "FREE", [1] = "AUTO", [2] = "VECTOR", [3] = "ALIGNED", [4] = "AUTO_CLAMPED" }
local ACT_FRAME_RANGE = 0x1000
-- an action as Blender's API shows it: frame_range (the manual range, else the keys' span, at least one frame) and
-- every f-curve with its keyframe points
function Anim.raw(f: Blend.File, act: Blend.View): { [string]: any }
local curves: { { [string]: any } } = {}
local lo: number, hi: number = math.huge, -math.huge
for _, fc in fcurves(f, act, nil) do
local path = fc:cstring("rna_path") or ""
local kind, who, rest = Anim.split(path)
local keys: { { [string]: any } } = {}
for _, b in fc:array("bezt", "BezTriple") do
local v = b:vec("vec")
if v and #v >= 9 then
local x: number = v[4]
local k: { [string]: any } = { co = { x, v[5] }, handle_left = { v[1], v[2] }, handle_right = { v[7], v[8] } }
k.interpolation = INTERPOLATION[b:num("ipo") or 2] or "BEZIER"
k.easing = EASING[b:num("easing") or 0] or "AUTO"
k.handle_left_type, k.handle_right_type = HANDLE[b:num("h1") or 0], HANDLE[b:num("h2") or 0]
k.back, k.amplitude, k.period = b:num("back") or 1.70158, b:num("amplitude") or 0.8, b:num("period") or 4.1
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
if #keys == 0 then
for _, p in fc:array("fpt", "FPoint") do
local v = p:vec("vec")
if v and #v >= 2 then
local x: number = v[1]
local k: { [string]: any } = { co = { x, v[2] } }
k.interpolation = "LINEAR"
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
end
local entry: { [string]: any } = { data_path = path, path = if kind == "pose.bones" then rest else path, keys = keys }
entry.bone = if kind == "pose.bones" then who else nil
entry.array_index = fc:num("array_index") or 0
entry.extrapolation = if (fc:num("extend") or 0) == 1 then "LINEAR" else "CONSTANT"
table.insert(curves, entry)
end
if bit32.band(act:num("flag") or 0, ACT_FRAME_RANGE) ~= 0 and act:has("frame_start") then
lo = act:num("frame_start") or 0
hi = act:num("frame_end") or 0
elseif lo > hi then
lo, hi = 0, 0
end
if hi <= lo then
hi = lo + 1
end
return { frame_range = { lo, hi }, curves = curves }
end
-- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of -- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of
-- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve -- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve
local OB_ADR: { [number]: { any } } = { local OB_ADR: { [number]: { any } } = {
@@ -163533,8 +163611,10 @@ __FILES["model/blend/Armature"] = function()
-- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers -- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers
-- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0), -- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0),
-- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs -- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs
-- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of; the -- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of,
-- common fields for the rest). Flags from DNA_armature_types.h, DNA_action_types.h, DNA_constraint_types.h. -- action, transform, stretch to, armature, floor, limit distance, track to, locked track; the common fields for the
-- rest), bone inheritance and b-bone settings, the stored pose basis. Flags from DNA_armature_types.h,
-- DNA_action_types.h, DNA_constraint_types.h.
local Blend = __include("containers/Blend") local Blend = __include("containers/Blend")
local Armature = {} local Armature = {}
@@ -163592,6 +163672,33 @@ local PCHAN_DRAW_NO_CUSTOM_BONE_SIZE = 1
local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024 local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024
local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 } local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 }
local AXES = { "x", "y", "z" } local AXES = { "x", "y", "z" }
local XYZ: { [number]: string } = { [0] = "X", [1] = "Y", [2] = "Z" }
-- bActionConstraint.type, .mix_mode
local ACTION_CHANNEL: { [number]: string } = {
[0] = "ROTATION_X", [1] = "ROTATION_Y", [2] = "ROTATION_Z", [10] = "SCALE_X", [11] = "SCALE_Y", [12] = "SCALE_Z",
[20] = "LOCATION_X", [21] = "LOCATION_Y", [22] = "LOCATION_Z",
}
local ACTION_MIX: { [number]: string } = { [0] = "AFTER_FULL", [1] = "AFTER", [2] = "BEFORE", [3] = "BEFORE_FULL", [4] = "BEFORE_SPLIT", [5] = "AFTER_SPLIT" }
local MAP: { [number]: string } = { [0] = "LOCATION", [1] = "ROTATION", [2] = "SCALE" }
-- the driver target rotation modes (DTAR_ROTMODE_*)
local FROM_ROT: { [number]: string } = {
[0] = "AUTO", [1] = "XYZ", [2] = "XZY", [3] = "YXZ", [4] = "YZX", [5] = "ZXY", [6] = "ZYX", [7] = "QUATERNION",
[8] = "SWING_TWIST_X", [9] = "SWING_TWIST_Y", [10] = "SWING_TWIST_Z",
}
local MIX_LOC: { [number]: string } = { [0] = "ADD", [1] = "REPLACE" }
local MIX_ROT: { [number]: string } = { [0] = "ADD", [1] = "REPLACE", [2] = "BEFORE", [3] = "AFTER" }
local MIX_SCALE: { [number]: string } = { [0] = "REPLACE", [1] = "MULTIPLY" }
local VOLUME: { [number]: string } = { [0] = "VOLUME_XZX", [1] = "VOLUME_X", [2] = "VOLUME_Z", [3] = "NO_VOLUME" }
local KEEP_AXIS: { [number]: string } = { [0] = "PLANE_X", [1] = "SWING_Y", [2] = "PLANE_Z" }
local FLOOR: { [number]: string } = { [0] = "FLOOR_X", [1] = "FLOOR_Y", [2] = "FLOOR_Z", [3] = "FLOOR_NEGATIVE_X", [4] = "FLOOR_NEGATIVE_Y", [5] = "FLOOR_NEGATIVE_Z" }
local DIST_MODE: { [number]: string } = { [0] = "LIMITDIST_INSIDE", [1] = "LIMITDIST_OUTSIDE", [2] = "LIMITDIST_ONSURFACE" }
local UP: { [number]: string } = { [0] = "UP_X", [1] = "UP_Y", [2] = "UP_Z" }
local LOCK: { [number]: string } = { [0] = "LOCK_X", [1] = "LOCK_Y", [2] = "LOCK_Z" }
-- Bone.inherit_scale_mode, bbone_prev_type / bbone_next_type, bbone_mapping_mode
local INHERIT_SCALE: { [number]: string } = { [0] = "FULL", [1] = "FIX_SHEAR", [2] = "AVERAGE", [3] = "NONE", [4] = "NONE_LEGACY", [5] = "ALIGNED" }
local HANDLE_TYPE: { [number]: string } = { [0] = "AUTO", [1] = "ABSOLUTE", [2] = "RELATIVE", [3] = "TANGENT" }
local MAPPING: { [number]: string } = { [0] = "STRAIGHT", [1] = "CURVED" }
local BONE_HINGE, BONE_NO_SCALE, BONE_NO_LOCAL_LOCATION, BONE_RELATIVE_PARENTING, BONE_ADD_PARENT_END_ROLL = 0x200, 0x8000, 0x400000, 0x800000, 0x1000000
local function bit(v: number?, mask: number): boolean local function bit(v: number?, mask: number): boolean
return bit32.band(v or 0, mask) ~= 0 return bit32.band(v or 0, mask) ~= 0
@@ -163766,7 +163873,35 @@ function Armature.bone(bone: Blend.View, pc: Blend.View?, pose: Blend.View?): {
head_local = vec3(bone, "arm_head"), head_local = vec3(bone, "arm_head"),
tail_local = vec3(bone, "arm_tail"), tail_local = vec3(bone, "arm_tail"),
roll = bone:num("arm_roll"), roll = bone:num("arm_roll"),
use_inherit_rotation = not bit(flag, BONE_HINGE),
use_local_location = not bit(flag, BONE_NO_LOCAL_LOCATION),
use_relative_parent = bit(flag, BONE_RELATIVE_PARENTING),
} }
local ism = bone:num("inherit_scale_mode")
e.inherit_scale = if ism then INHERIT_SCALE[ism] else (if bit(flag, BONE_NO_SCALE) then "NONE_LEGACY" else "FULL") -- BONE_NO_SCALE before 2.81
e.bbone_segments = bone:num("segments") or 1
e.bbone_x, e.bbone_z = bone:num("xwidth"), bone:num("zwidth")
e.bbone_easein, e.bbone_easeout = bone:num("ease1") or 1, bone:num("ease2") or 1
e.bbone_rollin, e.bbone_rollout = bone:num("roll1") or 0, bone:num("roll2") or 0
e.bbone_curveinx, e.bbone_curveinz = bone:num("curveInX") or 0, bone:num("curveInY") or 0 -- curveInY is the API's z
e.bbone_curveoutx, e.bbone_curveoutz = bone:num("curveOutX") or 0, bone:num("curveOutY") or 0
for _, side in { "in", "out" } do
local cap = if side == "in" then "In" else "Out"
local v = vec3(bone, "scale_" .. side)
if not v then
-- before 3.0: scaleIn (x) and scale_in_y (z); before 2.8 one value for both
local x = bone:num("scale" .. cap) or 1
v = { x, 1, bone:num("scale_" .. side .. "_y") or x }
end
e["bbone_scale" .. side] = v
end
e.bbone_handle_type_start = HANDLE_TYPE[bone:num("bbone_prev_type") or 0]
e.bbone_handle_type_end = HANDLE_TYPE[bone:num("bbone_next_type") or 0]
local prev, nxt = bone:deref("bbone_prev", 0, "Bone"), bone:deref("bbone_next", 0, "Bone")
e.bbone_custom_handle_start = if prev then prev:str("name") else nil
e.bbone_custom_handle_end = if nxt then nxt:str("name") else nil
e.use_endroll_as_inroll = if bone:has("bbone_flag") then bit(bone:num("bbone_flag"), 1) else bit(flag, BONE_ADD_PARENT_END_ROLL)
e.bbone_mapping_mode = MAPPING[bone:num("bbone_mapping_mode") or 0]
if bone:has("color") then if bone:has("color") then
e.color = boneColor(bone) e.color = boneColor(bone)
elseif pc and pose then elseif pc and pose then
@@ -163813,10 +163948,72 @@ local function constraintData(e: { [string]: any }, kind: string, d: Blend.View,
e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64) e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64)
e.use_offset = bit(flag, 128) e.use_offset = bit(flag, 128)
elseif kind == "COPY_SCALE" then elseif kind == "COPY_SCALE" then
-- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8 -- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8, MULTIPLY 16 (use_add is its inverse), UNIFORM 32
e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4) e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4)
e.use_offset = bit(flag, 8) e.use_offset = bit(flag, 8)
e.use_add = not bit(flag, 16)
e.use_make_uniform = bit(flag, 32)
e.power = d:num("power") or 1 e.power = d:num("power") or 1
elseif kind == "ACTION" then
-- flag: ACTCON_BONE_USE_OBJECT_ACTION 1, ACTCON_USE_EVAL_TIME 2
local act = d:deref("act", 0, "bAction")
e.action = if act then act:idName() else nil
e.transform_channel = ACTION_CHANNEL[d:num("type") or 20]
e.frame_start, e.frame_end = d:num("start") or 1, d:num("end") or 1
e.min, e.max = d:num("min") or 0, d:num("max") or 0
e.mix_mode = ACTION_MIX[d:num("mix_mode") or 0]
e.use_bone_object_action = bit(flag, 1)
e.use_eval_time = bit(flag, 2)
e.eval_time = d:num("eval_time") or 0
elseif kind == "TRANSFORM" then
e.map_from, e.map_to = MAP[d:num("from") or 0], MAP[d:num("to") or 0]
local map = d.struct.byName.map
for i, a in AXES do
local o = map and d.offset + map.offset + i - 1
e["map_to_" .. a .. "_from"] = XYZ[if o and o < buffer.len(d.file.buf) then buffer.readu8(d.file.buf, o) else i - 1]
end
e.use_motion_extrapolate = (d:num("expo") or 0) ~= 0
e.from_rotation_mode = FROM_ROT[d:num("from_rotation_mode") or 0]
e.to_euler_order = EULER_ORDER[d:num("to_euler_order") or 0]
e.mix_mode = MIX_LOC[d:num("mix_mode_loc") or 0]
e.mix_mode_rot = MIX_ROT[d:num("mix_mode_rot") or 0]
e.mix_mode_scale = MIX_SCALE[d:num("mix_mode_scale") or 0]
for _, side in { "from", "to" } do
for _, suffix in { "", "_rot", "_scale" } do
local lo, hi = d:vec(side .. "_min" .. suffix), d:vec(side .. "_max" .. suffix)
for i, a in AXES do
e[side .. "_min_" .. a .. suffix] = lo and lo[i] or 0
e[side .. "_max_" .. a .. suffix] = hi and hi[i] or 0
end
end
end
elseif kind == "STRETCH_TO" then
-- STRETCHTOCON_USE_BULGE_MIN 1, MAX 2
e.rest_length = d:num("orglength")
e.bulge = d:num("bulge")
e.volume = VOLUME[d:num("volmode") or 0]
e.keep_axis = KEEP_AXIS[d:num("plane") or 0]
e.use_bulge_min, e.use_bulge_max = bit(flag, 1), bit(flag, 2)
e.bulge_min, e.bulge_max, e.bulge_smooth = d:num("bulge_min"), d:num("bulge_max"), d:num("bulge_smooth")
elseif kind == "ARMATURE" then
-- CONSTRAINT_ARMATURE_QUATERNION 1, ENVELOPE 2, CUR_LOCATION 4
e.use_deform_preserve_volume, e.use_bone_envelopes, e.use_current_location = bit(flag, 1), bit(flag, 2), bit(flag, 4)
elseif kind == "FLOOR" then
-- flag: MINMAX_USEROT 4
e.floor_location = FLOOR[d:num("minmaxflag") or 2]
e.offset = d:num("offset") or 0
e.use_rotation = bit(flag, 4)
elseif kind == "LIMIT_DISTANCE" then
e.distance = d:num("dist")
e.limit_mode = DIST_MODE[d:num("mode") or 0]
elseif kind == "TRACK_TO" then
-- reserved1 the track axis, reserved2 the up axis; flags TARGET_Z_UP 1
e.track_axis = TRACK[d:num("reserved1") or 1]
e.up_axis = UP[d:num("reserved2") or 2]
e.use_target_z = bit(d:num("flags"), 1)
elseif kind == "LOCKED_TRACK" then
e.track_axis = TRACK[d:num("trackflag") or 1]
e.lock_axis = LOCK[d:num("lockflag") or 2]
elseif kind == "COPY_TRANSFORMS" then elseif kind == "COPY_TRANSFORMS" then
e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0] e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0]
e.remove_target_shear = bit(flag, 1) e.remove_target_shear = bit(flag, 1)
@@ -163929,6 +164126,14 @@ function Armature.pose(e: { [string]: any }, pc: Blend.View, resolve: Resolve, s
e["ik_stiffness_" .. a] = stiff and stiff[i] or 0 e["ik_stiffness_" .. a] = stiff and stiff[i] or 0
end end
e.pose_color = if pc:has("color") then boneColor(pc) else nil e.pose_color = if pc:has("color") then boneColor(pc) else nil
-- the stored basis (rotation_quaternion w, x, y, z; rotation_axis_angle angle, x, y, z)
e.location = vec3(pc, "loc", { 0, 0, 0 })
local q = pc:vec("quat")
e.rotation_quaternion = if q and #q >= 4 then { q[1], q[2], q[3], q[4] } else { 1, 0, 0, 0 }
e.rotation_euler = vec3(pc, "eul", { 0, 0, 0 })
local axis = vec3(pc, "rotAxis", { 0, 1, 0 }) :: { number }
e.rotation_axis_angle = { pc:num("rotAngle") or 0, axis[1], axis[2], axis[3] }
e.scale = vec3(pc, "size", nil) or vec3(pc, "scale", { 1, 1, 1 })
e.constraints = Armature.constraints(pc, resolve) e.constraints = Armature.constraints(pc, resolve)
end end
@@ -165673,6 +165878,7 @@ type Options = {
scene: string?, -- the scene to read (default: the file's current scene) scene: string?, -- the scene to read (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves in meta.blend.actions (default true)
resolve: ((uri: string) -> any)?, resolve: ((uri: string) -> any)?,
files: { [string]: any }?, files: { [string]: any }?,
maxVertices: number?, maxVertices: number?,
@@ -166658,8 +166864,27 @@ function Read.scene(f: Blend.File, opts: Options?): (Types.Scene?, string?)
end end
end end
skins(ctx) skins(ctx)
local mb: { [string]: any } = {}
if next(ctx.armatures) ~= nil then if next(ctx.armatures) ~= nil then
scene.meta.blend = { widgets = widgetList(ctx), bone_color_sets = Armature.colorSets() } mb.widgets = widgetList(ctx)
mb.bone_color_sets = Armature.colorSets()
end
-- every action in the file by name (assigned or not: action constraints and the NLA refer to them)
if o.rawActions ~= false then
local acts: { [string]: any } = {}
for _, b in Blend.blocks(f, "AC") do
local act = Blend.struct(f, b, 0, "bAction")
local name = act and act:idName()
if act and name and not acts[name] then
acts[name] = Anim.raw(f, act)
end
end
if next(acts) ~= nil then
mb.actions = acts
end
end
if next(mb) ~= nil then
scene.meta.blend = mb
end end
if o.animations ~= false then if o.animations ~= false then
animations(ctx) animations(ctx)
+183 -183
View File
@@ -436,187 +436,187 @@
[162461, "src/Rosetta/model/b3d/init.luau"], [162461, "src/Rosetta/model/b3d/init.luau"],
[162516, "src/Rosetta/model/b3d/Read.luau"], [162516, "src/Rosetta/model/b3d/Read.luau"],
[163087, "src/Rosetta/model/blend/init.luau"], [163087, "src/Rosetta/model/blend/init.luau"],
[163185, "src/Rosetta/model/blend/Anim.luau"], [163187, "src/Rosetta/model/blend/Anim.luau"],
[163531, "src/Rosetta/model/blend/Armature.luau"], [163609, "src/Rosetta/model/blend/Armature.luau"],
[163938, "src/Rosetta/model/blend/Material.luau"], [164143, "src/Rosetta/model/blend/Material.luau"],
[164290, "src/Rosetta/model/blend/Mesh.luau"], [164495, "src/Rosetta/model/blend/Mesh.luau"],
[164978, "src/Rosetta/model/blend/Normals.luau"], [165183, "src/Rosetta/model/blend/Normals.luau"],
[165139, "src/Rosetta/model/blend/Prim.luau"], [165344, "src/Rosetta/model/blend/Prim.luau"],
[165646, "src/Rosetta/model/blend/Read.luau"], [165851, "src/Rosetta/model/blend/Read.luau"],
[166685, "src/Rosetta/model/bsp/init.luau"], [166910, "src/Rosetta/model/bsp/init.luau"],
[166876, "src/Rosetta/model/bsp/Lightmap.luau"], [167101, "src/Rosetta/model/bsp/Lightmap.luau"],
[166942, "src/Rosetta/model/bsp/Quake.luau"], [167167, "src/Rosetta/model/bsp/Quake.luau"],
[167331, "src/Rosetta/model/bsp/Quake3.luau"], [167556, "src/Rosetta/model/bsp/Quake3.luau"],
[167560, "src/Rosetta/model/bsp/Tree.luau"], [167785, "src/Rosetta/model/bsp/Tree.luau"],
[167948, "src/Rosetta/model/buildmap/init.luau"], [168173, "src/Rosetta/model/buildmap/init.luau"],
[168220, "src/Rosetta/model/buildmap/Geometry.luau"], [168445, "src/Rosetta/model/buildmap/Geometry.luau"],
[168623, "src/Rosetta/model/d3map/init.luau"], [168848, "src/Rosetta/model/d3map/init.luau"],
[168905, "src/Rosetta/model/d3map/Parse.luau"], [169130, "src/Rosetta/model/d3map/Parse.luau"],
[169103, "src/Rosetta/model/dae/init.luau"], [169328, "src/Rosetta/model/dae/init.luau"],
[169292, "src/Rosetta/model/dae/Math.luau"], [169517, "src/Rosetta/model/dae/Math.luau"],
[169339, "src/Rosetta/model/dae/Read.luau"], [169564, "src/Rosetta/model/dae/Read.luau"],
[171189, "src/Rosetta/model/dae/Write.luau"], [171414, "src/Rosetta/model/dae/Write.luau"],
[171558, "src/Rosetta/model/fbx/init.luau"], [171783, "src/Rosetta/model/fbx/init.luau"],
[171706, "src/Rosetta/model/fbx/Ascii.luau"], [171931, "src/Rosetta/model/fbx/Ascii.luau"],
[171976, "src/Rosetta/model/fbx/Binary.luau"], [172201, "src/Rosetta/model/fbx/Binary.luau"],
[172431, "src/Rosetta/model/fbx/Read.luau"], [172656, "src/Rosetta/model/fbx/Read.luau"],
[173793, "src/Rosetta/model/fbx/Write.luau"], [174018, "src/Rosetta/model/fbx/Write.luau"],
[174778, "src/Rosetta/model/fbx/Xform.luau"], [175003, "src/Rosetta/model/fbx/Xform.luau"],
[174819, "src/Rosetta/model/gltf/init.luau"], [175044, "src/Rosetta/model/gltf/init.luau"],
[175056, "src/Rosetta/model/gltf/Pack.luau"], [175281, "src/Rosetta/model/gltf/Pack.luau"],
[175125, "src/Rosetta/model/gltf/Read.luau"], [175350, "src/Rosetta/model/gltf/Read.luau"],
[175866, "src/Rosetta/model/gltf/Write.luau"], [176091, "src/Rosetta/model/gltf/Write.luau"],
[176552, "src/Rosetta/model/godot/init.luau"], [176777, "src/Rosetta/model/godot/init.luau"],
[176643, "src/Rosetta/model/godot/Build.luau"], [176868, "src/Rosetta/model/godot/Build.luau"],
[177185, "src/Rosetta/model/godot/Primitives.luau"], [177410, "src/Rosetta/model/godot/Primitives.luau"],
[177460, "src/Rosetta/model/godot/Surface.luau"], [177685, "src/Rosetta/model/godot/Surface.luau"],
[177945, "src/Rosetta/model/godot/Write.luau"], [178170, "src/Rosetta/model/godot/Write.luau"],
[178274, "src/Rosetta/model/iqm/init.luau"], [178499, "src/Rosetta/model/iqm/init.luau"],
[178350, "src/Rosetta/model/iqm/Read.luau"], [178575, "src/Rosetta/model/iqm/Read.luau"],
[178705, "src/Rosetta/model/iqm/Write.luau"], [178930, "src/Rosetta/model/iqm/Write.luau"],
[179392, "src/Rosetta/model/ldraw/init.luau"], [179617, "src/Rosetta/model/ldraw/init.luau"],
[179470, "src/Rosetta/model/ldraw/Colors.luau"], [179695, "src/Rosetta/model/ldraw/Colors.luau"],
[179788, "src/Rosetta/model/ldraw/Read.luau"], [180013, "src/Rosetta/model/ldraw/Read.luau"],
[180365, "src/Rosetta/model/lwo/init.luau"], [180590, "src/Rosetta/model/lwo/init.luau"],
[180441, "src/Rosetta/model/lwo/Build.luau"], [180666, "src/Rosetta/model/lwo/Build.luau"],
[180903, "src/Rosetta/model/lwo/Parse.luau"], [181128, "src/Rosetta/model/lwo/Parse.luau"],
[181446, "src/Rosetta/model/map/init.luau"], [181671, "src/Rosetta/model/map/init.luau"],
[181763, "src/Rosetta/model/map/Build.luau"], [181988, "src/Rosetta/model/map/Build.luau"],
[182007, "src/Rosetta/model/map/Parse.luau"], [182232, "src/Rosetta/model/map/Parse.luau"],
[182392, "src/Rosetta/model/map/Write.luau"], [182617, "src/Rosetta/model/map/Write.luau"],
[182538, "src/Rosetta/model/mca/init.luau"], [182763, "src/Rosetta/model/mca/init.luau"],
[182880, "src/Rosetta/model/mca/Chunk.luau"], [183105, "src/Rosetta/model/mca/Chunk.luau"],
[183013, "src/Rosetta/model/mca/Lz4Block.luau"], [183238, "src/Rosetta/model/mca/Lz4Block.luau"],
[183083, "src/Rosetta/model/md2/init.luau"], [183308, "src/Rosetta/model/md2/init.luau"],
[183282, "src/Rosetta/model/md3/init.luau"], [183507, "src/Rosetta/model/md3/init.luau"],
[183510, "src/Rosetta/model/md5/init.luau"], [183735, "src/Rosetta/model/md5/init.luau"],
[183591, "src/Rosetta/model/md5/Read.luau"], [183816, "src/Rosetta/model/md5/Read.luau"],
[184024, "src/Rosetta/model/mdl/init.luau"], [184249, "src/Rosetta/model/mdl/init.luau"],
[184106, "src/Rosetta/model/mdl/HalfLife.luau"], [184331, "src/Rosetta/model/mdl/HalfLife.luau"],
[184410, "src/Rosetta/model/mdl/Quake.luau"], [184635, "src/Rosetta/model/mdl/Quake.luau"],
[184628, "src/Rosetta/model/ms3d/init.luau"], [184853, "src/Rosetta/model/ms3d/init.luau"],
[184700, "src/Rosetta/model/ms3d/Read.luau"], [184925, "src/Rosetta/model/ms3d/Read.luau"],
[185146, "src/Rosetta/model/ms3d/Write.luau"], [185371, "src/Rosetta/model/ms3d/Write.luau"],
[185615, "src/Rosetta/model/obj/init.luau"], [185840, "src/Rosetta/model/obj/init.luau"],
[186433, "src/Rosetta/model/obj/Mtl.luau"], [186658, "src/Rosetta/model/obj/Mtl.luau"],
[186721, "src/Rosetta/model/off/init.luau"], [186946, "src/Rosetta/model/off/init.luau"],
[187183, "src/Rosetta/model/ply/init.luau"], [187408, "src/Rosetta/model/ply/init.luau"],
[188288, "src/Rosetta/model/ply/Binary.luau"], [188513, "src/Rosetta/model/ply/Binary.luau"],
[188489, "src/Rosetta/model/pmx/init.luau"], [188714, "src/Rosetta/model/pmx/init.luau"],
[188558, "src/Rosetta/model/pmx/Build.luau"], [188783, "src/Rosetta/model/pmx/Build.luau"],
[188854, "src/Rosetta/model/pmx/Pmd.luau"], [189079, "src/Rosetta/model/pmx/Pmd.luau"],
[189189, "src/Rosetta/model/pmx/Read.luau"], [189414, "src/Rosetta/model/pmx/Read.luau"],
[189593, "src/Rosetta/model/proc/init.luau"], [189818, "src/Rosetta/model/proc/init.luau"],
[189975, "src/Rosetta/model/qb/init.luau"], [190200, "src/Rosetta/model/qb/init.luau"],
[190368, "src/Rosetta/model/rbxm/init.luau"], [190593, "src/Rosetta/model/rbxm/init.luau"],
[190961, "src/Rosetta/model/rbxmx/init.luau"], [191186, "src/Rosetta/model/rbxmx/init.luau"],
[191637, "src/Rosetta/model/robloxmesh/init.luau"], [191862, "src/Rosetta/model/robloxmesh/init.luau"],
[192296, "src/Rosetta/model/robloxmesh/Parse.luau"], [192521, "src/Rosetta/model/robloxmesh/Parse.luau"],
[192753, "src/Rosetta/model/robloxmesh/Write.luau"], [192978, "src/Rosetta/model/robloxmesh/Write.luau"],
[192862, "src/Rosetta/model/schematic/init.luau"], [193087, "src/Rosetta/model/schematic/init.luau"],
[193183, "src/Rosetta/model/schematic/Common.luau"], [193408, "src/Rosetta/model/schematic/Common.luau"],
[193303, "src/Rosetta/model/schematic/Litematic.luau"], [193528, "src/Rosetta/model/schematic/Litematic.luau"],
[193514, "src/Rosetta/model/schematic/Mcedit.luau"], [193739, "src/Rosetta/model/schematic/Mcedit.luau"],
[193758, "src/Rosetta/model/schematic/Sponge.luau"], [193983, "src/Rosetta/model/schematic/Sponge.luau"],
[193887, "src/Rosetta/model/smd/init.luau"], [194112, "src/Rosetta/model/smd/init.luau"],
[193954, "src/Rosetta/model/smd/Read.luau"], [194179, "src/Rosetta/model/smd/Read.luau"],
[194223, "src/Rosetta/model/smd/Write.luau"], [194448, "src/Rosetta/model/smd/Write.luau"],
[194466, "src/Rosetta/model/sourcemdl/init.luau"], [194691, "src/Rosetta/model/sourcemdl/init.luau"],
[194637, "src/Rosetta/model/sourcemdl/Build.luau"], [194862, "src/Rosetta/model/sourcemdl/Build.luau"],
[195067, "src/Rosetta/model/sourcemdl/Material.luau"], [195292, "src/Rosetta/model/sourcemdl/Material.luau"],
[195228, "src/Rosetta/model/sourcemdl/Mdl.luau"], [195453, "src/Rosetta/model/sourcemdl/Mdl.luau"],
[195755, "src/Rosetta/model/sourcemdl/Phy.luau"], [195980, "src/Rosetta/model/sourcemdl/Phy.luau"],
[195878, "src/Rosetta/model/sourcemdl/Vtx.luau"], [196103, "src/Rosetta/model/sourcemdl/Vtx.luau"],
[196060, "src/Rosetta/model/sourcemdl/Vvd.luau"], [196285, "src/Rosetta/model/sourcemdl/Vvd.luau"],
[196154, "src/Rosetta/model/stl/init.luau"], [196379, "src/Rosetta/model/stl/init.luau"],
[196604, "src/Rosetta/model/stl/Decode.luau"], [196829, "src/Rosetta/model/stl/Decode.luau"],
[196678, "src/Rosetta/model/t3d/init.luau"], [196903, "src/Rosetta/model/t3d/init.luau"],
[196772, "src/Rosetta/model/t3d/Build.luau"], [196997, "src/Rosetta/model/t3d/Build.luau"],
[197177, "src/Rosetta/model/t3d/Parse.luau"], [197402, "src/Rosetta/model/t3d/Parse.luau"],
[197345, "src/Rosetta/model/udmf/init.luau"], [197570, "src/Rosetta/model/udmf/init.luau"],
[197428, "src/Rosetta/model/usda/init.luau"], [197653, "src/Rosetta/model/usda/init.luau"],
[197637, "src/Rosetta/model/usda/Build.luau"], [197862, "src/Rosetta/model/usda/Build.luau"],
[198915, "src/Rosetta/model/usda/Parse.luau"], [199140, "src/Rosetta/model/usda/Parse.luau"],
[199713, "src/Rosetta/model/usda/Write.luau"], [199938, "src/Rosetta/model/usda/Write.luau"],
[200530, "src/Rosetta/model/vbsp/init.luau"], [200755, "src/Rosetta/model/vbsp/init.luau"],
[200976, "src/Rosetta/model/vbsp/Faces.luau"], [201201, "src/Rosetta/model/vbsp/Faces.luau"],
[201200, "src/Rosetta/model/vbsp/Props.luau"], [201425, "src/Rosetta/model/vbsp/Props.luau"],
[201292, "src/Rosetta/model/vmf/init.luau"], [201517, "src/Rosetta/model/vmf/init.luau"],
[201617, "src/Rosetta/model/vmf/Build.luau"], [201842, "src/Rosetta/model/vmf/Build.luau"],
[202041, "src/Rosetta/model/vox/init.luau"], [202266, "src/Rosetta/model/vox/init.luau"],
[202927, "src/Rosetta/model/vox/Grid.luau"], [203152, "src/Rosetta/model/vox/Grid.luau"],
[202984, "src/Rosetta/model/vrml/init.luau"], [203209, "src/Rosetta/model/vrml/init.luau"],
[203050, "src/Rosetta/model/x/init.luau"], [203275, "src/Rosetta/model/x/init.luau"],
[203180, "src/Rosetta/model/x/Build.luau"], [203405, "src/Rosetta/model/x/Build.luau"],
[203743, "src/Rosetta/model/x/Parse.luau"], [203968, "src/Rosetta/model/x/Parse.luau"],
[204040, "src/Rosetta/model/x3d/init.luau"], [204265, "src/Rosetta/model/x3d/init.luau"],
[204118, "src/Rosetta/music/669/init.luau"], [204343, "src/Rosetta/music/669/init.luau"],
[204325, "src/Rosetta/music/ahx/init.luau"], [204550, "src/Rosetta/music/ahx/init.luau"],
[204377, "src/Rosetta/music/far/init.luau"], [204602, "src/Rosetta/music/far/init.luau"],
[204607, "src/Rosetta/music/hmp/init.luau"], [204832, "src/Rosetta/music/hmp/init.luau"],
[204872, "src/Rosetta/music/hvl/init.luau"], [205097, "src/Rosetta/music/hvl/init.luau"],
[204924, "src/Rosetta/music/it/init.luau"], [205149, "src/Rosetta/music/it/init.luau"],
[205343, "src/Rosetta/music/it/Itsex.luau"], [205568, "src/Rosetta/music/it/Itsex.luau"],
[205460, "src/Rosetta/music/med/init.luau"], [205685, "src/Rosetta/music/med/init.luau"],
[206108, "src/Rosetta/music/midi/init.luau"], [206333, "src/Rosetta/music/midi/init.luau"],
[206252, "src/Rosetta/music/midi/Smf.luau"], [206477, "src/Rosetta/music/midi/Smf.luau"],
[206664, "src/Rosetta/music/mod/init.luau"], [206889, "src/Rosetta/music/mod/init.luau"],
[207018, "src/Rosetta/music/mtm/init.luau"], [207243, "src/Rosetta/music/mtm/init.luau"],
[207241, "src/Rosetta/music/mus/init.luau"], [207466, "src/Rosetta/music/mus/init.luau"],
[207399, "src/Rosetta/music/okt/init.luau"], [207624, "src/Rosetta/music/okt/init.luau"],
[207681, "src/Rosetta/music/ptm/init.luau"], [207906, "src/Rosetta/music/ptm/init.luau"],
[207904, "src/Rosetta/music/s3m/init.luau"], [208129, "src/Rosetta/music/s3m/init.luau"],
[208141, "src/Rosetta/music/sf2/init.luau"], [208366, "src/Rosetta/music/sf2/init.luau"],
[208185, "src/Rosetta/music/stm/init.luau"], [208410, "src/Rosetta/music/stm/init.luau"],
[208417, "src/Rosetta/music/ult/init.luau"], [208642, "src/Rosetta/music/ult/init.luau"],
[208722, "src/Rosetta/music/umx/init.luau"], [208947, "src/Rosetta/music/umx/init.luau"],
[208939, "src/Rosetta/music/xm/init.luau"], [209164, "src/Rosetta/music/xm/init.luau"],
[209501, "src/Rosetta/music/xmi/init.luau"], [209726, "src/Rosetta/music/xmi/init.luau"],
[209710, "src/Rosetta/ops/AudioOps.luau"], [209935, "src/Rosetta/ops/AudioOps.luau"],
[210189, "src/Rosetta/ops/ImageOps/init.luau"], [210414, "src/Rosetta/ops/ImageOps/init.luau"],
[210837, "src/Rosetta/ops/ImageOps/Kernels.luau"], [211062, "src/Rosetta/ops/ImageOps/Kernels.luau"],
[211477, "src/Rosetta/ops/LayerOps.luau"], [211702, "src/Rosetta/ops/LayerOps.luau"],
[211570, "src/Rosetta/ops/MeshOps/init.luau"], [211795, "src/Rosetta/ops/MeshOps/init.luau"],
[212710, "src/Rosetta/ops/MeshOps/Greedy.luau"], [212935, "src/Rosetta/ops/MeshOps/Greedy.luau"],
[212877, "src/Rosetta/ops/MusicOps.luau"], [213102, "src/Rosetta/ops/MusicOps.luau"],
[213226, "src/Rosetta/playlist/m3u/init.luau"], [213451, "src/Rosetta/playlist/m3u/init.luau"],
[213579, "src/Rosetta/playlist/pls/init.luau"], [213804, "src/Rosetta/playlist/pls/init.luau"],
[213757, "src/Rosetta/playlist/xspf/init.luau"], [213982, "src/Rosetta/playlist/xspf/init.luau"],
[213960, "src/Rosetta/subtitle/ass/init.luau"], [214185, "src/Rosetta/subtitle/ass/init.luau"],
[214404, "src/Rosetta/subtitle/srt/init.luau"], [214629, "src/Rosetta/subtitle/srt/init.luau"],
[214577, "src/Rosetta/subtitle/vtt/init.luau"], [214802, "src/Rosetta/subtitle/vtt/init.luau"],
[214780, "src/Rosetta/vector/gamemaps/init.luau"], [215005, "src/Rosetta/vector/gamemaps/init.luau"],
[214967, "src/Rosetta/vector/gamemaps/Expand.luau"], [215192, "src/Rosetta/vector/gamemaps/Expand.luau"],
[215064, "src/Rosetta/vector/ldtk/init.luau"], [215289, "src/Rosetta/vector/ldtk/init.luau"],
[215156, "src/Rosetta/vector/ldtk/Read.luau"], [215381, "src/Rosetta/vector/ldtk/Read.luau"],
[215492, "src/Rosetta/vector/ldtk/Write.luau"], [215717, "src/Rosetta/vector/ldtk/Write.luau"],
[216140, "src/Rosetta/vector/ogmo/init.luau"], [216365, "src/Rosetta/vector/ogmo/init.luau"],
[216259, "src/Rosetta/vector/ogmo/Read.luau"], [216484, "src/Rosetta/vector/ogmo/Read.luau"],
[216664, "src/Rosetta/vector/ogmo/Write.luau"], [216889, "src/Rosetta/vector/ogmo/Write.luau"],
[217018, "src/Rosetta/vector/svg/init.luau"], [217243, "src/Rosetta/vector/svg/init.luau"],
[217104, "src/Rosetta/vector/svg/Parse.luau"], [217329, "src/Rosetta/vector/svg/Parse.luau"],
[217850, "src/Rosetta/vector/svg/PathData.luau"], [218075, "src/Rosetta/vector/svg/PathData.luau"],
[218218, "src/Rosetta/vector/svg/Render.luau"], [218443, "src/Rosetta/vector/svg/Render.luau"],
[218635, "src/Rosetta/vector/svg/Style.luau"], [218860, "src/Rosetta/vector/svg/Style.luau"],
[219007, "src/Rosetta/vector/svg/Write.luau"], [219232, "src/Rosetta/vector/svg/Write.luau"],
[219207, "src/Rosetta/vector/tiled/init.luau"], [219432, "src/Rosetta/vector/tiled/init.luau"],
[219387, "src/Rosetta/vector/tiled/Data.luau"], [219612, "src/Rosetta/vector/tiled/Data.luau"],
[219538, "src/Rosetta/vector/tiled/Tmj.luau"], [219763, "src/Rosetta/vector/tiled/Tmj.luau"],
[220169, "src/Rosetta/vector/tiled/Tmx.luau"], [220394, "src/Rosetta/vector/tiled/Tmx.luau"],
[220781, "src/Rosetta/video/avi/init.luau"], [221006, "src/Rosetta/video/avi/init.luau"],
[221075, "src/Rosetta/video/fli/init.luau"], [221300, "src/Rosetta/video/fli/init.luau"],
[221226, "src/Rosetta/video/flv/init.luau"], [221451, "src/Rosetta/video/flv/init.luau"],
[221610, "src/Rosetta/video/flv/Amf.luau"], [221835, "src/Rosetta/video/flv/Amf.luau"],
[221768, "src/Rosetta/video/flv/Mux.luau"], [221993, "src/Rosetta/video/flv/Mux.luau"],
[222049, "src/Rosetta/video/h264/init.luau"], [222274, "src/Rosetta/video/h264/init.luau"],
[222188, "src/Rosetta/video/mkv/init.luau"], [222413, "src/Rosetta/video/mkv/init.luau"],
[222344, "src/Rosetta/video/mkv/Mux.luau"], [222569, "src/Rosetta/video/mkv/Mux.luau"],
[222623, "src/Rosetta/video/mkv/Parse.luau"], [222848, "src/Rosetta/video/mkv/Parse.luau"],
[223344, "src/Rosetta/video/mp4/init.luau"], [223569, "src/Rosetta/video/mp4/init.luau"],
[223672, "src/Rosetta/video/mpegps/init.luau"], [223897, "src/Rosetta/video/mpegps/init.luau"],
[223859, "src/Rosetta/video/mpegts/init.luau"], [224084, "src/Rosetta/video/mpegts/init.luau"],
[224105, "src/Rosetta/video/ogv/init.luau"], [224330, "src/Rosetta/video/ogv/init.luau"],
[224500, "src/Rosetta/video/smk/init.luau"], [224725, "src/Rosetta/video/smk/init.luau"],
[224809, "src/Rosetta/video/smk/Audio.luau"], [225034, "src/Rosetta/video/smk/Audio.luau"],
[224929, "src/Rosetta/video/y4m/init.luau"] [225154, "src/Rosetta/video/y4m/init.luau"]
] ]
Binary file not shown.
+2 -2
View File
@@ -48,8 +48,8 @@
"image_1": [[8, "src/Rosetta/image/ani/init.luau"], [188, "src/Rosetta/image/art/init.luau"], [676, "src/Rosetta/image/blp/init.luau"], [934, "src/Rosetta/image/bmp/init.luau"], [1349, "src/Rosetta/image/dds/init.luau"], [1832, "src/Rosetta/image/exr/init.luau"], [2592, "src/Rosetta/image/exr/Codec.luau"], [2703, "src/Rosetta/image/exr/Piz.luau"], [3060, "src/Rosetta/image/gif/init.luau"], [3576, "src/Rosetta/image/gif/Decode.luau"], [3652, "src/Rosetta/image/hdr/init.luau"], [3881, "src/Rosetta/image/hdr/Codec.luau"], [4092, "src/Rosetta/image/icns/init.luau"], [4423, "src/Rosetta/image/ico/init.luau"], [4700, "src/Rosetta/image/ico/Dib.luau"], [4795, "src/Rosetta/image/ilbm/init.luau"], [5114, "src/Rosetta/image/jpeg/init.luau"], [5273, "src/Rosetta/image/ktx/init.luau"], [5933, "src/Rosetta/image/lmp/init.luau"], [6066, "src/Rosetta/image/pcx/init.luau"], [6330, "src/Rosetta/image/pnm/init.luau"], [6708, "src/Rosetta/image/pnm/Codec.luau"], [6985, "src/Rosetta/image/qoi/init.luau"], [7107, "src/Rosetta/image/qoi/Codec.luau"], [7264, "src/Rosetta/image/sgi/init.luau"]], "image_1": [[8, "src/Rosetta/image/ani/init.luau"], [188, "src/Rosetta/image/art/init.luau"], [676, "src/Rosetta/image/blp/init.luau"], [934, "src/Rosetta/image/bmp/init.luau"], [1349, "src/Rosetta/image/dds/init.luau"], [1832, "src/Rosetta/image/exr/init.luau"], [2592, "src/Rosetta/image/exr/Codec.luau"], [2703, "src/Rosetta/image/exr/Piz.luau"], [3060, "src/Rosetta/image/gif/init.luau"], [3576, "src/Rosetta/image/gif/Decode.luau"], [3652, "src/Rosetta/image/hdr/init.luau"], [3881, "src/Rosetta/image/hdr/Codec.luau"], [4092, "src/Rosetta/image/icns/init.luau"], [4423, "src/Rosetta/image/ico/init.luau"], [4700, "src/Rosetta/image/ico/Dib.luau"], [4795, "src/Rosetta/image/ilbm/init.luau"], [5114, "src/Rosetta/image/jpeg/init.luau"], [5273, "src/Rosetta/image/ktx/init.luau"], [5933, "src/Rosetta/image/lmp/init.luau"], [6066, "src/Rosetta/image/pcx/init.luau"], [6330, "src/Rosetta/image/pnm/init.luau"], [6708, "src/Rosetta/image/pnm/Codec.luau"], [6985, "src/Rosetta/image/qoi/init.luau"], [7107, "src/Rosetta/image/qoi/Codec.luau"], [7264, "src/Rosetta/image/sgi/init.luau"]],
"image_2": [[8, "src/Rosetta/image/spr/init.luau"], [321, "src/Rosetta/image/sunras/init.luau"], [567, "src/Rosetta/image/tga/init.luau"], [837, "src/Rosetta/image/tga/Codec.luau"], [1037, "src/Rosetta/image/tiff/init.luau"], [1864, "src/Rosetta/image/tiff/Pixels.luau"], [2254, "src/Rosetta/image/tim/init.luau"], [2496, "src/Rosetta/image/vtf/init.luau"], [2731, "src/Rosetta/image/webp/init.luau"], [3341, "src/Rosetta/image/webp/Alpha.luau"], [3417, "src/Rosetta/image/webp/Anim.luau"], [3572, "src/Rosetta/image/xbm/init.luau"], [3733, "src/Rosetta/image/xpm/init.luau"], [4001, "src/Rosetta/image/xpm/Names.luau"]], "image_2": [[8, "src/Rosetta/image/spr/init.luau"], [321, "src/Rosetta/image/sunras/init.luau"], [567, "src/Rosetta/image/tga/init.luau"], [837, "src/Rosetta/image/tga/Codec.luau"], [1037, "src/Rosetta/image/tiff/init.luau"], [1864, "src/Rosetta/image/tiff/Pixels.luau"], [2254, "src/Rosetta/image/tim/init.luau"], [2496, "src/Rosetta/image/vtf/init.luau"], [2731, "src/Rosetta/image/webp/init.luau"], [3341, "src/Rosetta/image/webp/Alpha.luau"], [3417, "src/Rosetta/image/webp/Anim.luau"], [3572, "src/Rosetta/image/xbm/init.luau"], [3733, "src/Rosetta/image/xpm/init.luau"], [4001, "src/Rosetta/image/xpm/Names.luau"]],
"layered": [[8, "src/Rosetta/layered/aseprite/init.luau"], [746, "src/Rosetta/layered/ora/init.luau"], [1033, "src/Rosetta/layered/psd/init.luau"], [1768, "src/Rosetta/layered/psd/Channels.luau"]], "layered": [[8, "src/Rosetta/layered/aseprite/init.luau"], [746, "src/Rosetta/layered/ora/init.luau"], [1033, "src/Rosetta/layered/psd/init.luau"], [1768, "src/Rosetta/layered/psd/Channels.luau"]],
"model_1": [[8, "src/Rosetta/model/3ds/init.luau"], [91, "src/Rosetta/model/3ds/Build.luau"], [738, "src/Rosetta/model/3ds/Read.luau"], [1234, "src/Rosetta/model/3ds/Write.luau"], [2039, "src/Rosetta/model/3mf/init.luau"], [2121, "src/Rosetta/model/3mf/Read.luau"], [2709, "src/Rosetta/model/3mf/Write.luau"], [3114, "src/Rosetta/model/ase/init.luau"], [3237, "src/Rosetta/model/ase/Build.luau"], [3811, "src/Rosetta/model/ase/Parse.luau"], [3880, "src/Rosetta/model/ase/Write.luau"], [4343, "src/Rosetta/model/b3d/init.luau"], [4398, "src/Rosetta/model/b3d/Read.luau"], [4969, "src/Rosetta/model/blend/init.luau"], [5067, "src/Rosetta/model/blend/Anim.luau"], [5413, "src/Rosetta/model/blend/Armature.luau"], [5820, "src/Rosetta/model/blend/Material.luau"], [6172, "src/Rosetta/model/blend/Mesh.luau"], [6860, "src/Rosetta/model/blend/Normals.luau"], [7021, "src/Rosetta/model/blend/Prim.luau"]], "model_1": [[8, "src/Rosetta/model/3ds/init.luau"], [91, "src/Rosetta/model/3ds/Build.luau"], [738, "src/Rosetta/model/3ds/Read.luau"], [1234, "src/Rosetta/model/3ds/Write.luau"], [2039, "src/Rosetta/model/3mf/init.luau"], [2121, "src/Rosetta/model/3mf/Read.luau"], [2709, "src/Rosetta/model/3mf/Write.luau"], [3114, "src/Rosetta/model/ase/init.luau"], [3237, "src/Rosetta/model/ase/Build.luau"], [3811, "src/Rosetta/model/ase/Parse.luau"], [3880, "src/Rosetta/model/ase/Write.luau"], [4343, "src/Rosetta/model/b3d/init.luau"], [4398, "src/Rosetta/model/b3d/Read.luau"], [4969, "src/Rosetta/model/blend/init.luau"], [5069, "src/Rosetta/model/blend/Anim.luau"], [5491, "src/Rosetta/model/blend/Armature.luau"], [6025, "src/Rosetta/model/blend/Material.luau"], [6377, "src/Rosetta/model/blend/Mesh.luau"], [7065, "src/Rosetta/model/blend/Normals.luau"]],
"model_2": [[8, "src/Rosetta/model/blend/Read.luau"], [1047, "src/Rosetta/model/bsp/init.luau"], [1238, "src/Rosetta/model/bsp/Lightmap.luau"], [1304, "src/Rosetta/model/bsp/Quake.luau"], [1693, "src/Rosetta/model/bsp/Quake3.luau"], [1922, "src/Rosetta/model/bsp/Tree.luau"], [2310, "src/Rosetta/model/buildmap/init.luau"], [2582, "src/Rosetta/model/buildmap/Geometry.luau"], [2985, "src/Rosetta/model/d3map/init.luau"], [3267, "src/Rosetta/model/d3map/Parse.luau"], [3465, "src/Rosetta/model/dae/init.luau"], [3654, "src/Rosetta/model/dae/Math.luau"], [3701, "src/Rosetta/model/dae/Read.luau"], [5551, "src/Rosetta/model/dae/Write.luau"], [5920, "src/Rosetta/model/fbx/init.luau"], [6068, "src/Rosetta/model/fbx/Ascii.luau"], [6338, "src/Rosetta/model/fbx/Binary.luau"]], "model_2": [[8, "src/Rosetta/model/blend/Prim.luau"], [515, "src/Rosetta/model/blend/Read.luau"], [1574, "src/Rosetta/model/bsp/init.luau"], [1765, "src/Rosetta/model/bsp/Lightmap.luau"], [1831, "src/Rosetta/model/bsp/Quake.luau"], [2220, "src/Rosetta/model/bsp/Quake3.luau"], [2449, "src/Rosetta/model/bsp/Tree.luau"], [2837, "src/Rosetta/model/buildmap/init.luau"], [3109, "src/Rosetta/model/buildmap/Geometry.luau"], [3512, "src/Rosetta/model/d3map/init.luau"], [3794, "src/Rosetta/model/d3map/Parse.luau"], [3992, "src/Rosetta/model/dae/init.luau"], [4181, "src/Rosetta/model/dae/Math.luau"], [4228, "src/Rosetta/model/dae/Read.luau"], [6078, "src/Rosetta/model/dae/Write.luau"], [6447, "src/Rosetta/model/fbx/init.luau"], [6595, "src/Rosetta/model/fbx/Ascii.luau"], [6865, "src/Rosetta/model/fbx/Binary.luau"]],
"model_3": [[8, "src/Rosetta/model/fbx/Read.luau"], [1370, "src/Rosetta/model/fbx/Write.luau"], [2355, "src/Rosetta/model/fbx/Xform.luau"], [2396, "src/Rosetta/model/gltf/init.luau"], [2633, "src/Rosetta/model/gltf/Pack.luau"], [2702, "src/Rosetta/model/gltf/Read.luau"], [3443, "src/Rosetta/model/gltf/Write.luau"], [4129, "src/Rosetta/model/godot/init.luau"], [4220, "src/Rosetta/model/godot/Build.luau"], [4762, "src/Rosetta/model/godot/Primitives.luau"], [5037, "src/Rosetta/model/godot/Surface.luau"], [5522, "src/Rosetta/model/godot/Write.luau"], [5851, "src/Rosetta/model/iqm/init.luau"], [5927, "src/Rosetta/model/iqm/Read.luau"], [6282, "src/Rosetta/model/iqm/Write.luau"], [6969, "src/Rosetta/model/ldraw/init.luau"], [7047, "src/Rosetta/model/ldraw/Colors.luau"]], "model_3": [[8, "src/Rosetta/model/fbx/Read.luau"], [1370, "src/Rosetta/model/fbx/Write.luau"], [2355, "src/Rosetta/model/fbx/Xform.luau"], [2396, "src/Rosetta/model/gltf/init.luau"], [2633, "src/Rosetta/model/gltf/Pack.luau"], [2702, "src/Rosetta/model/gltf/Read.luau"], [3443, "src/Rosetta/model/gltf/Write.luau"], [4129, "src/Rosetta/model/godot/init.luau"], [4220, "src/Rosetta/model/godot/Build.luau"], [4762, "src/Rosetta/model/godot/Primitives.luau"], [5037, "src/Rosetta/model/godot/Surface.luau"], [5522, "src/Rosetta/model/godot/Write.luau"], [5851, "src/Rosetta/model/iqm/init.luau"], [5927, "src/Rosetta/model/iqm/Read.luau"], [6282, "src/Rosetta/model/iqm/Write.luau"], [6969, "src/Rosetta/model/ldraw/init.luau"], [7047, "src/Rosetta/model/ldraw/Colors.luau"]],
"model_4": [[8, "src/Rosetta/model/ldraw/Read.luau"], [585, "src/Rosetta/model/lwo/init.luau"], [661, "src/Rosetta/model/lwo/Build.luau"], [1123, "src/Rosetta/model/lwo/Parse.luau"], [1666, "src/Rosetta/model/map/init.luau"], [1983, "src/Rosetta/model/map/Build.luau"], [2227, "src/Rosetta/model/map/Parse.luau"], [2612, "src/Rosetta/model/map/Write.luau"], [2758, "src/Rosetta/model/mca/init.luau"], [3100, "src/Rosetta/model/mca/Chunk.luau"], [3233, "src/Rosetta/model/mca/Lz4Block.luau"], [3303, "src/Rosetta/model/md2/init.luau"], [3502, "src/Rosetta/model/md3/init.luau"], [3730, "src/Rosetta/model/md5/init.luau"], [3811, "src/Rosetta/model/md5/Read.luau"], [4244, "src/Rosetta/model/mdl/init.luau"], [4326, "src/Rosetta/model/mdl/HalfLife.luau"], [4630, "src/Rosetta/model/mdl/Quake.luau"], [4848, "src/Rosetta/model/ms3d/init.luau"], [4920, "src/Rosetta/model/ms3d/Read.luau"], [5366, "src/Rosetta/model/ms3d/Write.luau"], [5835, "src/Rosetta/model/obj/init.luau"], [6653, "src/Rosetta/model/obj/Mtl.luau"], [6941, "src/Rosetta/model/off/init.luau"]], "model_4": [[8, "src/Rosetta/model/ldraw/Read.luau"], [585, "src/Rosetta/model/lwo/init.luau"], [661, "src/Rosetta/model/lwo/Build.luau"], [1123, "src/Rosetta/model/lwo/Parse.luau"], [1666, "src/Rosetta/model/map/init.luau"], [1983, "src/Rosetta/model/map/Build.luau"], [2227, "src/Rosetta/model/map/Parse.luau"], [2612, "src/Rosetta/model/map/Write.luau"], [2758, "src/Rosetta/model/mca/init.luau"], [3100, "src/Rosetta/model/mca/Chunk.luau"], [3233, "src/Rosetta/model/mca/Lz4Block.luau"], [3303, "src/Rosetta/model/md2/init.luau"], [3502, "src/Rosetta/model/md3/init.luau"], [3730, "src/Rosetta/model/md5/init.luau"], [3811, "src/Rosetta/model/md5/Read.luau"], [4244, "src/Rosetta/model/mdl/init.luau"], [4326, "src/Rosetta/model/mdl/HalfLife.luau"], [4630, "src/Rosetta/model/mdl/Quake.luau"], [4848, "src/Rosetta/model/ms3d/init.luau"], [4920, "src/Rosetta/model/ms3d/Read.luau"], [5366, "src/Rosetta/model/ms3d/Write.luau"], [5835, "src/Rosetta/model/obj/init.luau"], [6653, "src/Rosetta/model/obj/Mtl.luau"], [6941, "src/Rosetta/model/off/init.luau"]],
"model_5": [[8, "src/Rosetta/model/ply/init.luau"], [1113, "src/Rosetta/model/ply/Binary.luau"], [1314, "src/Rosetta/model/pmx/init.luau"], [1383, "src/Rosetta/model/pmx/Build.luau"], [1679, "src/Rosetta/model/pmx/Pmd.luau"], [2014, "src/Rosetta/model/pmx/Read.luau"], [2418, "src/Rosetta/model/proc/init.luau"], [2800, "src/Rosetta/model/qb/init.luau"], [3193, "src/Rosetta/model/rbxm/init.luau"], [3786, "src/Rosetta/model/rbxmx/init.luau"], [4462, "src/Rosetta/model/robloxmesh/init.luau"], [5121, "src/Rosetta/model/robloxmesh/Parse.luau"], [5578, "src/Rosetta/model/robloxmesh/Write.luau"], [5687, "src/Rosetta/model/schematic/init.luau"], [6008, "src/Rosetta/model/schematic/Common.luau"], [6128, "src/Rosetta/model/schematic/Litematic.luau"], [6339, "src/Rosetta/model/schematic/Mcedit.luau"], [6583, "src/Rosetta/model/schematic/Sponge.luau"], [6712, "src/Rosetta/model/smd/init.luau"], [6779, "src/Rosetta/model/smd/Read.luau"], [7048, "src/Rosetta/model/smd/Write.luau"], [7291, "src/Rosetta/model/sourcemdl/init.luau"], [7462, "src/Rosetta/model/sourcemdl/Build.luau"], [7892, "src/Rosetta/model/sourcemdl/Material.luau"]], "model_5": [[8, "src/Rosetta/model/ply/init.luau"], [1113, "src/Rosetta/model/ply/Binary.luau"], [1314, "src/Rosetta/model/pmx/init.luau"], [1383, "src/Rosetta/model/pmx/Build.luau"], [1679, "src/Rosetta/model/pmx/Pmd.luau"], [2014, "src/Rosetta/model/pmx/Read.luau"], [2418, "src/Rosetta/model/proc/init.luau"], [2800, "src/Rosetta/model/qb/init.luau"], [3193, "src/Rosetta/model/rbxm/init.luau"], [3786, "src/Rosetta/model/rbxmx/init.luau"], [4462, "src/Rosetta/model/robloxmesh/init.luau"], [5121, "src/Rosetta/model/robloxmesh/Parse.luau"], [5578, "src/Rosetta/model/robloxmesh/Write.luau"], [5687, "src/Rosetta/model/schematic/init.luau"], [6008, "src/Rosetta/model/schematic/Common.luau"], [6128, "src/Rosetta/model/schematic/Litematic.luau"], [6339, "src/Rosetta/model/schematic/Mcedit.luau"], [6583, "src/Rosetta/model/schematic/Sponge.luau"], [6712, "src/Rosetta/model/smd/init.luau"], [6779, "src/Rosetta/model/smd/Read.luau"], [7048, "src/Rosetta/model/smd/Write.luau"], [7291, "src/Rosetta/model/sourcemdl/init.luau"], [7462, "src/Rosetta/model/sourcemdl/Build.luau"], [7892, "src/Rosetta/model/sourcemdl/Material.luau"]],
+279 -54
View File
@@ -453,7 +453,7 @@ local __CHUNK = {
["model/blend/Material"] = "model_1", ["model/blend/Material"] = "model_1",
["model/blend/Mesh"] = "model_1", ["model/blend/Mesh"] = "model_1",
["model/blend/Normals"] = "model_1", ["model/blend/Normals"] = "model_1",
["model/blend/Prim"] = "model_1", ["model/blend/Prim"] = "model_2",
["model/blend/Read"] = "model_2", ["model/blend/Read"] = "model_2",
["model/bsp"] = "model_2", ["model/bsp"] = "model_2",
["model/bsp/Lightmap"] = "model_2", ["model/bsp/Lightmap"] = "model_2",
@@ -160706,7 +160706,7 @@ end
<ProtectedString name="Source">--!optimize 2 <ProtectedString name="Source">--!optimize 2
--!nocheck --!nocheck
-- rosetta chunk model_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit. -- rosetta chunk model_1 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit.
-- 20 modules (0 native: @native); the Rosetta root requires it when one of them is first included. -- 19 modules (0 native: @native); the Rosetta root requires it when one of them is first included.
-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where). -- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where).
return function(__FILES, __include) return function(__FILES, __include)
__FILES["model/3ds"] = function() __FILES["model/3ds"] = function()
@@ -165678,7 +165678,8 @@ __FILES["model/blend"] = function()
-- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour -- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour
-- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights; -- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights;
-- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into -- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into
-- channels; rig data (bone collections / layers, colours, custom shapes, pose settings, constraint stacks) as extras. -- channels, and every action's raw f-curves in meta.blend.actions; rig data (bone collections / layers, colours,
-- custom shapes, pose settings, constraint stacks) as extras.
-- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes, -- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes,
-- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances. -- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances.
@@ -165711,6 +165712,7 @@ type DecodeOptions = {
scene: string?, -- a scene by name (default: the file's current scene) scene: string?, -- a scene by name (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves and keys in meta.blend.actions (default true)
resolve: ((uri: string) -&gt; any)?, -- external images resolve: ((uri: string) -&gt; any)?, -- external images
files: { [string]: any }?, files: { [string]: any }?,
maxBytes: number?, -- decompressed size limit (default 2^31) maxBytes: number?, -- decompressed size limit (default 2^31)
@@ -165832,6 +165834,54 @@ local function curve(f: Blend.File, fc: Blend.View): Curve?
return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods } return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods }
end end
-- an action's f-curves: the legacy list, or (4.4+ layered actions) the channel bags of the strips of every layer whose
-- slot handle matches (handle nil: the first layer's first strip's first channel bag)
local function fcurves(f: Blend.File, act: Blend.View, handle: number?): { Blend.View }
local list: { Blend.View } = act:list("curves", "FCurve")
if #list &gt; 0 or not act:has("layer_array") then
return list
end
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (handle == nil or (bag:num("slot_handle") or 0) == handle) then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
if handle == nil then
return list
end
end
end
end
if handle == nil then
return list
end
end
end
if handle == nil then
return list
end
end
return list
end
function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?) function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not adt then if not adt then
return nil, nil return nil, nil
@@ -165840,41 +165890,8 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not act then if not act then
return nil, nil return nil, nil
end end
local list: { Blend.View } = act:list("curves", "FCurve")
if #list == 0 and act:has("layer_array") then
local handle = adt:num("slot_handle") or 0
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (bag:num("slot_handle") or 0) == handle then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
end
end
end
end
end
end
end
local out: { Curve } = {} local out: { Curve } = {}
for _, fc in list do for _, fc in fcurves(f, act, adt:num("slot_handle") or 0) do
local c = curve(f, fc) local c = curve(f, fc)
if c then if c then
table.insert(out, c) table.insert(out, c)
@@ -165883,6 +165900,67 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
return out, act:idName() return out, act:idName()
end end
-- ------------------------------------------------------------------------------------------------ raw actions
local INTERPOLATION: { [number]: string } = {
[0] = "CONSTANT", [1] = "LINEAR", [2] = "BEZIER", [3] = "BACK", [4] = "BOUNCE", [5] = "CIRC", [6] = "CUBIC",
[7] = "ELASTIC", [8] = "EXPO", [9] = "QUAD", [10] = "QUART", [11] = "QUINT", [12] = "SINE",
}
local EASING: { [number]: string } = { [0] = "AUTO", [1] = "EASE_IN", [2] = "EASE_OUT", [3] = "EASE_IN_OUT" }
local HANDLE: { [number]: string } = { [0] = "FREE", [1] = "AUTO", [2] = "VECTOR", [3] = "ALIGNED", [4] = "AUTO_CLAMPED" }
local ACT_FRAME_RANGE = 0x1000
-- an action as Blender's API shows it: frame_range (the manual range, else the keys' span, at least one frame) and
-- every f-curve with its keyframe points
function Anim.raw(f: Blend.File, act: Blend.View): { [string]: any }
local curves: { { [string]: any } } = {}
local lo: number, hi: number = math.huge, -math.huge
for _, fc in fcurves(f, act, nil) do
local path = fc:cstring("rna_path") or ""
local kind, who, rest = Anim.split(path)
local keys: { { [string]: any } } = {}
for _, b in fc:array("bezt", "BezTriple") do
local v = b:vec("vec")
if v and #v &gt;= 9 then
local x: number = v[4]
local k: { [string]: any } = { co = { x, v[5] }, handle_left = { v[1], v[2] }, handle_right = { v[7], v[8] } }
k.interpolation = INTERPOLATION[b:num("ipo") or 2] or "BEZIER"
k.easing = EASING[b:num("easing") or 0] or "AUTO"
k.handle_left_type, k.handle_right_type = HANDLE[b:num("h1") or 0], HANDLE[b:num("h2") or 0]
k.back, k.amplitude, k.period = b:num("back") or 1.70158, b:num("amplitude") or 0.8, b:num("period") or 4.1
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
if #keys == 0 then
for _, p in fc:array("fpt", "FPoint") do
local v = p:vec("vec")
if v and #v &gt;= 2 then
local x: number = v[1]
local k: { [string]: any } = { co = { x, v[2] } }
k.interpolation = "LINEAR"
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
end
local entry: { [string]: any } = { data_path = path, path = if kind == "pose.bones" then rest else path, keys = keys }
entry.bone = if kind == "pose.bones" then who else nil
entry.array_index = fc:num("array_index") or 0
entry.extrapolation = if (fc:num("extend") or 0) == 1 then "LINEAR" else "CONSTANT"
table.insert(curves, entry)
end
if bit32.band(act:num("flag") or 0, ACT_FRAME_RANGE) ~= 0 and act:has("frame_start") then
lo = act:num("frame_start") or 0
hi = act:num("frame_end") or 0
elseif lo &gt; hi then
lo, hi = 0, 0
end
if hi &lt;= lo then
hi = lo + 1
end
return { frame_range = { lo, hi }, curves = curves }
end
-- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of -- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of
-- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve -- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve
local OB_ADR: { [number]: { any } } = { local OB_ADR: { [number]: { any } } = {
@@ -166120,8 +166198,10 @@ __FILES["model/blend/Armature"] = function()
-- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers -- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers
-- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0), -- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0),
-- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs -- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs
-- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of; the -- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of,
-- common fields for the rest). Flags from DNA_armature_types.h, DNA_action_types.h, DNA_constraint_types.h. -- action, transform, stretch to, armature, floor, limit distance, track to, locked track; the common fields for the
-- rest), bone inheritance and b-bone settings, the stored pose basis. Flags from DNA_armature_types.h,
-- DNA_action_types.h, DNA_constraint_types.h.
local Blend = __include("containers/Blend") local Blend = __include("containers/Blend")
local Armature = {} local Armature = {}
@@ -166179,6 +166259,33 @@ local PCHAN_DRAW_NO_CUSTOM_BONE_SIZE = 1
local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024 local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024
local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 } local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 }
local AXES = { "x", "y", "z" } local AXES = { "x", "y", "z" }
local XYZ: { [number]: string } = { [0] = "X", [1] = "Y", [2] = "Z" }
-- bActionConstraint.type, .mix_mode
local ACTION_CHANNEL: { [number]: string } = {
[0] = "ROTATION_X", [1] = "ROTATION_Y", [2] = "ROTATION_Z", [10] = "SCALE_X", [11] = "SCALE_Y", [12] = "SCALE_Z",
[20] = "LOCATION_X", [21] = "LOCATION_Y", [22] = "LOCATION_Z",
}
local ACTION_MIX: { [number]: string } = { [0] = "AFTER_FULL", [1] = "AFTER", [2] = "BEFORE", [3] = "BEFORE_FULL", [4] = "BEFORE_SPLIT", [5] = "AFTER_SPLIT" }
local MAP: { [number]: string } = { [0] = "LOCATION", [1] = "ROTATION", [2] = "SCALE" }
-- the driver target rotation modes (DTAR_ROTMODE_*)
local FROM_ROT: { [number]: string } = {
[0] = "AUTO", [1] = "XYZ", [2] = "XZY", [3] = "YXZ", [4] = "YZX", [5] = "ZXY", [6] = "ZYX", [7] = "QUATERNION",
[8] = "SWING_TWIST_X", [9] = "SWING_TWIST_Y", [10] = "SWING_TWIST_Z",
}
local MIX_LOC: { [number]: string } = { [0] = "ADD", [1] = "REPLACE" }
local MIX_ROT: { [number]: string } = { [0] = "ADD", [1] = "REPLACE", [2] = "BEFORE", [3] = "AFTER" }
local MIX_SCALE: { [number]: string } = { [0] = "REPLACE", [1] = "MULTIPLY" }
local VOLUME: { [number]: string } = { [0] = "VOLUME_XZX", [1] = "VOLUME_X", [2] = "VOLUME_Z", [3] = "NO_VOLUME" }
local KEEP_AXIS: { [number]: string } = { [0] = "PLANE_X", [1] = "SWING_Y", [2] = "PLANE_Z" }
local FLOOR: { [number]: string } = { [0] = "FLOOR_X", [1] = "FLOOR_Y", [2] = "FLOOR_Z", [3] = "FLOOR_NEGATIVE_X", [4] = "FLOOR_NEGATIVE_Y", [5] = "FLOOR_NEGATIVE_Z" }
local DIST_MODE: { [number]: string } = { [0] = "LIMITDIST_INSIDE", [1] = "LIMITDIST_OUTSIDE", [2] = "LIMITDIST_ONSURFACE" }
local UP: { [number]: string } = { [0] = "UP_X", [1] = "UP_Y", [2] = "UP_Z" }
local LOCK: { [number]: string } = { [0] = "LOCK_X", [1] = "LOCK_Y", [2] = "LOCK_Z" }
-- Bone.inherit_scale_mode, bbone_prev_type / bbone_next_type, bbone_mapping_mode
local INHERIT_SCALE: { [number]: string } = { [0] = "FULL", [1] = "FIX_SHEAR", [2] = "AVERAGE", [3] = "NONE", [4] = "NONE_LEGACY", [5] = "ALIGNED" }
local HANDLE_TYPE: { [number]: string } = { [0] = "AUTO", [1] = "ABSOLUTE", [2] = "RELATIVE", [3] = "TANGENT" }
local MAPPING: { [number]: string } = { [0] = "STRAIGHT", [1] = "CURVED" }
local BONE_HINGE, BONE_NO_SCALE, BONE_NO_LOCAL_LOCATION, BONE_RELATIVE_PARENTING, BONE_ADD_PARENT_END_ROLL = 0x200, 0x8000, 0x400000, 0x800000, 0x1000000
local function bit(v: number?, mask: number): boolean local function bit(v: number?, mask: number): boolean
return bit32.band(v or 0, mask) ~= 0 return bit32.band(v or 0, mask) ~= 0
@@ -166353,7 +166460,35 @@ function Armature.bone(bone: Blend.View, pc: Blend.View?, pose: Blend.View?): {
head_local = vec3(bone, "arm_head"), head_local = vec3(bone, "arm_head"),
tail_local = vec3(bone, "arm_tail"), tail_local = vec3(bone, "arm_tail"),
roll = bone:num("arm_roll"), roll = bone:num("arm_roll"),
use_inherit_rotation = not bit(flag, BONE_HINGE),
use_local_location = not bit(flag, BONE_NO_LOCAL_LOCATION),
use_relative_parent = bit(flag, BONE_RELATIVE_PARENTING),
} }
local ism = bone:num("inherit_scale_mode")
e.inherit_scale = if ism then INHERIT_SCALE[ism] else (if bit(flag, BONE_NO_SCALE) then "NONE_LEGACY" else "FULL") -- BONE_NO_SCALE before 2.81
e.bbone_segments = bone:num("segments") or 1
e.bbone_x, e.bbone_z = bone:num("xwidth"), bone:num("zwidth")
e.bbone_easein, e.bbone_easeout = bone:num("ease1") or 1, bone:num("ease2") or 1
e.bbone_rollin, e.bbone_rollout = bone:num("roll1") or 0, bone:num("roll2") or 0
e.bbone_curveinx, e.bbone_curveinz = bone:num("curveInX") or 0, bone:num("curveInY") or 0 -- curveInY is the API's z
e.bbone_curveoutx, e.bbone_curveoutz = bone:num("curveOutX") or 0, bone:num("curveOutY") or 0
for _, side in { "in", "out" } do
local cap = if side == "in" then "In" else "Out"
local v = vec3(bone, "scale_" .. side)
if not v then
-- before 3.0: scaleIn (x) and scale_in_y (z); before 2.8 one value for both
local x = bone:num("scale" .. cap) or 1
v = { x, 1, bone:num("scale_" .. side .. "_y") or x }
end
e["bbone_scale" .. side] = v
end
e.bbone_handle_type_start = HANDLE_TYPE[bone:num("bbone_prev_type") or 0]
e.bbone_handle_type_end = HANDLE_TYPE[bone:num("bbone_next_type") or 0]
local prev, nxt = bone:deref("bbone_prev", 0, "Bone"), bone:deref("bbone_next", 0, "Bone")
e.bbone_custom_handle_start = if prev then prev:str("name") else nil
e.bbone_custom_handle_end = if nxt then nxt:str("name") else nil
e.use_endroll_as_inroll = if bone:has("bbone_flag") then bit(bone:num("bbone_flag"), 1) else bit(flag, BONE_ADD_PARENT_END_ROLL)
e.bbone_mapping_mode = MAPPING[bone:num("bbone_mapping_mode") or 0]
if bone:has("color") then if bone:has("color") then
e.color = boneColor(bone) e.color = boneColor(bone)
elseif pc and pose then elseif pc and pose then
@@ -166400,10 +166535,72 @@ local function constraintData(e: { [string]: any }, kind: string, d: Blend.View,
e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64) e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64)
e.use_offset = bit(flag, 128) e.use_offset = bit(flag, 128)
elseif kind == "COPY_SCALE" then elseif kind == "COPY_SCALE" then
-- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8 -- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8, MULTIPLY 16 (use_add is its inverse), UNIFORM 32
e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4) e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4)
e.use_offset = bit(flag, 8) e.use_offset = bit(flag, 8)
e.use_add = not bit(flag, 16)
e.use_make_uniform = bit(flag, 32)
e.power = d:num("power") or 1 e.power = d:num("power") or 1
elseif kind == "ACTION" then
-- flag: ACTCON_BONE_USE_OBJECT_ACTION 1, ACTCON_USE_EVAL_TIME 2
local act = d:deref("act", 0, "bAction")
e.action = if act then act:idName() else nil
e.transform_channel = ACTION_CHANNEL[d:num("type") or 20]
e.frame_start, e.frame_end = d:num("start") or 1, d:num("end") or 1
e.min, e.max = d:num("min") or 0, d:num("max") or 0
e.mix_mode = ACTION_MIX[d:num("mix_mode") or 0]
e.use_bone_object_action = bit(flag, 1)
e.use_eval_time = bit(flag, 2)
e.eval_time = d:num("eval_time") or 0
elseif kind == "TRANSFORM" then
e.map_from, e.map_to = MAP[d:num("from") or 0], MAP[d:num("to") or 0]
local map = d.struct.byName.map
for i, a in AXES do
local o = map and d.offset + map.offset + i - 1
e["map_to_" .. a .. "_from"] = XYZ[if o and o &lt; buffer.len(d.file.buf) then buffer.readu8(d.file.buf, o) else i - 1]
end
e.use_motion_extrapolate = (d:num("expo") or 0) ~= 0
e.from_rotation_mode = FROM_ROT[d:num("from_rotation_mode") or 0]
e.to_euler_order = EULER_ORDER[d:num("to_euler_order") or 0]
e.mix_mode = MIX_LOC[d:num("mix_mode_loc") or 0]
e.mix_mode_rot = MIX_ROT[d:num("mix_mode_rot") or 0]
e.mix_mode_scale = MIX_SCALE[d:num("mix_mode_scale") or 0]
for _, side in { "from", "to" } do
for _, suffix in { "", "_rot", "_scale" } do
local lo, hi = d:vec(side .. "_min" .. suffix), d:vec(side .. "_max" .. suffix)
for i, a in AXES do
e[side .. "_min_" .. a .. suffix] = lo and lo[i] or 0
e[side .. "_max_" .. a .. suffix] = hi and hi[i] or 0
end
end
end
elseif kind == "STRETCH_TO" then
-- STRETCHTOCON_USE_BULGE_MIN 1, MAX 2
e.rest_length = d:num("orglength")
e.bulge = d:num("bulge")
e.volume = VOLUME[d:num("volmode") or 0]
e.keep_axis = KEEP_AXIS[d:num("plane") or 0]
e.use_bulge_min, e.use_bulge_max = bit(flag, 1), bit(flag, 2)
e.bulge_min, e.bulge_max, e.bulge_smooth = d:num("bulge_min"), d:num("bulge_max"), d:num("bulge_smooth")
elseif kind == "ARMATURE" then
-- CONSTRAINT_ARMATURE_QUATERNION 1, ENVELOPE 2, CUR_LOCATION 4
e.use_deform_preserve_volume, e.use_bone_envelopes, e.use_current_location = bit(flag, 1), bit(flag, 2), bit(flag, 4)
elseif kind == "FLOOR" then
-- flag: MINMAX_USEROT 4
e.floor_location = FLOOR[d:num("minmaxflag") or 2]
e.offset = d:num("offset") or 0
e.use_rotation = bit(flag, 4)
elseif kind == "LIMIT_DISTANCE" then
e.distance = d:num("dist")
e.limit_mode = DIST_MODE[d:num("mode") or 0]
elseif kind == "TRACK_TO" then
-- reserved1 the track axis, reserved2 the up axis; flags TARGET_Z_UP 1
e.track_axis = TRACK[d:num("reserved1") or 1]
e.up_axis = UP[d:num("reserved2") or 2]
e.use_target_z = bit(d:num("flags"), 1)
elseif kind == "LOCKED_TRACK" then
e.track_axis = TRACK[d:num("trackflag") or 1]
e.lock_axis = LOCK[d:num("lockflag") or 2]
elseif kind == "COPY_TRANSFORMS" then elseif kind == "COPY_TRANSFORMS" then
e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0] e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0]
e.remove_target_shear = bit(flag, 1) e.remove_target_shear = bit(flag, 1)
@@ -166516,6 +166713,14 @@ function Armature.pose(e: { [string]: any }, pc: Blend.View, resolve: Resolve, s
e["ik_stiffness_" .. a] = stiff and stiff[i] or 0 e["ik_stiffness_" .. a] = stiff and stiff[i] or 0
end end
e.pose_color = if pc:has("color") then boneColor(pc) else nil e.pose_color = if pc:has("color") then boneColor(pc) else nil
-- the stored basis (rotation_quaternion w, x, y, z; rotation_axis_angle angle, x, y, z)
e.location = vec3(pc, "loc", { 0, 0, 0 })
local q = pc:vec("quat")
e.rotation_quaternion = if q and #q &gt;= 4 then { q[1], q[2], q[3], q[4] } else { 1, 0, 0, 0 }
e.rotation_euler = vec3(pc, "eul", { 0, 0, 0 })
local axis = vec3(pc, "rotAxis", { 0, 1, 0 }) :: { number }
e.rotation_axis_angle = { pc:num("rotAngle") or 0, axis[1], axis[2], axis[3] }
e.scale = vec3(pc, "size", nil) or vec3(pc, "scale", { 1, 1, 1 })
e.constraints = Armature.constraints(pc, resolve) e.constraints = Armature.constraints(pc, resolve)
end end
@@ -167722,6 +167927,19 @@ end
return Normals return Normals
end end
end
</ProtectedString>
</Properties>
</Item>
<Item class="ModuleScript" referent="RBX00000000000000000000000000000033">
<Properties>
<string name="Name">model_2</string>
<ProtectedString name="Source">--!optimize 2
--!nocheck
-- rosetta chunk model_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit.
-- 18 modules (1 native: @native); the Rosetta root requires it when one of them is first included.
-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where).
return function(__FILES, __include)
__FILES["model/blend/Prim"] = function() __FILES["model/blend/Prim"] = function()
-- model/blend/Prim: model/blend/Mesh polygons to Scene primitives (one per material slot): corner normals from smooth -- model/blend/Prim: model/blend/Mesh polygons to Scene primitives (one per material slot): corner normals from smooth
@@ -168229,19 +168447,6 @@ end
return Prim return Prim
end end
end
</ProtectedString>
</Properties>
</Item>
<Item class="ModuleScript" referent="RBX00000000000000000000000000000033">
<Properties>
<string name="Name">model_2</string>
<ProtectedString name="Source">--!optimize 2
--!nocheck
-- rosetta chunk model_2 (build/Rosetta.rbxm): GENERATED by tools/bundle.py from src/Rosetta - do not edit.
-- 17 modules (1 native: @native); the Rosetta root requires it when one of them is first included.
-- Error lines map back to the sources through Rosetta.rbxm.linemap.json (tools/bundle.py --where).
return function(__FILES, __include)
__FILES["model/blend/Read"] = function() __FILES["model/blend/Read"] = function()
-- model/blend/Read: a parsed .blend (containers/Blend) to a Scene: the current scene's objects (from its collections, -- model/blend/Read: a parsed .blend (containers/Blend) to a Scene: the current scene's objects (from its collections,
@@ -168273,6 +168478,7 @@ type Options = {
scene: string?, -- the scene to read (default: the file's current scene) scene: string?, -- the scene to read (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves in meta.blend.actions (default true)
resolve: ((uri: string) -&gt; any)?, resolve: ((uri: string) -&gt; any)?,
files: { [string]: any }?, files: { [string]: any }?,
maxVertices: number?, maxVertices: number?,
@@ -169258,8 +169464,27 @@ function Read.scene(f: Blend.File, opts: Options?): (Types.Scene?, string?)
end end
end end
skins(ctx) skins(ctx)
local mb: { [string]: any } = {}
if next(ctx.armatures) ~= nil then if next(ctx.armatures) ~= nil then
scene.meta.blend = { widgets = widgetList(ctx), bone_color_sets = Armature.colorSets() } mb.widgets = widgetList(ctx)
mb.bone_color_sets = Armature.colorSets()
end
-- every action in the file by name (assigned or not: action constraints and the NLA refer to them)
if o.rawActions ~= false then
local acts: { [string]: any } = {}
for _, b in Blend.blocks(f, "AC") do
local act = Blend.struct(f, b, 0, "bAction")
local name = act and act:idName()
if act and name and not acts[name] then
acts[name] = Anim.raw(f, act)
end
end
if next(acts) ~= nil then
mb.actions = acts
end
end
if next(mb) ~= nil then
scene.meta.blend = mb
end end
if o.animations ~= false then if o.animations ~= false then
animations(ctx) animations(ctx)
+266 -41
View File
@@ -163733,7 +163733,8 @@ local __compat = __compat local buffer = __compat.buffer --!strict
-- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour -- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour
-- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights; -- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights;
-- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into -- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into
-- channels; rig data (bone collections / layers, colours, custom shapes, pose settings, constraint stacks) as extras. -- channels, and every action's raw f-curves in meta.blend.actions; rig data (bone collections / layers, colours,
-- custom shapes, pose settings, constraint stacks) as extras.
-- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes, -- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes,
-- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances. -- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances.
@@ -163775,6 +163776,7 @@ local BlendFormat = {
function BlendFormat.sniff(r) function BlendFormat.sniff(r)
local head = r:peek(7) local head = r:peek(7)
if head == "BLENDER" then if head == "BLENDER" then
@@ -163824,7 +163826,7 @@ BlendFormat.ipo = Anim.ipo
return BlendFormat return BlendFormat
end end
__FILES["model/blend/Anim"] = function() __FILES["model/blend/Anim"] = function()
local __compat = __compat local __iter = __compat.__iter --!strict local __compat = __compat local bit32, __iter = __compat.bit32, __compat.__iter --!strict
-- model/blend/Anim: Blender actions (legacy bAction.curves, and the layered actions of 4.4+: layers -> strips -> -- model/blend/Anim: Blender actions (legacy bAction.curves, and the layered actions of 4.4+: layers -> strips ->
-- keyframe data -> channel bags matched by the AnimData slot handle) and f-curve evaluation: constant, linear, -- keyframe data -> channel bags matched by the AnimData slot handle) and f-curve evaluation: constant, linear,
-- bezier (handles shortened so the segment stays a function of time, as Blender does) and the Penner easing modes -- bezier (handles shortened so the segment stays a function of time, as Blender does) and the Penner easing modes
@@ -163887,6 +163889,54 @@ return a.x < b.x
return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods } return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods }
end end
-- an action's f-curves: the legacy list, or (4.4+ layered actions) the channel bags of the strips of every layer whose
-- slot handle matches (handle nil: the first layer's first strip's first channel bag)
local function fcurves(f, act, handle)
local list= act:list("curves", "FCurve")
if #list > 0 or not act:has("layer_array") then
return list
end
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in __iter(act:pointers("layer_array", act:num("layer_array_num"))) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in __iter(layer:pointers("strip_array", layer:num("strip_array_num"))) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in __iter(kd:pointers("channelbag_array", kd:num("channelbag_array_num"))) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (handle == nil or (bag:num("slot_handle") or 0) == handle) then
for _, ca in __iter(bag:pointers("fcurve_array", bag:num("fcurve_array_num"))) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
if handle == nil then
return list
end
end
end
end
if handle == nil then
return list
end
end
end
if handle == nil then
return list
end
end
return list
end
function Anim.curves(f, adt) function Anim.curves(f, adt)
if not adt then if not adt then
return nil, nil return nil, nil
@@ -163895,41 +163945,8 @@ if not adt then
if not act then if not act then
return nil, nil return nil, nil
end end
local list= act:list("curves", "FCurve")
if #list == 0 and act:has("layer_array") then
local handle = adt:num("slot_handle") or 0
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in __iter(act:pointers("layer_array", act:num("layer_array_num"))) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in __iter(layer:pointers("strip_array", layer:num("strip_array_num"))) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in __iter(kd:pointers("channelbag_array", kd:num("channelbag_array_num"))) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (bag:num("slot_handle") or 0) == handle then
for _, ca in __iter(bag:pointers("fcurve_array", bag:num("fcurve_array_num"))) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
end
end
end
end
end
end
end
local out= {} local out= {}
for _, fc in __iter(list) do for _, fc in __iter(fcurves(f, act, adt:num("slot_handle") or 0)) do
local c = curve(f, fc) local c = curve(f, fc)
if c then if c then
table.insert(out, c) table.insert(out, c)
@@ -163938,6 +163955,67 @@ if not adt then
return out, act:idName() return out, act:idName()
end end
-- ------------------------------------------------------------------------------------------------ raw actions
local INTERPOLATION= {
[0] = "CONSTANT", [1] = "LINEAR", [2] = "BEZIER", [3] = "BACK", [4] = "BOUNCE", [5] = "CIRC", [6] = "CUBIC",
[7] = "ELASTIC", [8] = "EXPO", [9] = "QUAD", [10] = "QUART", [11] = "QUINT", [12] = "SINE",
}
local EASING= { [0] = "AUTO", [1] = "EASE_IN", [2] = "EASE_OUT", [3] = "EASE_IN_OUT" }
local HANDLE= { [0] = "FREE", [1] = "AUTO", [2] = "VECTOR", [3] = "ALIGNED", [4] = "AUTO_CLAMPED" }
local ACT_FRAME_RANGE = 0x1000
-- an action as Blender's API shows it: frame_range (the manual range, else the keys' span, at least one frame) and
-- every f-curve with its keyframe points
function Anim.raw(f, act)
local curves= {}
local lo, hi= math.huge, -math.huge
for _, fc in __iter(fcurves(f, act, nil)) do
local path = fc:cstring("rna_path") or ""
local kind, who, rest = Anim.split(path)
local keys= {}
for _, b in __iter(fc:array("bezt", "BezTriple")) do
local v = b:vec("vec")
if v and #v >= 9 then
local x= v[4]
local k= { co = { x, v[5] }, handle_left = { v[1], v[2] }, handle_right = { v[7], v[8] } }
k.interpolation = INTERPOLATION[b:num("ipo") or 2] or "BEZIER"
k.easing = EASING[b:num("easing") or 0] or "AUTO"
k.handle_left_type, k.handle_right_type = HANDLE[b:num("h1") or 0], HANDLE[b:num("h2") or 0]
k.back, k.amplitude, k.period = b:num("back") or 1.70158, b:num("amplitude") or 0.8, b:num("period") or 4.1
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
if #keys == 0 then
for _, p in __iter(fc:array("fpt", "FPoint")) do
local v = p:vec("vec")
if v and #v >= 2 then
local x= v[1]
local k= { co = { x, v[2] } }
k.interpolation = "LINEAR"
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
end
local entry= { data_path = path, path = (kind == "pose.bones" and{rest }or{path})[1], keys = keys }
entry.bone = (kind == "pose.bones" and{who }or{nil
})[1] entry.array_index = fc:num("array_index") or 0
entry.extrapolation = (fc:num("extend") or 0) == 1 and"LINEAR" or"CONSTANT"
table.insert(curves, entry)
end
if bit32.band(act:num("flag") or 0, ACT_FRAME_RANGE) ~= 0 and act:has("frame_start") then
lo = act:num("frame_start") or 0
hi = act:num("frame_end") or 0
elseif lo > hi then
lo, hi = 0, 0
end
if hi <= lo then
hi = lo + 1
end
return { frame_range = { lo, hi }, curves = curves }
end
-- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of -- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of
-- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve -- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve
local OB_ADR= { local OB_ADR= {
@@ -164175,8 +164253,10 @@ local __compat = __compat local buffer, bit32, type, __iter = __compat.buffer, _
-- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers -- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers
-- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0), -- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0),
-- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs -- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs
-- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of; the -- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of,
-- common fields for the rest). Flags from DNA_armature_types.h, DNA_action_types.h, DNA_constraint_types.h. -- action, transform, stretch to, armature, floor, limit distance, track to, locked track; the common fields for the
-- rest), bone inheritance and b-bone settings, the stored pose basis. Flags from DNA_armature_types.h,
-- DNA_action_types.h, DNA_constraint_types.h.
local Blend = __include("containers/Blend") local Blend = __include("containers/Blend")
local Armature = {} local Armature = {}
@@ -164234,6 +164314,33 @@ local PCHAN_DRAW_NO_CUSTOM_BONE_SIZE = 1
local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024 local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024
local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 } local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 }
local AXES = { "x", "y", "z" } local AXES = { "x", "y", "z" }
local XYZ= { [0] = "X", [1] = "Y", [2] = "Z" }
-- bActionConstraint.type, .mix_mode
local ACTION_CHANNEL= {
[0] = "ROTATION_X", [1] = "ROTATION_Y", [2] = "ROTATION_Z", [10] = "SCALE_X", [11] = "SCALE_Y", [12] = "SCALE_Z",
[20] = "LOCATION_X", [21] = "LOCATION_Y", [22] = "LOCATION_Z",
}
local ACTION_MIX= { [0] = "AFTER_FULL", [1] = "AFTER", [2] = "BEFORE", [3] = "BEFORE_FULL", [4] = "BEFORE_SPLIT", [5] = "AFTER_SPLIT" }
local MAP= { [0] = "LOCATION", [1] = "ROTATION", [2] = "SCALE" }
-- the driver target rotation modes (DTAR_ROTMODE_*)
local FROM_ROT= {
[0] = "AUTO", [1] = "XYZ", [2] = "XZY", [3] = "YXZ", [4] = "YZX", [5] = "ZXY", [6] = "ZYX", [7] = "QUATERNION",
[8] = "SWING_TWIST_X", [9] = "SWING_TWIST_Y", [10] = "SWING_TWIST_Z",
}
local MIX_LOC= { [0] = "ADD", [1] = "REPLACE" }
local MIX_ROT= { [0] = "ADD", [1] = "REPLACE", [2] = "BEFORE", [3] = "AFTER" }
local MIX_SCALE= { [0] = "REPLACE", [1] = "MULTIPLY" }
local VOLUME= { [0] = "VOLUME_XZX", [1] = "VOLUME_X", [2] = "VOLUME_Z", [3] = "NO_VOLUME" }
local KEEP_AXIS= { [0] = "PLANE_X", [1] = "SWING_Y", [2] = "PLANE_Z" }
local FLOOR= { [0] = "FLOOR_X", [1] = "FLOOR_Y", [2] = "FLOOR_Z", [3] = "FLOOR_NEGATIVE_X", [4] = "FLOOR_NEGATIVE_Y", [5] = "FLOOR_NEGATIVE_Z" }
local DIST_MODE= { [0] = "LIMITDIST_INSIDE", [1] = "LIMITDIST_OUTSIDE", [2] = "LIMITDIST_ONSURFACE" }
local UP= { [0] = "UP_X", [1] = "UP_Y", [2] = "UP_Z" }
local LOCK= { [0] = "LOCK_X", [1] = "LOCK_Y", [2] = "LOCK_Z" }
-- Bone.inherit_scale_mode, bbone_prev_type / bbone_next_type, bbone_mapping_mode
local INHERIT_SCALE= { [0] = "FULL", [1] = "FIX_SHEAR", [2] = "AVERAGE", [3] = "NONE", [4] = "NONE_LEGACY", [5] = "ALIGNED" }
local HANDLE_TYPE= { [0] = "AUTO", [1] = "ABSOLUTE", [2] = "RELATIVE", [3] = "TANGENT" }
local MAPPING= { [0] = "STRAIGHT", [1] = "CURVED" }
local BONE_HINGE, BONE_NO_SCALE, BONE_NO_LOCAL_LOCATION, BONE_RELATIVE_PARENTING, BONE_ADD_PARENT_END_ROLL = 0x200, 0x8000, 0x400000, 0x800000, 0x1000000
local function bit(v, mask) local function bit(v, mask)
return bit32.band(v or 0, mask) ~= 0 return bit32.band(v or 0, mask) ~= 0
@@ -164408,7 +164515,35 @@ local flag = bone:num("flag") or 0
head_local = vec3(bone, "arm_head"), head_local = vec3(bone, "arm_head"),
tail_local = vec3(bone, "arm_tail"), tail_local = vec3(bone, "arm_tail"),
roll = bone:num("arm_roll"), roll = bone:num("arm_roll"),
use_inherit_rotation = not bit(flag, BONE_HINGE),
use_local_location = not bit(flag, BONE_NO_LOCAL_LOCATION),
use_relative_parent = bit(flag, BONE_RELATIVE_PARENTING),
} }
local ism = bone:num("inherit_scale_mode")
e.inherit_scale = (ism and{INHERIT_SCALE[ism] }or{(bit(flag, BONE_NO_SCALE) and"NONE_LEGACY" or"FULL") -- BONE_NO_SCALE before 2.81
})[1] e.bbone_segments = bone:num("segments") or 1
e.bbone_x, e.bbone_z = bone:num("xwidth"), bone:num("zwidth")
e.bbone_easein, e.bbone_easeout = bone:num("ease1") or 1, bone:num("ease2") or 1
e.bbone_rollin, e.bbone_rollout = bone:num("roll1") or 0, bone:num("roll2") or 0
e.bbone_curveinx, e.bbone_curveinz = bone:num("curveInX") or 0, bone:num("curveInY") or 0 -- curveInY is the API's z
e.bbone_curveoutx, e.bbone_curveoutz = bone:num("curveOutX") or 0, bone:num("curveOutY") or 0
for _, side in __iter({ "in", "out" }) do
local cap = side == "in" and"In" or"Out"
local v = vec3(bone, "scale_" .. side)
if not v then
-- before 3.0: scaleIn (x) and scale_in_y (z); before 2.8 one value for both
local x = bone:num("scale" .. cap) or 1
v = { x, 1, bone:num("scale_" .. side .. "_y") or x }
end
e["bbone_scale" .. side] = v
end
e.bbone_handle_type_start = HANDLE_TYPE[bone:num("bbone_prev_type") or 0]
e.bbone_handle_type_end = HANDLE_TYPE[bone:num("bbone_next_type") or 0]
local prev, nxt = bone:deref("bbone_prev", 0, "Bone"), bone:deref("bbone_next", 0, "Bone")
e.bbone_custom_handle_start = (prev and{(prev:str("name") )}or{nil
})[1] e.bbone_custom_handle_end = (nxt and{(nxt:str("name") )}or{nil
})[1] e.use_endroll_as_inroll = (bone:has("bbone_flag") and{(bit(bone:num("bbone_flag"), 1) )}or{(bit(flag, BONE_ADD_PARENT_END_ROLL)
)})[1] e.bbone_mapping_mode = MAPPING[bone:num("bbone_mapping_mode") or 0]
if bone:has("color") then if bone:has("color") then
e.color = boneColor(bone) e.color = boneColor(bone)
elseif pc and pose then elseif pc and pose then
@@ -164455,10 +164590,72 @@ local function constraintData(e, kind, d, resolve)
e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64) e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64)
e.use_offset = bit(flag, 128) e.use_offset = bit(flag, 128)
elseif kind == "COPY_SCALE" then elseif kind == "COPY_SCALE" then
-- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8 -- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8, MULTIPLY 16 (use_add is its inverse), UNIFORM 32
e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4) e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4)
e.use_offset = bit(flag, 8) e.use_offset = bit(flag, 8)
e.use_add = not bit(flag, 16)
e.use_make_uniform = bit(flag, 32)
e.power = d:num("power") or 1 e.power = d:num("power") or 1
elseif kind == "ACTION" then
-- flag: ACTCON_BONE_USE_OBJECT_ACTION 1, ACTCON_USE_EVAL_TIME 2
local act = d:deref("act", 0, "bAction")
e.action = (act and{(act:idName() )}or{nil
})[1] e.transform_channel = ACTION_CHANNEL[d:num("type") or 20]
e.frame_start, e.frame_end = d:num("start") or 1, d:num("end") or 1
e.min, e.max = d:num("min") or 0, d:num("max") or 0
e.mix_mode = ACTION_MIX[d:num("mix_mode") or 0]
e.use_bone_object_action = bit(flag, 1)
e.use_eval_time = bit(flag, 2)
e.eval_time = d:num("eval_time") or 0
elseif kind == "TRANSFORM" then
e.map_from, e.map_to = MAP[d:num("from") or 0], MAP[d:num("to") or 0]
local map = d.struct.byName.map
for i, a in __iter(AXES) do
local o = map and d.offset + map.offset + i - 1
e["map_to_" .. a .. "_from"] = XYZ[(o and o < buffer.len(d.file.buf) and{(buffer.readu8(d.file.buf, o) )}or{(i - 1)})[1] ]
end
e.use_motion_extrapolate = (d:num("expo") or 0) ~= 0
e.from_rotation_mode = FROM_ROT[d:num("from_rotation_mode") or 0]
e.to_euler_order = EULER_ORDER[d:num("to_euler_order") or 0]
e.mix_mode = MIX_LOC[d:num("mix_mode_loc") or 0]
e.mix_mode_rot = MIX_ROT[d:num("mix_mode_rot") or 0]
e.mix_mode_scale = MIX_SCALE[d:num("mix_mode_scale") or 0]
for _, side in __iter({ "from", "to" }) do
for _, suffix in __iter({ "", "_rot", "_scale" }) do
local lo, hi = d:vec(side .. "_min" .. suffix), d:vec(side .. "_max" .. suffix)
for i, a in __iter(AXES) do
e[side .. "_min_" .. a .. suffix] = lo and lo[i] or 0
e[side .. "_max_" .. a .. suffix] = hi and hi[i] or 0
end
end
end
elseif kind == "STRETCH_TO" then
-- STRETCHTOCON_USE_BULGE_MIN 1, MAX 2
e.rest_length = d:num("orglength")
e.bulge = d:num("bulge")
e.volume = VOLUME[d:num("volmode") or 0]
e.keep_axis = KEEP_AXIS[d:num("plane") or 0]
e.use_bulge_min, e.use_bulge_max = bit(flag, 1), bit(flag, 2)
e.bulge_min, e.bulge_max, e.bulge_smooth = d:num("bulge_min"), d:num("bulge_max"), d:num("bulge_smooth")
elseif kind == "ARMATURE" then
-- CONSTRAINT_ARMATURE_QUATERNION 1, ENVELOPE 2, CUR_LOCATION 4
e.use_deform_preserve_volume, e.use_bone_envelopes, e.use_current_location = bit(flag, 1), bit(flag, 2), bit(flag, 4)
elseif kind == "FLOOR" then
-- flag: MINMAX_USEROT 4
e.floor_location = FLOOR[d:num("minmaxflag") or 2]
e.offset = d:num("offset") or 0
e.use_rotation = bit(flag, 4)
elseif kind == "LIMIT_DISTANCE" then
e.distance = d:num("dist")
e.limit_mode = DIST_MODE[d:num("mode") or 0]
elseif kind == "TRACK_TO" then
-- reserved1 the track axis, reserved2 the up axis; flags TARGET_Z_UP 1
e.track_axis = TRACK[d:num("reserved1") or 1]
e.up_axis = UP[d:num("reserved2") or 2]
e.use_target_z = bit(d:num("flags"), 1)
elseif kind == "LOCKED_TRACK" then
e.track_axis = TRACK[d:num("trackflag") or 1]
e.lock_axis = LOCK[d:num("lockflag") or 2]
elseif kind == "COPY_TRANSFORMS" then elseif kind == "COPY_TRANSFORMS" then
e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0] e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0]
e.remove_target_shear = bit(flag, 1) e.remove_target_shear = bit(flag, 1)
@@ -164571,7 +164768,15 @@ function Armature.pose(e, pc, resolve, shape)
e["ik_stiffness_" .. a] = stiff and stiff[i] or 0 e["ik_stiffness_" .. a] = stiff and stiff[i] or 0
end end
e.pose_color = (pc:has("color") and{(boneColor(pc) )}or{nil e.pose_color = (pc:has("color") and{(boneColor(pc) )}or{nil
})[1] e.constraints = Armature.constraints(pc, resolve) })[1] -- the stored basis (rotation_quaternion w, x, y, z; rotation_axis_angle angle, x, y, z)
e.location = vec3(pc, "loc", { 0, 0, 0 })
local q = pc:vec("quat")
e.rotation_quaternion = q and #q >= 4 and{ q[1], q[2], q[3], q[4] } or{ 1, 0, 0, 0 }
e.rotation_euler = vec3(pc, "eul", { 0, 0, 0 })
local axis = (vec3(pc, "rotAxis", { 0, 1, 0 }) )
e.rotation_axis_angle = { pc:num("rotAngle") or 0, axis[1], axis[2], axis[3] }
e.scale = vec3(pc, "size", nil) or vec3(pc, "scale", { 1, 1, 1 })
e.constraints = Armature.constraints(pc, resolve)
end end
return Armature return Armature
@@ -166320,6 +166525,7 @@ local Scene = Types.Scene
local OB_EMPTY, OB_MESH, OB_LAMP, OB_CAMERA, OB_ARMATURE = 0, 1, 10, 11, 25 local OB_EMPTY, OB_MESH, OB_LAMP, OB_CAMERA, OB_ARMATURE = 0, 1, 10, 11, 25
local PARSKEL, PARBONE = 4, 7 local PARSKEL, PARBONE = 4, 7
local LA_LOCAL, LA_SUN, LA_SPOT, LA_HEMI, LA_AREA = 0, 1, 2, 3, 4 local LA_LOCAL, LA_SUN, LA_SPOT, LA_HEMI, LA_AREA = 0, 1, 2, 3, 4
@@ -167300,8 +167506,27 @@ local o= opts or {}
end end
end end
skins(ctx) skins(ctx)
local mb= {}
if next(ctx.armatures) ~= nil then if next(ctx.armatures) ~= nil then
scene.meta.blend = { widgets = widgetList(ctx), bone_color_sets = Armature.colorSets() } mb.widgets = widgetList(ctx)
mb.bone_color_sets = Armature.colorSets()
end
-- every action in the file by name (assigned or not: action constraints and the NLA refer to them)
if o.rawActions ~= false then
local acts= {}
for _, b in __iter(Blend.blocks(f, "AC")) do
local act = Blend.struct(f, b, 0, "bAction")
local name = act and act:idName()
if act and name and not acts[name] then
acts[name] = Anim.raw(f, act)
end
end
if next(acts) ~= nil then
mb.actions = acts
end
end
if next(mb) ~= nil then
scene.meta.blend = mb
end end
if o.animations ~= false then if o.animations ~= false then
animations(ctx) animations(ctx)
+183 -183
View File
@@ -436,187 +436,187 @@
[163103, "src/Rosetta/model/b3d/init.luau"], [163103, "src/Rosetta/model/b3d/init.luau"],
[163158, "src/Rosetta/model/b3d/Read.luau"], [163158, "src/Rosetta/model/b3d/Read.luau"],
[163729, "src/Rosetta/model/blend/init.luau"], [163729, "src/Rosetta/model/blend/init.luau"],
[163827, "src/Rosetta/model/blend/Anim.luau"], [163829, "src/Rosetta/model/blend/Anim.luau"],
[164173, "src/Rosetta/model/blend/Armature.luau"], [164251, "src/Rosetta/model/blend/Armature.luau"],
[164580, "src/Rosetta/model/blend/Material.luau"], [164785, "src/Rosetta/model/blend/Material.luau"],
[164932, "src/Rosetta/model/blend/Mesh.luau"], [165137, "src/Rosetta/model/blend/Mesh.luau"],
[165620, "src/Rosetta/model/blend/Normals.luau"], [165825, "src/Rosetta/model/blend/Normals.luau"],
[165781, "src/Rosetta/model/blend/Prim.luau"], [165986, "src/Rosetta/model/blend/Prim.luau"],
[166288, "src/Rosetta/model/blend/Read.luau"], [166493, "src/Rosetta/model/blend/Read.luau"],
[167327, "src/Rosetta/model/bsp/init.luau"], [167552, "src/Rosetta/model/bsp/init.luau"],
[167518, "src/Rosetta/model/bsp/Lightmap.luau"], [167743, "src/Rosetta/model/bsp/Lightmap.luau"],
[167584, "src/Rosetta/model/bsp/Quake.luau"], [167809, "src/Rosetta/model/bsp/Quake.luau"],
[167973, "src/Rosetta/model/bsp/Quake3.luau"], [168198, "src/Rosetta/model/bsp/Quake3.luau"],
[168202, "src/Rosetta/model/bsp/Tree.luau"], [168427, "src/Rosetta/model/bsp/Tree.luau"],
[168590, "src/Rosetta/model/buildmap/init.luau"], [168815, "src/Rosetta/model/buildmap/init.luau"],
[168862, "src/Rosetta/model/buildmap/Geometry.luau"], [169087, "src/Rosetta/model/buildmap/Geometry.luau"],
[169265, "src/Rosetta/model/d3map/init.luau"], [169490, "src/Rosetta/model/d3map/init.luau"],
[169547, "src/Rosetta/model/d3map/Parse.luau"], [169772, "src/Rosetta/model/d3map/Parse.luau"],
[169745, "src/Rosetta/model/dae/init.luau"], [169970, "src/Rosetta/model/dae/init.luau"],
[169934, "src/Rosetta/model/dae/Math.luau"], [170159, "src/Rosetta/model/dae/Math.luau"],
[169981, "src/Rosetta/model/dae/Read.luau"], [170206, "src/Rosetta/model/dae/Read.luau"],
[171831, "src/Rosetta/model/dae/Write.luau"], [172056, "src/Rosetta/model/dae/Write.luau"],
[172200, "src/Rosetta/model/fbx/init.luau"], [172425, "src/Rosetta/model/fbx/init.luau"],
[172348, "src/Rosetta/model/fbx/Ascii.luau"], [172573, "src/Rosetta/model/fbx/Ascii.luau"],
[172618, "src/Rosetta/model/fbx/Binary.luau"], [172843, "src/Rosetta/model/fbx/Binary.luau"],
[173073, "src/Rosetta/model/fbx/Read.luau"], [173298, "src/Rosetta/model/fbx/Read.luau"],
[174435, "src/Rosetta/model/fbx/Write.luau"], [174660, "src/Rosetta/model/fbx/Write.luau"],
[175420, "src/Rosetta/model/fbx/Xform.luau"], [175645, "src/Rosetta/model/fbx/Xform.luau"],
[175461, "src/Rosetta/model/gltf/init.luau"], [175686, "src/Rosetta/model/gltf/init.luau"],
[175698, "src/Rosetta/model/gltf/Pack.luau"], [175923, "src/Rosetta/model/gltf/Pack.luau"],
[175767, "src/Rosetta/model/gltf/Read.luau"], [175992, "src/Rosetta/model/gltf/Read.luau"],
[176508, "src/Rosetta/model/gltf/Write.luau"], [176733, "src/Rosetta/model/gltf/Write.luau"],
[177194, "src/Rosetta/model/godot/init.luau"], [177419, "src/Rosetta/model/godot/init.luau"],
[177285, "src/Rosetta/model/godot/Build.luau"], [177510, "src/Rosetta/model/godot/Build.luau"],
[177827, "src/Rosetta/model/godot/Primitives.luau"], [178052, "src/Rosetta/model/godot/Primitives.luau"],
[178102, "src/Rosetta/model/godot/Surface.luau"], [178327, "src/Rosetta/model/godot/Surface.luau"],
[178587, "src/Rosetta/model/godot/Write.luau"], [178812, "src/Rosetta/model/godot/Write.luau"],
[178916, "src/Rosetta/model/iqm/init.luau"], [179141, "src/Rosetta/model/iqm/init.luau"],
[178992, "src/Rosetta/model/iqm/Read.luau"], [179217, "src/Rosetta/model/iqm/Read.luau"],
[179347, "src/Rosetta/model/iqm/Write.luau"], [179572, "src/Rosetta/model/iqm/Write.luau"],
[180034, "src/Rosetta/model/ldraw/init.luau"], [180259, "src/Rosetta/model/ldraw/init.luau"],
[180112, "src/Rosetta/model/ldraw/Colors.luau"], [180337, "src/Rosetta/model/ldraw/Colors.luau"],
[180430, "src/Rosetta/model/ldraw/Read.luau"], [180655, "src/Rosetta/model/ldraw/Read.luau"],
[181007, "src/Rosetta/model/lwo/init.luau"], [181232, "src/Rosetta/model/lwo/init.luau"],
[181083, "src/Rosetta/model/lwo/Build.luau"], [181308, "src/Rosetta/model/lwo/Build.luau"],
[181545, "src/Rosetta/model/lwo/Parse.luau"], [181770, "src/Rosetta/model/lwo/Parse.luau"],
[182088, "src/Rosetta/model/map/init.luau"], [182313, "src/Rosetta/model/map/init.luau"],
[182405, "src/Rosetta/model/map/Build.luau"], [182630, "src/Rosetta/model/map/Build.luau"],
[182649, "src/Rosetta/model/map/Parse.luau"], [182874, "src/Rosetta/model/map/Parse.luau"],
[183034, "src/Rosetta/model/map/Write.luau"], [183259, "src/Rosetta/model/map/Write.luau"],
[183180, "src/Rosetta/model/mca/init.luau"], [183405, "src/Rosetta/model/mca/init.luau"],
[183522, "src/Rosetta/model/mca/Chunk.luau"], [183747, "src/Rosetta/model/mca/Chunk.luau"],
[183655, "src/Rosetta/model/mca/Lz4Block.luau"], [183880, "src/Rosetta/model/mca/Lz4Block.luau"],
[183725, "src/Rosetta/model/md2/init.luau"], [183950, "src/Rosetta/model/md2/init.luau"],
[183924, "src/Rosetta/model/md3/init.luau"], [184149, "src/Rosetta/model/md3/init.luau"],
[184152, "src/Rosetta/model/md5/init.luau"], [184377, "src/Rosetta/model/md5/init.luau"],
[184233, "src/Rosetta/model/md5/Read.luau"], [184458, "src/Rosetta/model/md5/Read.luau"],
[184666, "src/Rosetta/model/mdl/init.luau"], [184891, "src/Rosetta/model/mdl/init.luau"],
[184748, "src/Rosetta/model/mdl/HalfLife.luau"], [184973, "src/Rosetta/model/mdl/HalfLife.luau"],
[185052, "src/Rosetta/model/mdl/Quake.luau"], [185277, "src/Rosetta/model/mdl/Quake.luau"],
[185270, "src/Rosetta/model/ms3d/init.luau"], [185495, "src/Rosetta/model/ms3d/init.luau"],
[185342, "src/Rosetta/model/ms3d/Read.luau"], [185567, "src/Rosetta/model/ms3d/Read.luau"],
[185788, "src/Rosetta/model/ms3d/Write.luau"], [186013, "src/Rosetta/model/ms3d/Write.luau"],
[186257, "src/Rosetta/model/obj/init.luau"], [186482, "src/Rosetta/model/obj/init.luau"],
[187075, "src/Rosetta/model/obj/Mtl.luau"], [187300, "src/Rosetta/model/obj/Mtl.luau"],
[187363, "src/Rosetta/model/off/init.luau"], [187588, "src/Rosetta/model/off/init.luau"],
[187825, "src/Rosetta/model/ply/init.luau"], [188050, "src/Rosetta/model/ply/init.luau"],
[188930, "src/Rosetta/model/ply/Binary.luau"], [189155, "src/Rosetta/model/ply/Binary.luau"],
[189131, "src/Rosetta/model/pmx/init.luau"], [189356, "src/Rosetta/model/pmx/init.luau"],
[189200, "src/Rosetta/model/pmx/Build.luau"], [189425, "src/Rosetta/model/pmx/Build.luau"],
[189496, "src/Rosetta/model/pmx/Pmd.luau"], [189721, "src/Rosetta/model/pmx/Pmd.luau"],
[189831, "src/Rosetta/model/pmx/Read.luau"], [190056, "src/Rosetta/model/pmx/Read.luau"],
[190235, "src/Rosetta/model/proc/init.luau"], [190460, "src/Rosetta/model/proc/init.luau"],
[190617, "src/Rosetta/model/qb/init.luau"], [190842, "src/Rosetta/model/qb/init.luau"],
[191010, "src/Rosetta/model/rbxm/init.luau"], [191235, "src/Rosetta/model/rbxm/init.luau"],
[191603, "src/Rosetta/model/rbxmx/init.luau"], [191828, "src/Rosetta/model/rbxmx/init.luau"],
[192279, "src/Rosetta/model/robloxmesh/init.luau"], [192504, "src/Rosetta/model/robloxmesh/init.luau"],
[192938, "src/Rosetta/model/robloxmesh/Parse.luau"], [193163, "src/Rosetta/model/robloxmesh/Parse.luau"],
[193395, "src/Rosetta/model/robloxmesh/Write.luau"], [193620, "src/Rosetta/model/robloxmesh/Write.luau"],
[193504, "src/Rosetta/model/schematic/init.luau"], [193729, "src/Rosetta/model/schematic/init.luau"],
[193825, "src/Rosetta/model/schematic/Common.luau"], [194050, "src/Rosetta/model/schematic/Common.luau"],
[193945, "src/Rosetta/model/schematic/Litematic.luau"], [194170, "src/Rosetta/model/schematic/Litematic.luau"],
[194156, "src/Rosetta/model/schematic/Mcedit.luau"], [194381, "src/Rosetta/model/schematic/Mcedit.luau"],
[194400, "src/Rosetta/model/schematic/Sponge.luau"], [194625, "src/Rosetta/model/schematic/Sponge.luau"],
[194529, "src/Rosetta/model/smd/init.luau"], [194754, "src/Rosetta/model/smd/init.luau"],
[194596, "src/Rosetta/model/smd/Read.luau"], [194821, "src/Rosetta/model/smd/Read.luau"],
[194865, "src/Rosetta/model/smd/Write.luau"], [195090, "src/Rosetta/model/smd/Write.luau"],
[195108, "src/Rosetta/model/sourcemdl/init.luau"], [195333, "src/Rosetta/model/sourcemdl/init.luau"],
[195279, "src/Rosetta/model/sourcemdl/Build.luau"], [195504, "src/Rosetta/model/sourcemdl/Build.luau"],
[195709, "src/Rosetta/model/sourcemdl/Material.luau"], [195934, "src/Rosetta/model/sourcemdl/Material.luau"],
[195870, "src/Rosetta/model/sourcemdl/Mdl.luau"], [196095, "src/Rosetta/model/sourcemdl/Mdl.luau"],
[196397, "src/Rosetta/model/sourcemdl/Phy.luau"], [196622, "src/Rosetta/model/sourcemdl/Phy.luau"],
[196520, "src/Rosetta/model/sourcemdl/Vtx.luau"], [196745, "src/Rosetta/model/sourcemdl/Vtx.luau"],
[196702, "src/Rosetta/model/sourcemdl/Vvd.luau"], [196927, "src/Rosetta/model/sourcemdl/Vvd.luau"],
[196796, "src/Rosetta/model/stl/init.luau"], [197021, "src/Rosetta/model/stl/init.luau"],
[197246, "src/Rosetta/model/stl/Decode.luau"], [197471, "src/Rosetta/model/stl/Decode.luau"],
[197320, "src/Rosetta/model/t3d/init.luau"], [197545, "src/Rosetta/model/t3d/init.luau"],
[197414, "src/Rosetta/model/t3d/Build.luau"], [197639, "src/Rosetta/model/t3d/Build.luau"],
[197819, "src/Rosetta/model/t3d/Parse.luau"], [198044, "src/Rosetta/model/t3d/Parse.luau"],
[197987, "src/Rosetta/model/udmf/init.luau"], [198212, "src/Rosetta/model/udmf/init.luau"],
[198070, "src/Rosetta/model/usda/init.luau"], [198295, "src/Rosetta/model/usda/init.luau"],
[198279, "src/Rosetta/model/usda/Build.luau"], [198504, "src/Rosetta/model/usda/Build.luau"],
[199557, "src/Rosetta/model/usda/Parse.luau"], [199782, "src/Rosetta/model/usda/Parse.luau"],
[200355, "src/Rosetta/model/usda/Write.luau"], [200580, "src/Rosetta/model/usda/Write.luau"],
[201172, "src/Rosetta/model/vbsp/init.luau"], [201397, "src/Rosetta/model/vbsp/init.luau"],
[201618, "src/Rosetta/model/vbsp/Faces.luau"], [201843, "src/Rosetta/model/vbsp/Faces.luau"],
[201842, "src/Rosetta/model/vbsp/Props.luau"], [202067, "src/Rosetta/model/vbsp/Props.luau"],
[201934, "src/Rosetta/model/vmf/init.luau"], [202159, "src/Rosetta/model/vmf/init.luau"],
[202259, "src/Rosetta/model/vmf/Build.luau"], [202484, "src/Rosetta/model/vmf/Build.luau"],
[202683, "src/Rosetta/model/vox/init.luau"], [202908, "src/Rosetta/model/vox/init.luau"],
[203569, "src/Rosetta/model/vox/Grid.luau"], [203794, "src/Rosetta/model/vox/Grid.luau"],
[203626, "src/Rosetta/model/vrml/init.luau"], [203851, "src/Rosetta/model/vrml/init.luau"],
[203692, "src/Rosetta/model/x/init.luau"], [203917, "src/Rosetta/model/x/init.luau"],
[203822, "src/Rosetta/model/x/Build.luau"], [204047, "src/Rosetta/model/x/Build.luau"],
[204385, "src/Rosetta/model/x/Parse.luau"], [204610, "src/Rosetta/model/x/Parse.luau"],
[204682, "src/Rosetta/model/x3d/init.luau"], [204907, "src/Rosetta/model/x3d/init.luau"],
[204760, "src/Rosetta/music/669/init.luau"], [204985, "src/Rosetta/music/669/init.luau"],
[204967, "src/Rosetta/music/ahx/init.luau"], [205192, "src/Rosetta/music/ahx/init.luau"],
[205019, "src/Rosetta/music/far/init.luau"], [205244, "src/Rosetta/music/far/init.luau"],
[205249, "src/Rosetta/music/hmp/init.luau"], [205474, "src/Rosetta/music/hmp/init.luau"],
[205514, "src/Rosetta/music/hvl/init.luau"], [205739, "src/Rosetta/music/hvl/init.luau"],
[205566, "src/Rosetta/music/it/init.luau"], [205791, "src/Rosetta/music/it/init.luau"],
[205985, "src/Rosetta/music/it/Itsex.luau"], [206210, "src/Rosetta/music/it/Itsex.luau"],
[206102, "src/Rosetta/music/med/init.luau"], [206327, "src/Rosetta/music/med/init.luau"],
[206750, "src/Rosetta/music/midi/init.luau"], [206975, "src/Rosetta/music/midi/init.luau"],
[206894, "src/Rosetta/music/midi/Smf.luau"], [207119, "src/Rosetta/music/midi/Smf.luau"],
[207306, "src/Rosetta/music/mod/init.luau"], [207531, "src/Rosetta/music/mod/init.luau"],
[207660, "src/Rosetta/music/mtm/init.luau"], [207885, "src/Rosetta/music/mtm/init.luau"],
[207883, "src/Rosetta/music/mus/init.luau"], [208108, "src/Rosetta/music/mus/init.luau"],
[208041, "src/Rosetta/music/okt/init.luau"], [208266, "src/Rosetta/music/okt/init.luau"],
[208323, "src/Rosetta/music/ptm/init.luau"], [208548, "src/Rosetta/music/ptm/init.luau"],
[208546, "src/Rosetta/music/s3m/init.luau"], [208771, "src/Rosetta/music/s3m/init.luau"],
[208783, "src/Rosetta/music/sf2/init.luau"], [209008, "src/Rosetta/music/sf2/init.luau"],
[208827, "src/Rosetta/music/stm/init.luau"], [209052, "src/Rosetta/music/stm/init.luau"],
[209059, "src/Rosetta/music/ult/init.luau"], [209284, "src/Rosetta/music/ult/init.luau"],
[209364, "src/Rosetta/music/umx/init.luau"], [209589, "src/Rosetta/music/umx/init.luau"],
[209581, "src/Rosetta/music/xm/init.luau"], [209806, "src/Rosetta/music/xm/init.luau"],
[210143, "src/Rosetta/music/xmi/init.luau"], [210368, "src/Rosetta/music/xmi/init.luau"],
[210352, "src/Rosetta/ops/AudioOps.luau"], [210577, "src/Rosetta/ops/AudioOps.luau"],
[210831, "src/Rosetta/ops/ImageOps/init.luau"], [211056, "src/Rosetta/ops/ImageOps/init.luau"],
[211479, "src/Rosetta/ops/ImageOps/Kernels.luau"], [211704, "src/Rosetta/ops/ImageOps/Kernels.luau"],
[212119, "src/Rosetta/ops/LayerOps.luau"], [212344, "src/Rosetta/ops/LayerOps.luau"],
[212212, "src/Rosetta/ops/MeshOps/init.luau"], [212437, "src/Rosetta/ops/MeshOps/init.luau"],
[213352, "src/Rosetta/ops/MeshOps/Greedy.luau"], [213577, "src/Rosetta/ops/MeshOps/Greedy.luau"],
[213519, "src/Rosetta/ops/MusicOps.luau"], [213744, "src/Rosetta/ops/MusicOps.luau"],
[213868, "src/Rosetta/playlist/m3u/init.luau"], [214093, "src/Rosetta/playlist/m3u/init.luau"],
[214221, "src/Rosetta/playlist/pls/init.luau"], [214446, "src/Rosetta/playlist/pls/init.luau"],
[214399, "src/Rosetta/playlist/xspf/init.luau"], [214624, "src/Rosetta/playlist/xspf/init.luau"],
[214602, "src/Rosetta/subtitle/ass/init.luau"], [214827, "src/Rosetta/subtitle/ass/init.luau"],
[215046, "src/Rosetta/subtitle/srt/init.luau"], [215271, "src/Rosetta/subtitle/srt/init.luau"],
[215219, "src/Rosetta/subtitle/vtt/init.luau"], [215444, "src/Rosetta/subtitle/vtt/init.luau"],
[215422, "src/Rosetta/vector/gamemaps/init.luau"], [215647, "src/Rosetta/vector/gamemaps/init.luau"],
[215609, "src/Rosetta/vector/gamemaps/Expand.luau"], [215834, "src/Rosetta/vector/gamemaps/Expand.luau"],
[215706, "src/Rosetta/vector/ldtk/init.luau"], [215931, "src/Rosetta/vector/ldtk/init.luau"],
[215798, "src/Rosetta/vector/ldtk/Read.luau"], [216023, "src/Rosetta/vector/ldtk/Read.luau"],
[216134, "src/Rosetta/vector/ldtk/Write.luau"], [216359, "src/Rosetta/vector/ldtk/Write.luau"],
[216782, "src/Rosetta/vector/ogmo/init.luau"], [217007, "src/Rosetta/vector/ogmo/init.luau"],
[216901, "src/Rosetta/vector/ogmo/Read.luau"], [217126, "src/Rosetta/vector/ogmo/Read.luau"],
[217306, "src/Rosetta/vector/ogmo/Write.luau"], [217531, "src/Rosetta/vector/ogmo/Write.luau"],
[217660, "src/Rosetta/vector/svg/init.luau"], [217885, "src/Rosetta/vector/svg/init.luau"],
[217746, "src/Rosetta/vector/svg/Parse.luau"], [217971, "src/Rosetta/vector/svg/Parse.luau"],
[218492, "src/Rosetta/vector/svg/PathData.luau"], [218717, "src/Rosetta/vector/svg/PathData.luau"],
[218860, "src/Rosetta/vector/svg/Render.luau"], [219085, "src/Rosetta/vector/svg/Render.luau"],
[219277, "src/Rosetta/vector/svg/Style.luau"], [219502, "src/Rosetta/vector/svg/Style.luau"],
[219649, "src/Rosetta/vector/svg/Write.luau"], [219874, "src/Rosetta/vector/svg/Write.luau"],
[219849, "src/Rosetta/vector/tiled/init.luau"], [220074, "src/Rosetta/vector/tiled/init.luau"],
[220029, "src/Rosetta/vector/tiled/Data.luau"], [220254, "src/Rosetta/vector/tiled/Data.luau"],
[220180, "src/Rosetta/vector/tiled/Tmj.luau"], [220405, "src/Rosetta/vector/tiled/Tmj.luau"],
[220811, "src/Rosetta/vector/tiled/Tmx.luau"], [221036, "src/Rosetta/vector/tiled/Tmx.luau"],
[221423, "src/Rosetta/video/avi/init.luau"], [221648, "src/Rosetta/video/avi/init.luau"],
[221717, "src/Rosetta/video/fli/init.luau"], [221942, "src/Rosetta/video/fli/init.luau"],
[221868, "src/Rosetta/video/flv/init.luau"], [222093, "src/Rosetta/video/flv/init.luau"],
[222252, "src/Rosetta/video/flv/Amf.luau"], [222477, "src/Rosetta/video/flv/Amf.luau"],
[222410, "src/Rosetta/video/flv/Mux.luau"], [222635, "src/Rosetta/video/flv/Mux.luau"],
[222691, "src/Rosetta/video/h264/init.luau"], [222916, "src/Rosetta/video/h264/init.luau"],
[222830, "src/Rosetta/video/mkv/init.luau"], [223055, "src/Rosetta/video/mkv/init.luau"],
[222986, "src/Rosetta/video/mkv/Mux.luau"], [223211, "src/Rosetta/video/mkv/Mux.luau"],
[223265, "src/Rosetta/video/mkv/Parse.luau"], [223490, "src/Rosetta/video/mkv/Parse.luau"],
[223986, "src/Rosetta/video/mp4/init.luau"], [224211, "src/Rosetta/video/mp4/init.luau"],
[224314, "src/Rosetta/video/mpegps/init.luau"], [224539, "src/Rosetta/video/mpegps/init.luau"],
[224501, "src/Rosetta/video/mpegts/init.luau"], [224726, "src/Rosetta/video/mpegts/init.luau"],
[224747, "src/Rosetta/video/ogv/init.luau"], [224972, "src/Rosetta/video/ogv/init.luau"],
[225142, "src/Rosetta/video/smk/init.luau"], [225367, "src/Rosetta/video/smk/init.luau"],
[225451, "src/Rosetta/video/smk/Audio.luau"], [225676, "src/Rosetta/video/smk/Audio.luau"],
[225571, "src/Rosetta/video/y4m/init.luau"] [225796, "src/Rosetta/video/y4m/init.luau"]
] ]
+28 -4
View File
@@ -985,11 +985,11 @@ hold the saved pose.
| Where | Fields | | Where | Fields |
|---|---| |---|---|
| 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` | | 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` | | 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) | | 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) |
| `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` | | `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 A colour is `{ palette, normal, select, active }`: `palette` is `"THEME01"` .. `"THEME20"` or `"CUSTOM"` (nil: the
default colour), the three colours are 0..1 sRGB (the custom colours, or the theme set's). Before 4.0 the bone group default colour), the three colours are 0..1 sRGB (the custom colours, or the theme set's). Before 4.0 the bone group
@@ -1005,17 +1005,37 @@ Type fields:
| `IK` | `pole_target`, `pole_subtarget`, `pole_angle`, `chain_count`, `iterations`, `use_tail`, `use_stretch`, `use_location`, `use_rotation`, `weight`, `orient_weight`, `lock_location_x/y/z`, `lock_rotation_x/y/z`, `ik_type`, `distance` | | `IK` | `pole_target`, `pole_subtarget`, `pole_angle`, `chain_count`, `iterations`, `use_tail`, `use_stretch`, `use_location`, `use_rotation`, `weight`, `orient_weight`, `lock_location_x/y/z`, `lock_rotation_x/y/z`, `ik_type`, `distance` |
| `COPY_ROTATION` | `use_x/y/z`, `invert_x/y/z`, `euler_order`, `mix_mode` | | `COPY_ROTATION` | `use_x/y/z`, `invert_x/y/z`, `euler_order`, `mix_mode` |
| `COPY_LOCATION` | `use_x/y/z`, `invert_x/y/z`, `use_offset` | | `COPY_LOCATION` | `use_x/y/z`, `invert_x/y/z`, `use_offset` |
| `COPY_SCALE` | `use_x/y/z`, `use_offset`, `power` | | `COPY_SCALE` | `use_x/y/z`, `use_offset`, `use_add`, `use_make_uniform`, `power` |
| `COPY_TRANSFORMS` | `mix_mode`, `remove_target_shear` | | `COPY_TRANSFORMS` | `mix_mode`, `remove_target_shear` |
| `DAMPED_TRACK` | `track_axis` | | `DAMPED_TRACK` | `track_axis` |
| `LIMIT_ROTATION` | `use_limit_x/y/z`, `min_x/y/z`, `max_x/y/z`, `euler_order`, `use_transform_limit` | | `LIMIT_ROTATION` | `use_limit_x/y/z`, `min_x/y/z`, `max_x/y/z`, `euler_order`, `use_transform_limit` |
| `LIMIT_LOCATION`, `LIMIT_SCALE` | `use_min_x/y/z`, `use_max_x/y/z`, `min_x/y/z`, `max_x/y/z`, `use_transform_limit` | | `LIMIT_LOCATION`, `LIMIT_SCALE` | `use_min_x/y/z`, `use_max_x/y/z`, `min_x/y/z`, `max_x/y/z`, `use_transform_limit` |
| `CHILD_OF` | `use_location_x/y/z`, `use_rotation_x/y/z`, `use_scale_x/y/z`, `set_inverse_pending`, `inverse_matrix` (column-major) | | `CHILD_OF` | `use_location_x/y/z`, `use_rotation_x/y/z`, `use_scale_x/y/z`, `set_inverse_pending`, `inverse_matrix` (column-major) |
| `ACTION` | `action` (name, see `meta.blend.actions`), `transform_channel` (`"LOCATION_X"` .. `"SCALE_Z"`), `frame_start`, `frame_end`, `min`, `max`, `mix_mode` (`"BEFORE_FULL"`, `"BEFORE"`, `"BEFORE_SPLIT"`, `"AFTER_FULL"`, `"AFTER"`, `"AFTER_SPLIT"`), `use_bone_object_action`, `use_eval_time`, `eval_time` |
| `TRANSFORM` | `map_from`, `map_to` (`"LOCATION"`, `"ROTATION"`, `"SCALE"`), `map_to_x_from` / `_y_` / `_z_` (`"X"`, `"Y"`, `"Z"`), `from_min_x` .. `to_max_z` with `_rot` and `_scale` variants (`from_max_x_rot`, `to_min_y_scale`, ...), `mix_mode`, `mix_mode_rot`, `mix_mode_scale`, `use_motion_extrapolate`, `from_rotation_mode` (`"AUTO"`, euler orders, `"QUATERNION"`, `"SWING_TWIST_X/Y/Z"`), `to_euler_order` |
| `STRETCH_TO` | `rest_length`, `bulge`, `volume` (`"VOLUME_XZX"`, `"VOLUME_X"`, `"VOLUME_Z"`, `"NO_VOLUME"`), `keep_axis` (`"PLANE_X"`, `"PLANE_Z"`, `"SWING_Y"`), `use_bulge_min`, `use_bulge_max`, `bulge_min`, `bulge_max`, `bulge_smooth` |
| `ARMATURE` | `targets`, `use_deform_preserve_volume`, `use_bone_envelopes`, `use_current_location` |
| `FLOOR` | `floor_location`, `offset`, `use_rotation` |
| `LIMIT_DISTANCE` | `distance`, `limit_mode` |
| `TRACK_TO` | `track_axis`, `up_axis`, `use_target_z` |
| `LOCKED_TRACK` | `track_axis`, `lock_axis` |
Shape keys: `mesh.extras.blend.shape_keys` lists every key in file order (the basis too) as `{ name, value, slider_min, Shape keys: `mesh.extras.blend.shape_keys` lists every key in file order (the basis too) as `{ name, value, slider_min,
slider_max, mute, relative_key, vertex_group? }`, and `reference_key` names the basis. Actions on shape key values 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). become `weights` channels (clamped to the slider range).
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.
Actions: `scene.meta.blend.actions[name] = { frame_range = { start, end }, curves }` holds every action in the file
(`rawActions = false` skips them), assigned or not, so action constraints can evaluate them at any frame; the
sampled `scene.animations` are unchanged. A curve is `{ data_path, bone?, path, array_index, extrapolation, keys }`
(`bone` and `path` split `pose.bones["name"].location`; other paths keep `path = data_path`; `extrapolation` is
`"CONSTANT"` or `"LINEAR"`), a key `{ co = { frame, value }, interpolation, easing, handle_left, handle_right,
handle_left_type, handle_right_type, back, amplitude, period }` with Blender's interpolation and easing names. Layered
actions (4.4+) give the first layer's first strip's first channel bag; files before 2.5 have IPOs instead (their
object and shape key IPOs are still sampled into `scene.animations`).
```luau ```luau
local rig = assert(F.model.load(riggedBlendBytes)) local rig = assert(F.model.load(riggedBlendBytes))
local joint = {} local joint = {}
@@ -1037,6 +1057,10 @@ assert(widget.name == "WGT_ring" and widget.node == nil)
assert(rig.meshes[widget.mesh].primitives[1].mode == "lines") assert(rig.meshes[widget.mesh].primitives[1].mode == "lines")
local tube = rig.meshes[1] local tube = rig.meshes[1]
assert(tube.extras.targetNames[1] == "Bulge" and tube.extras.blend.shape_keys[2].slider_max == 2) assert(tube.extras.targetNames[1] == "Bulge" and tube.extras.blend.shape_keys[2].slider_max == 2)
for name, action in rig.meta.blend.actions do
local curve = action.curves[1]
print(name, action.frame_range[1], action.frame_range[2], curve.bone, curve.path, curve.keys[1].interpolation)
end
``` ```
Anything else in the file is reachable through the container: `F.format("blend").open` parses the blocks and the Anything else in the file is reachable through the container: `F.format("blend").open` parses the blocks and the
+110 -34
View File
@@ -61,6 +61,54 @@ local function curve(f: Blend.File, fc: Blend.View): Curve?
return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods } return { path = path, index = fc:num("array_index") or 0, keys = keys, extend = fc:num("extend") or 0, modifiers = #mods }
end end
-- an action's f-curves: the legacy list, or (4.4+ layered actions) the channel bags of the strips of every layer whose
-- slot handle matches (handle nil: the first layer's first strip's first channel bag)
local function fcurves(f: Blend.File, act: Blend.View, handle: number?): { Blend.View }
local list: { Blend.View } = act:list("curves", "FCurve")
if #list > 0 or not act:has("layer_array") then
return list
end
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (handle == nil or (bag:num("slot_handle") or 0) == handle) then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
if handle == nil then
return list
end
end
end
end
if handle == nil then
return list
end
end
end
if handle == nil then
return list
end
end
return list
end
function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?) function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not adt then if not adt then
return nil, nil return nil, nil
@@ -69,41 +117,8 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
if not act then if not act then
return nil, nil return nil, nil
end end
local list: { Blend.View } = act:list("curves", "FCurve")
if #list == 0 and act:has("layer_array") then
local handle = adt:num("slot_handle") or 0
local datas = act:pointers("strip_keyframe_data_array", act:num("strip_keyframe_data_array_num"))
for _, la in act:pointers("layer_array", act:num("layer_array_num")) do
local lblk = la and Blend.resolve(f, la, act.block)
local layer = lblk and Blend.struct(f, lblk, 0, "ActionLayer")
if layer then
for _, sa in layer:pointers("strip_array", layer:num("strip_array_num")) do
local sblk = sa and Blend.resolve(f, sa, act.block)
local strip = sblk and Blend.struct(f, sblk, 0, "ActionStrip")
local di = strip and strip:num("data_index")
local dblk = di and datas[di + 1] and Blend.resolve(f, datas[di + 1], act.block)
local kd = dblk and Blend.struct(f, dblk, 0, "ActionStripKeyframeData")
if kd then
for _, ba in kd:pointers("channelbag_array", kd:num("channelbag_array_num")) do
local bblk = ba and Blend.resolve(f, ba, act.block)
local bag = bblk and (Blend.struct(f, bblk, 0, "ActionChannelBag") or Blend.struct(f, bblk, 0, "ActionChannelbag"))
if bag and (bag:num("slot_handle") or 0) == handle then
for _, ca in bag:pointers("fcurve_array", bag:num("fcurve_array_num")) do
local cblk = ca and Blend.resolve(f, ca, act.block)
local fc = cblk and Blend.struct(f, cblk, 0, "FCurve")
if fc then
table.insert(list, fc)
end
end
end
end
end
end
end
end
end
local out: { Curve } = {} local out: { Curve } = {}
for _, fc in list do for _, fc in fcurves(f, act, adt:num("slot_handle") or 0) do
local c = curve(f, fc) local c = curve(f, fc)
if c then if c then
table.insert(out, c) table.insert(out, c)
@@ -112,6 +127,67 @@ function Anim.curves(f: Blend.File, adt: Blend.View?): ({ Curve }?, string?)
return out, act:idName() return out, act:idName()
end end
-- ------------------------------------------------------------------------------------------------ raw actions
local INTERPOLATION: { [number]: string } = {
[0] = "CONSTANT", [1] = "LINEAR", [2] = "BEZIER", [3] = "BACK", [4] = "BOUNCE", [5] = "CIRC", [6] = "CUBIC",
[7] = "ELASTIC", [8] = "EXPO", [9] = "QUAD", [10] = "QUART", [11] = "QUINT", [12] = "SINE",
}
local EASING: { [number]: string } = { [0] = "AUTO", [1] = "EASE_IN", [2] = "EASE_OUT", [3] = "EASE_IN_OUT" }
local HANDLE: { [number]: string } = { [0] = "FREE", [1] = "AUTO", [2] = "VECTOR", [3] = "ALIGNED", [4] = "AUTO_CLAMPED" }
local ACT_FRAME_RANGE = 0x1000
-- an action as Blender's API shows it: frame_range (the manual range, else the keys' span, at least one frame) and
-- every f-curve with its keyframe points
function Anim.raw(f: Blend.File, act: Blend.View): { [string]: any }
local curves: { { [string]: any } } = {}
local lo: number, hi: number = math.huge, -math.huge
for _, fc in fcurves(f, act, nil) do
local path = fc:cstring("rna_path") or ""
local kind, who, rest = Anim.split(path)
local keys: { { [string]: any } } = {}
for _, b in fc:array("bezt", "BezTriple") do
local v = b:vec("vec")
if v and #v >= 9 then
local x: number = v[4]
local k: { [string]: any } = { co = { x, v[5] }, handle_left = { v[1], v[2] }, handle_right = { v[7], v[8] } }
k.interpolation = INTERPOLATION[b:num("ipo") or 2] or "BEZIER"
k.easing = EASING[b:num("easing") or 0] or "AUTO"
k.handle_left_type, k.handle_right_type = HANDLE[b:num("h1") or 0], HANDLE[b:num("h2") or 0]
k.back, k.amplitude, k.period = b:num("back") or 1.70158, b:num("amplitude") or 0.8, b:num("period") or 4.1
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
if #keys == 0 then
for _, p in fc:array("fpt", "FPoint") do
local v = p:vec("vec")
if v and #v >= 2 then
local x: number = v[1]
local k: { [string]: any } = { co = { x, v[2] } }
k.interpolation = "LINEAR"
table.insert(keys, k)
lo, hi = math.min(lo, x), math.max(hi, x)
end
end
end
local entry: { [string]: any } = { data_path = path, path = if kind == "pose.bones" then rest else path, keys = keys }
entry.bone = if kind == "pose.bones" then who else nil
entry.array_index = fc:num("array_index") or 0
entry.extrapolation = if (fc:num("extend") or 0) == 1 then "LINEAR" else "CONSTANT"
table.insert(curves, entry)
end
if bit32.band(act:num("flag") or 0, ACT_FRAME_RANGE) ~= 0 and act:has("frame_start") then
lo = act:num("frame_start") or 0
hi = act:num("frame_end") or 0
elseif lo > hi then
lo, hi = 0, 0
end
if hi <= lo then
hi = lo + 1
end
return { frame_range = { lo, hi }, curves = curves }
end
-- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of -- pre-2.5 IPO curves (Object.ipo / Key.ipo): the curve's adrcode picks the channel; object rotations are in units of
-- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve -- 10 degrees; the interpolation and extrapolation (0 constant, 1 linear; cyclic ones as constant) are per curve
local OB_ADR: { [number]: { any } } = { local OB_ADR: { [number]: { any } } = {
+130 -3
View File
@@ -3,8 +3,10 @@
-- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers -- armature space, deform, connect, wire), bone collections (4.x BoneCollection arrays and lists; before 4.0 the layers
-- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0), -- and bone groups converted as Blender 4.0's versioning does), bone colours (BoneColor; bone group colours before 4.0),
-- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs -- pose bones (custom shapes, locks, rotation mode, IK settings) and constraint stacks (bConstraint and the data structs
-- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of; the -- of IK, copy rotation / location / scale / transforms, damped track, limit rotation / location / scale, child of,
-- common fields for the rest). Flags from DNA_armature_types.h, DNA_action_types.h, DNA_constraint_types.h. -- action, transform, stretch to, armature, floor, limit distance, track to, locked track; the common fields for the
-- rest), bone inheritance and b-bone settings, the stored pose basis. Flags from DNA_armature_types.h,
-- DNA_action_types.h, DNA_constraint_types.h.
local Blend = require("@rosetta/containers/Blend") local Blend = require("@rosetta/containers/Blend")
local Armature = {} local Armature = {}
@@ -62,6 +64,33 @@ local PCHAN_DRAW_NO_CUSTOM_BONE_SIZE = 1
local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024 local LOCK_LOC, LOCK_ROT, LOCK_SCALE, LOCK_ROTW, LOCK_ROT4D = { 1, 2, 4 }, { 8, 16, 32 }, { 64, 128, 256 }, 512, 1024
local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 } local IK_NO_DOF, IK_LIMIT = { 1, 2, 4 }, { 8, 16, 32 }
local AXES = { "x", "y", "z" } local AXES = { "x", "y", "z" }
local XYZ: { [number]: string } = { [0] = "X", [1] = "Y", [2] = "Z" }
-- bActionConstraint.type, .mix_mode
local ACTION_CHANNEL: { [number]: string } = {
[0] = "ROTATION_X", [1] = "ROTATION_Y", [2] = "ROTATION_Z", [10] = "SCALE_X", [11] = "SCALE_Y", [12] = "SCALE_Z",
[20] = "LOCATION_X", [21] = "LOCATION_Y", [22] = "LOCATION_Z",
}
local ACTION_MIX: { [number]: string } = { [0] = "AFTER_FULL", [1] = "AFTER", [2] = "BEFORE", [3] = "BEFORE_FULL", [4] = "BEFORE_SPLIT", [5] = "AFTER_SPLIT" }
local MAP: { [number]: string } = { [0] = "LOCATION", [1] = "ROTATION", [2] = "SCALE" }
-- the driver target rotation modes (DTAR_ROTMODE_*)
local FROM_ROT: { [number]: string } = {
[0] = "AUTO", [1] = "XYZ", [2] = "XZY", [3] = "YXZ", [4] = "YZX", [5] = "ZXY", [6] = "ZYX", [7] = "QUATERNION",
[8] = "SWING_TWIST_X", [9] = "SWING_TWIST_Y", [10] = "SWING_TWIST_Z",
}
local MIX_LOC: { [number]: string } = { [0] = "ADD", [1] = "REPLACE" }
local MIX_ROT: { [number]: string } = { [0] = "ADD", [1] = "REPLACE", [2] = "BEFORE", [3] = "AFTER" }
local MIX_SCALE: { [number]: string } = { [0] = "REPLACE", [1] = "MULTIPLY" }
local VOLUME: { [number]: string } = { [0] = "VOLUME_XZX", [1] = "VOLUME_X", [2] = "VOLUME_Z", [3] = "NO_VOLUME" }
local KEEP_AXIS: { [number]: string } = { [0] = "PLANE_X", [1] = "SWING_Y", [2] = "PLANE_Z" }
local FLOOR: { [number]: string } = { [0] = "FLOOR_X", [1] = "FLOOR_Y", [2] = "FLOOR_Z", [3] = "FLOOR_NEGATIVE_X", [4] = "FLOOR_NEGATIVE_Y", [5] = "FLOOR_NEGATIVE_Z" }
local DIST_MODE: { [number]: string } = { [0] = "LIMITDIST_INSIDE", [1] = "LIMITDIST_OUTSIDE", [2] = "LIMITDIST_ONSURFACE" }
local UP: { [number]: string } = { [0] = "UP_X", [1] = "UP_Y", [2] = "UP_Z" }
local LOCK: { [number]: string } = { [0] = "LOCK_X", [1] = "LOCK_Y", [2] = "LOCK_Z" }
-- Bone.inherit_scale_mode, bbone_prev_type / bbone_next_type, bbone_mapping_mode
local INHERIT_SCALE: { [number]: string } = { [0] = "FULL", [1] = "FIX_SHEAR", [2] = "AVERAGE", [3] = "NONE", [4] = "NONE_LEGACY", [5] = "ALIGNED" }
local HANDLE_TYPE: { [number]: string } = { [0] = "AUTO", [1] = "ABSOLUTE", [2] = "RELATIVE", [3] = "TANGENT" }
local MAPPING: { [number]: string } = { [0] = "STRAIGHT", [1] = "CURVED" }
local BONE_HINGE, BONE_NO_SCALE, BONE_NO_LOCAL_LOCATION, BONE_RELATIVE_PARENTING, BONE_ADD_PARENT_END_ROLL = 0x200, 0x8000, 0x400000, 0x800000, 0x1000000
local function bit(v: number?, mask: number): boolean local function bit(v: number?, mask: number): boolean
return bit32.band(v or 0, mask) ~= 0 return bit32.band(v or 0, mask) ~= 0
@@ -236,7 +265,35 @@ function Armature.bone(bone: Blend.View, pc: Blend.View?, pose: Blend.View?): {
head_local = vec3(bone, "arm_head"), head_local = vec3(bone, "arm_head"),
tail_local = vec3(bone, "arm_tail"), tail_local = vec3(bone, "arm_tail"),
roll = bone:num("arm_roll"), roll = bone:num("arm_roll"),
use_inherit_rotation = not bit(flag, BONE_HINGE),
use_local_location = not bit(flag, BONE_NO_LOCAL_LOCATION),
use_relative_parent = bit(flag, BONE_RELATIVE_PARENTING),
} }
local ism = bone:num("inherit_scale_mode")
e.inherit_scale = if ism then INHERIT_SCALE[ism] else (if bit(flag, BONE_NO_SCALE) then "NONE_LEGACY" else "FULL") -- BONE_NO_SCALE before 2.81
e.bbone_segments = bone:num("segments") or 1
e.bbone_x, e.bbone_z = bone:num("xwidth"), bone:num("zwidth")
e.bbone_easein, e.bbone_easeout = bone:num("ease1") or 1, bone:num("ease2") or 1
e.bbone_rollin, e.bbone_rollout = bone:num("roll1") or 0, bone:num("roll2") or 0
e.bbone_curveinx, e.bbone_curveinz = bone:num("curveInX") or 0, bone:num("curveInY") or 0 -- curveInY is the API's z
e.bbone_curveoutx, e.bbone_curveoutz = bone:num("curveOutX") or 0, bone:num("curveOutY") or 0
for _, side in { "in", "out" } do
local cap = if side == "in" then "In" else "Out"
local v = vec3(bone, "scale_" .. side)
if not v then
-- before 3.0: scaleIn (x) and scale_in_y (z); before 2.8 one value for both
local x = bone:num("scale" .. cap) or 1
v = { x, 1, bone:num("scale_" .. side .. "_y") or x }
end
e["bbone_scale" .. side] = v
end
e.bbone_handle_type_start = HANDLE_TYPE[bone:num("bbone_prev_type") or 0]
e.bbone_handle_type_end = HANDLE_TYPE[bone:num("bbone_next_type") or 0]
local prev, nxt = bone:deref("bbone_prev", 0, "Bone"), bone:deref("bbone_next", 0, "Bone")
e.bbone_custom_handle_start = if prev then prev:str("name") else nil
e.bbone_custom_handle_end = if nxt then nxt:str("name") else nil
e.use_endroll_as_inroll = if bone:has("bbone_flag") then bit(bone:num("bbone_flag"), 1) else bit(flag, BONE_ADD_PARENT_END_ROLL)
e.bbone_mapping_mode = MAPPING[bone:num("bbone_mapping_mode") or 0]
if bone:has("color") then if bone:has("color") then
e.color = boneColor(bone) e.color = boneColor(bone)
elseif pc and pose then elseif pc and pose then
@@ -283,10 +340,72 @@ local function constraintData(e: { [string]: any }, kind: string, d: Blend.View,
e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64) e.invert_x, e.invert_y, e.invert_z = bit(flag, 16), bit(flag, 32), bit(flag, 64)
e.use_offset = bit(flag, 128) e.use_offset = bit(flag, 128)
elseif kind == "COPY_SCALE" then elseif kind == "COPY_SCALE" then
-- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8 -- SIZELIKE_X 1, Y 2, Z 4, OFFSET 8, MULTIPLY 16 (use_add is its inverse), UNIFORM 32
e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4) e.use_x, e.use_y, e.use_z = bit(flag, 1), bit(flag, 2), bit(flag, 4)
e.use_offset = bit(flag, 8) e.use_offset = bit(flag, 8)
e.use_add = not bit(flag, 16)
e.use_make_uniform = bit(flag, 32)
e.power = d:num("power") or 1 e.power = d:num("power") or 1
elseif kind == "ACTION" then
-- flag: ACTCON_BONE_USE_OBJECT_ACTION 1, ACTCON_USE_EVAL_TIME 2
local act = d:deref("act", 0, "bAction")
e.action = if act then act:idName() else nil
e.transform_channel = ACTION_CHANNEL[d:num("type") or 20]
e.frame_start, e.frame_end = d:num("start") or 1, d:num("end") or 1
e.min, e.max = d:num("min") or 0, d:num("max") or 0
e.mix_mode = ACTION_MIX[d:num("mix_mode") or 0]
e.use_bone_object_action = bit(flag, 1)
e.use_eval_time = bit(flag, 2)
e.eval_time = d:num("eval_time") or 0
elseif kind == "TRANSFORM" then
e.map_from, e.map_to = MAP[d:num("from") or 0], MAP[d:num("to") or 0]
local map = d.struct.byName.map
for i, a in AXES do
local o = map and d.offset + map.offset + i - 1
e["map_to_" .. a .. "_from"] = XYZ[if o and o < buffer.len(d.file.buf) then buffer.readu8(d.file.buf, o) else i - 1]
end
e.use_motion_extrapolate = (d:num("expo") or 0) ~= 0
e.from_rotation_mode = FROM_ROT[d:num("from_rotation_mode") or 0]
e.to_euler_order = EULER_ORDER[d:num("to_euler_order") or 0]
e.mix_mode = MIX_LOC[d:num("mix_mode_loc") or 0]
e.mix_mode_rot = MIX_ROT[d:num("mix_mode_rot") or 0]
e.mix_mode_scale = MIX_SCALE[d:num("mix_mode_scale") or 0]
for _, side in { "from", "to" } do
for _, suffix in { "", "_rot", "_scale" } do
local lo, hi = d:vec(side .. "_min" .. suffix), d:vec(side .. "_max" .. suffix)
for i, a in AXES do
e[side .. "_min_" .. a .. suffix] = lo and lo[i] or 0
e[side .. "_max_" .. a .. suffix] = hi and hi[i] or 0
end
end
end
elseif kind == "STRETCH_TO" then
-- STRETCHTOCON_USE_BULGE_MIN 1, MAX 2
e.rest_length = d:num("orglength")
e.bulge = d:num("bulge")
e.volume = VOLUME[d:num("volmode") or 0]
e.keep_axis = KEEP_AXIS[d:num("plane") or 0]
e.use_bulge_min, e.use_bulge_max = bit(flag, 1), bit(flag, 2)
e.bulge_min, e.bulge_max, e.bulge_smooth = d:num("bulge_min"), d:num("bulge_max"), d:num("bulge_smooth")
elseif kind == "ARMATURE" then
-- CONSTRAINT_ARMATURE_QUATERNION 1, ENVELOPE 2, CUR_LOCATION 4
e.use_deform_preserve_volume, e.use_bone_envelopes, e.use_current_location = bit(flag, 1), bit(flag, 2), bit(flag, 4)
elseif kind == "FLOOR" then
-- flag: MINMAX_USEROT 4
e.floor_location = FLOOR[d:num("minmaxflag") or 2]
e.offset = d:num("offset") or 0
e.use_rotation = bit(flag, 4)
elseif kind == "LIMIT_DISTANCE" then
e.distance = d:num("dist")
e.limit_mode = DIST_MODE[d:num("mode") or 0]
elseif kind == "TRACK_TO" then
-- reserved1 the track axis, reserved2 the up axis; flags TARGET_Z_UP 1
e.track_axis = TRACK[d:num("reserved1") or 1]
e.up_axis = UP[d:num("reserved2") or 2]
e.use_target_z = bit(d:num("flags"), 1)
elseif kind == "LOCKED_TRACK" then
e.track_axis = TRACK[d:num("trackflag") or 1]
e.lock_axis = LOCK[d:num("lockflag") or 2]
elseif kind == "COPY_TRANSFORMS" then elseif kind == "COPY_TRANSFORMS" then
e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0] e.mix_mode = TRANS_MIX[d:num("mix_mode") or 0]
e.remove_target_shear = bit(flag, 1) e.remove_target_shear = bit(flag, 1)
@@ -399,6 +518,14 @@ function Armature.pose(e: { [string]: any }, pc: Blend.View, resolve: Resolve, s
e["ik_stiffness_" .. a] = stiff and stiff[i] or 0 e["ik_stiffness_" .. a] = stiff and stiff[i] or 0
end end
e.pose_color = if pc:has("color") then boneColor(pc) else nil e.pose_color = if pc:has("color") then boneColor(pc) else nil
-- the stored basis (rotation_quaternion w, x, y, z; rotation_axis_angle angle, x, y, z)
e.location = vec3(pc, "loc", { 0, 0, 0 })
local q = pc:vec("quat")
e.rotation_quaternion = if q and #q >= 4 then { q[1], q[2], q[3], q[4] } else { 1, 0, 0, 0 }
e.rotation_euler = vec3(pc, "eul", { 0, 0, 0 })
local axis = vec3(pc, "rotAxis", { 0, 1, 0 }) :: { number }
e.rotation_axis_angle = { pc:num("rotAngle") or 0, axis[1], axis[2], axis[3] }
e.scale = vec3(pc, "size", nil) or vec3(pc, "scale", { 1, 1, 1 })
e.constraints = Armature.constraints(pc, resolve) e.constraints = Armature.constraints(pc, resolve)
end end
+21 -1
View File
@@ -28,6 +28,7 @@ export type Options = {
scene: string?, -- the scene to read (default: the file's current scene) scene: string?, -- the scene to read (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves in meta.blend.actions (default true)
resolve: ((uri: string) -> any)?, resolve: ((uri: string) -> any)?,
files: { [string]: any }?, files: { [string]: any }?,
maxVertices: number?, maxVertices: number?,
@@ -1013,8 +1014,27 @@ function Read.scene(f: Blend.File, opts: Options?): (Types.Scene?, string?)
end end
end end
skins(ctx) skins(ctx)
local mb: { [string]: any } = {}
if next(ctx.armatures) ~= nil then if next(ctx.armatures) ~= nil then
scene.meta.blend = { widgets = widgetList(ctx), bone_color_sets = Armature.colorSets() } mb.widgets = widgetList(ctx)
mb.bone_color_sets = Armature.colorSets()
end
-- every action in the file by name (assigned or not: action constraints and the NLA refer to them)
if o.rawActions ~= false then
local acts: { [string]: any } = {}
for _, b in Blend.blocks(f, "AC") do
local act = Blend.struct(f, b, 0, "bAction")
local name = act and act:idName()
if act and name and not acts[name] then
acts[name] = Anim.raw(f, act)
end
end
if next(acts) ~= nil then
mb.actions = acts
end
end
if next(mb) ~= nil then
scene.meta.blend = mb
end end
if o.animations ~= false then if o.animations ~= false then
animations(ctx) animations(ctx)
+3 -1
View File
@@ -5,7 +5,8 @@
-- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour -- meshes of every storage generation (MFace, MPoly / MLoop, attribute layers, AttributeStorage) with UV maps, colour
-- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights; -- attributes, custom normals, material slots; Principled BSDF materials; packed and external images; cameras; lights;
-- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into -- armatures, skins (vertex groups, top 4 weights), shape keys (relative keys, vertex groups); actions sampled into
-- channels; rig data (bone collections / layers, colours, custom shapes, pose settings, constraint stacks) as extras. -- channels, and every action's raw f-curves in meta.blend.actions; rig data (bone collections / layers, colours,
-- custom shapes, pose settings, constraint stacks) as extras.
-- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes, -- Not supported: modifiers (listed in meta.source.modifiers), curves / text / metaballs / grease pencil / volumes,
-- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances. -- NLA strips, drivers, constraint evaluation, f-curve modifiers, linked libraries, collection instances.
@@ -38,6 +39,7 @@ export type DecodeOptions = {
scene: string?, -- a scene by name (default: the file's current scene) scene: string?, -- a scene by name (default: the file's current scene)
sampleStep: number?, -- frames between animation samples (default 1) sampleStep: number?, -- frames between animation samples (default 1)
animations: boolean?, -- default true animations: boolean?, -- default true
rawActions: boolean?, -- every action's f-curves and keys in meta.blend.actions (default true)
resolve: ((uri: string) -> any)?, -- external images resolve: ((uri: string) -> any)?, -- external images
files: { [string]: any }?, files: { [string]: any }?,
maxBytes: number?, -- decompressed size limit (default 2^31) maxBytes: number?, -- decompressed size limit (default 2^31)
+65 -11
View File
@@ -178,16 +178,30 @@ local REQUIRED: { [string]: { string } } = {
IK = { "chain_count", "pole_target", "pole_subtarget", "pole_angle", "use_tail", "use_stretch", "iterations", "weight" }, IK = { "chain_count", "pole_target", "pole_subtarget", "pole_angle", "use_tail", "use_stretch", "iterations", "weight" },
COPY_ROTATION = { "use_x", "use_y", "use_z", "invert_x", "invert_y", "invert_z", "mix_mode", "euler_order" }, COPY_ROTATION = { "use_x", "use_y", "use_z", "invert_x", "invert_y", "invert_z", "mix_mode", "euler_order" },
COPY_LOCATION = { "use_x", "use_y", "use_z", "invert_x", "invert_y", "invert_z", "use_offset", "head_tail" }, COPY_LOCATION = { "use_x", "use_y", "use_z", "invert_x", "invert_y", "invert_z", "use_offset", "head_tail" },
COPY_SCALE = { "use_x", "use_y", "use_z", "use_offset", "power" }, COPY_SCALE = { "use_x", "use_y", "use_z", "use_offset", "power", "use_add", "use_make_uniform" },
COPY_TRANSFORMS = { "mix_mode", "head_tail" }, COPY_TRANSFORMS = { "mix_mode", "head_tail" },
DAMPED_TRACK = { "track_axis", "head_tail" }, DAMPED_TRACK = { "track_axis", "head_tail" },
LIMIT_ROTATION = { "use_limit_x", "use_limit_y", "use_limit_z", "min_x", "max_x", "min_z", "max_z", "use_transform_limit" }, LIMIT_ROTATION = { "use_limit_x", "use_limit_y", "use_limit_z", "min_x", "max_x", "min_z", "max_z", "use_transform_limit" },
LIMIT_LOCATION = { "use_min_x", "use_max_x", "use_min_z", "use_max_z", "min_x", "max_x", "min_z", "max_z", "use_transform_limit" }, LIMIT_LOCATION = { "use_min_x", "use_max_x", "use_min_z", "use_max_z", "min_x", "max_x", "min_z", "max_z", "use_transform_limit" },
CHILD_OF = { "inverse_matrix", "use_location_x", "use_rotation_y", "use_scale_x", "use_scale_z", "set_inverse_pending" }, CHILD_OF = { "inverse_matrix", "use_location_x", "use_rotation_y", "use_scale_x", "use_scale_z", "set_inverse_pending" },
ACTION = { "action", "transform_channel", "frame_start", "frame_end", "min", "max", "mix_mode", "use_bone_object_action", "use_eval_time", "eval_time" },
TRANSFORM = { "map_from", "map_to", "map_to_x_from", "map_to_y_from", "map_to_z_from", "use_motion_extrapolate", "from_rotation_mode",
"to_euler_order", "mix_mode", "mix_mode_rot", "mix_mode_scale", "from_min_x", "from_max_z", "to_min_y", "to_max_x",
"from_min_y_rot", "from_max_x_rot", "to_min_z_rot", "to_max_y_rot", "from_min_x_scale", "from_max_y_scale", "to_min_x_scale", "to_max_y_scale" },
STRETCH_TO = { "rest_length", "bulge", "volume", "keep_axis", "use_bulge_min", "use_bulge_max", "bulge_min", "bulge_max", "bulge_smooth" },
ARMATURE = { "use_deform_preserve_volume", "use_bone_envelopes", "use_current_location", "targets" },
FLOOR = { "floor_location", "offset", "use_rotation" },
LIMIT_DISTANCE = { "distance", "limit_mode" },
TRACK_TO = { "track_axis", "up_axis", "use_target_z" },
LOCKED_TRACK = { "track_axis", "lock_axis" },
} }
local BONE_KEYS = { "inherit_scale", "use_inherit_rotation", "use_local_location", "use_relative_parent", "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", "bbone_handle_type_start", "bbone_handle_type_end",
"bbone_custom_handle_start", "bbone_custom_handle_end", "use_endroll_as_inroll", "bbone_mapping_mode" }
local COMMON = { "type", "name", "influence", "mute", "target", "subtarget", "owner_space", "target_space" } local COMMON = { "type", "name", "influence", "mute", "target", "subtarget", "owner_space", "target_space" }
local checked = { rigs = 0, constraints = 0, worlds = 0, meshes = 0, normals = 0, weights = 0, shapes = 0, frames = 0, skinned = 0, curves = 0, materials = 0, cameras = 0, lights = 0 } local checked = { actions = 0, rigs = 0, constraints = 0, worlds = 0, meshes = 0, normals = 0, weights = 0, shapes = 0, frames = 0, skinned = 0, curves = 0, materials = 0, cameras = 0, lights = 0 }
local samples = {} local samples = {}
t:check(#Sets.old >= 4, "the old demo files were fetched (" .. #Sets.old .. ")") t:check(#Sets.old >= 4, "the old demo files were fetched (" .. #Sets.old .. ")")
@@ -544,13 +558,10 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
for k, s in scene.skins do for k, s in scene.skins do
t:eq(#s.joints, #gl.skins[k].joints, label .. ": skin joints") t:eq(#s.joints, #gl.skins[k].joints, label .. ": skin joints")
end end
-- bones at the saved frame (the rest pose here) -- bones at the saved frame: the saved pose (constraints muted in the reference)
for armName, list in ref.armatures do for key, want in ref.posedBones do
local aw = W[objects[armName]] local j = bones[string.match(key, "/(.+)$")]
for _, b in list do t:check(j and nearList(W[j], want, 1e-4), label .. ": bone " .. key)
local j = bones[b.name]
t:check(j and nearList(W[j], Scene.mul(aw, b["local"]), 1e-4), label .. ": bone " .. b.name)
end
end end
-- rig data against bpy (Blender 5.x reads the old files through its versioning: layers and bone groups as -- rig data against bpy (Blender 5.x reads the old files through its versioning: layers and bone groups as
-- collections, bone group colours as bone colours) -- collections, bone group colours as bone colours)
@@ -567,6 +578,18 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
local g = got[k] local g = got[k]
if k == "target" or k == "pole_target" or k == "custom_shape" then if k == "target" or k == "pole_target" or k == "custom_shape" then
g = nameOf(g) g = nameOf(g)
elseif k == "targets" and type(g) == "table" then
local named = {}
for i, x in g do
named[i] = { target = nameOf(x.target), subtarget = x.subtarget, weight = x.weight }
end
local ok = #named == #want[k]
for i, x in want[k] do
local y = named[i] or {}
ok = ok and y.target == x.target and (y.subtarget or "") == x.subtarget and near(y.weight or -1, x.weight, 1e-5)
end
t:check(ok, what .. " targets")
continue
end end
t:check(same(g, want[k], 1e-5), what .. " " .. k .. ": got " .. tostring(g) .. ", want " .. tostring(want[k])) t:check(same(g, want[k], 1e-5), what .. " " .. k .. ": got " .. tostring(g) .. ", want " .. tostring(want[k]))
end end
@@ -582,7 +605,8 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
end end
local POSE_KEYS = { "custom_shape", "custom_shape_transform", "custom_shape_translation", "custom_shape_rotation_euler", local POSE_KEYS = { "custom_shape", "custom_shape_transform", "custom_shape_translation", "custom_shape_rotation_euler",
"custom_shape_scale_xyz", "use_custom_shape_bone_size", "lock_location", "lock_rotation", "lock_rotation_w", "custom_shape_scale_xyz", "use_custom_shape_bone_size", "lock_location", "lock_rotation", "lock_rotation_w",
"lock_rotations_4d", "lock_scale", "rotation_mode", "ik_stretch" } "lock_rotations_4d", "lock_scale", "rotation_mode", "ik_stretch", "location", "rotation_quaternion", "rotation_euler",
"rotation_axis_angle", "scale" }
for _, a in { "x", "y", "z" } do for _, a in { "x", "y", "z" } do
for _, k in { "lock_ik_", "use_ik_limit_", "ik_min_", "ik_max_", "ik_stiffness_" } do for _, k in { "lock_ik_", "use_ik_limit_", "ik_min_", "ik_max_", "ik_stiffness_" } do
table.insert(POSE_KEYS, k .. a) table.insert(POSE_KEYS, k .. a)
@@ -605,6 +629,13 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
compareColor(e.color, b.color, what) compareColor(e.color, b.color, what)
compareColor(e.pose_color, b.pose.color, what .. " pose") compareColor(e.pose_color, b.pose.color, what .. " pose")
compareTable(e, b.pose, POSE_KEYS, what) compareTable(e, b.pose, POSE_KEYS, what)
local bk = {}
for _, k in BONE_KEYS do
if b.bone[k] ~= nil then
table.insert(bk, k)
end
end
compareTable(e, b.bone, bk, what)
t:eq(#e.constraints, #b.pose.constraints, what .. " constraints") t:eq(#e.constraints, #b.pose.constraints, what .. " constraints")
for k, rc in b.pose.constraints do for k, rc in b.pose.constraints do
local c = e.constraints[k] or {} local c = e.constraints[k] or {}
@@ -653,6 +684,29 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
end end
t:check(next(shapes) == nil, label .. ": every custom shape is listed") t:check(next(shapes) == nil, label .. ": every custom shape is listed")
end end
-- every action, raw: frame range, f-curves, keyframe points (bpy's first layer / strip / channel bag)
for name, ra in if src.version >= 250 then ref.allActions or {} else {} do -- older files: IPOs Blender converts on load
local a = scene.meta.blend and scene.meta.blend.actions and scene.meta.blend.actions[name]
t:check(a and nearList(a.frame_range, ra.frame_range, 1e-5), label .. ": action " .. name .. " frame range")
if not a then
continue
end
t:eq(#a.curves, #ra.curves, label .. ": action " .. name .. " curves")
for k, rc in ra.curves do
local c = a.curves[k] or { keys = {} }
local what = label .. ": action " .. name .. " " .. rc.data_path .. "[" .. rc.array_index .. "]"
t:check(c.data_path == rc.data_path and c.array_index == rc.array_index and c.extrapolation == rc.extrapolation, what)
local bone, prop = string.match(rc.data_path, '^pose%.bones%["(.-)"%]%.([%w_]+)$')
t:check(c.bone == bone and c.path == (prop or rc.data_path), what .. " bone / path")
t:eq(#c.keys, #rc.keys, what .. " keys")
for q, rk in rc.keys do
local ck = c.keys[q] or {}
t:check(nearList(ck.co, rk.co, 1e-5) and nearList(ck.handle_left, rk.handle_left, 1e-4) and nearList(ck.handle_right, rk.handle_right, 1e-4)
and ck.interpolation == rk.interpolation and ck.easing == rk.easing, what .. " key " .. q)
end
checked.actions += 1
end
end
-- f-curves through the evaluator, at every half frame (bezier, linear, constant, extrapolation) -- f-curves through the evaluator, at every half frame (bezier, linear, constant, extrapolation)
local file = assert(Blend.open(buffer.fromstring(c.data))) local file = assert(Blend.open(buffer.fromstring(c.data)))
for _, o in ref.objects do for _, o in ref.objects do
@@ -797,7 +851,7 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
end end
end end
end end
t:note("checked: %d rigs, %d constraints", checked.rigs, checked.constraints) t:note("checked: %d rigs, %d constraints, %d raw action curves", checked.rigs, checked.constraints, checked.actions)
t:note("checked: %d world matrices, %d meshes, %d corner normal sets, %d weight sets, %d shape key sets, %d f-curves, %d posed frames, %d skinned frames, %d materials, %d cameras, %d lights", t:note("checked: %d world matrices, %d meshes, %d corner normal sets, %d weight sets, %d shape key sets, %d f-curves, %d posed frames, %d skinned frames, %d materials, %d cameras, %d lights",
checked.worlds, checked.meshes, checked.normals, checked.weights, checked.shapes, checked.curves, checked.frames, checked.skinned, checked.materials, checked.cameras, checked.lights) checked.worlds, checked.meshes, checked.normals, checked.weights, checked.shapes, checked.curves, checked.frames, checked.skinned, checked.materials, checked.cameras, checked.lights)
+108 -1
View File
@@ -11,7 +11,9 @@
# collections and colours (4.x), custom shapes (a hidden widget in the scene, one outside it), # collections and colours (4.x), custom shapes (a hidden widget in the scene, one outside it),
# pose-bone constraints (IK, copy rotation / location / transforms, damped track, limit # pose-bone constraints (IK, copy rotation / location / transforms, damped track, limit
# rotation, child of, stretch to), lock and IK flags; shape keys with slider ranges, mute, # rotation, child of, stretch to), lock and IK flags; shape keys with slider ranges, mute,
# relative keys, a vertex group, and a shape-key action # relative keys, a vertex group, and a shape-key action; an unassigned action driven by an
# action constraint; transform / armature / floor / limit distance / track to / locked
# track constraints; bone inheritance and b-bone settings; a saved pose basis
import bpy, sys, os, math import bpy, sys, os, math
out = sys.argv[sys.argv.index("--") + 1] out = sys.argv[sys.argv.index("--") + 1]
@@ -461,6 +463,25 @@ def ctl_file():
b.parent = eb[parent] b.parent = eb[parent]
b.use_connect = connect b.use_connect = connect
b.use_deform = deform b.use_deform = deform
up, lo = eb["hand_ik"], eb["lower"] # b-bone settings on a bone that deforms nothing (skinning stays linear)
setp(eb["upper"], "inherit_scale", "ALIGNED")
setp(eb["upper"], "use_inherit_scale", False)
setp(lo, "use_inherit_rotation", False)
setp(lo, "use_local_location", False)
setp(eb["limit"], "use_relative_parent", True)
up.bbone_segments = 4
up.bbone_x, up.bbone_z = 0.05, 0.08
setp(up, "bbone_easein", 0.5)
setp(up, "bbone_easeout", 1.5)
setp(up, "bbone_rollin", 0.2)
setp(up, "bbone_curveinx", 0.1)
setp(up, "bbone_curveinz", -0.1)
setp(up, "bbone_curveoutx", 0.3)
setp(up, "bbone_scalein", (1.0, 1.0, 1.2))
setp(up, "bbone_handle_type_start", "ABSOLUTE")
setp(up, "bbone_custom_handle_start", eb["spine"])
setp(up, "bbone_handle_type_end", "TANGENT")
setp(up, "bbone_custom_handle_end", eb["pole"])
bpy.ops.object.mode_set(mode="OBJECT") bpy.ops.object.mode_set(mode="OBJECT")
bones = arm_data.bones bones = arm_data.bones
bones["root"].show_wire = True bones["root"].show_wire = True
@@ -587,6 +608,92 @@ def ctl_file():
c = pose["limit"].constraints.new("STRETCH_TO") c = pose["limit"].constraints.new("STRETCH_TO")
c.target = tgt c.target = tgt
c.influence = 0.5 c.influence = 0.5
c.rest_length = 0.75
c.bulge = 1.5
c.volume = "VOLUME_X"
c.keep_axis = "PLANE_Z"
setp(c, "use_bulge_min", True)
setp(c, "bulge_min", 0.5)
setp(c, "use_bulge_max", True)
setp(c, "bulge_max", 2.0)
setp(c, "bulge_smooth", 0.3)
c = pose["limit"].constraints.new("TRANSFORM")
c.target = tgt
c.map_from, c.map_to = "ROTATION", "SCALE"
c.map_to_x_from, c.map_to_y_from, c.map_to_z_from = "Z", "X", "Y"
setp(c, "from_max_x_rot", 2.356194)
setp(c, "from_min_y_rot", -0.5)
setp(c, "to_max_y_scale", 0.65)
setp(c, "to_min_x_scale", 0.9)
setp(c, "mix_mode_scale", "MULTIPLY")
setp(c, "from_rotation_mode", "SWING_TWIST_Y")
setp(c, "to_euler_order", "ZXY")
c.use_motion_extrapolate = True
c = pose["limit"].constraints.new("FLOOR")
c.target = tgt
c.floor_location = "FLOOR_NEGATIVE_Y"
c.offset = 0.2
c.use_rotation = True
c = pose["pole"].constraints.new("TRACK_TO")
c.target, c.subtarget = rig, "upper"
c.track_axis, c.up_axis = "TRACK_NEGATIVE_Y", "UP_X"
c.use_target_z = True
c = pose["root"].constraints.new("LOCKED_TRACK")
c.target = tgt
c.track_axis, c.lock_axis = "TRACK_X", "LOCK_Z"
c = pose["root"].constraints.new("LIMIT_DISTANCE")
c.target = tgt
c.distance = 2.5
c.limit_mode = "LIMITDIST_OUTSIDE"
c = pose["upper"].constraints["Copy Scale"]
setp(c, "use_make_uniform", True)
setp(c, "use_add", True)
setp(c, "power", 0.5)
if V >= (2, 80):
c = pose["spine"].constraints.new("ARMATURE")
t = c.targets.new()
t.target, t.subtarget, t.weight = rig, "root", 0.75
c.use_deform_preserve_volume = True
c.use_bone_envelopes = True
c.use_current_location = True
# an action only the action constraint uses: keys on hand_ik / limit, then unassigned
for f, loc, eul in ((1, (0, 0, 0), (0, 0, 0)), (10, (0.5, 0.1, 0), (0.3, 0, -0.2)), (25, (0, 0.4, 0.2), (-0.4, 0.2, 0))):
pose["hand_ik"].location = loc
pose["hand_ik"].keyframe_insert("location", frame=f)
pose["limit"].rotation_euler = eul
pose["limit"].keyframe_insert("rotation_euler", frame=f)
act = rig.animation_data.action
act.name = "CtlAct"
act.use_fake_user = True
curves = act.fcurves if hasattr(act, "fcurves") and V < (5, 0) else [c for l in act.layers for st in l.strips for b in st.channelbags for c in b.fcurves]
for fc in curves:
if fc.data_path.endswith("location"):
for kp in fc.keyframe_points:
kp.interpolation = "LINEAR"
elif fc.array_index == 1:
fc.keyframe_points[1].interpolation = "QUAD"
fc.keyframe_points[1].easing = "EASE_OUT"
fc.extrapolation = "LINEAR"
rig.animation_data.action = None
pose["hand_ik"].location = (0, 0, 0)
pose["limit"].rotation_euler = (0, 0, 0)
c = pose["hand_ik"].constraints.new("ACTION")
c.target, c.subtarget = rig, "pole"
c.action = act
c.transform_channel = "LOCATION_Y"
c.target_space = "LOCAL"
c.frame_start, c.frame_end = 0, 40
c.min, c.max = -0.05, 0.05
setp(c, "mix_mode", "AFTER")
setp(c, "use_eval_time", False)
setp(c, "eval_time", 0.25)
c.influence = 0.5
# a saved pose basis
pose["spine"].location = (0.01, 0.02, 0.03) # no rotation above the hinge bone (not modelled by joint nodes)
pose["pole"].rotation_quaternion = (0.9, 0.1, 0.3, 0.2)
pose["lower"].rotation_euler = (0.1, -0.2, 0.3)
pose["hand_ik"].rotation_axis_angle = (0.4, 0, 0, 1)
pose["limit"].scale = (1, 1.25, 0.8)
# shape keys on a mesh parented to the rig # shape keys on a mesh parented to the rig
fv = [(x * 0.5, 0, z * 0.5) for z in range(3) for x in range(3)] fv = [(x * 0.5, 0, z * 0.5) for z in range(3) for x in range(3)]
ff = [(0, 1, 4, 3), (1, 2, 5, 4), (3, 4, 7, 6), (4, 5, 8, 7)] ff = [(0, 1, 4, 3), (1, 2, 5, 4), (3, 4, 7, 6), (4, 5, 8, 7)]
+41 -3
View File
@@ -131,7 +131,7 @@ def rna_value(v):
return "" return ""
if isinstance(v, bpy.types.ID): if isinstance(v, bpy.types.ID):
return v.name return v.name
if isinstance(v, bpy.types.PoseBone): if isinstance(v, (bpy.types.PoseBone, bpy.types.Bone)):
return v.name return v.name
if isinstance(v, bool): if isinstance(v, bool):
return v return v
@@ -151,8 +151,36 @@ SKIP = {"rna_type", "show_expanded", "active", "is_valid", "is_override_data_edi
"error_rotation", "targets", "space_object", "space_subtarget"} "error_rotation", "targets", "space_object", "space_subtarget"}
BONE_KEYS = ("inherit_scale", "use_inherit_rotation", "use_local_location", "use_relative_parent", "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",
"bbone_handle_type_start", "bbone_handle_type_end", "bbone_custom_handle_start", "bbone_custom_handle_end",
"use_endroll_as_inroll", "bbone_mapping_mode")
def action_fcurves(act):
if V >= (4, 4) and hasattr(act, "layers") and len(act.layers) > 0:
for strip in act.layers[0].strips:
for bag in strip.channelbags:
return list(bag.fcurves)
return []
return list(act.fcurves)
def action_info(act):
curves = []
for fc in action_fcurves(act):
keys = [{"co": [r6(k.co[0]), r6(k.co[1])], "interpolation": k.interpolation, "easing": k.easing,
"handle_left": [r6(k.handle_left[0]), r6(k.handle_left[1])],
"handle_right": [r6(k.handle_right[0]), r6(k.handle_right[1])]} for k in fc.keyframe_points]
curves.append({"data_path": fc.data_path, "array_index": fc.array_index, "extrapolation": fc.extrapolation, "keys": keys})
return {"frame_range": [r6(act.frame_range[0]), r6(act.frame_range[1])], "curves": curves}
def constraint_info(c): def constraint_info(c):
out = {} out = {}
if c.type == "ARMATURE":
out["targets"] = [{"target": t.target.name if t.target else "", "subtarget": t.subtarget, "weight": r6(t.weight)} for t in c.targets]
for prop in c.bl_rna.properties: for prop in c.bl_rna.properties:
k = prop.identifier k = prop.identifier
if k in SKIP or prop.type == "COLLECTION": if k in SKIP or prop.type == "COLLECTION":
@@ -193,7 +221,13 @@ def rig_info(ob):
for a in "xyz": for a in "xyz":
for k in ("lock_ik_", "use_ik_limit_", "ik_min_", "ik_max_", "ik_stiffness_"): for k in ("lock_ik_", "use_ik_limit_", "ik_min_", "ik_max_", "ik_stiffness_"):
pose[k + a] = rna_value(getattr(pb, k + a)) pose[k + a] = rna_value(getattr(pb, k + a))
bones.append({"name": b.name, "head_local": [r6(x) for x in b.head_local], "tail_local": [r6(x) for x in b.tail_local], for k in ("location", "rotation_quaternion", "rotation_euler", "rotation_axis_angle", "scale"):
pose[k] = rna_value(getattr(pb, k))
info = {}
for k in BONE_KEYS:
if hasattr(b, k):
info[k] = rna_value(getattr(b, k))
bones.append({"name": b.name, "head_local": [r6(x) for x in b.head_local], "tail_local": [r6(x) for x in b.tail_local], "bone": info,
"roll": r6(roll), "deform": b.use_deform, "use_connect": b.use_connect, "show_wire": b.show_wire, "roll": r6(roll), "deform": b.use_deform, "use_connect": b.use_connect, "show_wire": b.show_wire,
"collections": [c.name for c in b.collections], "color": color_info(b.color), "pose": pose}) "collections": [c.name for c in b.collections], "color": color_info(b.color), "pose": pose})
cols = [{"name": c.name, "visible": c.is_visible, "parent": c.parent.name if c.parent else ""} for c in arm.collections_all] cols = [{"name": c.name, "visible": c.is_visible, "parent": c.parent.name if c.parent else ""} for c in arm.collections_all]
@@ -226,7 +260,8 @@ def dump(path):
ref = {"version": list(bpy.data.version), "fps": sc.render.fps / sc.render.fps_base, "frameStart": sc.frame_start, ref = {"version": list(bpy.data.version), "fps": sc.render.fps / sc.render.fps_base, "frameStart": sc.frame_start,
"frameCurrent": sc.frame_current, "resolution": [sc.render.resolution_x, sc.render.resolution_y], "frameCurrent": sc.frame_current, "resolution": [sc.render.resolution_x, sc.render.resolution_y],
"objects": [], "materials": [], "images": [], "cameras": {}, "lights": {}, "armatures": {}, "actions": {}, "objects": [], "materials": [], "images": [], "cameras": {}, "lights": {}, "armatures": {}, "actions": {},
"rigs": {}, "themeBoneColors": theme_colors()} "rigs": {}, "themeBoneColors": theme_colors(),
"allActions": {a.name: action_info(a) for a in bpy.data.actions}}
for ob in obs: for ob in obs:
o = {"name": ob.name, "type": ob.type, "parent": ob.parent.name if ob.parent else "", "parent_type": ob.parent_type, o = {"name": ob.name, "type": ob.type, "parent": ob.parent.name if ob.parent else "", "parent_type": ob.parent_type,
"parent_bone": ob.parent_bone, "world": [r6(x) for x in mat(ob.matrix_world)], "parent_bone": ob.parent_bone, "world": [r6(x) for x in mat(ob.matrix_world)],
@@ -272,6 +307,9 @@ def dump(path):
for pb in ob.pose.bones: for pb in ob.pose.bones:
for c in pb.constraints: for c in pb.constraints:
c.mute = True c.mute = True
sc.frame_set(sc.frame_current)
ref["posedBones"] = {ob.name + "/" + pb.name: [r6(x) for x in mat(ob.matrix_world @ pb.matrix)]
for ob in obs if ob.type == "ARMATURE" for pb in ob.pose.bones}
poses = [] poses = []
if ref["actions"]: if ref["actions"]:
for f in FRAMES: for f in FRAMES: