• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python cmds.lookThru函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中maya.cmds.lookThru函数的典型用法代码示例。如果您正苦于以下问题:Python lookThru函数的具体用法?Python lookThru怎么用?Python lookThru使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了lookThru函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: changeToPerspCam

 def changeToPerspCam(self):
     currentCam = cmds.lookThru(q=True)
     if currentCam != 'persp':
         # Select the perspective camera (default = modelPfloatanel4)attributeValue
         cmdStr = "lookThroughModelPanel" + " " + "persp" + " " + "modelPanel4;"
         mel.eval(cmdStr)
         cmds.lookThru('persp')
开发者ID:wolfpatrick,项目名称:FluidExplorerPlugin,代码行数:7,代码来源:MayaFunctions.py


示例2: createPreviewCamera

def createPreviewCamera(objectName):
    cmds.camera()
    cmds.rename("preview")
    mel.eval("cameraMakeNode 2 \"\";")
    selList = cmds.ls(selection=True)
    print(selList)

    previewCam = selList[0]
    previewAim = selList[1]

    boxMin = cmds.getAttr(objectName + ".boundingBoxMin")[0]
    boxMax = cmds.getAttr(objectName + ".boundingBoxMax")[0]

    ## move aim to bbx center
    aimPos = [(boxMax[0] + boxMin[0]) / 2, (boxMax[1] + boxMin[1]) / 2, (boxMax[2] + boxMin[2]) / 2]
    print(aimPos)
    cmds.move(aimPos[0], aimPos[1], aimPos[2], previewAim)

    camPosy = boxMax[1] * 1.7
    camPosx = boxMin[0] + camPosy * 1.2
    camPosz = boxMin[2] + camPosy * 1.2
    cmds.move(camPosx, camPosy, camPosz, previewCam)

    preCamShape = cmds.listRelatives(previewCam, children=True)[0]
    cmds.lookThru(preCamShape, "perspView")
开发者ID:yes7rose,项目名称:maya_utils,代码行数:25,代码来源:maya_utils.py


示例3: makeCamera

	def makeCamera(self, arg = None) : 
		self.renderCameraName = mc.textField('%s_newCameraTX' % self.ui, q = True, tx = True)
		self.setRenderSetting()
		self.currentCamera = mc.lookThru(q = True)

		if self.currentCamera : 

			if not mc.objExists(self.renderCameraName) : 
				self.renderCamera = mc.duplicate(self.currentCamera, n = self.renderCameraName)

			else : 
				self.renderCamera = [self.renderCameraName]

			cameraShape = mc.listRelatives(self.renderCamera[0], s = True)[0]

			mc.setAttr('%s.panZoomEnabled' % cameraShape, 1)
			mc.setAttr('%s.renderPanZoom' % cameraShape, 1)
			mc.setAttr('%s.displayResolution' % cameraShape, 1)

			mc.textField('%s_cameraTX' % self.ui, e = True, tx = self.renderCamera[0])
			mc.textField('%s_crrCameraTX' % self.ui, e = True, tx = self.currentCamera)
			mc.lookThru(self.renderCamera[0])

		else : 
			print 'Cannot get current camera'
开发者ID:myCodeTD,项目名称:tools2D,代码行数:25,代码来源:minifig2D_v003.py


示例4: customizeCamera

 def customizeCamera(self, camera):
     cmds.lookThru(camera)
     cmds.addAttr(camera, ln="Overlay", at="enum", en="No Overlay:Grid:SpiralTopRight:SpiralTopLeft:SpiralBottomRight:SpiralBottomLeft")
     cmds.addAttr(camera, ln="Overlay_Value", at="long")
     cmds.setAttr(camera + '.Overlay', e=True, keyable=True)
     cmds.setAttr(camera + '.Overlay_Value', e=True, keyable=True)
     cmds.expression(s='int $a=%s.Overlay;\r\n' % camera +
                       '%s.Overlay_Value=$a;' % camera+
                       'switch($a) { \r\n' +
                       '  case 0: \r\n' +
                       '    python("camera_overlays.Overlay_Function().noOverlay()"); \r\n' +
                       '    break;\r\n' +
                       '  case 1: \r\n' +
                       '    python("camera_overlays.Overlay_Function().toggleThirdsGrid()"); \r\n' +
                       '    break;\r\n' +
                       '  case 2: \r\n' +
                       '    python("camera_overlays.Overlay_Function().toggleGoldenSprialTopRight()"); \r\n' +
                       '    break;\r\n' +
                       '  case 3: \r\n' +
                       '    python("camera_overlays.Overlay_Function().toggleGoldenSprialTopLeft()"); \r\n' +
                       '    break;\r\n' +
                       '  case 4: \r\n' +
                       '    python("camera_overlays.Overlay_Function().toggleGoldenSprialBottomRight()"); \r\n' +
                       '    break;\r\n' +
                       '  case 5: \r\n' +
                       '    python("camera_overlays.Overlay_Function().toggleGoldenSprialBottomLeft()"); \r\n' +
                       '}select %s;\r' % camera, ae=False, o="renderCam")
