maya/python modify modelPanel layout and behaviour -
i'm working on first script in python. should 2 tabs script, on 1 tab there character picker, on second tab there should camera view face gui.
i'd rid of red circled menu (which can see here http://postimg.org/image/fozvc010x/) , lock view in way, forbidding zoom , pan.
i tried search on maya not clear me.
i attach code responsible view.
facialgui = cmds.formlayout() facialpanel = cmds.modelpanel(camera = "facial_cam") cmds.formlayout(facialgui, e=true, attachform=[ (facialpanel, "top", 0), (facialpanel, "left", 0), (facialpanel, "bottom", 0), (facialpanel, "right", 0) ]) cmds.setparent( '..' ) thanks, daniele!
to rid of red circled menu, in command modelpanel try set menubarvisible flag false
facialpanel = cmds.modelpanel(camera = "facial_cam", mbv=false) with command mel.eval("togglemodeleditorbars") can toggle editor bars' visibility.
if want lock zoom , pan, have on camera object.
edit
otherwise can screenshot of scene in way:
import maya.cmds cmd import maya.openmaya api import maya.openmayaui apiui def grabviewport(directory, imagename, ext="jpg"): viewport = apiui.m3dview.active3dview() viewport.refresh() img = api.mimage() img.create(1280, 720) viewport.readcolorbuffer(img, true) filepath = os.path.join(directory, imagename + "." + ext) img.writetofile(filepath, ext) cmd.viewset(front=true) cmd.viewfit() filename = "image" dir = "c:/snapshots" ext = "jpg" imagename = filename + "_front" grabviewport(dir, imagename, ext) so can take image , set in panel.
Comments
Post a Comment