model/blend: vertex and triangle parents, parent_type / parent_bone / parent_vertices / matrix_parent_inverse, widget flags, modifier stacks with Blender's type names and the armature modifier's settings
This commit is contained in:
1 parent
a9874e9f54
commit
2c2a52e4b3
11 files changed
+1003
-405
No files matched your search
+136
-11
@@ -167283,8 +167283,8 @@ __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,
|
||||||
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
||||||
-- inverse; bone parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled BSDF node or the legacy
|
-- inverse; bone, vertex and triangle parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled
|
||||||
-- colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
-- BSDF node or the legacy colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
||||||
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
||||||
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
||||||
local Blend = __include("containers/Blend")
|
local Blend = __include("containers/Blend")
|
||||||
@@ -167318,7 +167318,7 @@ type Options = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, PARVERT1, PARVERT3, PARBONE = 4, 5, 6, 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
|
||||||
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
||||||
local TYPE_NAME: { [number]: string } = {
|
local TYPE_NAME: { [number]: string } = {
|
||||||
@@ -167836,6 +167836,57 @@ local function skins(ctx: Ctx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Object.partype as the API names it (PARSKEL is "ARMATURE" under an armature, "LATTICE" under a lattice)
|
||||||
|
local PARENT_TYPE: { [number]: string } = { [0] = "OBJECT", [4] = "ARMATURE", [5] = "VERTEX", [6] = "VERTEX_3", [7] = "BONE" }
|
||||||
|
|
||||||
|
-- vertex positions of a mesh object (its own data, no modifiers or shape keys), for vertex parents; nil if unavailable
|
||||||
|
local function parentVertices(ctx: Ctx, par: Blend.View, indices: { number }): { { number } }?
|
||||||
|
if (par:num("type") or -1) ~= OB_MESH then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local me = par:deref("data", 0, "Mesh")
|
||||||
|
local ok, poly = pcall(Mesh.read, ctx.f, me :: any, { maxVertices = ctx.opts.maxVertices })
|
||||||
|
if not ok or not poly or not me then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local out = {}
|
||||||
|
for k, i in indices do
|
||||||
|
if i < 0 or i >= poly.nv then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
out[k] = { buffer.readf32(poly.pos, i * 12), buffer.readf32(poly.pos, i * 12 + 4), buffer.readf32(poly.pos, i * 12 + 8) }
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blender's tri_to_quat (math_geom.cc) as a rotation matrix: z along the triangle normal, x along v1 -> v2
|
||||||
|
local function triFrame(v1: { number }, v2: { number }, v3: { number }): M4
|
||||||
|
local function sub(a: { number }, b: { number }): { number }
|
||||||
|
return { a[1] - b[1], a[2] - b[2], a[3] - b[3] }
|
||||||
|
end
|
||||||
|
local function norm(a: { number }): { number }
|
||||||
|
local l = math.sqrt(a[1] * a[1] + a[2] * a[2] + a[3] * a[3])
|
||||||
|
return if l > 0 then { a[1] / l, a[2] / l, a[3] / l } else a
|
||||||
|
end
|
||||||
|
local e1, e2 = sub(v2, v1), sub(v3, v2) -- normal_tri_v3: (v1 - v2) x (v2 - v3)
|
||||||
|
local a, b = sub(v1, v2), sub(v2, v3)
|
||||||
|
local no = norm({ a[2] * b[3] - a[3] * b[2], a[3] * b[1] - a[1] * b[3], a[1] * b[2] - a[2] * b[1] })
|
||||||
|
local n = norm({ no[2], -no[1], 0 })
|
||||||
|
if n[1] == 0 and n[2] == 0 then
|
||||||
|
n = { 1, 0, 0 }
|
||||||
|
end
|
||||||
|
local angle = -0.5 * math.acos(math.clamp(no[3], -1, 1))
|
||||||
|
local q1 = { n[1] * math.sin(angle), n[2] * math.sin(angle), 0, math.cos(angle) } -- x, y, z, w
|
||||||
|
local m1 = Mat4.fromQuat(q1)
|
||||||
|
local inv = Mat4.inverseFull(m1) or Mat4.identity()
|
||||||
|
local vx, vy = Mat4.point(inv, e1[1], e1[2], e1[3])
|
||||||
|
local l = math.sqrt(vx * vx + vy * vy)
|
||||||
|
local angle2 = if l > 0 then 0.5 * math.atan2(vy / l, vx / l) else 0
|
||||||
|
local q2 = { 0, 0, math.sin(angle2), math.cos(angle2) }
|
||||||
|
local _ = e2
|
||||||
|
return Mat4.mul(m1, Mat4.fromQuat(q2))
|
||||||
|
end
|
||||||
|
|
||||||
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
||||||
local addr = ob.block and ob.block.addr
|
local addr = ob.block and ob.block.addr
|
||||||
if addr ~= nil and ctx.objects[addr] then
|
if addr ~= nil and ctx.objects[addr] then
|
||||||
@@ -167846,6 +167897,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
local parentOb = ob:deref("parent", 0, "Object")
|
local parentOb = ob:deref("parent", 0, "Object")
|
||||||
local parentNode: number? = under
|
local parentNode: number? = under
|
||||||
|
local vertexFallback = false
|
||||||
local prefix = Mat4.identity()
|
local prefix = Mat4.identity()
|
||||||
local partype = ob:num("partype") or 0
|
local partype = ob:num("partype") or 0
|
||||||
if parentOb then
|
if parentOb then
|
||||||
@@ -167854,6 +167906,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
parentNode = pn
|
parentNode = pn
|
||||||
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
||||||
if partype == PARBONE then
|
if partype == PARBONE then
|
||||||
|
-- the joint node is the bone's head frame (rest x pose); Blender parents to the tail
|
||||||
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
||||||
local bone = ob:str("parsubstr") or ""
|
local bone = ob:str("parsubstr") or ""
|
||||||
local j = info and info.names[bone]
|
local j = info and info.names[bone]
|
||||||
@@ -167862,6 +167915,26 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local len = info.bones[j]:num("length") or 0
|
local len = info.bones[j]:num("length") or 0
|
||||||
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
||||||
end
|
end
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
local idx = { ob:num("par1") or 0 }
|
||||||
|
if partype == PARVERT3 then
|
||||||
|
idx = { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
end
|
||||||
|
local vs = parentVertices(ctx, parentOb, idx)
|
||||||
|
if vs and partype == PARVERT3 then
|
||||||
|
local m = triFrame(vs[1], vs[2], vs[3])
|
||||||
|
m[13], m[14], m[15] = (vs[1][1] + vs[2][1] + vs[3][1]) / 3, (vs[1][2] + vs[2][2] + vs[3][2]) / 3, (vs[1][3] + vs[2][3] + vs[3][3]) / 3
|
||||||
|
prefix = Mat4.mul(m, prefix)
|
||||||
|
elseif vs then
|
||||||
|
-- the parent's rotation and scale do not apply: world = T(parent world x vertex) x parentinv x basis,
|
||||||
|
-- expressed under the parent node for its saved world matrix
|
||||||
|
local pw = worldOf(ctx, pn)
|
||||||
|
local wx, wy, wz = Mat4.point(pw, vs[1][1], vs[1][2], vs[1][3])
|
||||||
|
local inv = Mat4.inverseFull(pw) or Mat4.identity()
|
||||||
|
prefix = Mat4.mul(Mat4.mul(inv, Mat4.translation(wx, wy, wz)), prefix)
|
||||||
|
else
|
||||||
|
vertexFallback = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -167881,6 +167954,20 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local t = ob:num("type") or -1
|
local t = ob:num("type") or -1
|
||||||
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
||||||
node.extras = { blend = extras }
|
node.extras = { blend = extras }
|
||||||
|
if parentOb then
|
||||||
|
local pt = PARENT_TYPE[partype] or tostring(partype)
|
||||||
|
if partype == PARSKEL and (parentOb:num("type") or -1) == 22 then
|
||||||
|
pt = "LATTICE"
|
||||||
|
end
|
||||||
|
extras.parent_type = pt
|
||||||
|
extras.matrix_parent_inverse = mat4(ob, "parentinv")
|
||||||
|
if partype == PARBONE then
|
||||||
|
extras.parent_bone = ob:str("parsubstr")
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
extras.parent_vertices = if partype == PARVERT1 then { ob:num("par1") or 0 } else { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
extras.parent_vertices_unresolved = if vertexFallback then true else nil -- parented to the object instead
|
||||||
|
end
|
||||||
|
end
|
||||||
local lay = ob:num("lay")
|
local lay = ob:num("lay")
|
||||||
if lay and ctx.f.version < 280 then
|
if lay and ctx.f.version < 280 then
|
||||||
extras.layers = lay
|
extras.layers = lay
|
||||||
@@ -167893,14 +167980,6 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
if bit32.band(vis, 4) ~= 0 then
|
if bit32.band(vis, 4) ~= 0 then
|
||||||
extras.hide_render = true
|
extras.hide_render = true
|
||||||
end
|
end
|
||||||
local mods = {}
|
|
||||||
for _, md in ob:list("modifiers") do
|
|
||||||
table.insert(mods, { name = md:sub("modifier") and (md:sub("modifier") :: Blend.View):str("name") or md:str("name") or "", type = (string.gsub(md.struct.name, "ModifierData$", "")) })
|
|
||||||
end
|
|
||||||
if #mods > 0 then
|
|
||||||
extras.modifiers = mods
|
|
||||||
ctx.meta.modifiers[node.name or tostring(idx)] = mods
|
|
||||||
end
|
|
||||||
if t == OB_ARMATURE then
|
if t == OB_ARMATURE then
|
||||||
armature(ctx, ob, idx)
|
armature(ctx, ob, idx)
|
||||||
elseif t == OB_CAMERA then
|
elseif t == OB_CAMERA then
|
||||||
@@ -167914,6 +167993,43 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------------------------------ rigs
|
-- ------------------------------------------------------------------------------------------------ rigs
|
||||||
|
-- ModifierData.type names as the API gives them, from the struct name ("SimpleDeformModifierData" -> SIMPLE_DEFORM)
|
||||||
|
local MOD_NAME: { [string]: string } = {
|
||||||
|
LaplacianSmooth = "LAPLACIANSMOOTH", LaplacianDeform = "LAPLACIANDEFORM", WeightVGEdit = "VERTEX_WEIGHT_EDIT",
|
||||||
|
WeightVGMix = "VERTEX_WEIGHT_MIX", WeightVGProximity = "VERTEX_WEIGHT_PROXIMITY", UVProject = "UV_PROJECT",
|
||||||
|
UVWarp = "UV_WARP", MeshSeqCache = "MESH_SEQUENCE_CACHE", Softbody = "SOFT_BODY", ParticleSystem = "PARTICLE_SYSTEM",
|
||||||
|
ParticleInstance = "PARTICLE_INSTANCE", Fluidsim = "FLUID_SIMULATION", Smoke = "SMOKE", Surface = "SURFACE",
|
||||||
|
MeshToVolume = "MESH_TO_VOLUME", VolumeToMesh = "VOLUME_TO_MESH",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- the modifier stack (ModifierData.mode: eModifierMode_Realtime 1, Render 2); ARMATURE with its settings
|
||||||
|
-- (ArmatureModifierData.deformflag: ARM_DEF_VGROUP 1, ENVELOPE 2, QUATERNION 4, INVERT_VGROUP 16)
|
||||||
|
local function modifiers(ob: Blend.View, resolve: Armature.Resolve): { { [string]: any } }
|
||||||
|
local out = {}
|
||||||
|
for _, md in ob:list("modifiers") do
|
||||||
|
local head = md:sub("modifier") or md
|
||||||
|
local raw = string.gsub(md.struct.name, "ModifierData$", "")
|
||||||
|
local kind = MOD_NAME[raw] or string.upper((string.gsub(raw, "(%l)(%u)", "%1_%2")))
|
||||||
|
local mode = head:num("mode") or 3
|
||||||
|
local e: { [string]: any } = { type = kind, name = head:str("name") or "" }
|
||||||
|
e.show_viewport = bit32.band(mode, 1) ~= 0
|
||||||
|
e.show_render = bit32.band(mode, 2) ~= 0
|
||||||
|
if kind == "ARMATURE" then
|
||||||
|
local flag = md:num("deformflag") or 1
|
||||||
|
e.object = resolve(md:deref("object", 0, "Object"))
|
||||||
|
e.use_vertex_groups = bit32.band(flag, 1) ~= 0
|
||||||
|
e.use_bone_envelopes = bit32.band(flag, 2) ~= 0
|
||||||
|
e.use_deform_preserve_volume = bit32.band(flag, 4) ~= 0
|
||||||
|
e.invert_vertex_group = bit32.band(flag, 16) ~= 0
|
||||||
|
e.use_multi_modifier = (md:num("multi") or 0) ~= 0
|
||||||
|
local vg = md:str("defgrp_name")
|
||||||
|
e.vertex_group = if vg and vg ~= "" then vg else nil
|
||||||
|
end
|
||||||
|
table.insert(out, e)
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
local function rigs(ctx: Ctx)
|
local function rigs(ctx: Ctx)
|
||||||
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
||||||
for node = 1, #ctx.scene.nodes do
|
for node = 1, #ctx.scene.nodes do
|
||||||
@@ -167926,6 +168042,11 @@ local function rigs(ctx: Ctx)
|
|||||||
if #list > 0 then
|
if #list > 0 then
|
||||||
extras.constraints = list
|
extras.constraints = list
|
||||||
end
|
end
|
||||||
|
local mods = modifiers(ob, target)
|
||||||
|
if #mods > 0 then
|
||||||
|
extras.modifiers = mods
|
||||||
|
ctx.meta.modifiers[ctx.scene.nodes[node].name or tostring(node)] = mods
|
||||||
|
end
|
||||||
local id = ob:sub("id")
|
local id = ob:sub("id")
|
||||||
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
||||||
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
||||||
@@ -167982,6 +168103,10 @@ local function widgetList(ctx: Ctx): { { [string]: any } }
|
|||||||
if node then
|
if node then
|
||||||
w.node = node
|
w.node = node
|
||||||
w.mesh = ctx.scene.nodes[node].mesh
|
w.mesh = ctx.scene.nodes[node].mesh
|
||||||
|
local e = ctx.scene.nodes[node].extras :: any
|
||||||
|
if e and e.blend then
|
||||||
|
e.blend.widget = true
|
||||||
|
end
|
||||||
elseif t == OB_MESH then
|
elseif t == OB_MESH then
|
||||||
w.mesh = (meshOf(ctx, ob, true))
|
w.mesh = (meshOf(ctx, ob, true))
|
||||||
end
|
end
|
||||||
|
|||||||
+176
-176
@@ -447,180 +447,180 @@
|
|||||||
[166615, "src/Rosetta/model/blend/Normals.luau"],
|
[166615, "src/Rosetta/model/blend/Normals.luau"],
|
||||||
[166776, "src/Rosetta/model/blend/Prim.luau"],
|
[166776, "src/Rosetta/model/blend/Prim.luau"],
|
||||||
[167283, "src/Rosetta/model/blend/Read.luau"],
|
[167283, "src/Rosetta/model/blend/Read.luau"],
|
||||||
[168371, "src/Rosetta/model/bsp/init.luau"],
|
[168496, "src/Rosetta/model/bsp/init.luau"],
|
||||||
[168562, "src/Rosetta/model/bsp/Lightmap.luau"],
|
[168687, "src/Rosetta/model/bsp/Lightmap.luau"],
|
||||||
[168628, "src/Rosetta/model/bsp/Quake.luau"],
|
[168753, "src/Rosetta/model/bsp/Quake.luau"],
|
||||||
[169017, "src/Rosetta/model/bsp/Quake3.luau"],
|
[169142, "src/Rosetta/model/bsp/Quake3.luau"],
|
||||||
[169246, "src/Rosetta/model/bsp/Tree.luau"],
|
[169371, "src/Rosetta/model/bsp/Tree.luau"],
|
||||||
[169634, "src/Rosetta/model/buildmap/init.luau"],
|
[169759, "src/Rosetta/model/buildmap/init.luau"],
|
||||||
[169906, "src/Rosetta/model/buildmap/Geometry.luau"],
|
[170031, "src/Rosetta/model/buildmap/Geometry.luau"],
|
||||||
[170309, "src/Rosetta/model/d3map/init.luau"],
|
[170434, "src/Rosetta/model/d3map/init.luau"],
|
||||||
[170591, "src/Rosetta/model/d3map/Parse.luau"],
|
[170716, "src/Rosetta/model/d3map/Parse.luau"],
|
||||||
[170789, "src/Rosetta/model/dae/init.luau"],
|
[170914, "src/Rosetta/model/dae/init.luau"],
|
||||||
[170978, "src/Rosetta/model/dae/Math.luau"],
|
[171103, "src/Rosetta/model/dae/Math.luau"],
|
||||||
[171025, "src/Rosetta/model/dae/Read.luau"],
|
[171150, "src/Rosetta/model/dae/Read.luau"],
|
||||||
[172875, "src/Rosetta/model/dae/Write.luau"],
|
[173000, "src/Rosetta/model/dae/Write.luau"],
|
||||||
[173244, "src/Rosetta/model/fbx/init.luau"],
|
[173369, "src/Rosetta/model/fbx/init.luau"],
|
||||||
[173392, "src/Rosetta/model/fbx/Ascii.luau"],
|
[173517, "src/Rosetta/model/fbx/Ascii.luau"],
|
||||||
[173662, "src/Rosetta/model/fbx/Binary.luau"],
|
[173787, "src/Rosetta/model/fbx/Binary.luau"],
|
||||||
[174117, "src/Rosetta/model/fbx/Read.luau"],
|
[174242, "src/Rosetta/model/fbx/Read.luau"],
|
||||||
[175479, "src/Rosetta/model/fbx/Write.luau"],
|
[175604, "src/Rosetta/model/fbx/Write.luau"],
|
||||||
[176464, "src/Rosetta/model/fbx/Xform.luau"],
|
[176589, "src/Rosetta/model/fbx/Xform.luau"],
|
||||||
[176505, "src/Rosetta/model/gltf/init.luau"],
|
[176630, "src/Rosetta/model/gltf/init.luau"],
|
||||||
[176742, "src/Rosetta/model/gltf/Pack.luau"],
|
[176867, "src/Rosetta/model/gltf/Pack.luau"],
|
||||||
[176811, "src/Rosetta/model/gltf/Read.luau"],
|
[176936, "src/Rosetta/model/gltf/Read.luau"],
|
||||||
[177552, "src/Rosetta/model/gltf/Write.luau"],
|
[177677, "src/Rosetta/model/gltf/Write.luau"],
|
||||||
[178238, "src/Rosetta/model/godot/init.luau"],
|
[178363, "src/Rosetta/model/godot/init.luau"],
|
||||||
[178329, "src/Rosetta/model/godot/Build.luau"],
|
[178454, "src/Rosetta/model/godot/Build.luau"],
|
||||||
[178871, "src/Rosetta/model/godot/Primitives.luau"],
|
[178996, "src/Rosetta/model/godot/Primitives.luau"],
|
||||||
[179146, "src/Rosetta/model/godot/Surface.luau"],
|
[179271, "src/Rosetta/model/godot/Surface.luau"],
|
||||||
[179631, "src/Rosetta/model/godot/Write.luau"],
|
[179756, "src/Rosetta/model/godot/Write.luau"],
|
||||||
[179960, "src/Rosetta/model/iqm/init.luau"],
|
[180085, "src/Rosetta/model/iqm/init.luau"],
|
||||||
[180036, "src/Rosetta/model/iqm/Read.luau"],
|
[180161, "src/Rosetta/model/iqm/Read.luau"],
|
||||||
[180391, "src/Rosetta/model/iqm/Write.luau"],
|
[180516, "src/Rosetta/model/iqm/Write.luau"],
|
||||||
[181078, "src/Rosetta/model/ldraw/init.luau"],
|
[181203, "src/Rosetta/model/ldraw/init.luau"],
|
||||||
[181156, "src/Rosetta/model/ldraw/Colors.luau"],
|
[181281, "src/Rosetta/model/ldraw/Colors.luau"],
|
||||||
[181474, "src/Rosetta/model/ldraw/Read.luau"],
|
[181599, "src/Rosetta/model/ldraw/Read.luau"],
|
||||||
[182051, "src/Rosetta/model/lwo/init.luau"],
|
[182176, "src/Rosetta/model/lwo/init.luau"],
|
||||||
[182127, "src/Rosetta/model/lwo/Build.luau"],
|
[182252, "src/Rosetta/model/lwo/Build.luau"],
|
||||||
[182589, "src/Rosetta/model/lwo/Parse.luau"],
|
[182714, "src/Rosetta/model/lwo/Parse.luau"],
|
||||||
[183132, "src/Rosetta/model/map/init.luau"],
|
[183257, "src/Rosetta/model/map/init.luau"],
|
||||||
[183449, "src/Rosetta/model/map/Build.luau"],
|
[183574, "src/Rosetta/model/map/Build.luau"],
|
||||||
[183693, "src/Rosetta/model/map/Parse.luau"],
|
[183818, "src/Rosetta/model/map/Parse.luau"],
|
||||||
[184078, "src/Rosetta/model/map/Write.luau"],
|
[184203, "src/Rosetta/model/map/Write.luau"],
|
||||||
[184224, "src/Rosetta/model/mca/init.luau"],
|
[184349, "src/Rosetta/model/mca/init.luau"],
|
||||||
[184566, "src/Rosetta/model/mca/Chunk.luau"],
|
[184691, "src/Rosetta/model/mca/Chunk.luau"],
|
||||||
[184699, "src/Rosetta/model/mca/Lz4Block.luau"],
|
[184824, "src/Rosetta/model/mca/Lz4Block.luau"],
|
||||||
[184769, "src/Rosetta/model/md2/init.luau"],
|
[184894, "src/Rosetta/model/md2/init.luau"],
|
||||||
[184968, "src/Rosetta/model/md3/init.luau"],
|
[185093, "src/Rosetta/model/md3/init.luau"],
|
||||||
[185196, "src/Rosetta/model/md5/init.luau"],
|
[185321, "src/Rosetta/model/md5/init.luau"],
|
||||||
[185277, "src/Rosetta/model/md5/Read.luau"],
|
[185402, "src/Rosetta/model/md5/Read.luau"],
|
||||||
[185710, "src/Rosetta/model/mdl/init.luau"],
|
[185835, "src/Rosetta/model/mdl/init.luau"],
|
||||||
[185792, "src/Rosetta/model/mdl/HalfLife.luau"],
|
[185917, "src/Rosetta/model/mdl/HalfLife.luau"],
|
||||||
[186096, "src/Rosetta/model/mdl/Quake.luau"],
|
[186221, "src/Rosetta/model/mdl/Quake.luau"],
|
||||||
[186314, "src/Rosetta/model/ms3d/init.luau"],
|
[186439, "src/Rosetta/model/ms3d/init.luau"],
|
||||||
[186386, "src/Rosetta/model/ms3d/Read.luau"],
|
[186511, "src/Rosetta/model/ms3d/Read.luau"],
|
||||||
[186832, "src/Rosetta/model/ms3d/Write.luau"],
|
[186957, "src/Rosetta/model/ms3d/Write.luau"],
|
||||||
[187301, "src/Rosetta/model/obj/init.luau"],
|
[187426, "src/Rosetta/model/obj/init.luau"],
|
||||||
[188119, "src/Rosetta/model/obj/Mtl.luau"],
|
[188244, "src/Rosetta/model/obj/Mtl.luau"],
|
||||||
[188407, "src/Rosetta/model/off/init.luau"],
|
[188532, "src/Rosetta/model/off/init.luau"],
|
||||||
[188869, "src/Rosetta/model/ply/init.luau"],
|
[188994, "src/Rosetta/model/ply/init.luau"],
|
||||||
[189974, "src/Rosetta/model/ply/Binary.luau"],
|
[190099, "src/Rosetta/model/ply/Binary.luau"],
|
||||||
[190175, "src/Rosetta/model/pmx/init.luau"],
|
[190300, "src/Rosetta/model/pmx/init.luau"],
|
||||||
[190244, "src/Rosetta/model/pmx/Build.luau"],
|
[190369, "src/Rosetta/model/pmx/Build.luau"],
|
||||||
[190540, "src/Rosetta/model/pmx/Pmd.luau"],
|
[190665, "src/Rosetta/model/pmx/Pmd.luau"],
|
||||||
[190875, "src/Rosetta/model/pmx/Read.luau"],
|
[191000, "src/Rosetta/model/pmx/Read.luau"],
|
||||||
[191279, "src/Rosetta/model/proc/init.luau"],
|
[191404, "src/Rosetta/model/proc/init.luau"],
|
||||||
[191661, "src/Rosetta/model/qb/init.luau"],
|
[191786, "src/Rosetta/model/qb/init.luau"],
|
||||||
[192054, "src/Rosetta/model/rbxm/init.luau"],
|
[192179, "src/Rosetta/model/rbxm/init.luau"],
|
||||||
[192647, "src/Rosetta/model/rbxmx/init.luau"],
|
[192772, "src/Rosetta/model/rbxmx/init.luau"],
|
||||||
[193323, "src/Rosetta/model/robloxmesh/init.luau"],
|
[193448, "src/Rosetta/model/robloxmesh/init.luau"],
|
||||||
[193982, "src/Rosetta/model/robloxmesh/Parse.luau"],
|
[194107, "src/Rosetta/model/robloxmesh/Parse.luau"],
|
||||||
[194439, "src/Rosetta/model/robloxmesh/Write.luau"],
|
[194564, "src/Rosetta/model/robloxmesh/Write.luau"],
|
||||||
[194548, "src/Rosetta/model/schematic/init.luau"],
|
[194673, "src/Rosetta/model/schematic/init.luau"],
|
||||||
[194869, "src/Rosetta/model/schematic/Common.luau"],
|
[194994, "src/Rosetta/model/schematic/Common.luau"],
|
||||||
[194989, "src/Rosetta/model/schematic/Litematic.luau"],
|
[195114, "src/Rosetta/model/schematic/Litematic.luau"],
|
||||||
[195200, "src/Rosetta/model/schematic/Mcedit.luau"],
|
[195325, "src/Rosetta/model/schematic/Mcedit.luau"],
|
||||||
[195444, "src/Rosetta/model/schematic/Sponge.luau"],
|
[195569, "src/Rosetta/model/schematic/Sponge.luau"],
|
||||||
[195573, "src/Rosetta/model/smd/init.luau"],
|
[195698, "src/Rosetta/model/smd/init.luau"],
|
||||||
[195640, "src/Rosetta/model/smd/Read.luau"],
|
[195765, "src/Rosetta/model/smd/Read.luau"],
|
||||||
[195909, "src/Rosetta/model/smd/Write.luau"],
|
[196034, "src/Rosetta/model/smd/Write.luau"],
|
||||||
[196152, "src/Rosetta/model/sourcemdl/init.luau"],
|
[196277, "src/Rosetta/model/sourcemdl/init.luau"],
|
||||||
[196323, "src/Rosetta/model/sourcemdl/Build.luau"],
|
[196448, "src/Rosetta/model/sourcemdl/Build.luau"],
|
||||||
[196753, "src/Rosetta/model/sourcemdl/Material.luau"],
|
[196878, "src/Rosetta/model/sourcemdl/Material.luau"],
|
||||||
[196914, "src/Rosetta/model/sourcemdl/Mdl.luau"],
|
[197039, "src/Rosetta/model/sourcemdl/Mdl.luau"],
|
||||||
[197441, "src/Rosetta/model/sourcemdl/Phy.luau"],
|
[197566, "src/Rosetta/model/sourcemdl/Phy.luau"],
|
||||||
[197564, "src/Rosetta/model/sourcemdl/Vtx.luau"],
|
[197689, "src/Rosetta/model/sourcemdl/Vtx.luau"],
|
||||||
[197746, "src/Rosetta/model/sourcemdl/Vvd.luau"],
|
[197871, "src/Rosetta/model/sourcemdl/Vvd.luau"],
|
||||||
[197840, "src/Rosetta/model/stl/init.luau"],
|
[197965, "src/Rosetta/model/stl/init.luau"],
|
||||||
[198290, "src/Rosetta/model/stl/Decode.luau"],
|
[198415, "src/Rosetta/model/stl/Decode.luau"],
|
||||||
[198364, "src/Rosetta/model/t3d/init.luau"],
|
[198489, "src/Rosetta/model/t3d/init.luau"],
|
||||||
[198458, "src/Rosetta/model/t3d/Build.luau"],
|
[198583, "src/Rosetta/model/t3d/Build.luau"],
|
||||||
[198863, "src/Rosetta/model/t3d/Parse.luau"],
|
[198988, "src/Rosetta/model/t3d/Parse.luau"],
|
||||||
[199031, "src/Rosetta/model/udmf/init.luau"],
|
[199156, "src/Rosetta/model/udmf/init.luau"],
|
||||||
[199114, "src/Rosetta/model/usda/init.luau"],
|
[199239, "src/Rosetta/model/usda/init.luau"],
|
||||||
[199323, "src/Rosetta/model/usda/Build.luau"],
|
[199448, "src/Rosetta/model/usda/Build.luau"],
|
||||||
[200601, "src/Rosetta/model/usda/Parse.luau"],
|
[200726, "src/Rosetta/model/usda/Parse.luau"],
|
||||||
[201399, "src/Rosetta/model/usda/Write.luau"],
|
[201524, "src/Rosetta/model/usda/Write.luau"],
|
||||||
[202216, "src/Rosetta/model/vbsp/init.luau"],
|
[202341, "src/Rosetta/model/vbsp/init.luau"],
|
||||||
[202662, "src/Rosetta/model/vbsp/Faces.luau"],
|
[202787, "src/Rosetta/model/vbsp/Faces.luau"],
|
||||||
[202886, "src/Rosetta/model/vbsp/Props.luau"],
|
[203011, "src/Rosetta/model/vbsp/Props.luau"],
|
||||||
[202978, "src/Rosetta/model/vmf/init.luau"],
|
[203103, "src/Rosetta/model/vmf/init.luau"],
|
||||||
[203303, "src/Rosetta/model/vmf/Build.luau"],
|
[203428, "src/Rosetta/model/vmf/Build.luau"],
|
||||||
[203727, "src/Rosetta/model/vox/init.luau"],
|
[203852, "src/Rosetta/model/vox/init.luau"],
|
||||||
[204613, "src/Rosetta/model/vox/Grid.luau"],
|
[204738, "src/Rosetta/model/vox/Grid.luau"],
|
||||||
[204670, "src/Rosetta/model/vrml/init.luau"],
|
[204795, "src/Rosetta/model/vrml/init.luau"],
|
||||||
[204736, "src/Rosetta/model/x/init.luau"],
|
[204861, "src/Rosetta/model/x/init.luau"],
|
||||||
[204866, "src/Rosetta/model/x/Build.luau"],
|
[204991, "src/Rosetta/model/x/Build.luau"],
|
||||||
[205429, "src/Rosetta/model/x/Parse.luau"],
|
[205554, "src/Rosetta/model/x/Parse.luau"],
|
||||||
[205726, "src/Rosetta/model/x3d/init.luau"],
|
[205851, "src/Rosetta/model/x3d/init.luau"],
|
||||||
[205804, "src/Rosetta/music/669/init.luau"],
|
[205929, "src/Rosetta/music/669/init.luau"],
|
||||||
[206011, "src/Rosetta/music/ahx/init.luau"],
|
[206136, "src/Rosetta/music/ahx/init.luau"],
|
||||||
[206063, "src/Rosetta/music/far/init.luau"],
|
[206188, "src/Rosetta/music/far/init.luau"],
|
||||||
[206293, "src/Rosetta/music/hmp/init.luau"],
|
[206418, "src/Rosetta/music/hmp/init.luau"],
|
||||||
[206558, "src/Rosetta/music/hvl/init.luau"],
|
[206683, "src/Rosetta/music/hvl/init.luau"],
|
||||||
[206610, "src/Rosetta/music/it/init.luau"],
|
[206735, "src/Rosetta/music/it/init.luau"],
|
||||||
[207029, "src/Rosetta/music/it/Itsex.luau"],
|
[207154, "src/Rosetta/music/it/Itsex.luau"],
|
||||||
[207146, "src/Rosetta/music/med/init.luau"],
|
[207271, "src/Rosetta/music/med/init.luau"],
|
||||||
[207794, "src/Rosetta/music/midi/init.luau"],
|
[207919, "src/Rosetta/music/midi/init.luau"],
|
||||||
[207938, "src/Rosetta/music/midi/Smf.luau"],
|
[208063, "src/Rosetta/music/midi/Smf.luau"],
|
||||||
[208350, "src/Rosetta/music/mod/init.luau"],
|
[208475, "src/Rosetta/music/mod/init.luau"],
|
||||||
[208704, "src/Rosetta/music/mtm/init.luau"],
|
[208829, "src/Rosetta/music/mtm/init.luau"],
|
||||||
[208927, "src/Rosetta/music/mus/init.luau"],
|
[209052, "src/Rosetta/music/mus/init.luau"],
|
||||||
[209085, "src/Rosetta/music/okt/init.luau"],
|
[209210, "src/Rosetta/music/okt/init.luau"],
|
||||||
[209367, "src/Rosetta/music/ptm/init.luau"],
|
[209492, "src/Rosetta/music/ptm/init.luau"],
|
||||||
[209590, "src/Rosetta/music/s3m/init.luau"],
|
[209715, "src/Rosetta/music/s3m/init.luau"],
|
||||||
[209827, "src/Rosetta/music/sf2/init.luau"],
|
[209952, "src/Rosetta/music/sf2/init.luau"],
|
||||||
[209871, "src/Rosetta/music/stm/init.luau"],
|
[209996, "src/Rosetta/music/stm/init.luau"],
|
||||||
[210103, "src/Rosetta/music/ult/init.luau"],
|
[210228, "src/Rosetta/music/ult/init.luau"],
|
||||||
[210408, "src/Rosetta/music/umx/init.luau"],
|
[210533, "src/Rosetta/music/umx/init.luau"],
|
||||||
[210625, "src/Rosetta/music/xm/init.luau"],
|
[210750, "src/Rosetta/music/xm/init.luau"],
|
||||||
[211187, "src/Rosetta/music/xmi/init.luau"],
|
[211312, "src/Rosetta/music/xmi/init.luau"],
|
||||||
[211396, "src/Rosetta/ops/AudioOps.luau"],
|
[211521, "src/Rosetta/ops/AudioOps.luau"],
|
||||||
[211875, "src/Rosetta/ops/ImageOps/init.luau"],
|
[212000, "src/Rosetta/ops/ImageOps/init.luau"],
|
||||||
[212523, "src/Rosetta/ops/ImageOps/Kernels.luau"],
|
[212648, "src/Rosetta/ops/ImageOps/Kernels.luau"],
|
||||||
[213163, "src/Rosetta/ops/LayerOps.luau"],
|
[213288, "src/Rosetta/ops/LayerOps.luau"],
|
||||||
[213256, "src/Rosetta/ops/MeshOps/init.luau"],
|
[213381, "src/Rosetta/ops/MeshOps/init.luau"],
|
||||||
[214396, "src/Rosetta/ops/MeshOps/Greedy.luau"],
|
[214521, "src/Rosetta/ops/MeshOps/Greedy.luau"],
|
||||||
[214563, "src/Rosetta/ops/MusicOps.luau"],
|
[214688, "src/Rosetta/ops/MusicOps.luau"],
|
||||||
[214912, "src/Rosetta/playlist/m3u/init.luau"],
|
[215037, "src/Rosetta/playlist/m3u/init.luau"],
|
||||||
[215265, "src/Rosetta/playlist/pls/init.luau"],
|
[215390, "src/Rosetta/playlist/pls/init.luau"],
|
||||||
[215443, "src/Rosetta/playlist/xspf/init.luau"],
|
[215568, "src/Rosetta/playlist/xspf/init.luau"],
|
||||||
[215646, "src/Rosetta/subtitle/ass/init.luau"],
|
[215771, "src/Rosetta/subtitle/ass/init.luau"],
|
||||||
[216090, "src/Rosetta/subtitle/srt/init.luau"],
|
[216215, "src/Rosetta/subtitle/srt/init.luau"],
|
||||||
[216263, "src/Rosetta/subtitle/vtt/init.luau"],
|
[216388, "src/Rosetta/subtitle/vtt/init.luau"],
|
||||||
[216466, "src/Rosetta/vector/gamemaps/init.luau"],
|
[216591, "src/Rosetta/vector/gamemaps/init.luau"],
|
||||||
[216653, "src/Rosetta/vector/gamemaps/Expand.luau"],
|
[216778, "src/Rosetta/vector/gamemaps/Expand.luau"],
|
||||||
[216750, "src/Rosetta/vector/ldtk/init.luau"],
|
[216875, "src/Rosetta/vector/ldtk/init.luau"],
|
||||||
[216842, "src/Rosetta/vector/ldtk/Read.luau"],
|
[216967, "src/Rosetta/vector/ldtk/Read.luau"],
|
||||||
[217178, "src/Rosetta/vector/ldtk/Write.luau"],
|
[217303, "src/Rosetta/vector/ldtk/Write.luau"],
|
||||||
[217826, "src/Rosetta/vector/ogmo/init.luau"],
|
[217951, "src/Rosetta/vector/ogmo/init.luau"],
|
||||||
[217945, "src/Rosetta/vector/ogmo/Read.luau"],
|
[218070, "src/Rosetta/vector/ogmo/Read.luau"],
|
||||||
[218350, "src/Rosetta/vector/ogmo/Write.luau"],
|
[218475, "src/Rosetta/vector/ogmo/Write.luau"],
|
||||||
[218704, "src/Rosetta/vector/svg/init.luau"],
|
[218829, "src/Rosetta/vector/svg/init.luau"],
|
||||||
[218790, "src/Rosetta/vector/svg/Parse.luau"],
|
[218915, "src/Rosetta/vector/svg/Parse.luau"],
|
||||||
[219536, "src/Rosetta/vector/svg/PathData.luau"],
|
[219661, "src/Rosetta/vector/svg/PathData.luau"],
|
||||||
[219904, "src/Rosetta/vector/svg/Render.luau"],
|
[220029, "src/Rosetta/vector/svg/Render.luau"],
|
||||||
[220321, "src/Rosetta/vector/svg/Style.luau"],
|
[220446, "src/Rosetta/vector/svg/Style.luau"],
|
||||||
[220693, "src/Rosetta/vector/svg/Write.luau"],
|
[220818, "src/Rosetta/vector/svg/Write.luau"],
|
||||||
[220893, "src/Rosetta/vector/tiled/init.luau"],
|
[221018, "src/Rosetta/vector/tiled/init.luau"],
|
||||||
[221073, "src/Rosetta/vector/tiled/Data.luau"],
|
[221198, "src/Rosetta/vector/tiled/Data.luau"],
|
||||||
[221224, "src/Rosetta/vector/tiled/Tmj.luau"],
|
[221349, "src/Rosetta/vector/tiled/Tmj.luau"],
|
||||||
[221855, "src/Rosetta/vector/tiled/Tmx.luau"],
|
[221980, "src/Rosetta/vector/tiled/Tmx.luau"],
|
||||||
[222467, "src/Rosetta/video/avi/init.luau"],
|
[222592, "src/Rosetta/video/avi/init.luau"],
|
||||||
[222761, "src/Rosetta/video/fli/init.luau"],
|
[222886, "src/Rosetta/video/fli/init.luau"],
|
||||||
[222912, "src/Rosetta/video/flv/init.luau"],
|
[223037, "src/Rosetta/video/flv/init.luau"],
|
||||||
[223296, "src/Rosetta/video/flv/Amf.luau"],
|
[223421, "src/Rosetta/video/flv/Amf.luau"],
|
||||||
[223454, "src/Rosetta/video/flv/Mux.luau"],
|
[223579, "src/Rosetta/video/flv/Mux.luau"],
|
||||||
[223735, "src/Rosetta/video/h264/init.luau"],
|
[223860, "src/Rosetta/video/h264/init.luau"],
|
||||||
[223874, "src/Rosetta/video/mkv/init.luau"],
|
[223999, "src/Rosetta/video/mkv/init.luau"],
|
||||||
[224030, "src/Rosetta/video/mkv/Mux.luau"],
|
[224155, "src/Rosetta/video/mkv/Mux.luau"],
|
||||||
[224309, "src/Rosetta/video/mkv/Parse.luau"],
|
[224434, "src/Rosetta/video/mkv/Parse.luau"],
|
||||||
[225030, "src/Rosetta/video/mp4/init.luau"],
|
[225155, "src/Rosetta/video/mp4/init.luau"],
|
||||||
[225358, "src/Rosetta/video/mpegps/init.luau"],
|
[225483, "src/Rosetta/video/mpegps/init.luau"],
|
||||||
[225545, "src/Rosetta/video/mpegts/init.luau"],
|
[225670, "src/Rosetta/video/mpegts/init.luau"],
|
||||||
[225791, "src/Rosetta/video/ogv/init.luau"],
|
[225916, "src/Rosetta/video/ogv/init.luau"],
|
||||||
[226186, "src/Rosetta/video/smk/init.luau"],
|
[226311, "src/Rosetta/video/smk/init.luau"],
|
||||||
[226495, "src/Rosetta/video/smk/Audio.luau"],
|
[226620, "src/Rosetta/video/smk/Audio.luau"],
|
||||||
[226615, "src/Rosetta/video/y4m/init.luau"]
|
[226740, "src/Rosetta/video/y4m/init.luau"]
|
||||||
]
|
]
|
||||||
Binary file not shown.
+136
-11
@@ -171017,8 +171017,8 @@ __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,
|
||||||
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
||||||
-- inverse; bone parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled BSDF node or the legacy
|
-- inverse; bone, vertex and triangle parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled
|
||||||
-- colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
-- BSDF node or the legacy colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
||||||
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
||||||
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
||||||
local Blend = __include("containers/Blend")
|
local Blend = __include("containers/Blend")
|
||||||
@@ -171052,7 +171052,7 @@ type Options = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, PARVERT1, PARVERT3, PARBONE = 4, 5, 6, 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
|
||||||
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
||||||
local TYPE_NAME: { [number]: string } = {
|
local TYPE_NAME: { [number]: string } = {
|
||||||
@@ -171570,6 +171570,57 @@ local function skins(ctx: Ctx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Object.partype as the API names it (PARSKEL is "ARMATURE" under an armature, "LATTICE" under a lattice)
|
||||||
|
local PARENT_TYPE: { [number]: string } = { [0] = "OBJECT", [4] = "ARMATURE", [5] = "VERTEX", [6] = "VERTEX_3", [7] = "BONE" }
|
||||||
|
|
||||||
|
-- vertex positions of a mesh object (its own data, no modifiers or shape keys), for vertex parents; nil if unavailable
|
||||||
|
local function parentVertices(ctx: Ctx, par: Blend.View, indices: { number }): { { number } }?
|
||||||
|
if (par:num("type") or -1) ~= OB_MESH then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local me = par:deref("data", 0, "Mesh")
|
||||||
|
local ok, poly = pcall(Mesh.read, ctx.f, me :: any, { maxVertices = ctx.opts.maxVertices })
|
||||||
|
if not ok or not poly or not me then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local out = {}
|
||||||
|
for k, i in indices do
|
||||||
|
if i < 0 or i >= poly.nv then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
out[k] = { buffer.readf32(poly.pos, i * 12), buffer.readf32(poly.pos, i * 12 + 4), buffer.readf32(poly.pos, i * 12 + 8) }
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blender's tri_to_quat (math_geom.cc) as a rotation matrix: z along the triangle normal, x along v1 -> v2
|
||||||
|
local function triFrame(v1: { number }, v2: { number }, v3: { number }): M4
|
||||||
|
local function sub(a: { number }, b: { number }): { number }
|
||||||
|
return { a[1] - b[1], a[2] - b[2], a[3] - b[3] }
|
||||||
|
end
|
||||||
|
local function norm(a: { number }): { number }
|
||||||
|
local l = math.sqrt(a[1] * a[1] + a[2] * a[2] + a[3] * a[3])
|
||||||
|
return if l > 0 then { a[1] / l, a[2] / l, a[3] / l } else a
|
||||||
|
end
|
||||||
|
local e1, e2 = sub(v2, v1), sub(v3, v2) -- normal_tri_v3: (v1 - v2) x (v2 - v3)
|
||||||
|
local a, b = sub(v1, v2), sub(v2, v3)
|
||||||
|
local no = norm({ a[2] * b[3] - a[3] * b[2], a[3] * b[1] - a[1] * b[3], a[1] * b[2] - a[2] * b[1] })
|
||||||
|
local n = norm({ no[2], -no[1], 0 })
|
||||||
|
if n[1] == 0 and n[2] == 0 then
|
||||||
|
n = { 1, 0, 0 }
|
||||||
|
end
|
||||||
|
local angle = -0.5 * math.acos(math.clamp(no[3], -1, 1))
|
||||||
|
local q1 = { n[1] * math.sin(angle), n[2] * math.sin(angle), 0, math.cos(angle) } -- x, y, z, w
|
||||||
|
local m1 = Mat4.fromQuat(q1)
|
||||||
|
local inv = Mat4.inverseFull(m1) or Mat4.identity()
|
||||||
|
local vx, vy = Mat4.point(inv, e1[1], e1[2], e1[3])
|
||||||
|
local l = math.sqrt(vx * vx + vy * vy)
|
||||||
|
local angle2 = if l > 0 then 0.5 * math.atan2(vy / l, vx / l) else 0
|
||||||
|
local q2 = { 0, 0, math.sin(angle2), math.cos(angle2) }
|
||||||
|
local _ = e2
|
||||||
|
return Mat4.mul(m1, Mat4.fromQuat(q2))
|
||||||
|
end
|
||||||
|
|
||||||
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
||||||
local addr = ob.block and ob.block.addr
|
local addr = ob.block and ob.block.addr
|
||||||
if addr ~= nil and ctx.objects[addr] then
|
if addr ~= nil and ctx.objects[addr] then
|
||||||
@@ -171580,6 +171631,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
local parentOb = ob:deref("parent", 0, "Object")
|
local parentOb = ob:deref("parent", 0, "Object")
|
||||||
local parentNode: number? = under
|
local parentNode: number? = under
|
||||||
|
local vertexFallback = false
|
||||||
local prefix = Mat4.identity()
|
local prefix = Mat4.identity()
|
||||||
local partype = ob:num("partype") or 0
|
local partype = ob:num("partype") or 0
|
||||||
if parentOb then
|
if parentOb then
|
||||||
@@ -171588,6 +171640,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
parentNode = pn
|
parentNode = pn
|
||||||
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
||||||
if partype == PARBONE then
|
if partype == PARBONE then
|
||||||
|
-- the joint node is the bone's head frame (rest x pose); Blender parents to the tail
|
||||||
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
||||||
local bone = ob:str("parsubstr") or ""
|
local bone = ob:str("parsubstr") or ""
|
||||||
local j = info and info.names[bone]
|
local j = info and info.names[bone]
|
||||||
@@ -171596,6 +171649,26 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local len = info.bones[j]:num("length") or 0
|
local len = info.bones[j]:num("length") or 0
|
||||||
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
||||||
end
|
end
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
local idx = { ob:num("par1") or 0 }
|
||||||
|
if partype == PARVERT3 then
|
||||||
|
idx = { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
end
|
||||||
|
local vs = parentVertices(ctx, parentOb, idx)
|
||||||
|
if vs and partype == PARVERT3 then
|
||||||
|
local m = triFrame(vs[1], vs[2], vs[3])
|
||||||
|
m[13], m[14], m[15] = (vs[1][1] + vs[2][1] + vs[3][1]) / 3, (vs[1][2] + vs[2][2] + vs[3][2]) / 3, (vs[1][3] + vs[2][3] + vs[3][3]) / 3
|
||||||
|
prefix = Mat4.mul(m, prefix)
|
||||||
|
elseif vs then
|
||||||
|
-- the parent's rotation and scale do not apply: world = T(parent world x vertex) x parentinv x basis,
|
||||||
|
-- expressed under the parent node for its saved world matrix
|
||||||
|
local pw = worldOf(ctx, pn)
|
||||||
|
local wx, wy, wz = Mat4.point(pw, vs[1][1], vs[1][2], vs[1][3])
|
||||||
|
local inv = Mat4.inverseFull(pw) or Mat4.identity()
|
||||||
|
prefix = Mat4.mul(Mat4.mul(inv, Mat4.translation(wx, wy, wz)), prefix)
|
||||||
|
else
|
||||||
|
vertexFallback = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -171615,6 +171688,20 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local t = ob:num("type") or -1
|
local t = ob:num("type") or -1
|
||||||
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
||||||
node.extras = { blend = extras }
|
node.extras = { blend = extras }
|
||||||
|
if parentOb then
|
||||||
|
local pt = PARENT_TYPE[partype] or tostring(partype)
|
||||||
|
if partype == PARSKEL and (parentOb:num("type") or -1) == 22 then
|
||||||
|
pt = "LATTICE"
|
||||||
|
end
|
||||||
|
extras.parent_type = pt
|
||||||
|
extras.matrix_parent_inverse = mat4(ob, "parentinv")
|
||||||
|
if partype == PARBONE then
|
||||||
|
extras.parent_bone = ob:str("parsubstr")
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
extras.parent_vertices = if partype == PARVERT1 then { ob:num("par1") or 0 } else { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
extras.parent_vertices_unresolved = if vertexFallback then true else nil -- parented to the object instead
|
||||||
|
end
|
||||||
|
end
|
||||||
local lay = ob:num("lay")
|
local lay = ob:num("lay")
|
||||||
if lay and ctx.f.version < 280 then
|
if lay and ctx.f.version < 280 then
|
||||||
extras.layers = lay
|
extras.layers = lay
|
||||||
@@ -171627,14 +171714,6 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
if bit32.band(vis, 4) ~= 0 then
|
if bit32.band(vis, 4) ~= 0 then
|
||||||
extras.hide_render = true
|
extras.hide_render = true
|
||||||
end
|
end
|
||||||
local mods = {}
|
|
||||||
for _, md in ob:list("modifiers") do
|
|
||||||
table.insert(mods, { name = md:sub("modifier") and (md:sub("modifier") :: Blend.View):str("name") or md:str("name") or "", type = (string.gsub(md.struct.name, "ModifierData$", "")) })
|
|
||||||
end
|
|
||||||
if #mods > 0 then
|
|
||||||
extras.modifiers = mods
|
|
||||||
ctx.meta.modifiers[node.name or tostring(idx)] = mods
|
|
||||||
end
|
|
||||||
if t == OB_ARMATURE then
|
if t == OB_ARMATURE then
|
||||||
armature(ctx, ob, idx)
|
armature(ctx, ob, idx)
|
||||||
elseif t == OB_CAMERA then
|
elseif t == OB_CAMERA then
|
||||||
@@ -171648,6 +171727,43 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------------------------------ rigs
|
-- ------------------------------------------------------------------------------------------------ rigs
|
||||||
|
-- ModifierData.type names as the API gives them, from the struct name ("SimpleDeformModifierData" -> SIMPLE_DEFORM)
|
||||||
|
local MOD_NAME: { [string]: string } = {
|
||||||
|
LaplacianSmooth = "LAPLACIANSMOOTH", LaplacianDeform = "LAPLACIANDEFORM", WeightVGEdit = "VERTEX_WEIGHT_EDIT",
|
||||||
|
WeightVGMix = "VERTEX_WEIGHT_MIX", WeightVGProximity = "VERTEX_WEIGHT_PROXIMITY", UVProject = "UV_PROJECT",
|
||||||
|
UVWarp = "UV_WARP", MeshSeqCache = "MESH_SEQUENCE_CACHE", Softbody = "SOFT_BODY", ParticleSystem = "PARTICLE_SYSTEM",
|
||||||
|
ParticleInstance = "PARTICLE_INSTANCE", Fluidsim = "FLUID_SIMULATION", Smoke = "SMOKE", Surface = "SURFACE",
|
||||||
|
MeshToVolume = "MESH_TO_VOLUME", VolumeToMesh = "VOLUME_TO_MESH",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- the modifier stack (ModifierData.mode: eModifierMode_Realtime 1, Render 2); ARMATURE with its settings
|
||||||
|
-- (ArmatureModifierData.deformflag: ARM_DEF_VGROUP 1, ENVELOPE 2, QUATERNION 4, INVERT_VGROUP 16)
|
||||||
|
local function modifiers(ob: Blend.View, resolve: Armature.Resolve): { { [string]: any } }
|
||||||
|
local out = {}
|
||||||
|
for _, md in ob:list("modifiers") do
|
||||||
|
local head = md:sub("modifier") or md
|
||||||
|
local raw = string.gsub(md.struct.name, "ModifierData$", "")
|
||||||
|
local kind = MOD_NAME[raw] or string.upper((string.gsub(raw, "(%l)(%u)", "%1_%2")))
|
||||||
|
local mode = head:num("mode") or 3
|
||||||
|
local e: { [string]: any } = { type = kind, name = head:str("name") or "" }
|
||||||
|
e.show_viewport = bit32.band(mode, 1) ~= 0
|
||||||
|
e.show_render = bit32.band(mode, 2) ~= 0
|
||||||
|
if kind == "ARMATURE" then
|
||||||
|
local flag = md:num("deformflag") or 1
|
||||||
|
e.object = resolve(md:deref("object", 0, "Object"))
|
||||||
|
e.use_vertex_groups = bit32.band(flag, 1) ~= 0
|
||||||
|
e.use_bone_envelopes = bit32.band(flag, 2) ~= 0
|
||||||
|
e.use_deform_preserve_volume = bit32.band(flag, 4) ~= 0
|
||||||
|
e.invert_vertex_group = bit32.band(flag, 16) ~= 0
|
||||||
|
e.use_multi_modifier = (md:num("multi") or 0) ~= 0
|
||||||
|
local vg = md:str("defgrp_name")
|
||||||
|
e.vertex_group = if vg and vg ~= "" then vg else nil
|
||||||
|
end
|
||||||
|
table.insert(out, e)
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
local function rigs(ctx: Ctx)
|
local function rigs(ctx: Ctx)
|
||||||
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
||||||
for node = 1, #ctx.scene.nodes do
|
for node = 1, #ctx.scene.nodes do
|
||||||
@@ -171660,6 +171776,11 @@ local function rigs(ctx: Ctx)
|
|||||||
if #list > 0 then
|
if #list > 0 then
|
||||||
extras.constraints = list
|
extras.constraints = list
|
||||||
end
|
end
|
||||||
|
local mods = modifiers(ob, target)
|
||||||
|
if #mods > 0 then
|
||||||
|
extras.modifiers = mods
|
||||||
|
ctx.meta.modifiers[ctx.scene.nodes[node].name or tostring(node)] = mods
|
||||||
|
end
|
||||||
local id = ob:sub("id")
|
local id = ob:sub("id")
|
||||||
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
||||||
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
||||||
@@ -171716,6 +171837,10 @@ local function widgetList(ctx: Ctx): { { [string]: any } }
|
|||||||
if node then
|
if node then
|
||||||
w.node = node
|
w.node = node
|
||||||
w.mesh = ctx.scene.nodes[node].mesh
|
w.mesh = ctx.scene.nodes[node].mesh
|
||||||
|
local e = ctx.scene.nodes[node].extras :: any
|
||||||
|
if e and e.blend then
|
||||||
|
e.blend.widget = true
|
||||||
|
end
|
||||||
elseif t == OB_MESH then
|
elseif t == OB_MESH then
|
||||||
w.mesh = (meshOf(ctx, ob, true))
|
w.mesh = (meshOf(ctx, ob, true))
|
||||||
end
|
end
|
||||||
|
|||||||
+139
-14
@@ -167925,8 +167925,8 @@ __FILES["model/blend/Read"] = function()
|
|||||||
local __compat = __compat local buffer, bit32, type, __iter = __compat.buffer, __compat.bit32, __compat.type, __compat.__iter --!strict
|
local __compat = __compat local buffer, bit32, type, __iter = __compat.buffer, __compat.bit32, __compat.type, __compat.__iter --!strict
|
||||||
-- 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,
|
||||||
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
||||||
-- inverse; bone parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled BSDF node or the legacy
|
-- inverse; bone, vertex and triangle parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled
|
||||||
-- colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
-- BSDF node or the legacy colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
||||||
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
||||||
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
||||||
local Blend = __include("containers/Blend")
|
local Blend = __include("containers/Blend")
|
||||||
@@ -167960,7 +167960,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, PARVERT1, PARVERT3, PARBONE = 4, 5, 6, 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
|
||||||
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
||||||
local TYPE_NAME= {
|
local TYPE_NAME= {
|
||||||
@@ -168478,6 +168478,57 @@ local function skins(ctx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Object.partype as the API names it (PARSKEL is "ARMATURE" under an armature, "LATTICE" under a lattice)
|
||||||
|
local PARENT_TYPE= { [0] = "OBJECT", [4] = "ARMATURE", [5] = "VERTEX", [6] = "VERTEX_3", [7] = "BONE" }
|
||||||
|
|
||||||
|
-- vertex positions of a mesh object (its own data, no modifiers or shape keys), for vertex parents; nil if unavailable
|
||||||
|
local function parentVertices(ctx, par, indices)
|
||||||
|
if (par:num("type") or -1) ~= OB_MESH then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local me = par:deref("data", 0, "Mesh")
|
||||||
|
local ok, poly = pcall(Mesh.read, ctx.f, me , { maxVertices = ctx.opts.maxVertices })
|
||||||
|
if not ok or not poly or not me then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local out = {}
|
||||||
|
for k, i in __iter(indices) do
|
||||||
|
if i < 0 or i >= poly.nv then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
out[k] = { buffer.readf32(poly.pos, i * 12), buffer.readf32(poly.pos, i * 12 + 4), buffer.readf32(poly.pos, i * 12 + 8) }
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blender's tri_to_quat (math_geom.cc) as a rotation matrix: z along the triangle normal, x along v1 -> v2
|
||||||
|
local function triFrame(v1, v2, v3)
|
||||||
|
local function sub(a, b)
|
||||||
|
return { a[1] - b[1], a[2] - b[2], a[3] - b[3] }
|
||||||
|
end
|
||||||
|
local function norm(a)
|
||||||
|
local l = math.sqrt(a[1] * a[1] + a[2] * a[2] + a[3] * a[3])
|
||||||
|
return l > 0 and{ a[1] / l, a[2] / l, a[3] / l } or a
|
||||||
|
end
|
||||||
|
local e1, e2 = sub(v2, v1), sub(v3, v2) -- normal_tri_v3: (v1 - v2) x (v2 - v3)
|
||||||
|
local a, b = sub(v1, v2), sub(v2, v3)
|
||||||
|
local no = norm({ a[2] * b[3] - a[3] * b[2], a[3] * b[1] - a[1] * b[3], a[1] * b[2] - a[2] * b[1] })
|
||||||
|
local n = norm({ no[2], -no[1], 0 })
|
||||||
|
if n[1] == 0 and n[2] == 0 then
|
||||||
|
n = { 1, 0, 0 }
|
||||||
|
end
|
||||||
|
local angle = -0.5 * math.acos(math.clamp(no[3], -1, 1))
|
||||||
|
local q1 = { n[1] * math.sin(angle), n[2] * math.sin(angle), 0, math.cos(angle) } -- x, y, z, w
|
||||||
|
local m1 = Mat4.fromQuat(q1)
|
||||||
|
local inv = Mat4.inverseFull(m1) or Mat4.identity()
|
||||||
|
local vx, vy = Mat4.point(inv, e1[1], e1[2], e1[3])
|
||||||
|
local l = math.sqrt(vx * vx + vy * vy)
|
||||||
|
local angle2 = (l > 0 and{(0.5 * math.atan2(vy / l, vx / l) )}or{0
|
||||||
|
})[1] local q2 = { 0, 0, math.sin(angle2), math.cos(angle2) }
|
||||||
|
local _ = e2
|
||||||
|
return Mat4.mul(m1, Mat4.fromQuat(q2))
|
||||||
|
end
|
||||||
|
|
||||||
local function object(ctx, ob, under, depth)
|
local function object(ctx, ob, under, depth)
|
||||||
local addr = ob.block and ob.block.addr
|
local addr = ob.block and ob.block.addr
|
||||||
if addr ~= nil and ctx.objects[addr] then
|
if addr ~= nil and ctx.objects[addr] then
|
||||||
@@ -168488,6 +168539,7 @@ local addr = ob.block and ob.block.addr
|
|||||||
end
|
end
|
||||||
local parentOb = ob:deref("parent", 0, "Object")
|
local parentOb = ob:deref("parent", 0, "Object")
|
||||||
local parentNode= under
|
local parentNode= under
|
||||||
|
local vertexFallback = false
|
||||||
local prefix = Mat4.identity()
|
local prefix = Mat4.identity()
|
||||||
local partype = ob:num("partype") or 0
|
local partype = ob:num("partype") or 0
|
||||||
if parentOb then
|
if parentOb then
|
||||||
@@ -168496,6 +168548,7 @@ local addr = ob.block and ob.block.addr
|
|||||||
parentNode = pn
|
parentNode = pn
|
||||||
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
||||||
if partype == PARBONE then
|
if partype == PARBONE then
|
||||||
|
-- the joint node is the bone's head frame (rest x pose); Blender parents to the tail
|
||||||
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
||||||
local bone = ob:str("parsubstr") or ""
|
local bone = ob:str("parsubstr") or ""
|
||||||
local j = info and info.names[bone]
|
local j = info and info.names[bone]
|
||||||
@@ -168504,6 +168557,26 @@ local addr = ob.block and ob.block.addr
|
|||||||
local len = info.bones[j]:num("length") or 0
|
local len = info.bones[j]:num("length") or 0
|
||||||
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
||||||
end
|
end
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
local idx = { ob:num("par1") or 0 }
|
||||||
|
if partype == PARVERT3 then
|
||||||
|
idx = { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
end
|
||||||
|
local vs = parentVertices(ctx, parentOb, idx)
|
||||||
|
if vs and partype == PARVERT3 then
|
||||||
|
local m = triFrame(vs[1], vs[2], vs[3])
|
||||||
|
m[13], m[14], m[15] = (vs[1][1] + vs[2][1] + vs[3][1]) / 3, (vs[1][2] + vs[2][2] + vs[3][2]) / 3, (vs[1][3] + vs[2][3] + vs[3][3]) / 3
|
||||||
|
prefix = Mat4.mul(m, prefix)
|
||||||
|
elseif vs then
|
||||||
|
-- the parent's rotation and scale do not apply: world = T(parent world x vertex) x parentinv x basis,
|
||||||
|
-- expressed under the parent node for its saved world matrix
|
||||||
|
local pw = worldOf(ctx, pn)
|
||||||
|
local wx, wy, wz = Mat4.point(pw, vs[1][1], vs[1][2], vs[1][3])
|
||||||
|
local inv = Mat4.inverseFull(pw) or Mat4.identity()
|
||||||
|
prefix = Mat4.mul(Mat4.mul(inv, Mat4.translation(wx, wy, wz)), prefix)
|
||||||
|
else
|
||||||
|
vertexFallback = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -168523,6 +168596,20 @@ local addr = ob.block and ob.block.addr
|
|||||||
local t = ob:num("type") or -1
|
local t = ob:num("type") or -1
|
||||||
local extras= { type = TYPE_NAME[t] or tostring(t) }
|
local extras= { type = TYPE_NAME[t] or tostring(t) }
|
||||||
node.extras = { blend = extras }
|
node.extras = { blend = extras }
|
||||||
|
if parentOb then
|
||||||
|
local pt = PARENT_TYPE[partype] or tostring(partype)
|
||||||
|
if partype == PARSKEL and (parentOb:num("type") or -1) == 22 then
|
||||||
|
pt = "LATTICE"
|
||||||
|
end
|
||||||
|
extras.parent_type = pt
|
||||||
|
extras.matrix_parent_inverse = mat4(ob, "parentinv")
|
||||||
|
if partype == PARBONE then
|
||||||
|
extras.parent_bone = ob:str("parsubstr")
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
extras.parent_vertices = partype == PARVERT1 and{ ob:num("par1") or 0 } or{ ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
extras.parent_vertices_unresolved = vertexFallback and true or nil -- parented to the object instead
|
||||||
|
end
|
||||||
|
end
|
||||||
local lay = ob:num("lay")
|
local lay = ob:num("lay")
|
||||||
if lay and ctx.f.version < 280 then
|
if lay and ctx.f.version < 280 then
|
||||||
extras.layers = lay
|
extras.layers = lay
|
||||||
@@ -168535,14 +168622,6 @@ local addr = ob.block and ob.block.addr
|
|||||||
if bit32.band(vis, 4) ~= 0 then
|
if bit32.band(vis, 4) ~= 0 then
|
||||||
extras.hide_render = true
|
extras.hide_render = true
|
||||||
end
|
end
|
||||||
local mods = {}
|
|
||||||
for _, md in __iter(ob:list("modifiers")) do
|
|
||||||
table.insert(mods, { name = md:sub("modifier") and ((md:sub("modifier") )):str("name") or md:str("name") or "", type = (string.gsub(md.struct.name, "ModifierData$", "")) })
|
|
||||||
end
|
|
||||||
if #mods > 0 then
|
|
||||||
extras.modifiers = mods
|
|
||||||
ctx.meta.modifiers[node.name or tostring(idx)] = mods
|
|
||||||
end
|
|
||||||
if t == OB_ARMATURE then
|
if t == OB_ARMATURE then
|
||||||
armature(ctx, ob, idx)
|
armature(ctx, ob, idx)
|
||||||
elseif t == OB_CAMERA then
|
elseif t == OB_CAMERA then
|
||||||
@@ -168556,18 +168635,60 @@ local addr = ob.block and ob.block.addr
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------------------------------ rigs
|
-- ------------------------------------------------------------------------------------------------ rigs
|
||||||
|
-- ModifierData.type names as the API gives them, from the struct name ("SimpleDeformModifierData" -> SIMPLE_DEFORM)
|
||||||
|
local MOD_NAME= {
|
||||||
|
LaplacianSmooth = "LAPLACIANSMOOTH", LaplacianDeform = "LAPLACIANDEFORM", WeightVGEdit = "VERTEX_WEIGHT_EDIT",
|
||||||
|
WeightVGMix = "VERTEX_WEIGHT_MIX", WeightVGProximity = "VERTEX_WEIGHT_PROXIMITY", UVProject = "UV_PROJECT",
|
||||||
|
UVWarp = "UV_WARP", MeshSeqCache = "MESH_SEQUENCE_CACHE", Softbody = "SOFT_BODY", ParticleSystem = "PARTICLE_SYSTEM",
|
||||||
|
ParticleInstance = "PARTICLE_INSTANCE", Fluidsim = "FLUID_SIMULATION", Smoke = "SMOKE", Surface = "SURFACE",
|
||||||
|
MeshToVolume = "MESH_TO_VOLUME", VolumeToMesh = "VOLUME_TO_MESH",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- the modifier stack (ModifierData.mode: eModifierMode_Realtime 1, Render 2); ARMATURE with its settings
|
||||||
|
-- (ArmatureModifierData.deformflag: ARM_DEF_VGROUP 1, ENVELOPE 2, QUATERNION 4, INVERT_VGROUP 16)
|
||||||
|
local function modifiers(ob, resolve)
|
||||||
|
local out = {}
|
||||||
|
for _, md in __iter(ob:list("modifiers")) do
|
||||||
|
local head = md:sub("modifier") or md
|
||||||
|
local raw = string.gsub(md.struct.name, "ModifierData$", "")
|
||||||
|
local kind = MOD_NAME[raw] or string.upper((string.gsub(raw, "(%l)(%u)", "%1_%2")))
|
||||||
|
local mode = head:num("mode") or 3
|
||||||
|
local e= { type = kind, name = head:str("name") or "" }
|
||||||
|
e.show_viewport = bit32.band(mode, 1) ~= 0
|
||||||
|
e.show_render = bit32.band(mode, 2) ~= 0
|
||||||
|
if kind == "ARMATURE" then
|
||||||
|
local flag = md:num("deformflag") or 1
|
||||||
|
e.object = resolve(md:deref("object", 0, "Object"))
|
||||||
|
e.use_vertex_groups = bit32.band(flag, 1) ~= 0
|
||||||
|
e.use_bone_envelopes = bit32.band(flag, 2) ~= 0
|
||||||
|
e.use_deform_preserve_volume = bit32.band(flag, 4) ~= 0
|
||||||
|
e.invert_vertex_group = bit32.band(flag, 16) ~= 0
|
||||||
|
e.use_multi_modifier = (md:num("multi") or 0) ~= 0
|
||||||
|
local vg = md:str("defgrp_name")
|
||||||
|
e.vertex_group = (vg and vg ~= "" and{vg }or{nil
|
||||||
|
})[1] end
|
||||||
|
table.insert(out, e)
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
local function rigs(ctx)
|
local function rigs(ctx)
|
||||||
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
||||||
for node = 1, #ctx.scene.nodes do
|
for node = 1, #ctx.scene.nodes do
|
||||||
local __DARKLUA_CONTINUE_16=false repeat local ob = ctx.objView[node]
|
local __DARKLUA_CONTINUE_17=false repeat local ob = ctx.objView[node]
|
||||||
local extras = ob and (ctx.scene.nodes[node].extras ).blend
|
local extras = ob and (ctx.scene.nodes[node].extras ).blend
|
||||||
if not ob or not extras then
|
if not ob or not extras then
|
||||||
__DARKLUA_CONTINUE_16=true break
|
__DARKLUA_CONTINUE_17=true break
|
||||||
end
|
end
|
||||||
local list = Armature.constraints(ob, target)
|
local list = Armature.constraints(ob, target)
|
||||||
if #list > 0 then
|
if #list > 0 then
|
||||||
extras.constraints = list
|
extras.constraints = list
|
||||||
end
|
end
|
||||||
|
local mods = modifiers(ob, target)
|
||||||
|
if #mods > 0 then
|
||||||
|
extras.modifiers = mods
|
||||||
|
ctx.meta.modifiers[ctx.scene.nodes[node].name or tostring(node)] = mods
|
||||||
|
end
|
||||||
local id = ob:sub("id")
|
local id = ob:sub("id")
|
||||||
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
||||||
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
||||||
@@ -168610,7 +168731,7 @@ __DARKLUA_CONTINUE_16=true break
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
__DARKLUA_CONTINUE_16=true until true if not __DARKLUA_CONTINUE_16 then break end end
|
__DARKLUA_CONTINUE_17=true until true if not __DARKLUA_CONTINUE_17 then break end end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- every custom shape object: its node (and mesh) when it is in the scene, else its mesh only
|
-- every custom shape object: its node (and mesh) when it is in the scene, else its mesh only
|
||||||
@@ -168624,6 +168745,10 @@ local list = {}
|
|||||||
if node then
|
if node then
|
||||||
w.node = node
|
w.node = node
|
||||||
w.mesh = ctx.scene.nodes[node].mesh
|
w.mesh = ctx.scene.nodes[node].mesh
|
||||||
|
local e = ctx.scene.nodes[node].extras
|
||||||
|
if e and e.blend then
|
||||||
|
e.blend.widget = true
|
||||||
|
end
|
||||||
elseif t == OB_MESH then
|
elseif t == OB_MESH then
|
||||||
w.mesh = (meshOf(ctx, ob, true))
|
w.mesh = (meshOf(ctx, ob, true))
|
||||||
end
|
end
|
||||||
|
|||||||
+176
-176
@@ -447,180 +447,180 @@
|
|||||||
[167257, "src/Rosetta/model/blend/Normals.luau"],
|
[167257, "src/Rosetta/model/blend/Normals.luau"],
|
||||||
[167418, "src/Rosetta/model/blend/Prim.luau"],
|
[167418, "src/Rosetta/model/blend/Prim.luau"],
|
||||||
[167925, "src/Rosetta/model/blend/Read.luau"],
|
[167925, "src/Rosetta/model/blend/Read.luau"],
|
||||||
[169013, "src/Rosetta/model/bsp/init.luau"],
|
[169138, "src/Rosetta/model/bsp/init.luau"],
|
||||||
[169204, "src/Rosetta/model/bsp/Lightmap.luau"],
|
[169329, "src/Rosetta/model/bsp/Lightmap.luau"],
|
||||||
[169270, "src/Rosetta/model/bsp/Quake.luau"],
|
[169395, "src/Rosetta/model/bsp/Quake.luau"],
|
||||||
[169659, "src/Rosetta/model/bsp/Quake3.luau"],
|
[169784, "src/Rosetta/model/bsp/Quake3.luau"],
|
||||||
[169888, "src/Rosetta/model/bsp/Tree.luau"],
|
[170013, "src/Rosetta/model/bsp/Tree.luau"],
|
||||||
[170276, "src/Rosetta/model/buildmap/init.luau"],
|
[170401, "src/Rosetta/model/buildmap/init.luau"],
|
||||||
[170548, "src/Rosetta/model/buildmap/Geometry.luau"],
|
[170673, "src/Rosetta/model/buildmap/Geometry.luau"],
|
||||||
[170951, "src/Rosetta/model/d3map/init.luau"],
|
[171076, "src/Rosetta/model/d3map/init.luau"],
|
||||||
[171233, "src/Rosetta/model/d3map/Parse.luau"],
|
[171358, "src/Rosetta/model/d3map/Parse.luau"],
|
||||||
[171431, "src/Rosetta/model/dae/init.luau"],
|
[171556, "src/Rosetta/model/dae/init.luau"],
|
||||||
[171620, "src/Rosetta/model/dae/Math.luau"],
|
[171745, "src/Rosetta/model/dae/Math.luau"],
|
||||||
[171667, "src/Rosetta/model/dae/Read.luau"],
|
[171792, "src/Rosetta/model/dae/Read.luau"],
|
||||||
[173517, "src/Rosetta/model/dae/Write.luau"],
|
[173642, "src/Rosetta/model/dae/Write.luau"],
|
||||||
[173886, "src/Rosetta/model/fbx/init.luau"],
|
[174011, "src/Rosetta/model/fbx/init.luau"],
|
||||||
[174034, "src/Rosetta/model/fbx/Ascii.luau"],
|
[174159, "src/Rosetta/model/fbx/Ascii.luau"],
|
||||||
[174304, "src/Rosetta/model/fbx/Binary.luau"],
|
[174429, "src/Rosetta/model/fbx/Binary.luau"],
|
||||||
[174759, "src/Rosetta/model/fbx/Read.luau"],
|
[174884, "src/Rosetta/model/fbx/Read.luau"],
|
||||||
[176121, "src/Rosetta/model/fbx/Write.luau"],
|
[176246, "src/Rosetta/model/fbx/Write.luau"],
|
||||||
[177106, "src/Rosetta/model/fbx/Xform.luau"],
|
[177231, "src/Rosetta/model/fbx/Xform.luau"],
|
||||||
[177147, "src/Rosetta/model/gltf/init.luau"],
|
[177272, "src/Rosetta/model/gltf/init.luau"],
|
||||||
[177384, "src/Rosetta/model/gltf/Pack.luau"],
|
[177509, "src/Rosetta/model/gltf/Pack.luau"],
|
||||||
[177453, "src/Rosetta/model/gltf/Read.luau"],
|
[177578, "src/Rosetta/model/gltf/Read.luau"],
|
||||||
[178194, "src/Rosetta/model/gltf/Write.luau"],
|
[178319, "src/Rosetta/model/gltf/Write.luau"],
|
||||||
[178880, "src/Rosetta/model/godot/init.luau"],
|
[179005, "src/Rosetta/model/godot/init.luau"],
|
||||||
[178971, "src/Rosetta/model/godot/Build.luau"],
|
[179096, "src/Rosetta/model/godot/Build.luau"],
|
||||||
[179513, "src/Rosetta/model/godot/Primitives.luau"],
|
[179638, "src/Rosetta/model/godot/Primitives.luau"],
|
||||||
[179788, "src/Rosetta/model/godot/Surface.luau"],
|
[179913, "src/Rosetta/model/godot/Surface.luau"],
|
||||||
[180273, "src/Rosetta/model/godot/Write.luau"],
|
[180398, "src/Rosetta/model/godot/Write.luau"],
|
||||||
[180602, "src/Rosetta/model/iqm/init.luau"],
|
[180727, "src/Rosetta/model/iqm/init.luau"],
|
||||||
[180678, "src/Rosetta/model/iqm/Read.luau"],
|
[180803, "src/Rosetta/model/iqm/Read.luau"],
|
||||||
[181033, "src/Rosetta/model/iqm/Write.luau"],
|
[181158, "src/Rosetta/model/iqm/Write.luau"],
|
||||||
[181720, "src/Rosetta/model/ldraw/init.luau"],
|
[181845, "src/Rosetta/model/ldraw/init.luau"],
|
||||||
[181798, "src/Rosetta/model/ldraw/Colors.luau"],
|
[181923, "src/Rosetta/model/ldraw/Colors.luau"],
|
||||||
[182116, "src/Rosetta/model/ldraw/Read.luau"],
|
[182241, "src/Rosetta/model/ldraw/Read.luau"],
|
||||||
[182693, "src/Rosetta/model/lwo/init.luau"],
|
[182818, "src/Rosetta/model/lwo/init.luau"],
|
||||||
[182769, "src/Rosetta/model/lwo/Build.luau"],
|
[182894, "src/Rosetta/model/lwo/Build.luau"],
|
||||||
[183231, "src/Rosetta/model/lwo/Parse.luau"],
|
[183356, "src/Rosetta/model/lwo/Parse.luau"],
|
||||||
[183774, "src/Rosetta/model/map/init.luau"],
|
[183899, "src/Rosetta/model/map/init.luau"],
|
||||||
[184091, "src/Rosetta/model/map/Build.luau"],
|
[184216, "src/Rosetta/model/map/Build.luau"],
|
||||||
[184335, "src/Rosetta/model/map/Parse.luau"],
|
[184460, "src/Rosetta/model/map/Parse.luau"],
|
||||||
[184720, "src/Rosetta/model/map/Write.luau"],
|
[184845, "src/Rosetta/model/map/Write.luau"],
|
||||||
[184866, "src/Rosetta/model/mca/init.luau"],
|
[184991, "src/Rosetta/model/mca/init.luau"],
|
||||||
[185208, "src/Rosetta/model/mca/Chunk.luau"],
|
[185333, "src/Rosetta/model/mca/Chunk.luau"],
|
||||||
[185341, "src/Rosetta/model/mca/Lz4Block.luau"],
|
[185466, "src/Rosetta/model/mca/Lz4Block.luau"],
|
||||||
[185411, "src/Rosetta/model/md2/init.luau"],
|
[185536, "src/Rosetta/model/md2/init.luau"],
|
||||||
[185610, "src/Rosetta/model/md3/init.luau"],
|
[185735, "src/Rosetta/model/md3/init.luau"],
|
||||||
[185838, "src/Rosetta/model/md5/init.luau"],
|
[185963, "src/Rosetta/model/md5/init.luau"],
|
||||||
[185919, "src/Rosetta/model/md5/Read.luau"],
|
[186044, "src/Rosetta/model/md5/Read.luau"],
|
||||||
[186352, "src/Rosetta/model/mdl/init.luau"],
|
[186477, "src/Rosetta/model/mdl/init.luau"],
|
||||||
[186434, "src/Rosetta/model/mdl/HalfLife.luau"],
|
[186559, "src/Rosetta/model/mdl/HalfLife.luau"],
|
||||||
[186738, "src/Rosetta/model/mdl/Quake.luau"],
|
[186863, "src/Rosetta/model/mdl/Quake.luau"],
|
||||||
[186956, "src/Rosetta/model/ms3d/init.luau"],
|
[187081, "src/Rosetta/model/ms3d/init.luau"],
|
||||||
[187028, "src/Rosetta/model/ms3d/Read.luau"],
|
[187153, "src/Rosetta/model/ms3d/Read.luau"],
|
||||||
[187474, "src/Rosetta/model/ms3d/Write.luau"],
|
[187599, "src/Rosetta/model/ms3d/Write.luau"],
|
||||||
[187943, "src/Rosetta/model/obj/init.luau"],
|
[188068, "src/Rosetta/model/obj/init.luau"],
|
||||||
[188761, "src/Rosetta/model/obj/Mtl.luau"],
|
[188886, "src/Rosetta/model/obj/Mtl.luau"],
|
||||||
[189049, "src/Rosetta/model/off/init.luau"],
|
[189174, "src/Rosetta/model/off/init.luau"],
|
||||||
[189511, "src/Rosetta/model/ply/init.luau"],
|
[189636, "src/Rosetta/model/ply/init.luau"],
|
||||||
[190616, "src/Rosetta/model/ply/Binary.luau"],
|
[190741, "src/Rosetta/model/ply/Binary.luau"],
|
||||||
[190817, "src/Rosetta/model/pmx/init.luau"],
|
[190942, "src/Rosetta/model/pmx/init.luau"],
|
||||||
[190886, "src/Rosetta/model/pmx/Build.luau"],
|
[191011, "src/Rosetta/model/pmx/Build.luau"],
|
||||||
[191182, "src/Rosetta/model/pmx/Pmd.luau"],
|
[191307, "src/Rosetta/model/pmx/Pmd.luau"],
|
||||||
[191517, "src/Rosetta/model/pmx/Read.luau"],
|
[191642, "src/Rosetta/model/pmx/Read.luau"],
|
||||||
[191921, "src/Rosetta/model/proc/init.luau"],
|
[192046, "src/Rosetta/model/proc/init.luau"],
|
||||||
[192303, "src/Rosetta/model/qb/init.luau"],
|
[192428, "src/Rosetta/model/qb/init.luau"],
|
||||||
[192696, "src/Rosetta/model/rbxm/init.luau"],
|
[192821, "src/Rosetta/model/rbxm/init.luau"],
|
||||||
[193289, "src/Rosetta/model/rbxmx/init.luau"],
|
[193414, "src/Rosetta/model/rbxmx/init.luau"],
|
||||||
[193965, "src/Rosetta/model/robloxmesh/init.luau"],
|
[194090, "src/Rosetta/model/robloxmesh/init.luau"],
|
||||||
[194624, "src/Rosetta/model/robloxmesh/Parse.luau"],
|
[194749, "src/Rosetta/model/robloxmesh/Parse.luau"],
|
||||||
[195081, "src/Rosetta/model/robloxmesh/Write.luau"],
|
[195206, "src/Rosetta/model/robloxmesh/Write.luau"],
|
||||||
[195190, "src/Rosetta/model/schematic/init.luau"],
|
[195315, "src/Rosetta/model/schematic/init.luau"],
|
||||||
[195511, "src/Rosetta/model/schematic/Common.luau"],
|
[195636, "src/Rosetta/model/schematic/Common.luau"],
|
||||||
[195631, "src/Rosetta/model/schematic/Litematic.luau"],
|
[195756, "src/Rosetta/model/schematic/Litematic.luau"],
|
||||||
[195842, "src/Rosetta/model/schematic/Mcedit.luau"],
|
[195967, "src/Rosetta/model/schematic/Mcedit.luau"],
|
||||||
[196086, "src/Rosetta/model/schematic/Sponge.luau"],
|
[196211, "src/Rosetta/model/schematic/Sponge.luau"],
|
||||||
[196215, "src/Rosetta/model/smd/init.luau"],
|
[196340, "src/Rosetta/model/smd/init.luau"],
|
||||||
[196282, "src/Rosetta/model/smd/Read.luau"],
|
[196407, "src/Rosetta/model/smd/Read.luau"],
|
||||||
[196551, "src/Rosetta/model/smd/Write.luau"],
|
[196676, "src/Rosetta/model/smd/Write.luau"],
|
||||||
[196794, "src/Rosetta/model/sourcemdl/init.luau"],
|
[196919, "src/Rosetta/model/sourcemdl/init.luau"],
|
||||||
[196965, "src/Rosetta/model/sourcemdl/Build.luau"],
|
[197090, "src/Rosetta/model/sourcemdl/Build.luau"],
|
||||||
[197395, "src/Rosetta/model/sourcemdl/Material.luau"],
|
[197520, "src/Rosetta/model/sourcemdl/Material.luau"],
|
||||||
[197556, "src/Rosetta/model/sourcemdl/Mdl.luau"],
|
[197681, "src/Rosetta/model/sourcemdl/Mdl.luau"],
|
||||||
[198083, "src/Rosetta/model/sourcemdl/Phy.luau"],
|
[198208, "src/Rosetta/model/sourcemdl/Phy.luau"],
|
||||||
[198206, "src/Rosetta/model/sourcemdl/Vtx.luau"],
|
[198331, "src/Rosetta/model/sourcemdl/Vtx.luau"],
|
||||||
[198388, "src/Rosetta/model/sourcemdl/Vvd.luau"],
|
[198513, "src/Rosetta/model/sourcemdl/Vvd.luau"],
|
||||||
[198482, "src/Rosetta/model/stl/init.luau"],
|
[198607, "src/Rosetta/model/stl/init.luau"],
|
||||||
[198932, "src/Rosetta/model/stl/Decode.luau"],
|
[199057, "src/Rosetta/model/stl/Decode.luau"],
|
||||||
[199006, "src/Rosetta/model/t3d/init.luau"],
|
[199131, "src/Rosetta/model/t3d/init.luau"],
|
||||||
[199100, "src/Rosetta/model/t3d/Build.luau"],
|
[199225, "src/Rosetta/model/t3d/Build.luau"],
|
||||||
[199505, "src/Rosetta/model/t3d/Parse.luau"],
|
[199630, "src/Rosetta/model/t3d/Parse.luau"],
|
||||||
[199673, "src/Rosetta/model/udmf/init.luau"],
|
[199798, "src/Rosetta/model/udmf/init.luau"],
|
||||||
[199756, "src/Rosetta/model/usda/init.luau"],
|
[199881, "src/Rosetta/model/usda/init.luau"],
|
||||||
[199965, "src/Rosetta/model/usda/Build.luau"],
|
[200090, "src/Rosetta/model/usda/Build.luau"],
|
||||||
[201243, "src/Rosetta/model/usda/Parse.luau"],
|
[201368, "src/Rosetta/model/usda/Parse.luau"],
|
||||||
[202041, "src/Rosetta/model/usda/Write.luau"],
|
[202166, "src/Rosetta/model/usda/Write.luau"],
|
||||||
[202858, "src/Rosetta/model/vbsp/init.luau"],
|
[202983, "src/Rosetta/model/vbsp/init.luau"],
|
||||||
[203304, "src/Rosetta/model/vbsp/Faces.luau"],
|
[203429, "src/Rosetta/model/vbsp/Faces.luau"],
|
||||||
[203528, "src/Rosetta/model/vbsp/Props.luau"],
|
[203653, "src/Rosetta/model/vbsp/Props.luau"],
|
||||||
[203620, "src/Rosetta/model/vmf/init.luau"],
|
[203745, "src/Rosetta/model/vmf/init.luau"],
|
||||||
[203945, "src/Rosetta/model/vmf/Build.luau"],
|
[204070, "src/Rosetta/model/vmf/Build.luau"],
|
||||||
[204369, "src/Rosetta/model/vox/init.luau"],
|
[204494, "src/Rosetta/model/vox/init.luau"],
|
||||||
[205255, "src/Rosetta/model/vox/Grid.luau"],
|
[205380, "src/Rosetta/model/vox/Grid.luau"],
|
||||||
[205312, "src/Rosetta/model/vrml/init.luau"],
|
[205437, "src/Rosetta/model/vrml/init.luau"],
|
||||||
[205378, "src/Rosetta/model/x/init.luau"],
|
[205503, "src/Rosetta/model/x/init.luau"],
|
||||||
[205508, "src/Rosetta/model/x/Build.luau"],
|
[205633, "src/Rosetta/model/x/Build.luau"],
|
||||||
[206071, "src/Rosetta/model/x/Parse.luau"],
|
[206196, "src/Rosetta/model/x/Parse.luau"],
|
||||||
[206368, "src/Rosetta/model/x3d/init.luau"],
|
[206493, "src/Rosetta/model/x3d/init.luau"],
|
||||||
[206446, "src/Rosetta/music/669/init.luau"],
|
[206571, "src/Rosetta/music/669/init.luau"],
|
||||||
[206653, "src/Rosetta/music/ahx/init.luau"],
|
[206778, "src/Rosetta/music/ahx/init.luau"],
|
||||||
[206705, "src/Rosetta/music/far/init.luau"],
|
[206830, "src/Rosetta/music/far/init.luau"],
|
||||||
[206935, "src/Rosetta/music/hmp/init.luau"],
|
[207060, "src/Rosetta/music/hmp/init.luau"],
|
||||||
[207200, "src/Rosetta/music/hvl/init.luau"],
|
[207325, "src/Rosetta/music/hvl/init.luau"],
|
||||||
[207252, "src/Rosetta/music/it/init.luau"],
|
[207377, "src/Rosetta/music/it/init.luau"],
|
||||||
[207671, "src/Rosetta/music/it/Itsex.luau"],
|
[207796, "src/Rosetta/music/it/Itsex.luau"],
|
||||||
[207788, "src/Rosetta/music/med/init.luau"],
|
[207913, "src/Rosetta/music/med/init.luau"],
|
||||||
[208436, "src/Rosetta/music/midi/init.luau"],
|
[208561, "src/Rosetta/music/midi/init.luau"],
|
||||||
[208580, "src/Rosetta/music/midi/Smf.luau"],
|
[208705, "src/Rosetta/music/midi/Smf.luau"],
|
||||||
[208992, "src/Rosetta/music/mod/init.luau"],
|
[209117, "src/Rosetta/music/mod/init.luau"],
|
||||||
[209346, "src/Rosetta/music/mtm/init.luau"],
|
[209471, "src/Rosetta/music/mtm/init.luau"],
|
||||||
[209569, "src/Rosetta/music/mus/init.luau"],
|
[209694, "src/Rosetta/music/mus/init.luau"],
|
||||||
[209727, "src/Rosetta/music/okt/init.luau"],
|
[209852, "src/Rosetta/music/okt/init.luau"],
|
||||||
[210009, "src/Rosetta/music/ptm/init.luau"],
|
[210134, "src/Rosetta/music/ptm/init.luau"],
|
||||||
[210232, "src/Rosetta/music/s3m/init.luau"],
|
[210357, "src/Rosetta/music/s3m/init.luau"],
|
||||||
[210469, "src/Rosetta/music/sf2/init.luau"],
|
[210594, "src/Rosetta/music/sf2/init.luau"],
|
||||||
[210513, "src/Rosetta/music/stm/init.luau"],
|
[210638, "src/Rosetta/music/stm/init.luau"],
|
||||||
[210745, "src/Rosetta/music/ult/init.luau"],
|
[210870, "src/Rosetta/music/ult/init.luau"],
|
||||||
[211050, "src/Rosetta/music/umx/init.luau"],
|
[211175, "src/Rosetta/music/umx/init.luau"],
|
||||||
[211267, "src/Rosetta/music/xm/init.luau"],
|
[211392, "src/Rosetta/music/xm/init.luau"],
|
||||||
[211829, "src/Rosetta/music/xmi/init.luau"],
|
[211954, "src/Rosetta/music/xmi/init.luau"],
|
||||||
[212038, "src/Rosetta/ops/AudioOps.luau"],
|
[212163, "src/Rosetta/ops/AudioOps.luau"],
|
||||||
[212517, "src/Rosetta/ops/ImageOps/init.luau"],
|
[212642, "src/Rosetta/ops/ImageOps/init.luau"],
|
||||||
[213165, "src/Rosetta/ops/ImageOps/Kernels.luau"],
|
[213290, "src/Rosetta/ops/ImageOps/Kernels.luau"],
|
||||||
[213805, "src/Rosetta/ops/LayerOps.luau"],
|
[213930, "src/Rosetta/ops/LayerOps.luau"],
|
||||||
[213898, "src/Rosetta/ops/MeshOps/init.luau"],
|
[214023, "src/Rosetta/ops/MeshOps/init.luau"],
|
||||||
[215038, "src/Rosetta/ops/MeshOps/Greedy.luau"],
|
[215163, "src/Rosetta/ops/MeshOps/Greedy.luau"],
|
||||||
[215205, "src/Rosetta/ops/MusicOps.luau"],
|
[215330, "src/Rosetta/ops/MusicOps.luau"],
|
||||||
[215554, "src/Rosetta/playlist/m3u/init.luau"],
|
[215679, "src/Rosetta/playlist/m3u/init.luau"],
|
||||||
[215907, "src/Rosetta/playlist/pls/init.luau"],
|
[216032, "src/Rosetta/playlist/pls/init.luau"],
|
||||||
[216085, "src/Rosetta/playlist/xspf/init.luau"],
|
[216210, "src/Rosetta/playlist/xspf/init.luau"],
|
||||||
[216288, "src/Rosetta/subtitle/ass/init.luau"],
|
[216413, "src/Rosetta/subtitle/ass/init.luau"],
|
||||||
[216732, "src/Rosetta/subtitle/srt/init.luau"],
|
[216857, "src/Rosetta/subtitle/srt/init.luau"],
|
||||||
[216905, "src/Rosetta/subtitle/vtt/init.luau"],
|
[217030, "src/Rosetta/subtitle/vtt/init.luau"],
|
||||||
[217108, "src/Rosetta/vector/gamemaps/init.luau"],
|
[217233, "src/Rosetta/vector/gamemaps/init.luau"],
|
||||||
[217295, "src/Rosetta/vector/gamemaps/Expand.luau"],
|
[217420, "src/Rosetta/vector/gamemaps/Expand.luau"],
|
||||||
[217392, "src/Rosetta/vector/ldtk/init.luau"],
|
[217517, "src/Rosetta/vector/ldtk/init.luau"],
|
||||||
[217484, "src/Rosetta/vector/ldtk/Read.luau"],
|
[217609, "src/Rosetta/vector/ldtk/Read.luau"],
|
||||||
[217820, "src/Rosetta/vector/ldtk/Write.luau"],
|
[217945, "src/Rosetta/vector/ldtk/Write.luau"],
|
||||||
[218468, "src/Rosetta/vector/ogmo/init.luau"],
|
[218593, "src/Rosetta/vector/ogmo/init.luau"],
|
||||||
[218587, "src/Rosetta/vector/ogmo/Read.luau"],
|
[218712, "src/Rosetta/vector/ogmo/Read.luau"],
|
||||||
[218992, "src/Rosetta/vector/ogmo/Write.luau"],
|
[219117, "src/Rosetta/vector/ogmo/Write.luau"],
|
||||||
[219346, "src/Rosetta/vector/svg/init.luau"],
|
[219471, "src/Rosetta/vector/svg/init.luau"],
|
||||||
[219432, "src/Rosetta/vector/svg/Parse.luau"],
|
[219557, "src/Rosetta/vector/svg/Parse.luau"],
|
||||||
[220178, "src/Rosetta/vector/svg/PathData.luau"],
|
[220303, "src/Rosetta/vector/svg/PathData.luau"],
|
||||||
[220546, "src/Rosetta/vector/svg/Render.luau"],
|
[220671, "src/Rosetta/vector/svg/Render.luau"],
|
||||||
[220963, "src/Rosetta/vector/svg/Style.luau"],
|
[221088, "src/Rosetta/vector/svg/Style.luau"],
|
||||||
[221335, "src/Rosetta/vector/svg/Write.luau"],
|
[221460, "src/Rosetta/vector/svg/Write.luau"],
|
||||||
[221535, "src/Rosetta/vector/tiled/init.luau"],
|
[221660, "src/Rosetta/vector/tiled/init.luau"],
|
||||||
[221715, "src/Rosetta/vector/tiled/Data.luau"],
|
[221840, "src/Rosetta/vector/tiled/Data.luau"],
|
||||||
[221866, "src/Rosetta/vector/tiled/Tmj.luau"],
|
[221991, "src/Rosetta/vector/tiled/Tmj.luau"],
|
||||||
[222497, "src/Rosetta/vector/tiled/Tmx.luau"],
|
[222622, "src/Rosetta/vector/tiled/Tmx.luau"],
|
||||||
[223109, "src/Rosetta/video/avi/init.luau"],
|
[223234, "src/Rosetta/video/avi/init.luau"],
|
||||||
[223403, "src/Rosetta/video/fli/init.luau"],
|
[223528, "src/Rosetta/video/fli/init.luau"],
|
||||||
[223554, "src/Rosetta/video/flv/init.luau"],
|
[223679, "src/Rosetta/video/flv/init.luau"],
|
||||||
[223938, "src/Rosetta/video/flv/Amf.luau"],
|
[224063, "src/Rosetta/video/flv/Amf.luau"],
|
||||||
[224096, "src/Rosetta/video/flv/Mux.luau"],
|
[224221, "src/Rosetta/video/flv/Mux.luau"],
|
||||||
[224377, "src/Rosetta/video/h264/init.luau"],
|
[224502, "src/Rosetta/video/h264/init.luau"],
|
||||||
[224516, "src/Rosetta/video/mkv/init.luau"],
|
[224641, "src/Rosetta/video/mkv/init.luau"],
|
||||||
[224672, "src/Rosetta/video/mkv/Mux.luau"],
|
[224797, "src/Rosetta/video/mkv/Mux.luau"],
|
||||||
[224951, "src/Rosetta/video/mkv/Parse.luau"],
|
[225076, "src/Rosetta/video/mkv/Parse.luau"],
|
||||||
[225672, "src/Rosetta/video/mp4/init.luau"],
|
[225797, "src/Rosetta/video/mp4/init.luau"],
|
||||||
[226000, "src/Rosetta/video/mpegps/init.luau"],
|
[226125, "src/Rosetta/video/mpegps/init.luau"],
|
||||||
[226187, "src/Rosetta/video/mpegts/init.luau"],
|
[226312, "src/Rosetta/video/mpegts/init.luau"],
|
||||||
[226433, "src/Rosetta/video/ogv/init.luau"],
|
[226558, "src/Rosetta/video/ogv/init.luau"],
|
||||||
[226828, "src/Rosetta/video/smk/init.luau"],
|
[226953, "src/Rosetta/video/smk/init.luau"],
|
||||||
[227137, "src/Rosetta/video/smk/Audio.luau"],
|
[227262, "src/Rosetta/video/smk/Audio.luau"],
|
||||||
[227257, "src/Rosetta/video/y4m/init.luau"]
|
[227382, "src/Rosetta/video/y4m/init.luau"]
|
||||||
]
|
]
|
||||||
+18
-2
@@ -972,7 +972,7 @@ assert(scene.meta.up == "z" and #scene.skins == 1 and #scene.animations == 1)
|
|||||||
local tube = scene.meshes[1].primitives[1]
|
local tube = scene.meshes[1].primitives[1]
|
||||||
assert(tube.attributes.JOINTS_0 and tube.attributes.WEIGHTS_0 and #tube.targets == 1)
|
assert(tube.attributes.JOINTS_0 and tube.attributes.WEIGHTS_0 and #tube.targets == 1)
|
||||||
assert(scene.materials[1].name == "Skin" and scene.materials[1].roughness > 0.69)
|
assert(scene.materials[1].name == "Skin" and scene.materials[1].roughness > 0.69)
|
||||||
print(src.modifiers.Tube[1].type) -- Armature (not applied)
|
print(src.modifiers.Tube[1].type) -- ARMATURE (not applied)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Material graphs
|
### Material graphs
|
||||||
@@ -1007,7 +1007,7 @@ hold the saved pose.
|
|||||||
| joint node `extras.blend` (Bone) | `bone = true`, `length`, `deform`, `use_connect`, `show_wire`, `hide`, `head_local` / `tail_local` (armature space), `roll` (radians, armature space), `collections` (names, in collection order), `color`, `inherit_scale` (`"FULL"`, `"FIX_SHEAR"`, `"ALIGNED"`, `"AVERAGE"`, `"NONE"`, `"NONE_LEGACY"`), `use_inherit_rotation`, `use_local_location`, `use_relative_parent`; b-bones: `bbone_segments`, `bbone_x`, `bbone_z`, `bbone_easein` / `bbone_easeout`, `bbone_rollin` / `bbone_rollout`, `bbone_curveinx` / `bbone_curveinz` / `bbone_curveoutx` / `bbone_curveoutz`, `bbone_scalein` / `bbone_scaleout` (3 numbers), `bbone_handle_type_start` / `_end` (`"AUTO"`, `"ABSOLUTE"`, `"RELATIVE"`, `"TANGENT"`), `bbone_custom_handle_start` / `_end` (bone names), `use_endroll_as_inroll`, `bbone_mapping_mode` |
|
| joint node `extras.blend` (Bone) | `bone = true`, `length`, `deform`, `use_connect`, `show_wire`, `hide`, `head_local` / `tail_local` (armature space), `roll` (radians, armature space), `collections` (names, in collection order), `color`, `inherit_scale` (`"FULL"`, `"FIX_SHEAR"`, `"ALIGNED"`, `"AVERAGE"`, `"NONE"`, `"NONE_LEGACY"`), `use_inherit_rotation`, `use_local_location`, `use_relative_parent`; b-bones: `bbone_segments`, `bbone_x`, `bbone_z`, `bbone_easein` / `bbone_easeout`, `bbone_rollin` / `bbone_rollout`, `bbone_curveinx` / `bbone_curveinz` / `bbone_curveoutx` / `bbone_curveoutz`, `bbone_scalein` / `bbone_scaleout` (3 numbers), `bbone_handle_type_start` / `_end` (`"AUTO"`, `"ABSOLUTE"`, `"RELATIVE"`, `"TANGENT"`), `bbone_custom_handle_start` / `_end` (bone names), `use_endroll_as_inroll`, `bbone_mapping_mode` |
|
||||||
| joint node `extras.blend` (pose bone) | `rotation_mode` (`"QUATERNION"`, `"XYZ"` .. `"ZYX"`, `"AXIS_ANGLE"`), `lock_location` / `lock_rotation` / `lock_scale` (3 booleans), `lock_rotation_w`, `lock_rotations_4d`, `custom_shape` (node index, or the object's name when it is not in the scene), `custom_shape_transform` (bone name), `custom_shape_translation` / `custom_shape_rotation_euler` / `custom_shape_scale_xyz`, `use_custom_shape_bone_size`, `custom_shape_wire_width` (4.2+), `ik_stretch`, `lock_ik_x/y/z`, `use_ik_limit_x/y/z`, `ik_min_x/y/z`, `ik_max_x/y/z`, `ik_stiffness_x/y/z`, `pose_color`, `constraints`; the stored basis `location`, `rotation_quaternion` (w, x, y, z), `rotation_euler`, `rotation_axis_angle` (angle, x, y, z), `scale` |
|
| 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), `props` (the object's custom properties), `drivers` (the object's), `data_drivers` (its armature's or mesh's) |
|
| any object node `extras.blend` | `parent_type` (`"OBJECT"`, `"ARMATURE"`, `"LATTICE"`, `"BONE"`, `"VERTEX"`, `"VERTEX_3"`), `parent_bone`, `parent_vertices` (0-based; `parent_vertices_unresolved = true` when the parent is no mesh: then parented to the object), `matrix_parent_inverse` (column-major), `widget = true` on custom shape objects, `modifiers` (below), `constraints` (object constraints), `hide_viewport`, `hide_render` (when set), `props` (the object's custom properties), `drivers` (the object's), `data_drivers` (its armature's or mesh's) |
|
||||||
| joint node `extras.blend` (properties) | `props`: the pose bone's custom properties (`pose.bones["x"]["name"]`), `bone_props`: the bone's (`bones["x"]["name"]`), kept apart as Blender keeps them |
|
| joint node `extras.blend` (properties) | `props`: the pose bone's custom properties (`pose.bones["x"]["name"]`), `bone_props`: the bone's (`bones["x"]["name"]`), kept apart as Blender keeps them |
|
||||||
| mesh `extras.blend` | `shape_key_drivers`: the drivers of the mesh's shape keys (`key_blocks["x"].value`, ...) |
|
| mesh `extras.blend` | `shape_key_drivers`: the drivers of the mesh's shape keys (`key_blocks["x"].value`, ...) |
|
||||||
| `scene.meta.blend` | `widgets`: every custom shape object `{ name, type, node?, mesh? }` (objects outside the scene's collections get a mesh without a node; edge-only meshes as `"lines"` primitives); `bone_color_sets`: the default theme's `THEME01` .. `THEME20`; `actions`: every action in the file (below) |
|
| `scene.meta.blend` | `widgets`: every custom shape object `{ name, type, node?, mesh? }` (objects outside the scene's collections get a mesh without a node; edge-only meshes as `"lines"` primitives); `bone_color_sets`: the default theme's `THEME01` .. `THEME20`; `actions`: every action in the file (below) |
|
||||||
@@ -1069,6 +1069,22 @@ The driver's value goes through its f-curve: the keys, then the modifiers; with
|
|||||||
(Rain's drivers have two linear keys (0, 0) and (1, 1), or a generator). Files before 5.0 get Blender 5.0's move of
|
(Rain's drivers have two linear keys (0, 0) and (1, 1), or a generator). Files before 5.0 get Blender 5.0's move of
|
||||||
`bones["x"].hide` drivers from the armature data to the object (`pose.bones["x"].hide`).
|
`bones["x"].hide` drivers from the armature data to the object (`pose.bones["x"].hide`).
|
||||||
|
|
||||||
|
Parenting follows Blender's object matrix. A bone parent makes the object a child of the joint node: the joint is
|
||||||
|
the bone's head frame (rest x the stored or animated pose), and the object's local matrix is the bone-tail offset
|
||||||
|
(0, length, 0) x `matrix_parent_inverse` x its own basis, so it follows the joint's animation. A triangle parent
|
||||||
|
(`VERTEX_3`) puts the frame Blender builds from the three vertices (their centre, `tri_to_quat`) under the parent
|
||||||
|
node; a single vertex parent (`VERTEX`) takes only the vertex's position, not the parent's rotation or scale, so the
|
||||||
|
child's local matrix is exact for the parent's saved transform (an animated parent rotation is not compensated). Vertex
|
||||||
|
positions are the parent mesh's own, before modifiers and shape keys. Armature and lattice parents are plain object
|
||||||
|
parents (the deformation is the skin or the lattice modifier). A skinned mesh's node transform does not move its
|
||||||
|
vertices (glTF skinning), so a bone-parented node that is also skinned follows the skin only.
|
||||||
|
|
||||||
|
`modifiers` lists the stack in order as `{ type, name, show_viewport, show_render }` with Blender's type names
|
||||||
|
(`"ARMATURE"`, `"SUBSURF"`, `"MIRROR"`, ...); `ARMATURE` adds `object` (node index or name), `use_vertex_groups`,
|
||||||
|
`use_bone_envelopes`, `use_deform_preserve_volume`, `use_multi_modifier`, `vertex_group`, `invert_vertex_group`. The
|
||||||
|
same lists are in `meta.source.modifiers` by object name. A mesh with an Armature modifier (or an armature parent of
|
||||||
|
type `ARMATURE`) becomes a skin from its vertex groups, as before; the other settings are data.
|
||||||
|
|
||||||
Joint nodes model the plain parent chain: Blender's inheritance settings (`use_inherit_rotation`, `inherit_scale`,
|
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.
|
`use_local_location`) and b-bone deformation are data for an evaluator, not applied to the joints or skins.
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
--!strict
|
--!strict
|
||||||
-- 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,
|
||||||
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
-- or Base list before 2.8) with their transforms (euler orders, quaternion, axis angle, delta transforms, parent
|
||||||
-- inverse; bone parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled BSDF node or the legacy
|
-- inverse; bone, vertex and triangle parents), meshes (model/blend/Mesh, model/blend/Prim), materials (Principled
|
||||||
-- colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
-- BSDF node or the legacy colour), images (packed bytes or external uris), cameras, lights (watts to candela / lux as Blender's glTF exporter
|
||||||
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
-- does: 683 lm/W, / 4 pi for point and spot), armatures (bones to joint nodes with the saved pose, rig data through
|
||||||
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
-- model/blend/Armature), skins, shape keys and actions sampled into channels.
|
||||||
local Blend = require("@rosetta/containers/Blend")
|
local Blend = require("@rosetta/containers/Blend")
|
||||||
@@ -36,7 +36,7 @@ export type Options = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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, PARVERT1, PARVERT3, PARBONE = 4, 5, 6, 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
|
||||||
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
local EULER = { [1] = "xyz", [2] = "xzy", [3] = "yxz", [4] = "yzx", [5] = "zxy", [6] = "zyx" }
|
||||||
local TYPE_NAME: { [number]: string } = {
|
local TYPE_NAME: { [number]: string } = {
|
||||||
@@ -554,6 +554,57 @@ local function skins(ctx: Ctx)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Object.partype as the API names it (PARSKEL is "ARMATURE" under an armature, "LATTICE" under a lattice)
|
||||||
|
local PARENT_TYPE: { [number]: string } = { [0] = "OBJECT", [4] = "ARMATURE", [5] = "VERTEX", [6] = "VERTEX_3", [7] = "BONE" }
|
||||||
|
|
||||||
|
-- vertex positions of a mesh object (its own data, no modifiers or shape keys), for vertex parents; nil if unavailable
|
||||||
|
local function parentVertices(ctx: Ctx, par: Blend.View, indices: { number }): { { number } }?
|
||||||
|
if (par:num("type") or -1) ~= OB_MESH then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local me = par:deref("data", 0, "Mesh")
|
||||||
|
local ok, poly = pcall(Mesh.read, ctx.f, me :: any, { maxVertices = ctx.opts.maxVertices })
|
||||||
|
if not ok or not poly or not me then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
local out = {}
|
||||||
|
for k, i in indices do
|
||||||
|
if i < 0 or i >= poly.nv then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
out[k] = { buffer.readf32(poly.pos, i * 12), buffer.readf32(poly.pos, i * 12 + 4), buffer.readf32(poly.pos, i * 12 + 8) }
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Blender's tri_to_quat (math_geom.cc) as a rotation matrix: z along the triangle normal, x along v1 -> v2
|
||||||
|
local function triFrame(v1: { number }, v2: { number }, v3: { number }): M4
|
||||||
|
local function sub(a: { number }, b: { number }): { number }
|
||||||
|
return { a[1] - b[1], a[2] - b[2], a[3] - b[3] }
|
||||||
|
end
|
||||||
|
local function norm(a: { number }): { number }
|
||||||
|
local l = math.sqrt(a[1] * a[1] + a[2] * a[2] + a[3] * a[3])
|
||||||
|
return if l > 0 then { a[1] / l, a[2] / l, a[3] / l } else a
|
||||||
|
end
|
||||||
|
local e1, e2 = sub(v2, v1), sub(v3, v2) -- normal_tri_v3: (v1 - v2) x (v2 - v3)
|
||||||
|
local a, b = sub(v1, v2), sub(v2, v3)
|
||||||
|
local no = norm({ a[2] * b[3] - a[3] * b[2], a[3] * b[1] - a[1] * b[3], a[1] * b[2] - a[2] * b[1] })
|
||||||
|
local n = norm({ no[2], -no[1], 0 })
|
||||||
|
if n[1] == 0 and n[2] == 0 then
|
||||||
|
n = { 1, 0, 0 }
|
||||||
|
end
|
||||||
|
local angle = -0.5 * math.acos(math.clamp(no[3], -1, 1))
|
||||||
|
local q1 = { n[1] * math.sin(angle), n[2] * math.sin(angle), 0, math.cos(angle) } -- x, y, z, w
|
||||||
|
local m1 = Mat4.fromQuat(q1)
|
||||||
|
local inv = Mat4.inverseFull(m1) or Mat4.identity()
|
||||||
|
local vx, vy = Mat4.point(inv, e1[1], e1[2], e1[3])
|
||||||
|
local l = math.sqrt(vx * vx + vy * vy)
|
||||||
|
local angle2 = if l > 0 then 0.5 * math.atan2(vy / l, vx / l) else 0
|
||||||
|
local q2 = { 0, 0, math.sin(angle2), math.cos(angle2) }
|
||||||
|
local _ = e2
|
||||||
|
return Mat4.mul(m1, Mat4.fromQuat(q2))
|
||||||
|
end
|
||||||
|
|
||||||
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number): number?
|
||||||
local addr = ob.block and ob.block.addr
|
local addr = ob.block and ob.block.addr
|
||||||
if addr ~= nil and ctx.objects[addr] then
|
if addr ~= nil and ctx.objects[addr] then
|
||||||
@@ -564,6 +615,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
local parentOb = ob:deref("parent", 0, "Object")
|
local parentOb = ob:deref("parent", 0, "Object")
|
||||||
local parentNode: number? = under
|
local parentNode: number? = under
|
||||||
|
local vertexFallback = false
|
||||||
local prefix = Mat4.identity()
|
local prefix = Mat4.identity()
|
||||||
local partype = ob:num("partype") or 0
|
local partype = ob:num("partype") or 0
|
||||||
if parentOb then
|
if parentOb then
|
||||||
@@ -572,6 +624,7 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
parentNode = pn
|
parentNode = pn
|
||||||
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
prefix = mat4(ob, "parentinv") or Mat4.identity()
|
||||||
if partype == PARBONE then
|
if partype == PARBONE then
|
||||||
|
-- the joint node is the bone's head frame (rest x pose); Blender parents to the tail
|
||||||
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
local info = parentOb.block and ctx.armatures[parentOb.block.addr]
|
||||||
local bone = ob:str("parsubstr") or ""
|
local bone = ob:str("parsubstr") or ""
|
||||||
local j = info and info.names[bone]
|
local j = info and info.names[bone]
|
||||||
@@ -580,6 +633,26 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local len = info.bones[j]:num("length") or 0
|
local len = info.bones[j]:num("length") or 0
|
||||||
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
prefix = Mat4.mul(Mat4.translation(0, len, 0), prefix)
|
||||||
end
|
end
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
local idx = { ob:num("par1") or 0 }
|
||||||
|
if partype == PARVERT3 then
|
||||||
|
idx = { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
end
|
||||||
|
local vs = parentVertices(ctx, parentOb, idx)
|
||||||
|
if vs and partype == PARVERT3 then
|
||||||
|
local m = triFrame(vs[1], vs[2], vs[3])
|
||||||
|
m[13], m[14], m[15] = (vs[1][1] + vs[2][1] + vs[3][1]) / 3, (vs[1][2] + vs[2][2] + vs[3][2]) / 3, (vs[1][3] + vs[2][3] + vs[3][3]) / 3
|
||||||
|
prefix = Mat4.mul(m, prefix)
|
||||||
|
elseif vs then
|
||||||
|
-- the parent's rotation and scale do not apply: world = T(parent world x vertex) x parentinv x basis,
|
||||||
|
-- expressed under the parent node for its saved world matrix
|
||||||
|
local pw = worldOf(ctx, pn)
|
||||||
|
local wx, wy, wz = Mat4.point(pw, vs[1][1], vs[1][2], vs[1][3])
|
||||||
|
local inv = Mat4.inverseFull(pw) or Mat4.identity()
|
||||||
|
prefix = Mat4.mul(Mat4.mul(inv, Mat4.translation(wx, wy, wz)), prefix)
|
||||||
|
else
|
||||||
|
vertexFallback = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -599,6 +672,20 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
local t = ob:num("type") or -1
|
local t = ob:num("type") or -1
|
||||||
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
local extras: { [string]: any } = { type = TYPE_NAME[t] or tostring(t) }
|
||||||
node.extras = { blend = extras }
|
node.extras = { blend = extras }
|
||||||
|
if parentOb then
|
||||||
|
local pt = PARENT_TYPE[partype] or tostring(partype)
|
||||||
|
if partype == PARSKEL and (parentOb:num("type") or -1) == 22 then
|
||||||
|
pt = "LATTICE"
|
||||||
|
end
|
||||||
|
extras.parent_type = pt
|
||||||
|
extras.matrix_parent_inverse = mat4(ob, "parentinv")
|
||||||
|
if partype == PARBONE then
|
||||||
|
extras.parent_bone = ob:str("parsubstr")
|
||||||
|
elseif partype == PARVERT1 or partype == PARVERT3 then
|
||||||
|
extras.parent_vertices = if partype == PARVERT1 then { ob:num("par1") or 0 } else { ob:num("par1") or 0, ob:num("par2") or 0, ob:num("par3") or 0 }
|
||||||
|
extras.parent_vertices_unresolved = if vertexFallback then true else nil -- parented to the object instead
|
||||||
|
end
|
||||||
|
end
|
||||||
local lay = ob:num("lay")
|
local lay = ob:num("lay")
|
||||||
if lay and ctx.f.version < 280 then
|
if lay and ctx.f.version < 280 then
|
||||||
extras.layers = lay
|
extras.layers = lay
|
||||||
@@ -611,14 +698,6 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
if bit32.band(vis, 4) ~= 0 then
|
if bit32.band(vis, 4) ~= 0 then
|
||||||
extras.hide_render = true
|
extras.hide_render = true
|
||||||
end
|
end
|
||||||
local mods = {}
|
|
||||||
for _, md in ob:list("modifiers") do
|
|
||||||
table.insert(mods, { name = md:sub("modifier") and (md:sub("modifier") :: Blend.View):str("name") or md:str("name") or "", type = (string.gsub(md.struct.name, "ModifierData$", "")) })
|
|
||||||
end
|
|
||||||
if #mods > 0 then
|
|
||||||
extras.modifiers = mods
|
|
||||||
ctx.meta.modifiers[node.name or tostring(idx)] = mods
|
|
||||||
end
|
|
||||||
if t == OB_ARMATURE then
|
if t == OB_ARMATURE then
|
||||||
armature(ctx, ob, idx)
|
armature(ctx, ob, idx)
|
||||||
elseif t == OB_CAMERA then
|
elseif t == OB_CAMERA then
|
||||||
@@ -632,6 +711,43 @@ local function object(ctx: Ctx, ob: Blend.View, under: number?, depth: number):
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- ------------------------------------------------------------------------------------------------ rigs
|
-- ------------------------------------------------------------------------------------------------ rigs
|
||||||
|
-- ModifierData.type names as the API gives them, from the struct name ("SimpleDeformModifierData" -> SIMPLE_DEFORM)
|
||||||
|
local MOD_NAME: { [string]: string } = {
|
||||||
|
LaplacianSmooth = "LAPLACIANSMOOTH", LaplacianDeform = "LAPLACIANDEFORM", WeightVGEdit = "VERTEX_WEIGHT_EDIT",
|
||||||
|
WeightVGMix = "VERTEX_WEIGHT_MIX", WeightVGProximity = "VERTEX_WEIGHT_PROXIMITY", UVProject = "UV_PROJECT",
|
||||||
|
UVWarp = "UV_WARP", MeshSeqCache = "MESH_SEQUENCE_CACHE", Softbody = "SOFT_BODY", ParticleSystem = "PARTICLE_SYSTEM",
|
||||||
|
ParticleInstance = "PARTICLE_INSTANCE", Fluidsim = "FLUID_SIMULATION", Smoke = "SMOKE", Surface = "SURFACE",
|
||||||
|
MeshToVolume = "MESH_TO_VOLUME", VolumeToMesh = "VOLUME_TO_MESH",
|
||||||
|
}
|
||||||
|
|
||||||
|
-- the modifier stack (ModifierData.mode: eModifierMode_Realtime 1, Render 2); ARMATURE with its settings
|
||||||
|
-- (ArmatureModifierData.deformflag: ARM_DEF_VGROUP 1, ENVELOPE 2, QUATERNION 4, INVERT_VGROUP 16)
|
||||||
|
local function modifiers(ob: Blend.View, resolve: Armature.Resolve): { { [string]: any } }
|
||||||
|
local out = {}
|
||||||
|
for _, md in ob:list("modifiers") do
|
||||||
|
local head = md:sub("modifier") or md
|
||||||
|
local raw = string.gsub(md.struct.name, "ModifierData$", "")
|
||||||
|
local kind = MOD_NAME[raw] or string.upper((string.gsub(raw, "(%l)(%u)", "%1_%2")))
|
||||||
|
local mode = head:num("mode") or 3
|
||||||
|
local e: { [string]: any } = { type = kind, name = head:str("name") or "" }
|
||||||
|
e.show_viewport = bit32.band(mode, 1) ~= 0
|
||||||
|
e.show_render = bit32.band(mode, 2) ~= 0
|
||||||
|
if kind == "ARMATURE" then
|
||||||
|
local flag = md:num("deformflag") or 1
|
||||||
|
e.object = resolve(md:deref("object", 0, "Object"))
|
||||||
|
e.use_vertex_groups = bit32.band(flag, 1) ~= 0
|
||||||
|
e.use_bone_envelopes = bit32.band(flag, 2) ~= 0
|
||||||
|
e.use_deform_preserve_volume = bit32.band(flag, 4) ~= 0
|
||||||
|
e.invert_vertex_group = bit32.band(flag, 16) ~= 0
|
||||||
|
e.use_multi_modifier = (md:num("multi") or 0) ~= 0
|
||||||
|
local vg = md:str("defgrp_name")
|
||||||
|
e.vertex_group = if vg and vg ~= "" then vg else nil
|
||||||
|
end
|
||||||
|
table.insert(out, e)
|
||||||
|
end
|
||||||
|
return out
|
||||||
|
end
|
||||||
|
|
||||||
local function rigs(ctx: Ctx)
|
local function rigs(ctx: Ctx)
|
||||||
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
local target, shape = resolver(ctx, false), resolver(ctx, true)
|
||||||
for node = 1, #ctx.scene.nodes do
|
for node = 1, #ctx.scene.nodes do
|
||||||
@@ -644,6 +760,11 @@ local function rigs(ctx: Ctx)
|
|||||||
if #list > 0 then
|
if #list > 0 then
|
||||||
extras.constraints = list
|
extras.constraints = list
|
||||||
end
|
end
|
||||||
|
local mods = modifiers(ob, target)
|
||||||
|
if #mods > 0 then
|
||||||
|
extras.modifiers = mods
|
||||||
|
ctx.meta.modifiers[ctx.scene.nodes[node].name or tostring(node)] = mods
|
||||||
|
end
|
||||||
local id = ob:sub("id")
|
local id = ob:sub("id")
|
||||||
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
extras.props = Driver.props(id and id:deref("properties", 0, "IDProperty"))
|
||||||
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
local drivers = Driver.list(ctx.f, ob:deref("adt", 0, "AnimData"), target)
|
||||||
@@ -700,6 +821,10 @@ local function widgetList(ctx: Ctx): { { [string]: any } }
|
|||||||
if node then
|
if node then
|
||||||
w.node = node
|
w.node = node
|
||||||
w.mesh = ctx.scene.nodes[node].mesh
|
w.mesh = ctx.scene.nodes[node].mesh
|
||||||
|
local e = ctx.scene.nodes[node].extras :: any
|
||||||
|
if e and e.blend then
|
||||||
|
e.blend.widget = true
|
||||||
|
end
|
||||||
elseif t == OB_MESH then
|
elseif t == OB_MESH then
|
||||||
w.mesh = (meshOf(ctx, ob, true))
|
w.mesh = (meshOf(ctx, ob, true))
|
||||||
end
|
end
|
||||||
|
|||||||
+37
-2
@@ -257,9 +257,44 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
|
|||||||
local i = objects[o.name]
|
local i = objects[o.name]
|
||||||
t:check(i, label .. ": object " .. o.name)
|
t:check(i, label .. ": object " .. o.name)
|
||||||
if i then
|
if i then
|
||||||
t:check(nearList(W[i], o.world, 1e-4), label .. ": " .. o.name .. " world\n got " .. fmt(W[i]) .. "\n want " .. fmt(o.world))
|
-- with the reference's constraints muted (the reader does not evaluate them: bone-parented objects follow
|
||||||
|
-- the stored pose)
|
||||||
|
local wantW = o.worldMuted or o.world
|
||||||
|
t:check(nearList(W[i], wantW, 1e-4), label .. ": " .. o.name .. " world\n got " .. fmt(W[i]) .. "\n want " .. fmt(wantW))
|
||||||
local e = scene.nodes[i].extras.blend
|
local e = scene.nodes[i].extras.blend
|
||||||
t:check((e.hide_viewport == true) == o.hide_viewport and (e.hide_render == true) == o.hide_render, label .. ": " .. o.name .. " hide flags")
|
t:check((e.hide_viewport == true) == o.hide_viewport and (e.hide_render == true) == o.hide_render, label .. ": " .. o.name .. " hide flags")
|
||||||
|
-- parenting and the modifier stack as the API names them
|
||||||
|
if o.parent ~= "" and o.parent_type then
|
||||||
|
t:eq(e.parent_type, o.parent_type, label .. ": " .. o.name .. " parent_type")
|
||||||
|
t:eq(e.parent_bone or "", if o.parent_type == "BONE" then o.parent_bone else "", label .. ": " .. o.name .. " parent_bone")
|
||||||
|
if o.parent_info and o.parent_info.matrix_parent_inverse then
|
||||||
|
t:check(nearList(e.matrix_parent_inverse, o.parent_info.matrix_parent_inverse, 1e-5), label .. ": " .. o.name .. " matrix_parent_inverse")
|
||||||
|
if string.sub(o.parent_type, 1, 6) == "VERTEX" then
|
||||||
|
local want = table.move(o.parent_info.parent_vertices, 1, if o.parent_type == "VERTEX" then 1 else 3, 1, {})
|
||||||
|
t:check(same(e.parent_vertices, want, 0) and not e.parent_vertices_unresolved, label .. ": " .. o.name .. " parent_vertices")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- Blender's versioning adds modifiers to old files (particle systems before 2.5, "Auto Smooth" before 4.1)
|
||||||
|
local modsRef = {}
|
||||||
|
for _, rm in o.modifier_info or {} do
|
||||||
|
if not (src.version < 401 and rm.type == "NODES" and rm.name == "Auto Smooth") then
|
||||||
|
table.insert(modsRef, rm)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if o.modifier_info and src.version >= 250 then
|
||||||
|
t:eq(#(e.modifiers or {}), #modsRef, label .. ": " .. o.name .. " modifiers")
|
||||||
|
for k, rm in modsRef do
|
||||||
|
local m = (e.modifiers or {})[k] or {}
|
||||||
|
for key, want in rm do
|
||||||
|
local got = m[key]
|
||||||
|
if key == "object" and type(got) == "number" then
|
||||||
|
got = scene.nodes[got].name
|
||||||
|
end
|
||||||
|
t:check(same(got, want, 0), label .. ": " .. o.name .. " modifier " .. rm.name .. " " .. key .. ": got " .. tostring(got) .. ", want " .. tostring(want))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
checked.worlds += 1
|
checked.worlds += 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -836,7 +871,7 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
|
|||||||
for _, w in mb.widgets do
|
for _, w in mb.widgets do
|
||||||
t:check(shapes[w.name], label .. ": widget " .. w.name .. " is a custom shape")
|
t:check(shapes[w.name], label .. ": widget " .. w.name .. " is a custom shape")
|
||||||
shapes[w.name] = nil
|
shapes[w.name] = nil
|
||||||
t:check(w.node == nil or scene.nodes[w.node].name == w.name, label .. ": widget node")
|
t:check(w.node == nil or (scene.nodes[w.node].name == w.name and scene.nodes[w.node].extras.blend.widget == true), label .. ": widget node")
|
||||||
local m = w.mesh and scene.meshes[w.mesh]
|
local m = w.mesh and scene.meshes[w.mesh]
|
||||||
local lines = 0
|
local lines = 0
|
||||||
for _, p in m and m.primitives or {} do
|
for _, p in m and m.primitives or {} do
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
# action constraint; transform / armature / floor / limit distance / track to / locked
|
# action constraint; transform / armature / floor / limit distance / track to / locked
|
||||||
# track constraints; bone inheritance and b-bone settings; a saved pose basis; drivers
|
# track constraints; bone inheritance and b-bone settings; a saved pose basis; drivers
|
||||||
# (every variable type, keys, modifiers) on the rig, its data and the shape keys; custom
|
# (every variable type, keys, modifiers) on the rig, its data and the shape keys; custom
|
||||||
# properties on pose bones, bones and objects
|
# properties on pose bones, bones and objects; vertex, vertex-triangle and lattice parents,
|
||||||
|
# an object parented to a bone
|
||||||
# mat_<ver>.blend material graphs: images through Mix / MixRGB, Hue-Saturation, Bright-Contrast, Gamma,
|
# mat_<ver>.blend material graphs: images through Mix / MixRGB, Hue-Saturation, Bright-Contrast, Gamma,
|
||||||
# Invert, RGB Curves, Color Ramp, reroutes and node groups; roughness images linked directly
|
# Invert, RGB Curves, Color Ramp, reroutes and node groups; roughness images linked directly
|
||||||
# or through a ramp; vertex colours; bump; unresolved links; a UDIM image with two tiles
|
# or through a ramp; vertex colours; bump; unresolved links; a UDIM image with two tiles
|
||||||
@@ -732,6 +733,37 @@ def ctl_file():
|
|||||||
smile.value = v
|
smile.value = v
|
||||||
smile.keyframe_insert("value", frame=f)
|
smile.keyframe_insert("value", frame=f)
|
||||||
smile.value = 1.5
|
smile.value = 1.5
|
||||||
|
# vertex / triangle / lattice / bone parents
|
||||||
|
from mathutils import Matrix
|
||||||
|
anchor = link(bpy.data.objects.new("Anchor", mesh("AnchorMesh", [(0, 0, 0), (1, 0.2, 0), (0.3, 1, 0.4), (0.5, 0.5, 1)], [(0, 1, 2), (0, 2, 3)])))
|
||||||
|
anchor.location, anchor.rotation_euler, anchor.scale = (2, -2, 1), (0.3, 0.2, 0.5), (1, 1.5, 1)
|
||||||
|
update()
|
||||||
|
vkid = link(bpy.data.objects.new("VertKid", None))
|
||||||
|
vkid.parent, vkid.parent_type = anchor, "VERTEX"
|
||||||
|
vkid.parent_vertices = (2, 0, 0)
|
||||||
|
vkid.location = (0.1, 0.2, 0.3)
|
||||||
|
vkid.matrix_parent_inverse = Matrix.Translation((0.5, 0, -0.25))
|
||||||
|
tkid = link(bpy.data.objects.new("TriKid", None))
|
||||||
|
tkid.parent, tkid.parent_type = anchor, "VERTEX_3"
|
||||||
|
tkid.parent_vertices = (1, 2, 3)
|
||||||
|
tkid.location, tkid.rotation_euler = (0.2, 0, 0.1), (0.1, 0.4, 0)
|
||||||
|
lat = link(bpy.data.objects.new("Lat", bpy.data.lattices.new("LatData")))
|
||||||
|
lat.location = (-2, 1, 0)
|
||||||
|
caged = link(bpy.data.objects.new("Caged", mesh("CagedMesh", [(0, 0, 0), (1, 0, 0), (0, 1, 0)], [(0, 1, 2)])))
|
||||||
|
caged.parent = lat
|
||||||
|
setp(caged, "parent_type", "LATTICE")
|
||||||
|
caged.location = (0.25, 0, 0)
|
||||||
|
caged.modifiers.new("Lattice", "LATTICE").object = lat
|
||||||
|
bkid = link(bpy.data.objects.new("BoneKid", None))
|
||||||
|
bkid.parent, bkid.parent_type, bkid.parent_bone = rig, "BONE", "lower"
|
||||||
|
bkid.location = (0.1, 0.05, 0)
|
||||||
|
face.modifiers["Armature"].use_multi_modifier = True
|
||||||
|
am = caged.modifiers.new("Unbound", "ARMATURE") # no object: deforms nothing, its settings are data
|
||||||
|
am.use_deform_preserve_volume, am.use_bone_envelopes, am.use_vertex_groups = True, True, False
|
||||||
|
am.vertex_group, am.invert_vertex_group = "spine", True
|
||||||
|
am.show_viewport = False
|
||||||
|
sub = wbox.modifiers.new("Smooth", "SUBSURF")
|
||||||
|
sub.show_render = False
|
||||||
# custom properties (ID properties)
|
# custom properties (ID properties)
|
||||||
props = pose["root"]
|
props = pose["root"]
|
||||||
props["ik_arm"] = 1.0
|
props["ik_arm"] = 1.0
|
||||||
|
|||||||
@@ -283,6 +283,16 @@ def action_info(act):
|
|||||||
return {"frame_range": [r6(act.frame_range[0]), r6(act.frame_range[1])], "curves": curves}
|
return {"frame_range": [r6(act.frame_range[0]), r6(act.frame_range[1])], "curves": curves}
|
||||||
|
|
||||||
|
|
||||||
|
def modifier_info(m):
|
||||||
|
e = {"type": m.type, "name": m.name, "show_viewport": m.show_viewport, "show_render": m.show_render}
|
||||||
|
if m.type == "ARMATURE":
|
||||||
|
e.update({"object": m.object.name if m.object else "", "use_vertex_groups": m.use_vertex_groups,
|
||||||
|
"use_bone_envelopes": m.use_bone_envelopes, "use_deform_preserve_volume": m.use_deform_preserve_volume,
|
||||||
|
"use_multi_modifier": m.use_multi_modifier, "vertex_group": m.vertex_group,
|
||||||
|
"invert_vertex_group": m.invert_vertex_group})
|
||||||
|
return e
|
||||||
|
|
||||||
|
|
||||||
def props_info(owner):
|
def props_info(owner):
|
||||||
out = {}
|
out = {}
|
||||||
for k in owner.keys():
|
for k in owner.keys():
|
||||||
@@ -422,6 +432,9 @@ def dump(path):
|
|||||||
"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)],
|
||||||
"collections": [c.name for c in ob.users_collection], "hide_viewport": ob.hide_viewport,
|
"collections": [c.name for c in ob.users_collection], "hide_viewport": ob.hide_viewport,
|
||||||
"hide_render": ob.hide_render, "props": props_info(ob), "drivers": drivers_of(ob),
|
"hide_render": ob.hide_render, "props": props_info(ob), "drivers": drivers_of(ob),
|
||||||
|
"parent_info": {"matrix_parent_inverse": [r6(x) for x in mat(ob.matrix_parent_inverse)],
|
||||||
|
"parent_vertices": list(ob.parent_vertices)} if ob.parent else {},
|
||||||
|
"modifier_info": [modifier_info(m) for m in ob.modifiers],
|
||||||
"data_drivers": drivers_of(ob.data) if ob.data is not None and ob.type in ("ARMATURE", "MESH") else [],
|
"data_drivers": drivers_of(ob.data) if ob.data is not None and ob.type in ("ARMATURE", "MESH") else [],
|
||||||
"shape_key_drivers": drivers_of(ob.data.shape_keys) if ob.type == "MESH" and ob.data.shape_keys else []}
|
"shape_key_drivers": drivers_of(ob.data.shape_keys) if ob.type == "MESH" and ob.data.shape_keys else []}
|
||||||
if ob.type == "MESH":
|
if ob.type == "MESH":
|
||||||
@@ -465,6 +478,8 @@ def dump(path):
|
|||||||
for c in pb.constraints:
|
for c in pb.constraints:
|
||||||
c.mute = True
|
c.mute = True
|
||||||
sc.frame_set(sc.frame_current)
|
sc.frame_set(sc.frame_current)
|
||||||
|
for o in ref["objects"]:
|
||||||
|
o["worldMuted"] = [r6(x) for x in mat(bpy.data.objects[o["name"]].matrix_world)]
|
||||||
ref["posedBones"] = {ob.name + "/" + pb.name: [r6(x) for x in mat(ob.matrix_world @ pb.matrix)]
|
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}
|
for ob in obs if ob.type == "ARMATURE" for pb in ob.pose.bones}
|
||||||
poses = []
|
poses = []
|
||||||
@@ -479,7 +494,7 @@ def dump(path):
|
|||||||
p["bones"][ob.name + "/" + pb.name] = [r6(x) for x in mat(ob.matrix_world @ pb.matrix)]
|
p["bones"][ob.name + "/" + pb.name] = [r6(x) for x in mat(ob.matrix_world @ pb.matrix)]
|
||||||
if ob.type == "MESH" and ob.data.shape_keys:
|
if ob.type == "MESH" and ob.data.shape_keys:
|
||||||
p["shapes"][ob.name] = [r6(b.value) for b in ob.data.shape_keys.key_blocks]
|
p["shapes"][ob.name] = [r6(b.value) for b in ob.data.shape_keys.key_blocks]
|
||||||
if ob.type == "MESH" and any(m.type == "ARMATURE" for m in ob.modifiers) and f == math.floor(f):
|
if ob.type == "MESH" and any(m.type == "ARMATURE" and m.object and m.show_viewport for m in ob.modifiers) and f == math.floor(f):
|
||||||
ev = ob.evaluated_get(bpy.context.evaluated_depsgraph_get())
|
ev = ob.evaluated_get(bpy.context.evaluated_depsgraph_get())
|
||||||
em = ev.to_mesh()
|
em = ev.to_mesh()
|
||||||
w = ob.matrix_world
|
w = ob.matrix_world
|
||||||
|
|||||||
Reference in new issue
Block a user