开发者ID:afrocircus,项目名称:LVFX-pipeline,代码行数:27,代码来源:custom_camera.py


示例5: turntable

def turntable():
    """
    Main function. Creates turntable. Requires a list of selected objects.
    :return: None
    """
    objs = cmds.ls(selection=True)
    meshes = checkSelection(objs)
    if not meshes:
        cmds.error('Please select a mesh object')
    pivlist = getSelectionPivot(meshes)
    turnCam = createCamera()
    centroid = findCentroid(pivlist)

    # change camera pivot to centroid
    cmds.xform(turnCam[0], ws=True, piv=centroid)

    # animate camera. rotate around y axis.
    firstFrame = str(cmds.playbackOptions(q=True, minTime=True))
    lastFrame = str(cmds.playbackOptions(q=True, maxTime=True))
    cmds.expression(name='TurnTableExpression',
                    string='{0}.rotateY=360*(frame-{1})/{2}-{1};'.format(turnCam[0],
                                                                         firstFrame, lastFrame))

    # create a 3 point light rig.
    keyLight = createLight('areaLight', 'key', centroid)
    fillLight = createLight('areaLight', 'fill', centroid)
    rimLight = createLight('areaLight', 'rim', centroid)
    cmds.lookThru(turnCam[0])
开发者ID:afrocircus,项目名称:LVFX-pipeline,代码行数:28,代码来源:turntable.py


示例6: set_camera_drawing

def set_camera_drawing():
    c = cmds.camera(rotation=[0,90,0], position=[0,0,0])

    panels = cmds.getPanel( all=True )
    cmds.lookThru(c[0])

    cmds.setKeyframe(c, attribute='rotateX', t='0sec', value=0)
    cmds.setKeyframe(c, attribute='translateY', t='0sec', value=15)
    cmds.setKeyframe(c, attribute='translateZ', t='0sec', value=0)
开发者ID:chirs,项目名称:studio5,代码行数:9,代码来源:panopticon.py


示例7: get_thumbnail

 def get_thumbnail(self):
     for camera in mc.listCameras():
         if camera == "persp":
             pass
         else:
             mm.eval("viewFit -all;")
             mc.lookThru(camera)
             mc.playblast( cf= "H:\\Image Test\\" + camera + ".jpg" , fr=1, fmt="image", v=False, wh=[500, 300], orn=False,
                 compression="jpg", quality=100, percent=100 )
开发者ID:ThibH,项目名称:software_scripts,代码行数:9,代码来源:thumbnail_without_camera.py


示例8: setCurrentCamera

def setCurrentCamera(cam):
    '''
    Sets the current maya viewport camera.

    Args:
        cam(string): the camras name you want to set
    '''
    vpPanel = cmds.getPanel(wf=True)
    cmds.lookThru(vpPanel, cam)
开发者ID:cmcpasserby,项目名称:pbTools,代码行数:9,代码来源:helpers.py


示例9: set_camera_moving

def set_camera_moving():
    """
    Set the camera.
    """

    #c = cmds.camera(rotation=[0,90,0], position=[100,0,0])
    c = cmds.camera(rotation=[-28,45,0], position=[28, 21, 28])

    panels = cmds.getPanel( all=True )
    cmds.lookThru(c[0])
开发者ID:chirs,项目名称:studio5,代码行数:10,代码来源:panopticon.py


示例10: clearScene

def clearScene(arg):
    '''
    Deletes all objects and shaders in the scene.
    
    args: Dummy argument needed to satisfy the command interface.
    On exit: All objects and shaders in the scene have been deleted, and the active camera
             has been changed to the default "persp" camera.
    '''
    cmds.select(all = True)
    cmds.delete()
    cmds.lookThru("persp")
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:11,代码来源:cityGui.py


示例11: main

def main():

    panels = cmds.getPanel( all=True )
    cmds.lookThru(c[0])

    cmds.setKeyframe(c[0], attribute='translateY', t=['0sec',], value=20)
    cmds.setKeyframe(c[0], attribute='translateY', t=['15sec',], value=0)

    cmds.setKeyframe(c[0], attribute='translateZ', t=['3sec',], value=0)
    cmds.setKeyframe(c[0], attribute='translateZ', t=['9sec',], value=20)

    cmds.setKeyframe(c[0], attribute='rotateX', t=['0sec',], value=-90)
    cmds.setKeyframe(c[0], attribute='rotateX', t=['15sec',], value=0)
开发者ID:chirs,项目名称:studio5,代码行数:13,代码来源:camera.py


示例12: makeCamera

def makeCamera(name_, environment):
    '''
    Creates a camera with the given background colour. 
    
    name_: The name the camera is given.
    environment: The colour the backround for the camera will have.
    On exit: A camera with the given background colour has been created and 
             made active.
    '''
    camera_ = cmds.camera(n = name_)
    cmds.setAttr(camera_[1] + ".backgroundColor", environment[0], environment[1],environment[2])
    cmds.camera(camera_[0], edit = True, position = [0,100,250], rotation = [-23,0,0])
    cmds.lookThru(camera_[0])
开发者ID:hcbsundberg,项目名称:City_Generator,代码行数:13,代码来源:cityGenerator.py


示例13: setUI

	def setUI(self, mode, arg = None) : 

		# multi frame
		multi = mc.checkBox('%s_multiCB' % self.ui, q = True, v = True)

		if mode == 'getCurrentCamera' : 
			camera = mc.lookThru(q = True)
			mc.textField('%s_crrCameraTX' % self.ui, e = True, tx = camera)

		if mode == 'get2DCamera' : 
			camera = mc.lookThru(q = True)
			mc.textField('%s_cameraTX' % self.ui, e = True, tx = camera)

		if mode == 'getCurrentTime' : 
			if multi : 
				currentTime = str(int(mc.currentTime(q = True)))
				currentTimes = self.checkMultiFrame()

				if not currentTime in currentTimes : 
					text = (',').join(currentTimes)
					text = (',').join([text, str(currentTime)])
					mc.textField('%s_frameTX' % self.ui, e = True, tx = text)

			else : 
				currentTime = int(mc.currentTime(q = True))
				mc.textField('%s_frameTX' % self.ui, e = True, tx = currentTime)

		if mode == 'getCurrentCameraOM' : 
			camera = mc.optionMenu('%s_crrCameraOM' % self.ui, q = True, v = True)
			mc.textField('%s_crrCameraTX' % self.ui, e = True, tx = camera)

		if mode == 'get2DCameraOM' : 
			camera = mc.optionMenu('%s_cameraOM' % self.ui, q = True, v = True)
			mc.textField('%s_cameraTX' % self.ui, e = True, tx = camera)


		if mode == 'getNewCamera' : 
			sel = mc.ls(sl = True)

			if sel : 
				namespace = mayaTools.getNamespace(sel[0])
				text = '%s_cam' % namespace
				mc.textField('%s_newCameraTX' % self.ui, e = True, tx = text)


		if mode == 'onAddLayers' : 
			mc.textScrollList('%s_renderLayerTSL' % self.ui, e = True, en = True)

		if mode == 'offAddLayers' : 
			mc.textScrollList('%s_renderLayerTSL' % self.ui, e = True, en = False)
开发者ID:myCodeTD,项目名称:tools2D,代码行数:50,代码来源:minifig2D_v003.py


示例14: switchCamera

	def switchCamera(self, arg = None) : 
		cam3D = mc.textField('%s_crrCameraTX' % self.ui, q = True, tx = True)
		cam2D = mc.textField('%s_cameraTX' % self.ui, q = True, tx = True)

		print cam3D, cam2D

		if cam3D and cam2D : 
			cam = {cam2D: cam3D, cam3D: cam2D}
			setting = {cam3D: 'self.setRenderSetting()', cam2D: 'self.restoreRender()'}
			currentCam = mc.lookThru(q = True)

			if currentCam : 
				mc.lookThru(cam[currentCam])
				eval(setting[currentCam])
开发者ID:myCodeTD,项目名称:tools2D,代码行数:14,代码来源:minifig2D_v003.py


示例15: adjustLights

 def adjustLights(self, *args):
     """Function that looks through the next light for Camera adjustment"""
     #Look through a light for easy adjustment
     print("adjustLights called\n")
     for l in self.lights:
         if l == self.currentLight:
             lxform = cmds.listRelatives(l, p=1)
             print("DEBUG: looking thru: " + lxform[0])
             cmds.lookThru("modelPanel4", lxform[0],  nc=.001, fc=1000)
     if self.currentLight == "keyLightShape":
         self.currentLight = "fillLightShape"
     elif self.currentLight == "fillLightShape":
         self.currentLight = "backLightShape"
     else:
         self.currentLight = "keyLightShape"
开发者ID:NicolasBar,项目名称:maya,代码行数:15,代码来源:3ptLightwin_2.0.py


示例16: _maintain_camera

def _maintain_camera(panel, camera):
    state = {}

    if not _in_standalone():
        cmds.lookThru(panel, camera)
    else:
        state = dict((camera, cmds.getAttr(camera + ".rnd"))
                     for camera in cmds.ls(type="camera"))
        cmds.setAttr(camera + ".rnd", True)

    try:
        yield
    finally:
        for camera, renderable in state.iteritems():
            cmds.setAttr(camera + ".rnd", renderable)
开发者ID:ProgressiveFX,项目名称:pyblish-pfx,代码行数:15,代码来源:capture.py


示例17: runImportLight

    def runImportLight(self, arg = None) : 
        title = 'Light Template'
        allRefs = mc.file(q = True, r = True)
        rigGrp = 'Rig:Geo_Grp'
        selLight = str(self.ui.light_comboBox.currentText())
        self.selLightPath = '%s/%s' % (self.lightRig, selLight)

        if not mc.objExists('Light_Grp') : 
            if not self.selLightPath in allRefs : 
                mc.file(self.selLightPath,r=True, uns=True, dns=True )
            
            mc.setAttr( "vraySettings.relements_usereferenced", 1)

        else : 
            self.messageBox('Warning', 'Light Rig Exists')

        if not mc.objExists('cam_grp') : 
            if not self.turnTableCamera in allRefs : 
                mc.file(self.turnTableCamera, r=True, uns=True, dns=True)

            mc.playbackOptions( min=1 ) 
            mc.playbackOptions( max=100 ) 
            mc.lookThru('turntable_cam')
            mc.setAttr('turntable_camShape.renderable', 1)
            allCams = mc.listCameras()

            for eachCam in allCams : 
                shape = mc.listRelatives(eachCam, s = True)[0]
                mc.setAttr('%s.renderable' % shape, 0)

                if eachCam == 'turntable_cam' : 
                    mc.setAttr('%s.renderable' % shape, 1)
                    mc.setAttr('%s.displayFieldChart' % shape, 1)
                    mc.setAttr('%s.displayResolution' % shape, 1)
                    mc.setAttr('%s.overscan' % shape, 1.3)
                    mc.setAttr('%s.backgroundColor' % shape, 0.5, 0.5, 0.5, type = 'double3')
                    # mc.eval('setAttr "turntable_camShape.backgroundColor" -type double3 0.5 0.5 0.5 ;')

                    if mc.objExists(rigGrp) : 
                        mc.select(rigGrp)
                        mm.eval('fitPanel -selected;')

                    mc.currentTime(9)

            self.setStatus(title, True)        

        else : 
            self.messageBox('Warning', 'Turntable Camera Exists')
开发者ID:myCodeTD,项目名称:shade_tool,代码行数:48,代码来源:shade_app.py


