diff --git a/tree.py b/tree.py index a963311..28619f4 100644 --- a/tree.py +++ b/tree.py @@ -7,10 +7,16 @@ def build_tree(gltf): if "children" not in node: continue for child_ix in node["children"]: - assert child_ix > node_ix, (child_ix, node_ix) assert child_ix not in parents parents[child_ix] = node_ix + for skin in gltf.json["skins"]: + seen = set() + for joint in skin["joints"]: + parent = parents[joint] + assert parent in seen or parent not in skin["joints"], (parent, joint, seen) + seen.add(joint) + return parents if __name__ == "__main__":