Packing Blender file now creates a zip

This commit is contained in:
Brett Williams
2023-06-05 14:46:51 -05:00
parent fab9661948
commit 5b54a11788
2 changed files with 34 additions and 21 deletions

View File

@@ -4,6 +4,9 @@ except ImportError:
from base_engine import *
import json
import re
import logging
logger = logging.getLogger()
class Blender(BaseRenderEngine):
@@ -76,6 +79,7 @@ class Blender(BaseRenderEngine):
def pack_project_file(cls, project_path, timeout=30):
# Credit to L0Lock for pack script - https://blender.stackexchange.com/a/243935
try:
logger.info(f"Starting to pack Blender file: {project_path}")
results = cls.run_python_script(project_path, os.path.join(os.path.dirname(os.path.realpath(__file__)),
'scripts', 'blender', 'pack_project.py'), timeout=timeout)
@@ -87,10 +91,10 @@ class Blender(BaseRenderEngine):
for err in not_found:
logger.error(err)
p = re.compile('Info: Saved "(.*)"')
p = re.compile('Saved to: (.*)\n')
match = p.search(result_text)
if match:
new_path = os.path.join(dir_name, match.group(1))
new_path = os.path.join(dir_name, match.group(1).strip())
logger.info(f'Blender file packed successfully to {new_path}')
return new_path
except Exception as e: