-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
viewer=False removes file extension #51
Comments
Do you have any idea for a good solution to this? It's kind of holding me back on something and I want to avoid just "guessing" the extension? |
Not directly, if you think of anything, PR's are welcome! |
It's a really tricky one, because there seems to be no way to really know the extension. A way I'm thinking of is doing something like |
I think there are only two options on output, film or image, where each have their own number of compressions. Maybe we could build a dictionary of each combination and take control over that extension ourselves? {
"mov": {
"h264": ".mov",
"avi": ".avi"
},
"image": {
"png": ".png",
"tiff": ".tiff"
}
} |
Could do yes, but there's quite a list of available options. Plus that it depends on the codecs that are installed on a system. So you might miss some that others might have but you don't. To have a list of available options: import maya.cmds as mc
def list_formats():
import maya.cmds
# Workaround for Maya playblast bug where undo would
# move the currentTime to frame one.
maya.cmds.currentTime(maya.cmds.currentTime(q=1))
return maya.cmds.playblast(query=True, format=True)
def list_compressions(format):
import maya.mel
# Workaround for Maya playblast bug where undo would
# move the currentTime to frame one.
maya.cmds.currentTime(maya.cmds.currentTime(q=1))
cmd = 'playblast -format "{0}" -query -compression'.format(format)
return maya.mel.eval(cmd)
for format in list_formats():
for compression in list_compressions(format):
print format, compression Another trick could be to instead of disabling the |
A workaround we have put in place in production (even though it's quite a hack!) was the following: import os
import glob
import logging
log = logging.getLogger(__name__)
def _fix_playblast_output_path(filepath):
"""Workaround a bug in maya.cmds.playblast to return correct filepath.
When the `viewer` argument is set to False and maya.cmds.playblast does not
automatically open the playblasted file the returned filepath does not have
the file's extension added correctly.
To workaround this we just glob.glob() for any file extensions and assume
the latest modified file is the correct file and return it.
"""
# Catch cancelled playblast
if filepath is None:
log.warning("Playblast did not result in output path. "
"Playblast is probably interrupted.")
return
# Fix: playblast not returning correct filename (with extension)
# Lets assume the most recently modified file is the correct one.
if not os.path.exists(filepath):
files = glob.glob(filepath + ".*")
if not files:
raise RuntimeError("Couldn't find playblast from: "
"{0}".format(filepath))
filepath = max(files, key=os.path.getmtime)
return filepath This has worked for video files perfectly. Haven't tested it with image sequences yet. Unfortunately I still haven't found a way to have the |
I have submitted this as a bug to Autodesk. The support ticket id is |
The Autodesk Support team was able to reproduce this issue on their end and they've submitted a change request to the dev team. Once there's any new information on that end I'll follow up here. |
This bug is present in
cmds.playblast
too.The text was updated successfully, but these errors were encountered: