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

Maya Batch Mode does not respect viewport_options #92

Open
joshdicarlo opened this issue Aug 2, 2022 · 2 comments
Open

Maya Batch Mode does not respect viewport_options #92

joshdicarlo opened this issue Aug 2, 2022 · 2 comments

Comments

@joshdicarlo
Copy link

When running maya in batch mode (mayapy.exe + maya.standalone), maya will only produce lit, smoothShaded, textured playblasts.

viewport_options - no matter how explicit, seem to be completely ignored in batch mode.

See issue 91 for some code snippets representing what I'm running in maya batch.

Simplified example of batch script (again haven't tested these trimmed versions, but they are stripped down directly from more featured versions):

# custom_capture_batch.py
import maya.standalone
maya.standalone.initialize()
import sys
_PATHS = [  ] #<-Insert any necessary extra sys.path stuff here
for p in _PATHS:
    sys.path.insert(0,p)
import custom_capture as cc
if __name__ == '__main__':
  import argparse

  parser = argparse.ArgumentParser()
  parser.add_argument('source_file', help='file to playblast from')
  args = parser.parse_args()

  # generate smooth shaded with textures
  cmds.file(args.source_file, f=1,o=1)

  # generate smooth shaded, lit, with textures
  cc.custom_capture(name = 'smooth_lit_tex',tex=True, flat_shaded = False, lit = True)
  # generate flat shaded, lit, with no textures
  cc.custom_capture(name = 'flat_lit_notex',tex=False, flat_shaded = True, lit = True)
  # generate flat shaded, lit, with textures
  cc.custom_capture(name = 'flat_lit_tex',tex=True, flat_shaded = True, lit = True)
  # generate flat shaded, unlit, no textures
  cc.custom_capture(name = 'flat_unlit_notex',tex=False, flat_shaded = True, lit = 0)

And the code that would be used to trigger it:

def custom_capture_batch(*args, **kwargs):
  import subprocess

  MAYA_DIR = #your may a directory here
  MAYA_EXE = '{0}/bin/mayapy.exe'.format(MAYA_DIR)
  SCRIPT = os.path.join(os.path.split(__file__)[0], 'scripts', 'custom_capture_batch.py').replace('\\','/')
  SRC_FILE = cmds.file(cmds.file(q=1,exn=1)

  process_args = [MAYA_EXE, SCRIPT, SRC_FILE]
  process = subprocess.Popen(process_args, creationflags=0x08000000, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, text=True)
@BigRoy
Copy link
Collaborator

BigRoy commented Aug 2, 2022

@joshdicarlo Playblasting in mayabatch (without a GUI) is very limited because as far as I am aware not all of its GUI & OpenGL capabilities are initialized. Can you confirm this issue does not occur with a call to cmds.playblast()?

Maya capture uses things like Maya's modelEditor commands to set e.g. visibilities or settings but I believe in Maya batch no actual model editors get initialized. But I might be wrong.

It would be great if you could set up a reproducable example that uses maya.cmds.playblast to confirm the issue is with Maya capture.

@joshdicarlo
Copy link
Author

Sure, I'll let you know if I confirm that. There was a time when playblasting didn't work at all in batch, but saw some recent posts around about it now being functional.

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

No branches or pull requests

2 participants