Skip to content
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

Scene-name for output #4

Closed
mottosso opened this issue Oct 7, 2014 · 8 comments
Closed

Scene-name for output #4

mottosso opened this issue Oct 7, 2014 · 8 comments
Labels

Comments

@mottosso
Copy link
Member

mottosso commented Oct 7, 2014

Provide a flag for using the current scene name for output

import capture
capture.capture(filename=capture.SCENE)
@BigRoy
Copy link
Collaborator

BigRoy commented Jul 12, 2015

The output path defined through filename is the complete destination path and not only the file's name. So do you mean this would save the playblast next to the working file?

Something like

# pseudocode (might work as is, but haven't tested)
import maya.cmds
import os
import capture

scene = cmds.file(query=True, sceneName=True)
filename, ext = os.path.splitext(scene)

capture(filename=filename)

Also, what happens if scene hasn't been saved yet?

@mottosso
Copy link
Member Author

You know, I'm not too sure what made me think of this feature initially. Possibly for it's simplicity, and generality; scripts could then be built without hard-coding any paths, and just assume the scene-name.

But you're right, what if the scene hasn't been saved? I'd probably expect an exception at that point, what do you think?

@BigRoy
Copy link
Collaborator

BigRoy commented Jul 12, 2015

I think many will have their own naming conventions so won't use it at all. Maybe only when doing a very quick capture could it be useful?

I think it's easier to stick to Maya's default conventions as a fallback for playblast locations. By default (if a path is relative) it will put it into the current workspace's movies file rule directory. For example this could be in the workspace.mel for a project:

workspace -fr "movie" "movies";

In practice if I would save with only a filename as opposed to a full path it would fall back on this system and do that?

# pseudocode (might work as is, but haven't tested)
import maya.cmds
import os
import capture

filename = "playblast"
scene = cmds.file(query=True, sceneName=True)
if scene:
    filename = os.path.basename(scene)
    filename, ext = os.path.splitext(filename)

capture(filename=filename)

I think that should capture into the movies directory with the scene name if file is saved, otherwise playblast is used. That should be similar to Maya's default behaviour through the UI.

So we only pass the filename and not the absolute path to the maya.cmds.playblast command and use Maya's fallback.

@mottosso
Copy link
Member Author

I think that sounds good, but it's hard to tell without having a solid use case.

Maybe let's find a use for it (in Magenta) and go from there?

@BigRoy
Copy link
Collaborator

BigRoy commented Jul 12, 2015

Sounds good.

Actually to be complete. At the current stage capture will fall back on Maya's system anyway for relative paths. Though I did notice something odd:

capture.snap(filename='test')
capture.capture(filename='test')

Both of these save to a different folder. The first goes into the images folder, the other saves next to the file. This makes me think it uses the format flag to derive what type of file it is? Usually there is no file rule for qt so it saves next to it?

Even more interesting is that saving through the Maya UI with playblast to filename test generates the following mel command:

playblast  -format qt -filename "movies/test.mov" -sequenceTime 0 -clearCache 1 -viewer 1 -showOrnaments 1 -fp 4 -percent 100 -compression "H.264" -quality 100 -widthHeight 960 540;

@mottosso
Copy link
Member Author

This makes me think it uses the format flag to derive what type of file it is?

That rings a bell, but can't be sure..

BigRoy added a commit to BigRoy/maya-capture that referenced this issue Jul 13, 2015
…n for best viewing.

- Moved `maintain_aspect_ratio` to `capture()` command so it could also be used for `maya.cmds.playblast` widthHeight.
- Center the independent on the screen to improve the viewing experience.
@BigRoy
Copy link
Collaborator

BigRoy commented Feb 19, 2016

I think this should just be added as an example snippet in the readme instead of a global option.

Something like this:

import os
import maya.cmds as cmds
import capture

filepath = cmds.file(q=1, sn=1)
filename = os.path.splitext(os.path.basename(filepath))[0]
capture.capture(filename=filename)

typed on phone, so there might be some typos

I remember there even being an argument for cmds.file to only retrieve the file's name as opposed to full path, so maybe you could even do it without os.

I think more advanced technical artists might customize it further anyway then just the filenames and as such don't use this?

What do you think?

BigRoy added a commit to BigRoy/maya-capture that referenced this issue Feb 19, 2016
- Include example for capturing selected cameras abstractfactory#3
- Include example for saving to scene name abstractfactory#4
@mottosso
Copy link
Member Author

Yeah, I like this direction. Less features, more flexibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants