zs_ai_render_script.py 724 B

123456789101112131415161718192021222324252627282930313233343536
  1. # render
  2. import bpy
  3. import sys
  4. import json
  5. import base64
  6. def convert_base64_string_to_object(base64_string):
  7. bytes = base64.b64decode(base64_string)
  8. string = bytes.decode("ascii")
  9. # return json.loads(string)
  10. return string
  11. argv = sys.argv
  12. try:
  13. argv = argv[argv.index("--") + 1 :]
  14. # scene_info_base64 = argv[0]
  15. # scene_info_bytes = base64.b64decode(scene_info_base64)
  16. # scene_info_string = scene_info_bytes.decode("ascii")
  17. scene_info_string = argv[0]
  18. # print("loading scene data", scene_info_string)
  19. bpy.context.scene.shot_info_ai = convert_base64_string_to_object(scene_info_string)
  20. bpy.ops.zs_sd_loader.load_scene()
  21. except Exception as e:
  22. print("Error:", e)