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

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

No files matched your search

+37 -2
View File
@@ -257,9 +257,44 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
local i = objects[o.name]
t:check(i, label .. ": object " .. o.name)
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
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
end
end
@@ -836,7 +871,7 @@ for _, tag in { "old", "279", "293", "35", "41", "cur" } do
for _, w in mb.widgets do
t:check(shapes[w.name], label .. ": widget " .. w.name .. " is a custom shape")
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 lines = 0
for _, p in m and m.primitives or {} do