Open aardschok opened 7 years ago
Here is an example of letting Maya control the output
def preview_fname(self, instance, dirname):
"""Return outputted filename with #### for padding
Passing the absolute path to Deadline enables Deadline Monitor
to provide the user with a Job Output menu option.
Deadline requires the path to be formatted with # in place of numbers.
From
/path/to/render.0000.png
To
/path/to/render.####.png
"""
# We'll need to take tokens into account
fname = cmds.renderSettings(firstImageName=True,
fullPath=True,
layer=instance.name)[0]
# outFormatControl:
# - 0 is no extension, name.#
# - 1 is with extension, name.#.ext
# - 2 is use custom extension
formatcontol = cmds.getAttr("defaultRenderGlobals.outFormatControl")
if formatcontol == 0:
raise RuntimeError("Output has no extension")
# Check the filename formatting from the render settings
# Does the output have frames?
has_frames = cmds.getAttr("defaultRenderGlobals.animation")
if not has_frames:
self.log.info("No frames in filename")
file_name = os.path.join(dirname, os.path.basename(fname))
return file_name
# Where are the frame put in the filename?
frame_before = cmds.getAttr("defaultRenderGlobals.putFrameBeforeExt")
# Get the number of digits the padding will get
padding_count = cmds.getAttr("defaultRenderGlobals.extensionPadding")
try:
# Always use the basename when wanting to perform actions such as split
basename = os.path.basename(fname)
basename_parts = basename.rsplit(".", 2)
# Depending on the where the frame is places, get the right
# variables rsplit
if frame_before:
name, padding, ext = basename_parts
else:
name, ext, padding = basename_parts
# check if the extension is correct for vray
new_padding = "#" * padding_count
fname = basename.replace(padding, new_padding)
new_ext = get_vray_extension() or ext
if new_ext != ext:
fname = fname.replace(ext, new_ext)
file_name = os.path.join(dirname, instance.name, fname)
except ValueError:
file_name = ""
self.log.info("Couldn't figure out where renders go")
return file_name
Thanks @aardschok.
I also struggled with this problem. The problem I'm having specifically is that of Redshift, which alters the name of the output Maya provides for it by appending .name_of_aov
to it.
Because of this lack of control, and because I expect other engines will impose their own control over it, I went with "let Maya name things however it pleases" and to treat the outputted image sequences for what they are, regardless of name.
The only way I could think to solve this, was by implementing Redshift specific functionality into the collector itself and from there determine the exact name. But given Mindbender is using Redshift alongside other engines with the expectation that they will continue to try even more engines in the near future, I chose not to go down that rabbit hole and let Maya and the engines do as they please.
Let me know what you think about this, odds are their requirements don't apply to you and that you can more safely determine the actual name. The loss on their part, was that I was unable to have them access the render via the Deadline GUI right-click menu "Browse Output". It's a great feature, but the added maintenance and cost of bugs was greater.
Because of this lack of control, and because I expect other engines will impose their own control over it, I went with "let Maya name things however it pleases" and to treat the outputted image sequences for what they are, regardless of name.
Just as a note: V-Ray does something similar, it appends the Render Element (which is a pass/AOV) name to the render layer name, e.g. layer.diffuse.####.exr
with diffuse being the render element.
Don't all renderers in Maya actually do that? :)
Don't all renderers in Maya actually do that? :)
I could not say! But they would at least not expose the same interface to find out.
Problem
The issue arises when creating the
OutputFilename0
for the payload which conflicts with the actual output.The conflict lies with assuming the output filename through the
cmds.renderSettings
where the information comes from the render settings' Common tab. Depending on the settings of theFrame/Animation ext
under File Output we might encounter an entire different formatting such asfilename.ext.#
. Example OutputFilename0:X:\project_awesome\film\shot0010\render\maya\renders\ENV\shot1_render_v007.tga.0001
Third party renderers such as VRay might override many settings, I have encountered that theFrame/Animation ex
is not alterable when VRay is set as renderer.The tokens from the renderSettings are not taken in account when creating the payload, you hardcoded the
OutputFilePrefix
with<RenderLayer>/<RenderLayer>
. The user might set it up as<RenderLayer>/<RenderPass>
Solution(s)
There are two ways this can be resolved.
Proposal