示例18: CameraToPopDist

 def CameraToPopDist( self ):
     camPos = Vector(mc.xform(mc.lookThru(q=True),q=True,t=True))
     if self.nearestRoot:
         popPos = Vector(mc.objectCenter(self.nearestRoot))
     else:
         popPos = self.FindNearestObjectToCamera()
     return (camPos-popPos).mag()
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:7,代码来源:traceSelectTool.py


示例19: lookThruAndFrame

def lookThruAndFrame(obj):
    """
    Looks through the given obj and moves the obj so that it frames the viewport objects.
    :param obj: The camera or light object.
    :return: None
    """
    cmds.lookThru(obj)
    # Position the active camera to view the active objects
    pm.viewFit()

    # Position cameraShape-1 to view all objects
    pm.viewFit(obj, all=True)

    # Fill 50 percent of the active view with active objects
    pm.viewFit(f=0.5)
    pm.viewFit(all=True)
开发者ID:afrocircus,项目名称:LVFX-pipeline,代码行数:16,代码来源:turntable.py


示例20: TraceGesturePress

    def TraceGesturePress( self ):
        """ Procedure called on press """
        if debug>0: print("begin PRESS")
        # Clean up: if there are any locators or groups in the scene, delete them
        if( len(mc.ls("locator*")) > 0 ):
            mc.delete(mc.ls("locator*"))
        if( len(mc.ls("*Grp")) > 0 ):
            mc.delete(mc.ls("*Grp"))

        # find the position of the mouse click
        pressPosition = Vector( mc.draggerContext( 'TraceGesture', query=True, anchorPoint=True) )

        camPos = self.CameraPosition()
        viewAxis = self.CameraViewAxis()
        closestObj2Cam = self.FindNearestObjectToCamera()
        self.interactionPlane = Plane(viewAxis,closestObj2Cam)

        pressPosition = self.FindRayPlaneIntersect( camPos, pressPosition, self.interactionPlane )
        if debug > 0:
            mc.group(n="traceGrp",empty=True)
            loc = mc.spaceLocator(p=pressPosition)
            mc.parent(loc,"traceGrp")

        for root in self.xformRoots:
            # remember whether (or not) the motion paths for a root were visible when the interaction started
            self.motionPathsVisible[root] = mc.getAttr("%s_MotionTraces.visibility"%root)
            # set up all the traces
            self.trace[root].Clear()
            # set the trace normal to the viewing normal of the camera
            self.trace[root].normal = self.interactionPlane.normal #Vector( mc.xform(mc.lookThru(q=True), q=True, m=True)[8:11] )
            self.trace[root].planePt = self.interactionPlane.point #closestObj2Cam

        self.nearestRoot, rootDist = self.FindNearestRoot( pressPosition, self.interactionPlane )
        mc.setAttr("%s_MotionTraces.visibility"%self.nearestRoot, 1)   # vis the new display layer

        # make a group to hold the trace locators
        if debug > 0:
            mc.group(name="trace%sGrp"%self.nearestRoot,empty=True)
            loc = mc.spaceLocator(p=pressPosition)
            mc.parent(loc,"trace%sGrp"%self.nearestRoot)
        # reset the trace
        self.trace[self.nearestRoot].Clear()
        # start the timer
        self.startTime = time.time()
        # set the trace normal to the viewing normal of the camera
        self.trace[self.nearestRoot].normal = Vector( mc.xform(mc.lookThru(q=True), q=True, m=True)[8:11] )
        self.trace[self.nearestRoot].planePt = closestObj2Cam
                
        # add the initial click position to the trace
        self.trace[self.nearestRoot].AddPoint( pressPosition )
        
        self.nearestPath, pathDist = self.FindNearestMotionPath( pressPosition, self.nearestRoot )
        if not mc.draggerContext( 'TraceGesture', query=True, modifier=True) == "ctrl":
            self.trace[self.nearestRoot].SetUpDTWs()
            mc.refresh(currentView=True,force=True)
        if debug>0: print("end PRESS")
开发者ID:jeisenma,项目名称:traceSelectionInMaya,代码行数:56,代码来源:traceSelectTool.py



注:本文中的maya.cmds.lookThru函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python cmds.ls函数代码示例发布时间:2022-05-27
下一篇:
Python cmds.lockNode函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap