Git Product home page Git Product logo

Comments (8)

BigRoy avatar BigRoy commented on August 11, 2024

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?

from maya-capture.

mottosso avatar mottosso commented on August 11, 2024

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?

from maya-capture.

BigRoy avatar BigRoy commented on August 11, 2024

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.

from maya-capture.

mottosso avatar mottosso commented on August 11, 2024

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?

from maya-capture.

BigRoy avatar BigRoy commented on August 11, 2024

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;

from maya-capture.

mottosso avatar mottosso commented on August 11, 2024

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..

from maya-capture.

BigRoy avatar BigRoy commented on August 11, 2024

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?

from maya-capture.

mottosso avatar mottosso commented on August 11, 2024

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

from maya-capture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.