Continue Blender Web parity task handoff
This commit is contained in:
49
tools/web/generated/M16-GAP-00233.py
Normal file
49
tools/web/generated/M16-GAP-00233.py
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
ARMATURE_NAME = "WebGapArmatureCopyBoneColorArmature"
|
||||
OBJECT_NAME = "WebGapArmatureCopyBoneColorObject"
|
||||
SOURCE_BONE = "WebGapArmatureCopyBoneColorSource"
|
||||
SELECTED_BONE = "WebGapArmatureCopyBoneColorSelected"
|
||||
UNSELECTED_BONE = "WebGapArmatureCopyBoneColorUnselected"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00233.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)
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.object.mode_set(mode="EDIT")
|
||||
bones = {}
|
||||
for name, x in ((SOURCE_BONE, 0.0), (SELECTED_BONE, 1.0), (UNSELECTED_BONE, 2.0)):
|
||||
bone = armature.edit_bones.new(name)
|
||||
bone.head = (x, 0.0, 0.0)
|
||||
bone.tail = (x, 1.0, 0.0)
|
||||
bones[name] = bone
|
||||
source = bones[SOURCE_BONE]
|
||||
source.color.palette = "CUSTOM"
|
||||
source.color.custom.normal = (0.12, 0.24, 0.36)
|
||||
source.color.custom.select = (0.42, 0.54, 0.66)
|
||||
source.color.custom.active = (0.72, 0.84, 0.96)
|
||||
bones[SELECTED_BONE].color.palette = "THEME04"
|
||||
bones[UNSELECTED_BONE].color.palette = "THEME05"
|
||||
for bone in bones.values():
|
||||
bone.select = True
|
||||
bones[UNSELECTED_BONE].select = False
|
||||
armature.edit_bones.active = source
|
||||
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