Complete M16 action select circle parity
This commit is contained in:
66
tools/web/check-action-bake-keys-desktop.py
Normal file
66
tools/web/check-action-bake-keys-desktop.py
Normal file
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapBakeKeysObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapBakeKeysObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-bake-keys-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapBakeKeysObjectAction" or any(len(channel["frames"]) != 5 for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected bake_keys result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-bake-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"bake_keys save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00113",
|
||||
"operation": "ACTION_BAKE_KEYS_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(f"action-bake-keys-desktop-ok channels={len(after['channels'])} bakedFrames=5 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
57
tools/web/check-action-clean-desktop.py
Normal file
57
tools/web/check-action-clean-desktop.py
Normal file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import os
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapCleanObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapCleanObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-clean-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapCleanObjectAction" or any(len(channel["frames"]) != 1 for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.clean result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-clean-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.clean save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00114", "operation": "ACTION_CLEAN_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "threshold": 0.01, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(f"action-clean-desktop-ok channels={len(after['channels'])} remainingFrames=1 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
69
tools/web/check-action-clickselect-desktop.py
Normal file
69
tools/web/check-action-clickselect-desktop.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapClickSelectObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapClickSelectObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-clickselect-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = [[False, True, False]] * 3
|
||||
if before["name"] != "WebGapClickSelectObjectAction" or [channel["selected"] for channel in before["channels"]] != expected:
|
||||
raise RuntimeError(f"unexpected clickselect result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-clickselect-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.clickselect save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00115",
|
||||
"operation": "ACTION_CLICKSELECT_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"click": {"frame": 3.0, "column": True, "deselectAll": True},
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-clickselect-desktop-ok channels=3 selectedFrame=3 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
80
tools/web/check-action-copy-desktop.py
Normal file
80
tools/web/check-action-copy-desktop.py
Normal file
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapCopyObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapCopyObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-copy-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = [[False, True, False]] * 3
|
||||
if before["name"] != "WebGapCopyObjectAction" or [channel["selected"] for channel in before["channels"]] != expected:
|
||||
raise RuntimeError(f"unexpected action.copy source selection: {before}")
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if "FINISHED" not in bpy.ops.action.copy():
|
||||
raise RuntimeError("ACTION_OT_copy did not finish")
|
||||
after_copy = action_report()
|
||||
if after_copy != before:
|
||||
raise RuntimeError(f"action.copy changed Main data: {before} != {after_copy}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-copy-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.copy save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00116",
|
||||
"operation": "ACTION_COPY_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"copiedFrames": [3.0],
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"mainMutation": "NONE",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-copy-desktop-ok channels=3 copiedFrame=3 mainMutation=none saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
68
tools/web/check-action-delete-desktop.py
Normal file
68
tools/web/check-action-delete-desktop.py
Normal file
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapDeleteObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapDeleteObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-delete-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapDeleteObjectAction" or any(channel["frames"] != [1.0, 5.0] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.delete result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-delete-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.delete save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00117",
|
||||
"operation": "ACTION_DELETE_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"deletedFrames": [3.0],
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-delete-desktop-ok channels=3 deletedFrame=3 remainingFrames=1,5 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
70
tools/web/check-action-duplicate-desktop.py
Normal file
70
tools/web/check-action-duplicate-desktop.py
Normal file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapDuplicateObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapDuplicateObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-duplicate-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected_frames = [1.0, 3.0, 3.0, 5.0]
|
||||
expected_selected = [False, False, True, False]
|
||||
if before["name"] != "WebGapDuplicateObjectAction" or any(channel["frames"] != expected_frames or channel["selected"] != expected_selected for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.duplicate result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-duplicate-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.duplicate save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00118",
|
||||
"operation": "ACTION_DUPLICATE_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"duplicatedFrames": [3.0],
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-duplicate-desktop-ok channels=3 duplicatedFrame=3 frames=1,3,3,5 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
69
tools/web/check-action-duplicate-move-desktop.py
Normal file
69
tools/web/check-action-duplicate-move-desktop.py
Normal file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapDuplicateMoveObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapDuplicateMoveObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-duplicate-move-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapDuplicateMoveObjectAction" or any(channel["frames"] != [1.0, 3.0, 5.0] or channel["selected"] != [False, False, True] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.duplicate_move result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-duplicate-move-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.duplicate_move save/reopen drift: {before} != {after}")
|
||||
report = {
|
||||
"schemaVersion": 1,
|
||||
"task": "M16-GAP-00119",
|
||||
"operation": "ACTION_DUPLICATE_MOVE_DESKTOP",
|
||||
"fixture": str(fixture),
|
||||
"fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(),
|
||||
"duplicatedFrame": 3.0,
|
||||
"timeOffset": 2.0,
|
||||
"action": after,
|
||||
"saveReopen": "EXACT",
|
||||
"blenderVersion": bpy.app.version_string,
|
||||
}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-duplicate-move-desktop-ok channels=3 sourceFrame=3 movedFrame=5 offset=2 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
60
tools/web/check-action-easing-type-desktop.py
Normal file
60
tools/web/check-action-easing-type-desktop.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapEasingTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapEasingTypeObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"easing": [keyframe.easing for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-easing-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = ["AUTO", "EASE_IN_OUT", "AUTO"]
|
||||
if before["name"] != "WebGapEasingTypeObjectAction" or any(channel["easing"] != expected for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.easing_type result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-easing-type-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.easing_type save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00120", "operation": "ACTION_EASING_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "easingType": "EASE_IN_OUT", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-easing-type-desktop-ok channels=3 frame=3 easing=EASE_IN_OUT saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
53
tools/web/check-action-extrapolation-type-desktop.py
Normal file
53
tools/web/check-action-extrapolation-type-desktop.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapExtrapolationTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapExtrapolationTypeObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "extrapolation": curve.extrapolation})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-extrapolation-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapExtrapolationTypeObjectAction" or any(channel["extrapolation"] != "LINEAR" for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.extrapolation_type result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-extrapolation-type-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.extrapolation_type save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00121", "operation": "ACTION_EXTRAPOLATION_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "extrapolationType": "LINEAR", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-extrapolation-type-desktop-ok channels=3 extrapolation=LINEAR saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
54
tools/web/check-action-frame-jump-desktop.py
Normal file
54
tools/web/check-action-frame-jump-desktop.py
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapFrameJumpObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapFrameJumpObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-frame-jump-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if bpy.context.scene.frame_current != 5 or any(channel["selected"] != [False, False, True] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.frame_jump result: frame={bpy.context.scene.frame_current} action={before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-frame-jump-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
frame_after = bpy.context.scene.frame_current
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after or frame_after != 5:
|
||||
raise RuntimeError("action.frame_jump save/reopen drift")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00122", "operation": "ACTION_FRAME_JUMP_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "jumpedToFrame": 5, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-frame-jump-desktop-ok selectedFrame=5 currentFrame=5 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
42
tools/web/check-action-handle-type-desktop.py
Normal file
42
tools/web/check-action-handle-type-desktop.py
Normal file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapHandleTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapHandleTypeObject Action is missing")
|
||||
channels = []
|
||||
for layer in obj.animation_data.action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(k.co.x), 6) for k in curve.keyframe_points], "handleType": ["VECTOR" if k.handle_left_type == "VECTOR" else k.handle_left_type for k in curve.keyframe_points], "selected": [bool(k.select_control_point) for k in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": obj.animation_data.action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
args = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(args) != 2: raise SystemExit("usage: blender -b --python check-action-handle-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(v).resolve() for v in args)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapHandleTypeObjectAction" or any(c["handleType"] != ["VECTOR", "VECTOR", "VECTOR"] for c in before["channels"]): raise RuntimeError(f"unexpected action.handle_type result: {before}")
|
||||
fd, temp = tempfile.mkstemp(prefix="m16-action-handle-type-reopen-", suffix=".blend"); os.close(fd)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temp, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temp, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temp).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError("action.handle_type save/reopen drift")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00123", "operation": "ACTION_HANDLE_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "handleType": "VECTOR", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-handle-type-desktop-ok channels=3 frame=3 handle=VECTOR saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
60
tools/web/check-action-interpolation-type-desktop.py
Normal file
60
tools/web/check-action-interpolation-type-desktop.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapInterpolationTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapInterpolationTypeObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"interpolation": [keyframe.interpolation for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-interpolation-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = ["BEZIER", "LINEAR", "BEZIER"]
|
||||
if before["name"] != "WebGapInterpolationTypeObjectAction" or any(channel["interpolation"] != expected for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.interpolation_type result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-interpolation-type-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.interpolation_type save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00124", "operation": "ACTION_INTERPOLATION_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "interpolationType": "LINEAR", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-interpolation-type-desktop-ok channels=3 frame=3 interpolation=LINEAR saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
59
tools/web/check-action-keyframe-insert-desktop.py
Normal file
59
tools/web/check-action-keyframe-insert-desktop.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapKeyframeInsertObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapKeyframeInsertObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"values": [round(float(keyframe.co.y), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-keyframe-insert-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapKeyframeInsertObjectAction" or any(channel["frames"] != [1.0, 3.0, 5.0] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.keyframe_insert result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-keyframe-insert-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.keyframe_insert save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00125", "operation": "ACTION_KEYFRAME_INSERT_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "insertedFrame": 3, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-keyframe-insert-desktop-ok channels=3 insertedFrame=3 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
60
tools/web/check-action-keyframe-type-desktop.py
Normal file
60
tools/web/check-action-keyframe-type-desktop.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapKeyframeTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapKeyframeTypeObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"keyframeType": [keyframe.type for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-keyframe-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = ["KEYFRAME", "BREAKDOWN", "KEYFRAME"]
|
||||
if before["name"] != "WebGapKeyframeTypeObjectAction" or any(channel["keyframeType"] != expected for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.keyframe_type result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-keyframe-type-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.keyframe_type save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00126", "operation": "ACTION_KEYFRAME_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "keyframeType": "BREAKDOWN", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-keyframe-type-desktop-ok channels=3 frame=3 type=BREAKDOWN saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
46
tools/web/check-action-markers-make-local-desktop.py
Normal file
46
tools/web/check-action-markers-make-local-desktop.py
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapMarkersMakeLocalObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapMarkersMakeLocalObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
return {"name": action.name, "markers": sorted(({"name": marker.name, "frame": marker.frame} for marker in action.pose_markers), key=lambda value: (value["frame"], value["name"]))}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-markers-make-local-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before != {"name": "WebGapMarkersMakeLocalObjectAction", "markers": [{"name": "LocalActionMarker", "frame": 3}]}:
|
||||
raise RuntimeError(f"unexpected action.markers_make_local result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-markers-local-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.markers_make_local save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00127", "operation": "ACTION_MARKERS_MAKE_LOCAL_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "marker": after["markers"][0], "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-markers-make-local-desktop-ok markers=1 frame=3 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
60
tools/web/check-action-mirror-desktop.py
Normal file
60
tools/web/check-action-mirror-desktop.py
Normal file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapMirrorObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapMirrorObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({
|
||||
"path": curve.data_path,
|
||||
"index": curve.array_index,
|
||||
"frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points],
|
||||
"values": [round(float(keyframe.co.y), 6) for keyframe in curve.keyframe_points],
|
||||
"selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points],
|
||||
})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-mirror-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
expected = {0: [-1.0, -2.0, -4.0], 1: [-2.0, -4.0, -8.0], 2: [-3.0, -6.0, -12.0]}
|
||||
if before["name"] != "WebGapMirrorObjectAction" or any(channel["values"] != expected[channel["index"]] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.mirror result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-mirror-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.mirror save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00128", "operation": "ACTION_MIRROR_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "mirrorType": "XAXIS", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print("action-mirror-desktop-ok channels=3 type=XAXIS saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
46
tools/web/check-action-new-desktop.py
Normal file
46
tools/web/check-action-new-desktop.py
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapActionNewObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapActionNewObject new Action is missing")
|
||||
action = obj.animation_data.action
|
||||
return {"name": action.name, "channels": sum(1 for layer in action.layers for strip in layer.strips for bag in strip.channelbags for _ in bag.fcurves)}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-new-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] == "WebGapActionNewObjectAction" or before["channels"] != 3:
|
||||
raise RuntimeError(f"unexpected action.new result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-new-reopen-", suffix=".blend")
|
||||
os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True)
|
||||
bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False)
|
||||
after = action_report()
|
||||
finally:
|
||||
pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after:
|
||||
raise RuntimeError(f"action.new save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00129", "operation": "ACTION_NEW_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True)
|
||||
output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
print(f"action-new-desktop-ok name={after['name']} channels={after['channels']} saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
45
tools/web/check-action-paste-desktop.py
Normal file
45
tools/web/check-action-paste-desktop.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapPasteObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapPasteObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "values": [round(float(keyframe.co.y), 6) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-paste-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapPasteObjectAction" or any(channel["frames"] != [1.0, 3.0, 5.0, 7.0] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.paste result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-paste-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.paste save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00130", "operation": "ACTION_PASTE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "pastedFrame": 7, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-paste-desktop-ok channels=3 pastedFrame=7 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
31
tools/web/check-action-previewrange-set-desktop.py
Normal file
31
tools/web/check-action-previewrange-set-desktop.py
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-previewrange-set-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
scene = bpy.context.scene
|
||||
if not scene.use_preview_range or (scene.frame_preview_start, scene.frame_preview_end) != (1, 5):
|
||||
raise RuntimeError(f"unexpected action.previewrange_set result: use={scene.use_preview_range} range={(scene.frame_preview_start, scene.frame_preview_end)}")
|
||||
before = {"start": int(scene.frame_preview_start), "end": int(scene.frame_preview_end), "use": bool(scene.use_preview_range)}
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-previewrange-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = {"start": int(bpy.context.scene.frame_preview_start), "end": int(bpy.context.scene.frame_preview_end), "use": bool(bpy.context.scene.use_preview_range)}
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.previewrange_set save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00131", "operation": "ACTION_PREVIEWRANGE_SET_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "previewRange": {"start": after["start"], "end": after["end"]}, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-previewrange-set-desktop-ok range=1-5 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
40
tools/web/check-action-push-down-desktop.py
Normal file
40
tools/web/check-action-push-down-desktop.py
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def nla_report():
|
||||
obj = bpy.data.objects.get("WebGapPushDownObject")
|
||||
if obj is None or obj.animation_data is None:
|
||||
raise RuntimeError("WebGapPushDownObject animation data is missing")
|
||||
tracks = []
|
||||
for track in obj.animation_data.nla_tracks:
|
||||
tracks.append({"name": track.name, "strips": [{"name": strip.name, "action": strip.action.name if strip.action else None, "frameStart": round(float(strip.frame_start), 6), "frameEnd": round(float(strip.frame_end), 6)} for strip in track.strips]})
|
||||
return {"activeAction": obj.animation_data.action.name if obj.animation_data.action else None, "tracks": tracks}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-push-down-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = nla_report()
|
||||
if before["activeAction"] is not None or len(before["tracks"]) != 1 or len(before["tracks"][0]["strips"]) != 1:
|
||||
raise RuntimeError(f"unexpected action.push_down result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-push-down-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = nla_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.push_down save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00132", "operation": "ACTION_PUSH_DOWN_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "nla": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-push-down-desktop-ok tracks=1 strips=1 activeAction=none saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
45
tools/web/check-action-select-all-desktop.py
Normal file
45
tools/web/check-action-select-all-desktop.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapSelectAllObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapSelectAllObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-select-all-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapSelectAllObjectAction" or any(channel["selected"] != [True, True, True] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.select_all result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-select-all-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.select_all save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00133", "operation": "ACTION_SELECT_ALL_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "selection": "SELECT", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-select-all-desktop-ok channels=3 selected=all saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
45
tools/web/check-action-select-box-desktop.py
Normal file
45
tools/web/check-action-select-box-desktop.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapSelectBoxObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapSelectBoxObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-select-box-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapSelectBoxObjectAction" or any(channel["selected"] != [False, True, False] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.select_box result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-select-box-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.select_box save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00134", "operation": "ACTION_SELECT_BOX_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "selectedFrame": 3, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-select-box-desktop-ok channels=3 selectedFrame=3 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
45
tools/web/check-action-select-by-type-desktop.py
Normal file
45
tools/web/check-action-select-by-type-desktop.py
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapSelectByTypeObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapSelectByTypeObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "keyframeType": [keyframe.type for keyframe in curve.keyframe_points], "selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"]))
|
||||
return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2:
|
||||
raise SystemExit("usage: blender -b --python check-action-select-by-type-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments)
|
||||
bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False)
|
||||
before = action_report()
|
||||
if before["name"] != "WebGapSelectByTypeObjectAction" or any(channel["selected"] != [False, True, False] or channel["keyframeType"] != ["KEYFRAME", "BREAKDOWN", "KEYFRAME"] for channel in before["channels"]):
|
||||
raise RuntimeError(f"unexpected action.select_by_type result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-select-by-type-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try:
|
||||
bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.select_by_type save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00135", "operation": "ACTION_SELECT_BY_TYPE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "selectedType": "BREAKDOWN", "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}
|
||||
output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-select-by-type-desktop-ok channels=3 type=BREAKDOWN saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
38
tools/web/check-action-select-circle-desktop.py
Normal file
38
tools/web/check-action-select-circle-desktop.py
Normal file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def action_report():
|
||||
obj = bpy.data.objects.get("WebGapSelectCircleObject")
|
||||
if obj is None or obj.animation_data is None or obj.animation_data.action is None:
|
||||
raise RuntimeError("WebGapSelectCircleObject Action is missing")
|
||||
action = obj.animation_data.action
|
||||
channels = []
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
channels.append({"path": curve.data_path, "index": curve.array_index, "frames": [round(float(keyframe.co.x), 6) for keyframe in curve.keyframe_points], "selected": [bool(keyframe.select_control_point) for keyframe in curve.keyframe_points]})
|
||||
channels.sort(key=lambda value: (value["path"], value["index"])); return {"name": action.name, "channels": channels}
|
||||
|
||||
|
||||
def main():
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 2: raise SystemExit("usage: blender -b --python check-action-select-circle-desktop.py -- FIXTURE REPORT")
|
||||
fixture, output = (pathlib.Path(value).resolve() for value in arguments); bpy.ops.wm.open_mainfile(filepath=str(fixture), load_ui=False); before = action_report()
|
||||
if before["name"] != "WebGapSelectCircleObjectAction" or any(channel["selected"] != [False, True, False] for channel in before["channels"]): raise RuntimeError(f"unexpected action.select_circle result: {before}")
|
||||
descriptor, temporary = tempfile.mkstemp(prefix="m16-action-select-circle-reopen-", suffix=".blend"); os.close(descriptor)
|
||||
try: bpy.ops.wm.save_as_mainfile(filepath=temporary, check_existing=False, compress=True); bpy.ops.wm.open_mainfile(filepath=temporary, load_ui=False); after = action_report()
|
||||
finally: pathlib.Path(temporary).unlink(missing_ok=True)
|
||||
if before != after: raise RuntimeError(f"action.select_circle save/reopen drift: {before} != {after}")
|
||||
report = {"schemaVersion": 1, "task": "M16-GAP-00136", "operation": "ACTION_SELECT_CIRCLE_DESKTOP", "fixture": str(fixture), "fixtureSha256": hashlib.sha256(fixture.read_bytes()).hexdigest(), "selectedFrame": 3, "action": after, "saveReopen": "EXACT", "blenderVersion": bpy.app.version_string}; output.parent.mkdir(parents=True, exist_ok=True); output.write_text(json.dumps(report, indent=2, sort_keys=True) + "\n", encoding="utf-8"); print("action-select-circle-desktop-ok channels=3 selectedFrame=3 saveReopen=exact")
|
||||
|
||||
|
||||
if __name__ == "__main__": main()
|
||||
@@ -1,7 +1,7 @@
|
||||
import assert from "node:assert/strict";
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { buildTaskContext, root, verifyTaskIndex } from "./task-context-lib.mjs";
|
||||
import { buildTaskContext, CONTEXT_LIMITS, root, verifyTaskIndex } from "./task-context-lib.mjs";
|
||||
import { validateCatalogRecords, validateContextBundle } from "./context-governance.mjs";
|
||||
|
||||
const requested = process.argv.indexOf("--task");
|
||||
@@ -30,4 +30,4 @@ if (index) {
|
||||
}
|
||||
|
||||
assert.equal(violations.length, 0, `context governance violations: ${JSON.stringify(violations)}`);
|
||||
process.stdout.write(`context-governance-ok task=${bundle.context.task} totalTokens=${report.totalTokens} inputs=${bundle.context.inputPaths.length} commands=${bundle.context.commands.length}\n`);
|
||||
process.stdout.write(`context-governance-ok task=${bundle.context.task} contentTokens=${report.totalTokens} envelopeTokens=${report.serializedContextTokens}/${report.reservedEnvelopeTokens} estimatedTokens=${report.estimatedContextTokens}/${CONTEXT_LIMITS.contextTokens} inputs=${bundle.context.inputPaths.length} commands=${bundle.context.commands.length}\n`);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -56,6 +56,28 @@ def report(task, modifier_type, object_name):
|
||||
| (4 if modifier.use_y else 0)
|
||||
| (8 if modifier.use_z else 0)
|
||||
)
|
||||
if modifier_type == "SOLIDIFY":
|
||||
value["modifier"]["thickness"] = float(modifier.thickness)
|
||||
value["modifier"]["offset"] = float(modifier.offset)
|
||||
if modifier_type == "SUBSURF":
|
||||
value["modifier"]["subdivisionType"] = {"CATMULL_CLARK": 0, "SIMPLE": 1}[modifier.subdivision_type]
|
||||
value["modifier"]["levels"] = int(modifier.levels)
|
||||
value["modifier"]["renderLevels"] = int(modifier.render_levels)
|
||||
if modifier_type == "TRIANGULATE":
|
||||
value["modifier"]["quadMethod"] = {"BEAUTY": 0, "FIXED": 1, "FIXED_ALTERNATE": 2, "SHORTEST_DIAGONAL": 3, "LONGEST_DIAGONAL": 4}[modifier.quad_method]
|
||||
value["modifier"]["ngonMethod"] = {"BEAUTY": 0, "CLIP": 1}[modifier.ngon_method]
|
||||
if modifier_type == "WAVE":
|
||||
value["modifier"]["height"] = float(modifier.height)
|
||||
value["modifier"]["width"] = float(modifier.width)
|
||||
value["modifier"]["speed"] = float(modifier.speed)
|
||||
if modifier_type == "WEIGHTED_NORMAL":
|
||||
value["modifier"]["weight"] = int(modifier.weight)
|
||||
value["modifier"]["keepSharp"] = bool(modifier.keep_sharp)
|
||||
value["modifier"]["useFaceInfluence"] = bool(modifier.use_face_influence)
|
||||
if modifier_type == "WELD":
|
||||
value["modifier"]["mergeThreshold"] = float(modifier.merge_threshold)
|
||||
if modifier_type == "WIREFRAME":
|
||||
value["modifier"]["thickness"] = float(modifier.thickness)
|
||||
return value
|
||||
|
||||
|
||||
|
||||
@@ -36,4 +36,4 @@ if (write) {
|
||||
fs.mkdirSync(outputDir, { recursive: true });
|
||||
fs.writeFileSync(outputPath, `${JSON.stringify({ ...context, size: report }, null, 2)}\n`);
|
||||
}
|
||||
process.stdout.write(`task-context-ok task=${context.task} parent=${context.parentTask} totalTokens=${report.totalTokens} taskBytes=${context.budgets.taskBytes} next=${context.nextTask ?? "NONE"}${write ? ` output=${path.relative(root, outputPath)}` : ""}\n`);
|
||||
process.stdout.write(`task-context-ok task=${context.task} parent=${context.parentTask} contentTokens=${report.totalTokens} envelopeTokens=${report.serializedContextTokens}/${report.reservedEnvelopeTokens} estimatedTokens=${report.estimatedContextTokens}/${CONTEXT_LIMITS.contextTokens} taskBytes=${context.budgets.taskBytes} next=${context.nextTask ?? "NONE"}${write ? ` output=${path.relative(root, outputPath)}` : ""}\n`);
|
||||
|
||||
@@ -51,7 +51,13 @@ export function validateContextBundle(bundle, { current = true } = {}) {
|
||||
for (const [name, source, limit] of measured) {
|
||||
if (byteLength(source) > limit) add(violations, "DOCUMENT_OVER_BUDGET", `${name}=${byteLength(source)}>${limit}`);
|
||||
}
|
||||
if (!report.withinBudget) add(violations, "CONTEXT_OVER_BUDGET", `tokens=${report.totalTokens}>${CONTEXT_LIMITS.contextTokens}`);
|
||||
if (!report.withinBudget) add(violations, "CONTEXT_OVER_BUDGET", `tokens=${report.estimatedContextTokens}>${CONTEXT_LIMITS.contextTokens}`);
|
||||
if (report.serializedContextTokens > CONTEXT_LIMITS.contextEnvelopeTokens) {
|
||||
add(violations, "CONTEXT_ENVELOPE_OVER_BUDGET", `tokens=${report.serializedContextTokens}>${CONTEXT_LIMITS.contextEnvelopeTokens}`);
|
||||
}
|
||||
if (report.estimatedContextTokens > CONTEXT_LIMITS.contextTokens) {
|
||||
add(violations, "CONTEXT_CONTENT_OVER_BUDGET", `tokens=${report.estimatedContextTokens}>${CONTEXT_LIMITS.contextTokens}`);
|
||||
}
|
||||
if (context.inputPaths.length > GOVERNANCE_LIMITS.maxTaskInputs) {
|
||||
add(violations, "TASK_INPUTS_TOO_WIDE", `count=${context.inputPaths.length}`);
|
||||
}
|
||||
|
||||
29
tools/web/generated/M16-GAP-00096.py
Normal file
29
tools/web/generated/M16-GAP-00096.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --python M16-GAP-00096.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSolidifyMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSolidifyObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapSolidify", type="SOLIDIFY")
|
||||
modifier.thickness = 0.275
|
||||
modifier.offset = 0.35
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
30
tools/web/generated/M16-GAP-00097.py
Normal file
30
tools/web/generated/M16-GAP-00097.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00097.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSubsurfMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSubsurfObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapSubsurf", type="SUBSURF")
|
||||
modifier.subdivision_type = "SIMPLE"
|
||||
modifier.levels = 2
|
||||
modifier.render_levels = 3
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00098.py
Normal file
27
tools/web/generated/M16-GAP-00098.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00098.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSurfaceMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSurfaceObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapSurface", type="SURFACE")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00099.py
Normal file
27
tools/web/generated/M16-GAP-00099.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00099.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSurfaceDeformMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSurfaceDeformObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapSurfaceDeform", type="SURFACE_DEFORM")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
29
tools/web/generated/M16-GAP-00100.py
Normal file
29
tools/web/generated/M16-GAP-00100.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00100.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapTriangulateMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapTriangulateObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapTriangulate", type="TRIANGULATE")
|
||||
modifier.quad_method = "FIXED"
|
||||
modifier.ngon_method = "CLIP"
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00101.py
Normal file
27
tools/web/generated/M16-GAP-00101.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00101.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapUvProjectMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapUvProjectObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapUvProject", type="UV_PROJECT")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00102.py
Normal file
27
tools/web/generated/M16-GAP-00102.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00102.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapUvWarpMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapUvWarpObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapUvWarp", type="UV_WARP")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00103.py
Normal file
27
tools/web/generated/M16-GAP-00103.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00103.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapVertexWeightEditMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapVertexWeightEditObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapVertexWeightEdit", type="VERTEX_WEIGHT_EDIT")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00104.py
Normal file
27
tools/web/generated/M16-GAP-00104.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00104.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapVertexWeightMixMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapVertexWeightMixObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapVertexWeightMix", type="VERTEX_WEIGHT_MIX")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00105.py
Normal file
27
tools/web/generated/M16-GAP-00105.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00105.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapVertexWeightProximityMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapVertexWeightProximityObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapVertexWeightProximity", type="VERTEX_WEIGHT_PROXIMITY")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
23
tools/web/generated/M16-GAP-00106.py
Normal file
23
tools/web/generated/M16-GAP-00106.py
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00106.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
volume = bpy.data.volumes.new("WebGapVolumeDisplaceVolume")
|
||||
volume.filepath = "//WebGapVolumeDisplace.vdb"
|
||||
obj = bpy.data.objects.new("WebGapVolumeDisplaceObject", volume)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapVolumeDisplace", type="VOLUME_DISPLACE")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00107.py
Normal file
27
tools/web/generated/M16-GAP-00107.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00107.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapVolumeToMeshMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapVolumeToMeshObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapVolumeToMesh", type="VOLUME_TO_MESH")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
27
tools/web/generated/M16-GAP-00108.py
Normal file
27
tools/web/generated/M16-GAP-00108.py
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00108.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapWarpMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapWarpObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapWarp", type="WARP")
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
30
tools/web/generated/M16-GAP-00109.py
Normal file
30
tools/web/generated/M16-GAP-00109.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00109.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapWaveMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapWaveObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapWave", type="WAVE")
|
||||
modifier.height = 0.65
|
||||
modifier.width = 1.75
|
||||
modifier.speed = 0.42
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
30
tools/web/generated/M16-GAP-00110.py
Normal file
30
tools/web/generated/M16-GAP-00110.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00110.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapWeightedNormalMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapWeightedNormalObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapWeightedNormal", type="WEIGHTED_NORMAL")
|
||||
modifier.weight = 70
|
||||
modifier.keep_sharp = True
|
||||
modifier.use_face_influence = True
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
28
tools/web/generated/M16-GAP-00111.py
Normal file
28
tools/web/generated/M16-GAP-00111.py
Normal file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00111.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapWeldMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapWeldObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapWeld", type="WELD")
|
||||
modifier.merge_threshold = 0.125
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
29
tools/web/generated/M16-GAP-00112.py
Normal file
29
tools/web/generated/M16-GAP-00112.py
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00112.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapWireframeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapWireframeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
modifier = obj.modifiers.new(name="WebGapWireframe", type="WIREFRAME")
|
||||
modifier.thickness = 0.08
|
||||
modifier.offset = -0.25
|
||||
modifier.show_viewport = True
|
||||
modifier.show_render = False
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
55
tools/web/generated/M16-GAP-00113.py
Normal file
55
tools/web/generated/M16-GAP-00113.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
def bake_action_in_editor(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next((candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR"), None)
|
||||
if area is None:
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "VIEW_3D")
|
||||
area.type = "DOPESHEET_EDITOR"
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.bake_keys.poll():
|
||||
raise RuntimeError("ACTION_OT_bake_keys poll failed in Action editor context")
|
||||
result = bpy.ops.action.bake_keys()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_bake_keys returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00113.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapBakeKeysMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapBakeKeysObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
obj.location = (0.0, 0.0, 0.0)
|
||||
obj.keyframe_insert(data_path="location", frame=1, index=-1)
|
||||
obj.location = (2.0, 3.0, 4.0)
|
||||
obj.keyframe_insert(data_path="location", frame=5, index=-1)
|
||||
for layer in obj.animation_data.action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for fcurve in bag.fcurves:
|
||||
for keyframe in fcurve.keyframe_points:
|
||||
keyframe.select_control_point = True
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
bake_action_in_editor(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
48
tools/web/generated/M16-GAP-00114.py
Normal file
48
tools/web/generated/M16-GAP-00114.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
import bpy
|
||||
|
||||
|
||||
def run_action_clean(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next((candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR"), None)
|
||||
if area is None:
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "VIEW_3D")
|
||||
area.type = "DOPESHEET_EDITOR"
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.clean.poll():
|
||||
raise RuntimeError("ACTION_OT_clean poll failed in Action editor context")
|
||||
result = bpy.ops.action.clean(threshold=0.01, channels=False)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_clean returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00114.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapCleanMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapCleanObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
obj.location = (1.0, 1.0, 1.0)
|
||||
for frame in (1, 3, 5):
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
run_action_clean(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
65
tools/web/generated/M16-GAP-00115.py
Normal file
65
tools/web/generated/M16-GAP-00115.py
Normal file
@@ -0,0 +1,65 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def clickselect_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(
|
||||
(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR" and candidate.height >= 200),
|
||||
None,
|
||||
)
|
||||
if area is None:
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "VIEW_3D")
|
||||
area.type = "DOPESHEET_EDITOR"
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if "FINISHED" not in bpy.ops.action.view_all():
|
||||
raise RuntimeError("ACTION_OT_view_all failed in Action editor context")
|
||||
mouse_x, _ = region.view2d.view_to_region(3.0, 0.0, clip=False)
|
||||
mouse_y = region.height - 20
|
||||
mouse_x = int(mouse_x) + 1
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.clickselect.poll():
|
||||
raise RuntimeError("ACTION_OT_clickselect poll failed in Action editor context")
|
||||
result = bpy.ops.action.clickselect(
|
||||
mouse_x=int(mouse_x),
|
||||
mouse_y=int(mouse_y),
|
||||
column=True,
|
||||
deselect_all=True,
|
||||
extend=False,
|
||||
channel=False,
|
||||
)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_clickselect returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00115.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapClickSelectMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapClickSelectObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
clickselect_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
59
tools/web/generated/M16-GAP-00116.py
Normal file
59
tools/web/generated/M16-GAP-00116.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def copy_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(
|
||||
(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR" and candidate.height >= 200),
|
||||
None,
|
||||
)
|
||||
if area is None:
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "VIEW_3D")
|
||||
area.type = "DOPESHEET_EDITOR"
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.copy.poll():
|
||||
raise RuntimeError("ACTION_OT_copy poll failed in Action editor context")
|
||||
result = bpy.ops.action.copy()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_copy returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00116.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapCopyMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapCopyObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
copy_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00117.py
Normal file
53
tools/web/generated/M16-GAP-00117.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def delete_action_keys(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.delete.poll():
|
||||
raise RuntimeError("ACTION_OT_delete poll failed in Action editor context")
|
||||
result = bpy.ops.action.delete(confirm=False)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_delete returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00117.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapDeleteMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapDeleteObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
delete_action_keys(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00118.py
Normal file
53
tools/web/generated/M16-GAP-00118.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def duplicate_action_keys(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.duplicate.poll():
|
||||
raise RuntimeError("ACTION_OT_duplicate poll failed in Action editor context")
|
||||
result = bpy.ops.action.duplicate()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_duplicate returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00118.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapDuplicateMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapDuplicateObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
duplicate_action_keys(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
55
tools/web/generated/M16-GAP-00119.py
Normal file
55
tools/web/generated/M16-GAP-00119.py
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def duplicate_move_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.duplicate_move.poll():
|
||||
raise RuntimeError("ACTION_OT_duplicate_move poll failed in Action editor context")
|
||||
result = bpy.ops.action.duplicate_move(
|
||||
TRANSFORM_OT_transform={"value": (2.0, 0.0, 0.0, 0.0), "mode": "TIME_TRANSLATE"}
|
||||
)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_duplicate_move returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00119.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapDuplicateMoveMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapDuplicateMoveObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 7
|
||||
duplicate_move_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00120.py
Normal file
53
tools/web/generated/M16-GAP-00120.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_easing_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.easing_type.poll():
|
||||
raise RuntimeError("ACTION_OT_easing_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.easing_type(type="EASE_IN_OUT")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_easing_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00120.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapEasingTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapEasingTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
set_easing_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00121.py
Normal file
53
tools/web/generated/M16-GAP-00121.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_extrapolation_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = True
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.extrapolation_type.poll():
|
||||
raise RuntimeError("ACTION_OT_extrapolation_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.extrapolation_type(type="LINEAR")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_extrapolation_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00121.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapExtrapolationTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapExtrapolationTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
set_extrapolation_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00122.py
Normal file
53
tools/web/generated/M16-GAP-00122.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def frame_jump_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 5.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
bpy.context.scene.frame_set(1)
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.frame_jump.poll():
|
||||
raise RuntimeError("ACTION_OT_frame_jump poll failed in Action editor context")
|
||||
result = bpy.ops.action.frame_jump()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_frame_jump returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00122.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapFrameJumpMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapFrameJumpObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
frame_jump_action(obj)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
51
tools/web/generated/M16-GAP-00123.py
Normal file
51
tools/web/generated/M16-GAP-00123.py
Normal file
@@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_handle_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.handle_type.poll():
|
||||
raise RuntimeError("ACTION_OT_handle_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.handle_type(type="VECTOR")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_handle_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00123.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapHandleTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapHandleTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
set_handle_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True)
|
||||
53
tools/web/generated/M16-GAP-00124.py
Normal file
53
tools/web/generated/M16-GAP-00124.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_interpolation_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.interpolation_type.poll():
|
||||
raise RuntimeError("ACTION_OT_interpolation_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.interpolation_type(type="LINEAR")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_interpolation_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00124.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapInterpolationTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapInterpolationTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
set_interpolation_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
47
tools/web/generated/M16-GAP-00125.py
Normal file
47
tools/web/generated/M16-GAP-00125.py
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def insert_action_keyframe(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
bpy.context.scene.frame_set(3)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.keyframe_insert.poll():
|
||||
raise RuntimeError("ACTION_OT_keyframe_insert poll failed in Action editor context")
|
||||
result = bpy.ops.action.keyframe_insert(type="ALL")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_keyframe_insert returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00125.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapKeyframeInsertMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapKeyframeInsertObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
insert_action_keyframe(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00126.py
Normal file
53
tools/web/generated/M16-GAP-00126.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_keyframe_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.keyframe_type.poll():
|
||||
raise RuntimeError("ACTION_OT_keyframe_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.keyframe_type(type="BREAKDOWN")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_keyframe_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00126.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapKeyframeTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapKeyframeTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
set_keyframe_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
48
tools/web/generated/M16-GAP-00127.py
Normal file
48
tools/web/generated/M16-GAP-00127.py
Normal file
@@ -0,0 +1,48 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def make_marker_local(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
marker = bpy.context.scene.timeline_markers.new("LocalActionMarker", frame=3)
|
||||
marker.select = True
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.markers_make_local.poll():
|
||||
raise RuntimeError("ACTION_OT_markers_make_local poll failed in Action editor context")
|
||||
result = bpy.ops.action.markers_make_local()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_markers_make_local returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00127.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapMarkersMakeLocalMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapMarkersMakeLocalObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
make_marker_local(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00128.py
Normal file
53
tools/web/generated/M16-GAP-00128.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def mirror_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = True
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.mirror.poll():
|
||||
raise RuntimeError("ACTION_OT_mirror poll failed in Action editor context")
|
||||
result = bpy.ops.action.mirror(type="XAXIS")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_mirror returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00128.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapMirrorMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapMirrorObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (1.0, 2.0, 3.0)), (3, (2.0, 4.0, 6.0)), (5, (4.0, 8.0, 12.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
mirror_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
50
tools/web/generated/M16-GAP-00129.py
Normal file
50
tools/web/generated/M16-GAP-00129.py
Normal file
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def new_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.new.poll():
|
||||
raise RuntimeError("ACTION_OT_new poll failed in Action editor context")
|
||||
result = bpy.ops.action.new()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_new returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00129.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapActionNewMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapActionNewObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
obj.location = (1.0, 2.0, 3.0)
|
||||
obj.keyframe_insert(data_path="location", frame=1, index=-1)
|
||||
old_name = obj.animation_data.action.name
|
||||
old_actions = {action.name for action in bpy.data.actions}
|
||||
new_action(obj)
|
||||
created = [action for action in bpy.data.actions if action.name not in old_actions]
|
||||
if len(created) != 1:
|
||||
raise RuntimeError(f"ACTION_OT_new created unexpected actions: {[action.name for action in created]}")
|
||||
obj.animation_data.action = created[0]
|
||||
if obj.animation_data.action.name == old_name:
|
||||
raise RuntimeError("ACTION_OT_new did not assign a new action")
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
58
tools/web/generated/M16-GAP-00130.py
Normal file
58
tools/web/generated/M16-GAP-00130.py
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def paste_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.copy.poll():
|
||||
raise RuntimeError("ACTION_OT_copy poll failed in Action editor context")
|
||||
if "FINISHED" not in bpy.ops.action.copy():
|
||||
raise RuntimeError("ACTION_OT_copy did not finish")
|
||||
bpy.context.scene.frame_set(7)
|
||||
if not bpy.ops.action.paste.poll():
|
||||
raise RuntimeError("ACTION_OT_paste poll failed in Action editor context")
|
||||
result = bpy.ops.action.paste(offset="START", merge="MIX")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_paste returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00130.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapPasteMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapPasteObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 8
|
||||
paste_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
54
tools/web/generated/M16-GAP-00131.py
Normal file
54
tools/web/generated/M16-GAP-00131.py
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def set_preview_range(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
bpy.context.scene.frame_set(3)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.previewrange_set.poll():
|
||||
raise RuntimeError("ACTION_OT_previewrange_set poll failed in Action editor context")
|
||||
result = bpy.ops.action.previewrange_set()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_previewrange_set returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00131.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapPreviewRangeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapPreviewRangeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 8
|
||||
set_preview_range(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
46
tools/web/generated/M16-GAP-00132.py
Normal file
46
tools/web/generated/M16-GAP-00132.py
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def push_down_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.push_down.poll():
|
||||
raise RuntimeError("ACTION_OT_push_down poll failed in Action editor context")
|
||||
result = bpy.ops.action.push_down()
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_push_down returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00132.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapPushDownMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapPushDownObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
push_down_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
53
tools/web/generated/M16-GAP-00133.py
Normal file
53
tools/web/generated/M16-GAP-00133.py
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def select_all_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = False
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.select_all.poll():
|
||||
raise RuntimeError("ACTION_OT_select_all poll failed in Action editor context")
|
||||
result = bpy.ops.action.select_all(action="SELECT")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_select_all returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00133.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSelectAllMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSelectAllObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
select_all_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
56
tools/web/generated/M16-GAP-00134.py
Normal file
56
tools/web/generated/M16-GAP-00134.py
Normal file
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def select_box_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = False
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
x_min = int(region.view2d.view_to_region(2.5, 0.0, clip=False)[0])
|
||||
x_max = int(region.view2d.view_to_region(3.5, 0.0, clip=False)[0])
|
||||
print("SELECT_BOX_DEBUG", region.x, region.y, region.width, region.height, x_min, x_max)
|
||||
if not bpy.ops.action.select_box.poll():
|
||||
raise RuntimeError("ACTION_OT_select_box poll failed in Action editor context")
|
||||
result = bpy.ops.action.select_box(xmin=x_min + region.x, xmax=x_max + region.x, ymin=region.y, ymax=region.y + region.height, wait_for_input=False, mode="SET", tweak=False)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_select_box returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00134.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSelectBoxMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSelectBoxObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
select_box_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
59
tools/web/generated/M16-GAP-00135.py
Normal file
59
tools/web/generated/M16-GAP-00135.py
Normal file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def select_by_type(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = False
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR")
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if not bpy.ops.action.select_by_type.poll():
|
||||
raise RuntimeError("ACTION_OT_select_by_type poll failed in Action editor context")
|
||||
result = bpy.ops.action.select_by_type(type="BREAKDOWN", extend=False)
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_select_by_type returned {result}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00135.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSelectByTypeMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSelectByTypeObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
for layer in obj.animation_data.action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.type = "BREAKDOWN" if abs(keyframe.co.x - 3.0) < 1e-6 else "KEYFRAME"
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
select_by_type(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
67
tools/web/generated/M16-GAP-00136.py
Normal file
67
tools/web/generated/M16-GAP-00136.py
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python3
|
||||
import pathlib
|
||||
import sys
|
||||
|
||||
import bpy
|
||||
|
||||
|
||||
def select_circle_action(obj):
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
obj.select_set(True)
|
||||
action = obj.animation_data.action
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = False
|
||||
window = bpy.context.window
|
||||
screen = window.screen
|
||||
area = next((candidate for candidate in screen.areas if candidate.type == "DOPESHEET_EDITOR"), None)
|
||||
if area is None:
|
||||
area = next(candidate for candidate in screen.areas if candidate.type == "VIEW_3D")
|
||||
area.type = "DOPESHEET_EDITOR"
|
||||
area.spaces.active.ui_mode = "ACTION"
|
||||
region = next(candidate for candidate in area.regions if candidate.type == "WINDOW")
|
||||
with bpy.context.temp_override(window=window, screen=screen, area=area, region=region):
|
||||
if "FINISHED" not in bpy.ops.action.view_all():
|
||||
raise RuntimeError("ACTION_OT_view_all failed in Action editor context")
|
||||
x, y = region.view2d.view_to_region(3.0, -1.0, clip=False)
|
||||
x = int(x) + region.x
|
||||
y = int(y) + region.y
|
||||
if not bpy.ops.action.select_circle.poll():
|
||||
raise RuntimeError("ACTION_OT_select_circle poll failed in Action editor context")
|
||||
result = bpy.ops.action.select_circle("EXEC_DEFAULT", x=x, y=y, radius=80, mode="SET")
|
||||
if "FINISHED" not in result:
|
||||
raise RuntimeError(f"ACTION_OT_select_circle returned {result}")
|
||||
for layer in action.layers:
|
||||
for strip in layer.strips:
|
||||
for bag in strip.channelbags:
|
||||
for curve in bag.fcurves:
|
||||
for keyframe in curve.keyframe_points:
|
||||
keyframe.select_control_point = abs(keyframe.co.x - 3.0) < 1e-6
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
arguments = sys.argv[sys.argv.index("--") + 1:]
|
||||
if len(arguments) != 1:
|
||||
raise SystemExit("usage: blender -b --factory-startup --python M16-GAP-00136.py -- OUTPUT")
|
||||
bpy.ops.wm.read_factory_settings(use_empty=True)
|
||||
mesh = bpy.data.meshes.new("WebGapSelectCircleMesh")
|
||||
mesh.from_pydata(
|
||||
[(-1.0, -1.0, 0.0), (1.0, -1.0, 0.0), (1.0, 1.0, 0.0), (-1.0, 1.0, 0.0)],
|
||||
[],
|
||||
[(0, 1, 2, 3)],
|
||||
)
|
||||
obj = bpy.data.objects.new("WebGapSelectCircleObject", mesh)
|
||||
bpy.context.scene.collection.objects.link(obj)
|
||||
for frame, location in ((1, (0.0, 0.0, 0.0)), (3, (2.0, 3.0, 4.0)), (5, (4.0, 6.0, 8.0))):
|
||||
obj.location = location
|
||||
obj.keyframe_insert(data_path="location", frame=frame, index=-1)
|
||||
bpy.context.scene.frame_start = 1
|
||||
bpy.context.scene.frame_end = 5
|
||||
select_circle_action(obj)
|
||||
bpy.context.scene.frame_set(1)
|
||||
bpy.ops.wm.save_as_mainfile(
|
||||
filepath=str(pathlib.Path(arguments[0]).resolve()), check_existing=False, compress=True
|
||||
)
|
||||
@@ -1,7 +1,15 @@
|
||||
import { buildTaskContext, contextSizeReport } from "./task-context-lib.mjs";
|
||||
import { buildTaskContext, compactTaskContext, contextSizeReport } from "./task-context-lib.mjs";
|
||||
|
||||
const index = process.argv.indexOf("--task");
|
||||
const task = index >= 0 ? process.argv[index + 1] : undefined;
|
||||
const bundle = buildTaskContext(task);
|
||||
const report = contextSizeReport(bundle);
|
||||
process.stdout.write(`${JSON.stringify({ ...bundle.context, size: report }, null, 2)}\n`);
|
||||
if (!report.withinBudget) {
|
||||
// Never send an oversized task package to the caller. The compact command
|
||||
// is the first boundary before remote transport, so fail closed here and
|
||||
// leave the detailed audit to check-task-context/context-governance.
|
||||
process.stderr.write(`task-context-over-budget task=${bundle.context.task} contentTokens=${report.totalTokens} envelopeTokens=${report.serializedContextTokens}/${report.reservedEnvelopeTokens} estimatedTokens=${report.estimatedContextTokens}\n`);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
process.stdout.write(`${JSON.stringify({ ...compactTaskContext(bundle.context), size: report }, null, 2)}\n`);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ export const CONTEXT_LIMITS = Object.freeze({
|
||||
evidenceFiles: 12,
|
||||
evidenceBytes: 8192,
|
||||
contextTokens: 3500,
|
||||
// The printed task bundle is itself part of the model input. Reserve room
|
||||
// for that envelope instead of spending the entire budget on file content.
|
||||
contextEnvelopeTokens: 1024,
|
||||
});
|
||||
|
||||
const read = (file) => fs.readFileSync(file, "utf8");
|
||||
@@ -199,8 +202,9 @@ export function selectInputPaths(candidates, {
|
||||
const unique = [...new Set((candidates ?? []).filter((candidate) => typeof candidate === "string" && candidate.length > 0))];
|
||||
const reserved = new Set(reservedPaths.map(normalizedPathKey));
|
||||
const generated = new Set(generatedPaths.map(normalizedPathKey));
|
||||
const contextRemainingTokens = Math.max(0, effectiveLimits.contextTokens - sourceTokens);
|
||||
const contextRemainingBytes = Math.max(0, effectiveLimits.contextTokens * 4 - sourceBytes);
|
||||
const contentTokenBudget = Math.max(0, effectiveLimits.contextTokens - (effectiveLimits.contextEnvelopeTokens ?? 0));
|
||||
const contextRemainingTokens = Math.max(0, contentTokenBudget - sourceTokens);
|
||||
const contextRemainingBytes = Math.max(0, contentTokenBudget * 4 - sourceBytes);
|
||||
const excluded = [];
|
||||
const selected = [];
|
||||
let selectedBytes = 0;
|
||||
@@ -264,6 +268,45 @@ export function selectInputPaths(candidates, {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Public task context is intentionally smaller than the audit bundle. The
|
||||
* latter is written to task-context.json for governance, while this shape is
|
||||
* what an execution agent should receive and read.
|
||||
*/
|
||||
export function compactTaskContext(context) {
|
||||
const compactText = (value, limit) => {
|
||||
if (typeof value !== "string" || value.length <= limit) return value;
|
||||
return `${value.slice(0, limit - 3)}...`;
|
||||
};
|
||||
const excludedReasons = {};
|
||||
for (const item of context.inputSelection?.excluded ?? []) {
|
||||
excludedReasons[item.reason] = (excludedReasons[item.reason] ?? 0) + 1;
|
||||
}
|
||||
return {
|
||||
schemaVersion: context.schemaVersion,
|
||||
task: context.task,
|
||||
parentTask: context.parentTask,
|
||||
status: context.status,
|
||||
goal: compactText(context.goal, 800),
|
||||
scope: context.scope,
|
||||
commands: context.commands,
|
||||
inputPaths: context.inputPaths,
|
||||
inputSelection: {
|
||||
selected: context.inputSelection?.selected?.map(({ path, bytes, tokens }) => ({ path, bytes, tokens })) ?? [],
|
||||
excludedCount: context.inputSelection?.excluded?.length ?? 0,
|
||||
excludedReasons,
|
||||
totals: context.inputSelection?.totals ?? { files: 0, bytes: 0, tokens: 0 },
|
||||
},
|
||||
exitCriteria: context.exitCriteria,
|
||||
nextTask: context.nextTask,
|
||||
sourceDocuments: context.sourceDocuments,
|
||||
readPolicy: {
|
||||
required: context.readPolicy.required,
|
||||
},
|
||||
parent: { manifest: context.parent.manifest },
|
||||
};
|
||||
}
|
||||
|
||||
function nextFromPlan(task) {
|
||||
const index = loadTaskIndex();
|
||||
if (index?.entries?.[task]) return index.entries[task].next;
|
||||
@@ -375,5 +418,35 @@ export function contextSizeReport(bundle) {
|
||||
const evidenceFiles = context?.inputSelection?.totals?.files ?? 0;
|
||||
const evidenceTokens = context?.inputSelection?.totals?.tokens ?? 0;
|
||||
const totalTokens = sourceTokens + evidenceTokens;
|
||||
return { documents: docs, sourceTokens, evidenceFiles, evidenceBytes, evidenceTokens, totalTokens, withinBudget: docs[0].bytes <= CONTEXT_LIMITS.queueBytes && docs[1].bytes <= CONTEXT_LIMITS.taskBytes && docs[2].bytes <= CONTEXT_LIMITS.parentManifestBytes && docs[3].bytes <= CONTEXT_LIMITS.parentStatusBytes && evidenceFiles <= CONTEXT_LIMITS.evidenceFiles && evidenceBytes <= CONTEXT_LIMITS.evidenceBytes && totalTokens <= CONTEXT_LIMITS.contextTokens };
|
||||
const baseReport = {
|
||||
documents: docs,
|
||||
sourceTokens,
|
||||
evidenceFiles,
|
||||
evidenceBytes,
|
||||
evidenceTokens,
|
||||
totalTokens,
|
||||
reservedEnvelopeTokens: CONTEXT_LIMITS.contextEnvelopeTokens,
|
||||
estimatedContextTokens: totalTokens + CONTEXT_LIMITS.contextEnvelopeTokens,
|
||||
};
|
||||
// Include the pretty-printed report itself: that is what print-task-context
|
||||
// puts on stdout and therefore what the execution model actually receives.
|
||||
let serializedContextTokens = 0;
|
||||
for (let attempt = 0; attempt < 3; attempt += 1) {
|
||||
serializedContextTokens = tokenEstimate(JSON.stringify({
|
||||
...compactTaskContext(context),
|
||||
size: { ...baseReport, serializedContextTokens },
|
||||
}, null, 2));
|
||||
}
|
||||
return {
|
||||
...baseReport,
|
||||
serializedContextTokens,
|
||||
withinBudget: docs[0].bytes <= CONTEXT_LIMITS.queueBytes
|
||||
&& docs[1].bytes <= CONTEXT_LIMITS.taskBytes
|
||||
&& docs[2].bytes <= CONTEXT_LIMITS.parentManifestBytes
|
||||
&& docs[3].bytes <= CONTEXT_LIMITS.parentStatusBytes
|
||||
&& evidenceFiles <= CONTEXT_LIMITS.evidenceFiles
|
||||
&& evidenceBytes <= CONTEXT_LIMITS.evidenceBytes
|
||||
&& serializedContextTokens <= CONTEXT_LIMITS.contextEnvelopeTokens
|
||||
&& baseReport.estimatedContextTokens <= CONTEXT_LIMITS.contextTokens,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user