Reorganize Blender Web execution around capabilities
This commit is contained in:
37
tools/web/generated/M16-GAP-00276.py
Normal file
37
tools/web/generated/M16-GAP-00276.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
LIBRARY_NAME = "WebGapAssetClearSingle.blend"
|
||||
OBJECT_NAME = "WebGapAssetClearSingleObject"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00276.py -- OUTPUT")
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
source = output.with_name(LIBRARY_NAME)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapAssetClearSingleMesh")
|
||||
mesh.from_pydata([(-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)], [], [(0, 1, 2)])
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(source), check_existing=False, compress=True)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
with bpy.data.libraries.load(str(source), link=True) as (data_from, data_to):
|
||||
if OBJECT_NAME not in data_from.objects:
|
||||
raise RuntimeError("asset-clear-single source object is missing")
|
||||
data_to.objects = [OBJECT_NAME]
|
||||
linked = data_to.objects[0]
|
||||
if linked is None:
|
||||
raise RuntimeError("asset-clear-single linked object is missing")
|
||||
bpy.context.scene.collection.objects.link(linked)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
37
tools/web/generated/M16-GAP-00277.py
Normal file
37
tools/web/generated/M16-GAP-00277.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
LIBRARY_NAME = "WebGapAssetLibraryRefresh.blend"
|
||||
OBJECT_NAME = "WebGapAssetLibraryRefreshObject"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00277.py -- OUTPUT")
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
source = output.with_name(LIBRARY_NAME)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapAssetLibraryRefreshMesh")
|
||||
mesh.from_pydata([(-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)], [], [(0, 1, 2)])
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(source), check_existing=False, compress=True)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
with bpy.data.libraries.load(str(source), link=True) as (data_from, data_to):
|
||||
if OBJECT_NAME not in data_from.objects:
|
||||
raise RuntimeError("asset-library-refresh source object is missing")
|
||||
data_to.objects = [OBJECT_NAME]
|
||||
linked = data_to.objects[0]
|
||||
if linked is None:
|
||||
raise RuntimeError("asset-library-refresh linked object is missing")
|
||||
bpy.context.scene.collection.objects.link(linked)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
37
tools/web/generated/M16-GAP-00278.py
Normal file
37
tools/web/generated/M16-GAP-00278.py
Normal file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
LIBRARY_NAME = "WebGapAssetLibraryReloadListing.blend"
|
||||
OBJECT_NAME = "WebGapAssetLibraryReloadListingObject"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00278.py -- OUTPUT")
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
source = output.with_name(LIBRARY_NAME)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapAssetLibraryReloadListingMesh")
|
||||
mesh.from_pydata([(-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)], [], [(0, 1, 2)])
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(source), check_existing=False, compress=True)
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
with bpy.data.libraries.load(str(source), link=True) as (data_from, data_to):
|
||||
if OBJECT_NAME not in data_from.objects:
|
||||
raise RuntimeError("asset-library-reload-listing source object is missing")
|
||||
data_to.objects = [OBJECT_NAME]
|
||||
linked = data_to.objects[0]
|
||||
if linked is None:
|
||||
raise RuntimeError("asset-library-reload-listing linked object is missing")
|
||||
bpy.context.scene.collection.objects.link(linked)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
36
tools/web/generated/M16-GAP-00279.py
Normal file
36
tools/web/generated/M16-GAP-00279.py
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
OBJECT_NAME = "WebGapAssetMarkObject"
|
||||
MESH_NAME = "WebGapAssetMarkMesh"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit(
|
||||
"usage: blender -b --factory-startup --python M16-GAP-00279.py -- OUTPUT"
|
||||
)
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new(MESH_NAME)
|
||||
mesh.from_pydata(((-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)), (), ((0, 1, 2),))
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
|
||||
# Background mode has no editor ID context for the operator. Seed the persisted asset record
|
||||
# with the same data API used by Blender's asset system.
|
||||
obj.asset_mark()
|
||||
obj.asset_data.author = "M16 Fixture"
|
||||
obj.asset_data.description = "Asset mark operator fixture"
|
||||
obj.asset_data.tags.new("operator-mark")
|
||||
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
35
tools/web/generated/M16-GAP-00280.py
Normal file
35
tools/web/generated/M16-GAP-00280.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
OBJECT_NAME = "WebGapAssetMarkSingleObject"
|
||||
MESH_NAME = "WebGapAssetMarkSingleMesh"
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit(
|
||||
"usage: blender -b --factory-startup --python M16-GAP-00280.py -- OUTPUT"
|
||||
)
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new(MESH_NAME)
|
||||
mesh.from_pydata(((-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)), (), ((0, 1, 2),))
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
|
||||
# Background mode has no editor ID context; seed the persisted single-asset record.
|
||||
obj.asset_mark()
|
||||
obj.asset_data.author = "M16 Fixture"
|
||||
obj.asset_data.description = "Asset mark single operator fixture"
|
||||
obj.asset_data.tags.new("operator-mark-single")
|
||||
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
50
tools/web/generated/M16-GAP-00281.py
Normal file
50
tools/web/generated/M16-GAP-00281.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
LIBRARY_NAME = "WebGapOpenContaining.blend"
|
||||
OBJECT_NAME = "WebGapOpenContainingObject"
|
||||
|
||||
|
||||
def reset():
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
|
||||
|
||||
def create_source(path):
|
||||
reset()
|
||||
mesh = bpy.data.meshes.new("WebGapOpenContainingMesh")
|
||||
mesh.from_pydata([(-1.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)], [], [(0, 1, 2)])
|
||||
obj = bpy.data.objects.new(OBJECT_NAME, mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(path), check_existing=False, compress=True)
|
||||
|
||||
|
||||
def create_fixture(output):
|
||||
source = output.with_name(LIBRARY_NAME)
|
||||
create_source(source)
|
||||
reset()
|
||||
with bpy.data.libraries.load(str(source), link=True) as (data_from, data_to):
|
||||
if OBJECT_NAME not in data_from.objects:
|
||||
raise RuntimeError("open-containing source object is missing")
|
||||
data_to.objects = [OBJECT_NAME]
|
||||
linked = data_to.objects[0]
|
||||
if linked is None:
|
||||
raise RuntimeError("open-containing linked object is missing")
|
||||
bpy.context.scene.collection.objects.link(linked)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(output), check_existing=False, compress=True)
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1 :]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00281.py -- OUTPUT")
|
||||
output = pathlib.Path(arguments[0]).resolve()
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
create_fixture(output)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user