12 lines
1.2 KiB
Python
12 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
import pathlib, sys, bpy
|
|
|
|
ARMATURE_NAME="WebGapArmatureSubdivideArmature"; OBJECT_NAME="WebGapArmatureSubdivideObject"; SOURCE_BONE="WebGapArmatureSubdivideSource"; OTHER_BONE="WebGapArmatureSubdivideOther"
|
|
def main():
|
|
args=sys.argv[sys.argv.index("--")+1:]
|
|
if len(args)!=1: raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00261.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")
|
|
source=arm.edit_bones.new(SOURCE_BONE); source.head=(0,0,0); source.tail=(0,1,0); other=arm.edit_bones.new(OTHER_BONE); other.head=(2,0,0); other.tail=(2,1,0); source.select=True; source.select_head=True; source.select_tail=True; other.select=False; other.select_head=False; other.select_tail=False; arm.edit_bones.active=source
|
|
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()
|