本文整理汇总了Python中maya.cmds.modelPanel函数的典型用法代码示例。如果您正苦于以下问题:Python modelPanel函数的具体用法?Python modelPanel怎么用?Python modelPanel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了modelPanel函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: modView
def modView():
MyLabel = 'My Panel'
cmds.frameLayout( lv=0 )
mPanel = cmds.modelPanel()
modelPanel = cmds.modelPanel( mPanel, l=MyLabel, rp=oPanel )
'''
示例2: HUDInterface
def HUDInterface(self):
SelectedTab = cmds.tabLayout( "TabLayout", query = True, st = True)
#Get the persp panel
perspPanel = cmds.getPanel( withLabel='Persp View')
#change the view to the camera
cmds.modelPanel( perspPanel, edit = True, camera = "persp")
#When the Project tab is clicked
if SelectedTab == "CMProjectLayout":
cmds.hudButton("SnapButton", edit = True , vis = False)
self.TurntableHelper(False)
#When Image tab is clicked
elif SelectedTab == "SnapShotTabLayout":
cmds.hudButton("SnapButton", edit = True, rc = self.functions[0] , label = "Snap Image", vis = True)
self.TurntableHelper(False)
#When the turntable tab is clicked
elif SelectedTab == "TurntableCounterLayout":
cmds.hudButton("SnapButton", edit = True , rc = self.functions[1], label = "Create Turntable", vis = True)
self.TurntableHelper(True)
#When the Renderer tab is clicked
elif SelectedTab == "BatchRendererCounterLayout":
cmds.hudButton("SnapButton", edit = True , vis = False)
self.TurntableHelper(False)
#cmds.text("BatchRendererCounter", edit = True, label = "Image to render = " + str(BatchRendererFile.BatchRendererClass.ChangeCounter()))
示例3: playblastStart
def playblastStart(cameraList):
for x in cameraList:
i = cmds.listRelatives( x, p=True )
cmds.select(i)
start = cmds.findKeyframe( i, which="first" )
end = cmds.findKeyframe( i, which="last" )
sceneNameFull = cmds.file(query = True, shortName = True, sceneName = True)
if '.mb' in sceneNameFull or '.ma' in sceneNameFull:
sceneName = sceneNameFull[:-3]
else:
sceneName = sceneNameFull
cmds.select(cl = 1)
focus = cmds.getPanel( withFocus=True )
cmds.modelPanel( focus, edit=True, camera = x )
cmds.modelEditor( focus, edit = True, cameras = False, locators = False)
print start, end
if start == end: # this means there's no keyframes
print 'no keyframes on this one, playblasting timeline duration'
cmds.playblast (format = "qt", compression = "Sorenson Video 3", filename = desktop + sceneName + '_' + str(i[0]) + '.mov', clearCache = 1 , viewer = 0, showOrnaments = 1, fp = 4, percent = 100, quality = 100, widthHeight = [1280, 720])
else:
print 'keyframes found, playblasting their start to end'
cmds.playblast (startTime = start, endTime = end, format = "qt", compression = "Sorenson Video 3", filename = desktop + sceneName + '_' + str(i[0]) + '.mov', sequenceTime = 0, clearCache = 1 , viewer = 0, showOrnaments = 1, fp = 4, percent = 100, quality = 100, widthHeight = [1280, 720])
#cmds.playblast( completeFilename = str(i) + '.mov', startTime = start, endTime = end, viewer = True, clearCache = True, percent = 100, quality = 100, format = "qt", framePadding = 20 )
cmds.modelEditor( focus, edit = True, cameras = True, locators = True)
print ' moving to the next one '
示例4: mvgDeleteWindow
def mvgDeleteWindow():
import maya.cmds as cmds
if cmds.window('mayaMVG', exists=True):
cmds.deleteUI('mayaMVG', window=True)
if cmds.modelPanel('mvgLPanel', q=True, ex=True):
cmds.deleteUI('mvgLPanel', pnl=True)
if cmds.modelPanel('mvgRPanel', q=True, ex=True):
cmds.deleteUI('mvgRPanel', pnl=True)
示例5: SetActiveCamera
def SetActiveCamera(Camera):
print "Setting the active camera"
#Get the persp panel
perspPanel = cmds.getPanel( withLabel='Persp View')
#Get the active camera in the panel
cmds.modelPanel( perspPanel, edit = True, camera = Camera)
print Camera + " is set as the active camera in the perspView"
示例6: CreateSnap
def CreateSnap():
#Create a snapshot from the signature image
SubdivisionTextClass.ImagePath = cmds.getAttr("CMSettings.ProjectPath") + "/temp/" + cmds.getAttr("CMSettings.ModelName") + "_Subdivision_Temp_0" + ".png"
cmds.editRenderLayerGlobals( currentRenderLayer = "Subdivision_0")
ScreenCapture.ScreenCapture(SubdivisionTextClass.ImagePath, [740,400])
cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
#Return the camera to whatever it was
cmds.modelPanel( perspPanel, edit = True, camera = oldCamera)
示例7: ChangeCamera
def ChangeCamera():
cmds.modelPanel( perspPanel, edit = True, camera = "persp")
SubdivisionTextClass.Camera = "persp"
#change the view to the camera
i = 0
while cmds.objExists("shot_" + str(i)):
if cmds.getAttr("shot_" + str(i) + ".CMSignature"):
SubdivisionTextClass.Camera = "shot_" + str(i)
cmds.modelPanel( perspPanel, edit = True, camera = "shot_" + str(i))
i = i + 1
示例8: storeSettings
def storeSettings(self):
'''
main work function, store all UI settings
'''
self.dataStore['autoKey'] = cmds.autoKeyframe(query=True, state=True)
# timeline management
self.dataStore['currentTime'] = cmds.currentTime(q=True)
self.dataStore['minTime'] = cmds.playbackOptions(q=True, min=True)
self.dataStore['maxTime'] = cmds.playbackOptions(q=True, max=True)
self.dataStore['startTime'] = cmds.playbackOptions(q=True, ast=True)
self.dataStore['endTime'] = cmds.playbackOptions(q=True, aet=True)
self.dataStore['playSpeed'] = cmds.playbackOptions(query=True, playbackSpeed=True)
self.dataStore['playLoop'] = cmds.playbackOptions(query=True, loop=True)
# unit management
self.dataStore['timeUnit'] = cmds.currentUnit(q=True, fullName=True, time=True)
self.dataStore['sceneUnits'] = cmds.currentUnit(q=True, fullName=True, linear=True)
self.dataStore['upAxis'] = cmds.upAxis(q=True, axis=True)
# viewport colors
self.dataStore['displayGradient'] = cmds.displayPref(q=True, displayGradient=True)
# objects colors
self.dataStore['curvecolor'] = cmds.displayColor("curve", q=True, dormant=True)
# panel management
self.dataStore['panelStore'] = {}
for panel in ['modelPanel1', 'modelPanel2', 'modelPanel3', 'modelPanel4']:
if not cmds.modelPanel(panel, q=True, exists=True):
continue
self.dataStore['panelStore'][panel] = {}
self.dataStore['panelStore'][panel]['settings'] = cmds.modelEditor(panel, q=True, sts=True)
activeCam = cmds.modelPanel(panel, q=True, camera=True)
if not cmds.nodeType(activeCam) == 'camera':
activeCam = cmds.listRelatives(activeCam, f=True)[0]
self.dataStore['panelStore'][panel]['activeCam'] = activeCam
# camera management
# TODO : store the camera field of view etc also
self.dataStore['cameraTransforms'] = {}
for cam in ['persp', 'top', 'side', 'front']:
try:
self.dataStore['cameraTransforms'][cam] = [cmds.getAttr('%s.translate' % cam),
cmds.getAttr('%s.rotate' % cam),
cmds.getAttr('%s.scale' % cam)]
except:
log.debug("Camera doesn't exists : %s" % cam)
# sound management
self.dataStore['activeSound'] = cmds.timeControl(self.gPlayBackSlider, q=True, s=1)
self.dataStore['displaySound'] = cmds.timeControl(self.gPlayBackSlider, q=True, ds=1)
示例9: _independent_panel
def _independent_panel(width, height, off_screen=False):
"""Create capture-window context without decorations
Arguments:
width (int): Width of panel
height (int): Height of panel
Example:
>>> with _independent_panel(800, 600):
... cmds.capture()
"""
# center panel on screen
screen_width, screen_height = _get_screen_size()
topLeft = [int((screen_height-height)/2.0),
int((screen_width-width)/2.0)]
window = cmds.window(width=width,
height=height,
topLeftCorner=topLeft,
menuBarVisible=False,
titleBar=False,
visible=not off_screen)
cmds.paneLayout()
panel = cmds.modelPanel(menuBarVisible=False,
label='CapturePanel')
# Hide icons under panel menus
bar_layout = cmds.modelPanel(panel, q=True, barLayout=True)
cmds.frameLayout(bar_layout, edit=True, collapse=True)
if not off_screen:
cmds.showWindow(window)
# Set the modelEditor of the modelPanel as the active view so it takes
# the playback focus. Does seem redundant with the `refresh` added in.
editor = cmds.modelPanel(panel, query=True, modelEditor=True)
cmds.modelEditor(editor, edit=True, activeView=True)
# Force a draw refresh of Maya so it keeps focus on the new panel
# This focus is required to force preview playback in the independent panel
cmds.refresh(force=True)
try:
yield panel
finally:
# Delete the panel to fix memory leak (about 5 mb per capture)
cmds.deleteUI(panel, panel=True)
cmds.deleteUI(window)
示例10: addCharacter
def addCharacter(self, close, *args):
project = cmds.optionMenu(self.widgets["project"], q=True, value=True)
selectedCharacter = cmds.textScrollList(self.widgets["characterList"], q=True, si=True)[0]
rigPath = os.path.join(
self.mayaToolsDir, "General", "ART", "Projects", project, "AnimRigs", selectedCharacter + ".mb"
)
# find existing namespaces in scene
namespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
# reference the rig file
cmds.file(
rigPath, r=True, type="mayaBinary", loadReferenceDepth="all", namespace=selectedCharacter, options="v=0"
)
# clear selection and fit view
cmds.select(clear=True)
cmds.viewFit()
panels = cmds.getPanel(type="modelPanel")
# turn on smooth shading
for panel in panels:
editor = cmds.modelPanel(panel, q=True, modelEditor=True)
cmds.modelEditor(editor, edit=True, displayAppearance="smoothShaded", displayTextures=True, textures=True)
# find new namespaces in scene (this is here in case I need to do something later and I need the new name that was created)
newCharacterName = selectedCharacter
newNamespaces = cmds.namespaceInfo(listOnlyNamespaces=True)
for name in newNamespaces:
if name not in namespaces:
newCharacterName = name
# launch UI
import ART_animationUI
reload(ART_animationUI)
ART_animationUI.AnimationUI()
if close:
cmds.deleteUI(self.widgets["window"])
示例11: UpdateSubSnap
def UpdateSubSnap():
perspPanel = cmds.getPanel( withLabel='Persp View')
oldCamera = cmds.modelPanel( perspPanel, query = True, camera = True)
def ChangeCamera():
cmds.modelPanel( perspPanel, edit = True, camera = "persp")
SubdivisionTextClass.Camera = "persp"
#change the view to the camera
i = 0
while cmds.objExists("shot_" + str(i)):
if cmds.getAttr("shot_" + str(i) + ".CMSignature"):
SubdivisionTextClass.Camera = "shot_" + str(i)
cmds.modelPanel( perspPanel, edit = True, camera = "shot_" + str(i))
i = i + 1
def CreateSnap():
#Create a snapshot from the signature image
SubdivisionTextClass.ImagePath = cmds.getAttr("CMSettings.ProjectPath") + "/temp/" + cmds.getAttr("CMSettings.ModelName") + "_Subdivision_Temp_0" + ".png"
cmds.editRenderLayerGlobals( currentRenderLayer = "Subdivision_0")
ScreenCapture.ScreenCapture(SubdivisionTextClass.ImagePath, [740,400])
cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
#Return the camera to whatever it was
cmds.modelPanel( perspPanel, edit = True, camera = oldCamera)
ChangeCamera()
CreateSnap()
if cmds.picture("BasePicture", query = True, exists = True):
cmds.picture( "BasePicture", edit = True, image = SubdivisionTextClass.ImagePath )
示例12: reset_camera
def reset_camera ():
print '_' * 80
print '=' * 80
# parameter defaults
camParms = {
'displayFilmGate' : 1,
'displayResolution' : 1,
'panZoomEnabled' : 0,
'horizontalPan' : 0,
'verticalPan' : 0,
'zoom' : 1,
'horizontalFilmOffset' : 0,
'overscan' : 1,
'verticalFilmOffset' : 0
}
panel = cmds.getPanel (withFocus = True)
print '> panel:\t\t', panel
camera = cmds.modelPanel (panel, query = True, camera = True)
print '> camera:\t\t', camera
cameraShape = cmds.listRelatives (camera, shapes = True)[0]
print '> camera shape:\t', cameraShape
# set default parameters
for i in camParms:
cmds.setAttr (cameraShape + '.' + i, camParms[i])
print '>', i, ':', ' ' * (25 - len(i)), camParms[i]
示例13: draw_PlayView
def draw_PlayView(pWindowTitle, *args):
ctrl_set = set()
wInd = 0
WH = (-75, -125) # Window dimensions are 250*150, negated for addition
for panel in cmds.getPanel(vis=True):
try:
ctrl = cmds.modelPanel(panel, q=True, control=True)
ctrl_set.add(get_layout_control(ctrl))
log.debug("Panel: {}".format(ctrl))
log.debug("Control: {}".format(ctrl_set))
except:
pass
for parent in ctrl_set:
for w in get_windows():
if parent.startswith(w):
WC = get_window_center(w)
TLC = [sum(x) for x in zip(WC, WH)]
log.debug("Window center: {}".format(WC))
log.debug("Top-left corner: {}".format(TLC))
gui(parent, pWindowTitle, "{}{}".format(windowID, wInd), TLC)
log.debug("Window: {}{}".format(windowID, wInd))
log.debug("Control: {}".format(parent))
wInd += 1
示例14: setCaptureSettings
def setCaptureSettings(self):
for i in self.mPanelList:
mEditor = cmds.modelPanel(i['model_panel'], query=True, modelEditor=True)
for setting in i:
if setting != 'model_panel':
execStr = 'cmds.modelEditor("' + str(mEditor) + '", edit=True, ' + setting + '=' + str(i[setting]) + ')'
exec(execStr)
示例15: getCurrentModelPanels
def getCurrentModelPanels():
pannels = cmds.getPanel( vis=1 )
modelPanels = []
for pannel in pannels:
if cmds.modelPanel( pannel, ex=1 ):
modelPanels.append( pannel )
return modelPanels