Continue Blender Web parity task handoff
This commit is contained in:
45
tools/web/generated/M16-GAP-00216.py
Normal file
45
tools/web/generated/M16-GAP-00216.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
ARMATURE_NAME = "WebGapArmatureAssignArmature"
|
||||
OBJECT_NAME = "WebGapArmatureAssignObject"
|
||||
SOURCE_COLLECTION = "WebGapArmatureAssignSource"
|
||||
TARGET_COLLECTION = "WebGapArmatureAssignTarget"
|
||||
PARENT_NAME = "WebGapArmatureAssignParent"
|
||||
CHILD_NAME = "WebGapArmatureAssignChild"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00216.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
armature = bpy.data.armatures.new(ARMATURE_NAME)
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, armature)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
source = armature.collections.new(SOURCE_COLLECTION)
|
||||
armature.collections.new(TARGET_COLLECTION)
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.object.mode_set(mode="EDIT")
|
||||
parent = armature.edit_bones.new(PARENT_NAME)
|
||||
parent.head = (0.0, 0.0, 0.0)
|
||||
parent.tail = (0.0, 0.0, 2.0)
|
||||
child = armature.edit_bones.new(CHILD_NAME)
|
||||
child.head = (0.0, 0.0, 2.0)
|
||||
child.tail = (0.0, 1.0, 3.0)
|
||||
child.parent = parent
|
||||
child.use_connect = False
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
source.assign(armature.bones[CHILD_NAME])
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user