Files
workinf_Blender_Wasm/tools/web/generated/M16-GAP-00259.py
mes123456 9f43244982
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled
Continue Blender Web parity task handoff
2026-08-23 05:47:21 -04:00

27 lines
1.6 KiB
Python

#!/usr/bin/env python3
import pathlib
import sys
import bpy
ARMATURE_NAME = "WebGapArmatureShortestPathArmature"
OBJECT_NAME = "WebGapArmatureShortestPathObject"
ROOT_BONE = "WebGapArmatureShortestPathRoot"
CHILD_BONE = "WebGapArmatureShortestPathChild"
GRANDCHILD_BONE = "WebGapArmatureShortestPathGrandchild"
OTHER_BONE = "WebGapArmatureShortestPathOther"
def main():
args = sys.argv[sys.argv.index("--") + 1:]
if len(args) != 1: raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00259.py -- OUTPUT")
bpy.ops.wm.read_factory_settings(use_empty=True)
arm = bpy.data.armatures.new(ARMATURE_NAME); obj = bpy.data.objects.new(OBJECT_NAME, arm); bpy.context.scene.collection.objects.link(obj)
bpy.context.view_layer.objects.active = obj; obj.select_set(True); bpy.ops.object.mode_set(mode="EDIT")
root = arm.edit_bones.new(ROOT_BONE); root.head=(0,0,0); root.tail=(0,1,0)
child = arm.edit_bones.new(CHILD_BONE); child.head=(0,1,0); child.tail=(0,2,0); child.parent=root; child.use_connect=True
grand = arm.edit_bones.new(GRANDCHILD_BONE); grand.head=(0,2,0); grand.tail=(0,3,0); grand.parent=child; grand.use_connect=True
other = arm.edit_bones.new(OTHER_BONE); other.head=(2,0,0); other.tail=(2,1,0)
for bone in (root, child, grand): bone.select=True; bone.select_head=True; bone.select_tail=True
other.select=False; other.select_head=False; other.select_tail=False; arm.edit_bones.active=root
bpy.ops.object.mode_set(mode="OBJECT"); bpy.ops.wm.save_as_mainfile(filepath=str(pathlib.Path(args[0]).resolve()), check_existing=False, compress=True)
if __name__ == "__main__": main()