Update pack_project script for Blender

This commit is contained in:
Brett Williams
2023-06-05 13:11:18 -05:00
parent 21557cf4ed
commit fab9661948
3 changed files with 44 additions and 9 deletions

View File

@@ -61,7 +61,7 @@ class Blender(BaseRenderEngine):
scene_info = None
try:
results = cls.run_python_script(project_path, os.path.join(os.path.dirname(os.path.realpath(__file__)),
'scripts', 'get_blender_info.py'), timeout=timeout)
'scripts', 'blender', 'get_file_info.py'), timeout=timeout)
result_text = results.stdout.decode()
for line in result_text.splitlines():
if line.startswith('SCENE_DATA:'):
@@ -75,15 +75,9 @@ class Blender(BaseRenderEngine):
@classmethod
def pack_project_file(cls, project_path, timeout=30):
# Credit to L0Lock for pack script - https://blender.stackexchange.com/a/243935
pack_expression = "import bpy\n" \
"bpy.ops.file.pack_all()\n" \
"bpy.ops.file.make_paths_absolute()\n" \
"myPath = bpy.data.filepath\n" \
"myPath = str(myPath)\n" \
"bpy.ops.wm.save_as_mainfile(filepath=myPath[:-6]+'_packed'+myPath[-6:])"
try:
results = Blender.run_python_expression(project_path, pack_expression, timeout=timeout)
results = cls.run_python_script(project_path, os.path.join(os.path.dirname(os.path.realpath(__file__)),
'scripts', 'blender', 'pack_project.py'), timeout=timeout)
result_text = results.stdout.decode()
dir_name = os.path.dirname(project_path)