This commit is contained in:
Andrew Scobie 2018-07-18 16:51:25 +12:00
Родитель b9e100fcf5
Коммит c947927e2f
1 изменённых файлов: 24 добавлений и 20 удалений

Просмотреть файл

@ -133,11 +133,11 @@ def create_task(frame, task_id, job_id, tile_num, current_x, current_y):
optionalParams = os.environ["OPTIONAL_PARAMS"] optionalParams = os.environ["OPTIONAL_PARAMS"]
# generate the blender command line # generate the blender command line
command_line = "{} -b \"{}/{}\" -P \"{}/scripts/python-task-manager.py\" -y -t 0 {}".format( command_line = "\"{}\" -b \"{}\\{}\" -P \"{}\\scripts\\python-task-manager.py\" -y -t 0 {}".format(
blender_exe(), blender_exe(),
os_env("AZ_BATCH_JOB_PREP_WORKING_DIR"), os_specific_env("AZ_BATCH_JOB_PREP_WORKING_DIR"),
blend_file, blend_file,
os_env("AZ_BATCH_TASK_WORKING_DIR"), os_specific_env("AZ_BATCH_TASK_WORKING_DIR"),
optionalParams optionalParams
) )
@ -315,10 +315,10 @@ def blender_exe():
Gets the operating system specific blender exe. Gets the operating system specific blender exe.
""" """
current_os = os.environ["TEMPLATE_OS"] current_os = os.environ["TEMPLATE_OS"]
return "blender" if current_os.lower() == "linux" else "\"%BLENDER_2018_EXEC%\"" return "blender" if current_os.lower() == "linux" else "%BLENDER_2018_EXEC%"
def os_env(env_var_name): def os_specific_env(env_var_name):
""" """
Gets the operating system specific environment variable format string. Gets the operating system specific environment variable format string.
@ -340,18 +340,10 @@ def os_specific_command_line(command_line):
:type command_line: str :type command_line: str
""" """
current_os = os.environ["TEMPLATE_OS"] current_os = os.environ["TEMPLATE_OS"]
command = "/bin/bash -c '{}'" if current_os.lower() == "linux" else "cmd.exe /c '{}'" command = "/bin/bash -c '{}'" if current_os.lower() == "linux" else "cmd.exe /c \"{}\""
return command.format(command_line) return command.format(command_line)
def magick_command(command):
"""
Gets the operating system specific image magick command.
"""
current_os = os.environ["TEMPLATE_OS"]
return command if current_os.lower() == "linux" else "magick {}".format(command)
def convert_command(frame, output_format): def convert_command(frame, output_format):
""" """
Command for executing the ImageMagick 'convert' command. Command for executing the ImageMagick 'convert' command.
@ -365,9 +357,15 @@ def convert_command(frame, output_format):
:param output_format: Blender output format (PNG, OPEN_EXR, etc). :param output_format: Blender output format (PNG, OPEN_EXR, etc).
:type output_format: str :type output_format: str
""" """
return "cd {};{} tile_* -flatten frame_{}.{}".format( command = ""
os_env("AZ_BATCH_TASK_WORKING_DIR"), current_os = os.environ["TEMPLATE_OS"]
magick_command("convert"),
if current_os.lower() == "linux":
command = "cd $AZ_BATCH_TASK_WORKING_DIR;convert tile_* -flatten frame_{}.{}"
else:
command = "cd /d %AZ_BATCH_TASK_WORKING_DIR% & magick convert tile_* -flatten frame_{}.{}"
return command.format(
pad_number(frame, PAD_LEN_FRAME), pad_number(frame, PAD_LEN_FRAME),
get_file_extension(output_format) get_file_extension(output_format)
) )
@ -387,10 +385,16 @@ def montage_command(frame, x_tiles, y_tiles, output_format):
:param y_tiles: Number of tiles on the Y axis. :param y_tiles: Number of tiles on the Y axis.
:type y_tiles: int :type y_tiles: int
""" """
command = ""
tiles = get_tile_names(x_tiles * y_tiles) tiles = get_tile_names(x_tiles * y_tiles)
return "cd {};{} {} -tile {}x{} -background none -geometry +0+0 frame_{}.{}".format( current_os = os.environ["TEMPLATE_OS"]
os_env("AZ_BATCH_TASK_WORKING_DIR"),
magick_command("montage"), if current_os.lower() == "linux":
command = "cd $AZ_BATCH_TASK_WORKING_DIR;montage {} -tile {}x{} -background none -geometry +0+0 frame_{}.{}"
else:
command = "cd /d %AZ_BATCH_TASK_WORKING_DIR% & magick montage {} -tile {}x{} -background none -geometry +0+0 frame_{}.{}"
return command.format(
" ".join(tiles), " ".join(tiles),
x_tiles, x_tiles,
y_tiles, y_tiles,