本文整理汇总了Python中maya.cmds.camera函数的典型用法代码示例。如果您正苦于以下问题:Python camera函数的具体用法?Python camera怎么用?Python camera使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了camera函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: setThreePanelLayout
def setThreePanelLayout():
shotCamera = animMod.getShotCamera()
if not shotCamera: shotCamera = "persp"
mel.eval("toolboxChangeQuickLayoutButton \"Persp/Graph/Hypergraph\" 2;"+\
#"ThreeTopSplitViewArrangement;"+\
"lookThroughModelPanel %s hyperGraphPanel2;"%shotCamera+\
"lookThroughModelPanel persp modelPanel4;")
#"scriptedPanel -e -rp modelPanel2 graphEditor1;")
viewports = [view for view in cmds.getPanel(type='modelPanel') if view in cmds.getPanel(visiblePanels=True)]
defaultCameras = [u'front', u'persp', u'side', u'top']
for view in viewports:
camera = utilMod.getCamFromSelection([cmds.modelEditor(view, query=True, camera=True)])
cameraTransform = camera[0]
cameraShape = camera[1]
if cameraTransform in defaultCameras:
utilMod.animViewportViewMode(view)
if cameraTransform == "persp":
cmds.camera(cameraTransform, edit=True, orthographic=False)
cmds.setAttr("%s.nearClipPlane"%cameraShape, 1000)
cmds.setAttr("%s.farClipPlane"%cameraShape, 10000000)
cmds.setAttr("%s.focalLength"%cameraShape, 3500)
else:
utilMod.cameraViewMode(view)
cmds.setAttr("%s.displayFilmGate"%cameraShape, 1)
cmds.setAttr("%s.overscan"%cameraShape, 1)
开发者ID:Italic-,项目名称:maya-prefs,代码行数:28,代码来源:commandsMod.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: save_image_with_camera_pos
def save_image_with_camera_pos(csv_writer, mesh_name, file_ext, dest_dir, camera_pos, camera_interest_pos):
camera_name, camera_shape = cmd.camera(p=camera_pos, wci=camera_interest_pos)
cmd.setAttr(camera_shape+'.backgroundColor', back_color[0], back_color[1], back_color[2], type="double3")
cmd.setAttr(camera_shape+".renderable", 1)
focal_length = cmd.camera(camera_shape, q=True, fl=True)
inches_to_mm = 25.4
app_horiz = cmd.camera(camera_shape, q=True, hfa=True) * inches_to_mm
app_vert = cmd.camera(camera_shape, q=True, vfa=True) * inches_to_mm
pixel_width = cmd.getAttr("defaultResolution.width")
pixel_height = cmd.getAttr("defaultResolution.height")
focal_length_x_pixel = pixel_width * focal_length / app_horiz
focal_length_y_pixel = pixel_height * focal_length / app_vert
# print cmd.camera(camera_shape, q=True, fs=True)
# print focal_length
# print app_horiz, app_vert
# print focal_length_x_pixel, focal_length_y_pixel
image_file = mesh_name+"."+file_ext
image_src = cmd.render(camera_shape)
image_dest = path.join(dest_dir, image_file)
shutil.move(image_src, image_dest)
save_camera_data_to_writer(csv_writer, mesh_name, camera_pos, camera_interest_pos, focal_length)
开发者ID:brianhou,项目名称:GPIS,代码行数:27,代码来源:maya_renderer.py
示例4: __init__
def __init__ (self):
try: self.name = self.get_camera_from_selection() [0]
except: self.name = self.get_camera_from_panel()
try: self.shape = cmds.listRelatives (self.name, shapes = True) [0]
except: self.shape = ""
if self.shape != "":
self.res_x = cmds.getAttr ("defaultResolution.width")
self.res_y = cmds.getAttr ("defaultResolution.height")
self.focal = cmds.camera (self.shape, query = True, focalLength = True)
self.aperture_h = cmds.getAttr (self.shape + ".horizontalFilmAperture")
self.aperture_h = cmds.camera (self.shape, query = True, horizontalFilmAperture = True)
self.aperture_v = cmds.getAttr (self.shape + ".verticalFilmAperture")
self.pixelAspect = cmds.getAttr ("defaultResolution.pixelAspect")
self.deviceAspect = cmds.getAttr ("defaultResolution.deviceAspectRatio")
cmds.getAttr ("defaultResolution.lockDeviceAspectRatio")
cmds.camera (self.shape, edit = True, displayResolution = 1)
cmds.camera (self.shape, edit = True, displayFilmGate = 1)
cmds.camera (self.shape, edit = True, farClipPlane = 1000000)
cmds.camera (self.shape, edit = True, nearClipPlane = 0.01)
cmds.setAttr (self.shape + ".focalLength", channelBox = True)
cmds.setAttr (self.shape + ".horizontalFilmAperture", channelBox = True)
cmds.setAttr (self.shape + ".verticalFilmAperture", channelBox = True)
cmds.setAttr (self.name+".sx", keyable=False, channelBox = True)
cmds.setAttr (self.name+".sy", keyable=False, channelBox = True)
cmds.setAttr (self.name+".sz", keyable=False, channelBox = True)
cmds.setAttr (self.name+".v", keyable=False, channelBox = True)
self.print_info()
#self.add_imageplane()
else: print ":: SELECT CAMERA"
开发者ID:danielforgacs,项目名称:code-dump,代码行数:34,代码来源:ford_Camera_v0_1_7.py
示例5: CreateCamera
def CreateCamera(self):
print "Creating camera"
#Array to store all objects in the scene
cmds.select(None)
#Copy from the current active camera
cmds.duplicate( self.GetActiveCamera(), name = self.Camera)
try:cmds.delete(self.Camera + "|CMForegroundPlane")
except:pass
try:cmds.delete(self.Camera + "|CMBackgroundPlane")
except:pass
i = 0
while(cmds.objExists("shot_" + str(i))):
try:cmds.delete(self.Camera + "|" + "shot_" + str(i) + "_ImagePlane")
except:pass
i = i + 1
#Make the camera startup so that the user may not delete it directly
#Enable the resolution gate
cmds.camera(self.Camera, edit = True, startupCamera = True, displayResolution = True)
#Make the camera hidden
cmds.setAttr(self.Camera + ".visibility", False)
#Add the attributes to define range and renderability
cmds.select(self.Camera)
cmds.addAttr(longName = 'CMRenderable', attributeType = 'bool', defaultValue = True)
cmds.addAttr(longName = 'StartRange', attributeType = 'short', defaultValue = 0, min = 0, max = 35)
cmds.addAttr(longName = 'StopRange' , attributeType = 'short', defaultValue = 35, min = 0, max = 35)
cmds.select(None)
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:32,代码来源:TurntableFile.py
示例6: creatStereo
def creatStereo():
camL = mc.ls(sl=1)
if camL == []:
mc.confirmDialog(title="Missing", message="Please select a camera!", button=["Ok"])
return
cam = camL[0]
camShape = mc.listRelatives(cam, s=1)[0]
FL = mc.camera(cam, q=1, fl=1)
NCP = mc.camera(cam, q=1, ncp=1)
FCP = mc.camera(cam, q=1, fcp=1)
cam3d = maya.app.stereo.stereoCameraRig.createStereoCameraRig()
mc.parent(cam3d[0], cam)
mc.setAttr(cam3d[0] + ".translate", 0, 0, 0, lock=1)
mc.setAttr(cam3d[0] + ".rotate", 0, 0, 0, lock=1)
mc.setAttr(cam3d[0] + ".scale", 1, 1, 1, lock=1)
cam3dShape = mc.listRelatives(cam3d[0], s=1)[0]
mc.connectControl("interaxialSleder", stereoShape + ".interaxialSeparation")
mc.connectControl("zeroSleder", stereoShape + ".zeroParallax")
mc.setAttr(cam3dShape + ".focalLength", FL)
mc.setAttr(cam3dShape + ".nearClipPlane", NCP)
mc.setAttr(cam3dShape + ".farClipPlane", FCP)
mc.setAttr(cam3dShape + ".zeroParallaxPlane", 1)
mc.setAttr(cam3dShape + ".safeViewingVolume", 1)
for i in cam3d:
mc.rename(i, cam + "_" + i)
camListStereo = mc.ls(type="stereoRigTransform")
if camListStereo == []:
mc.floatSliderGrp(interaxialSleder, e=1, enable=False)
mc.floatSliderGrp(zeroSleder, e=1, enable=False)
else:
stereoShape = mc.listRelatives(camListStereo[0], s=1)[0]
mc.floatSliderGrp(interaxialSleder, e=1, enable=True)
mc.floatSliderGrp(zeroSleder, e=1, enable=True)
mc.connectControl(interaxialSleder, cam3dShape + ".interaxialSeparation")
mc.connectControl(zeroSleder, cam3dShape + ".zeroParallax")
开发者ID:chuckbruno,项目名称:Python_scripts,代码行数:35,代码来源:stereoPlayblast_new_01.py
示例7: set_clip_plane_vals
def set_clip_plane_vals(near_val, far_val):
cams = cmds.ls(cameras=True)
for curr_cam in cams:
try:
cmds.camera (curr_cam, edit=True, cp=True, ncp=near_val, fcp=far_val)
except RuntimeError, err:
print 'Error: Camera clipping planes not set correctly for camera %s. (%s)' % (curr_cam, err[0][:-1])
开发者ID:CGartist3D,项目名称:ani-matic,代码行数:7,代码来源:layout_clippingPlanes.py
示例8: twoK1152Cam
def twoK1152Cam(self):
camName= "fin_05_shotCAM_01"
camMake = cmds.camera(name=camName)
camShape = camMake[1]
cmds.camera( camShape, e=True, ff='horizontal', hfa=0.98, vfa=0.551 )
twoK1152(self)
del camName, camMake, camShape
开发者ID:lucienfostier,项目名称:finPipeline,代码行数:7,代码来源:setCam.py
示例9: highDefCam
def highDefCam(self):
camName= "fin_06_shotCAM_01"
camMake = cmds.camera(name=camName)
camShape = camMake[1]
cmds.camera( camShape, e=True, ff='horizontal', hfa=0.792, vfa=0.446 )
highDef(self)
del camName, camMake, camShape
开发者ID:lucienfostier,项目名称:finPipeline,代码行数:7,代码来源:setCam.py
示例10: nuke_track_node
def nuke_track_node():
"""
creates a nuke track node for the selected transform.
selection order: trasnform, camera
"""
selection = cmds.ls( selection = True )
point = selection[0]
camera = selection[1]
cameraShape = cmds.listRelatives( shapes = True )[0]
aperture_h = cmds.camera( camera, hfa=1, q=1)
aperture_v = cmds.camera( camera, vfa=1, q=1)
trackNode = 'Tracker3 { track1 {{curve x1 '
tx = ''
ty = ''
endframe = 48
for frame in range( 1, endframe + 1 ):
cmds.currentTime( frame )
fov_h = cmds.camera( camera, hfv=1, q=1)
fov_v = cmds.camera( camera, vfv=1, q=1)
track = get_normalized_screen_position( point, camera, fov_h, fov_v, aperture_h, aperture_v )
tx += str( track[0] * 1280 ) + ' '
ty += str( track[1] * 720 ) + ' '
trackNode += tx + '} {curve x1 ' + ty + '}}}'
print '#' * 50
print '>>> tracker node, copy paste to nuke:'
print trackNode
开发者ID:danielforgacs,项目名称:code-dump,代码行数:29,代码来源:ford_stabilizer_v0.5.5.py
示例11: onActivateButtonClick
def onActivateButtonClick(self,param):
if self.isActive is True:
self.isActive = False
if self.cameraOrigin is not None :
cmds.camera(self.currentCamera, edit=True, position=self.cameraOrigin["translate"], rotation=self.cameraOrigin["rotation"])
self.setConsoleText("Rigging desactive.")
for p in self.pointsMap :
self.onStateButtonClick(p)
return
self.isActive = True
self.cameraOrigin = {
"translate" : cmds.xform(self.currentCamera, query=1, ws=1,rp=1),
"rotation" : cmds.xform(self.currentCamera, query=1, ws=1,ro=1),
}
cmds.camera(self.currentCamera, edit=True, position=[0,0,self.cameraZ],rotation=[0,0,0])
self.setConsoleText("Rigging actif, choisissez un point.", color=[0,0.4,0])
开发者ID:LecomteEmerick,项目名称:MayaProject,代码行数:25,代码来源:autoriggin_ui.py
示例12: export2DPointData
def export2DPointData(path,pt,cam,start,end,width=2348,height=1152):
'''
Export raw 2D (screen space) point position data based on the specified camera to an ascii text file
@param path: Directory to save the 2D data export file to
@type path: str
@param pt: The point to export 2D position data for
@type pt: str
@param cam: The camera used to calculate the 2D screen space from
@type cam: str
@param start: The first frame of the data sequence
@type start: int
@param end: The last frame of the data sequence
@type end: int
@param width: Maximum output screen space width
@type width: int
@param height: Maximum output screen space height
@type height: int
'''
# Check path
dirpath = path.replace(path.split('/')[-1],'')
if not os.path.isdir(dirpath): os.makedirs(dirpath)
# Open file for writing
file = open(path,"w")
# -----------------------
# - Write Position Data -
# -----------------------
# Cycle through frame range
for f in range(start,end+1):
# Set current frame
mc.currentTime(f)
# Get point world space position
pos = glTools.utils.base.getMPoint(pt)
# Get camera details
cam_hfv = mc.camera(cam,q=True,hfv=True)
cam_vfv = mc.camera(cam,q=True,vfv=True)
cam_mat = glTools.utils.matrix.getMatrix(cam).inverse()
# Calculate 2D point
ssPt = pos * cam_mat
ptx = ( ( ( ssPt.x / -ssPt.z ) / math.tan( math.radians(cam_hfv / 2) ) ) / 2.0) + 0.5
pty = ( ( ( ssPt.y / -ssPt.z ) / math.tan( math.radians(cam_vfv / 2) ) ) / 2.0) + 0.5
# Write data to file
file.write(str(ptx * width) + ' ' + str(pty * height) + '\n')
# End file with new line
file.write('')
# Close file
file.close()
# Print result
print('2D point data exported to '+path)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:59,代码来源:exportPointData.py
示例13: place_cameras
def place_cameras(points):
for i in points:
cmds.camera(centerOfInterest=5, focalLength=35, lensSqueezeRatio=1, cameraScale=1, horizontalFilmAperture=1.41732, horizontalFilmOffset=0,
verticalFilmAperture=0.94488, verticalFilmOffset=0, filmFit="fill", overscan=1, motionBlur=0, shutterAngle=144, nearClipPlane=0.1,
farClipPlane=10000, orthographic=0, orthographicWidth=30, panZoomEnabled=0, horizontalPan=0, verticalPan=0, zoom=1)
cmds.move(i[0], 5.0, i[1])
#cmds.rotate(0.0, i[2]+90, 0.0, absolute=True, objectSpace=True, forceOrderXYZ=True)
cmds.viewPlace(lookAt=[0, 3.0, 0])
开发者ID:ana0,项目名称:maya-scripts,代码行数:8,代码来源:material_swapper.py
示例14: run_app
def run_app(self):
"""
Callback from when the menu is clicked.
"""
## Tell the artist to be patient... eg not genY
cmds.headsUpMessage("Building shotCam...", time = 1)
inprogressBar = pbui.ProgressBarUI(title = 'Building Shotcam:')
inprogressBar.show()
## Instantiate the API
tk = sgtk.sgtk_from_path("T:/software/bubblebathbay")
debug(app = self, method = 'run_app', message = 'API instanced...\n%s' % tk, verbose = False)
debug(app = self, method = 'run_app', message = 'Fetch Shot Assets launched...', verbose = False)
context = self.context ## To get the step
debug(app = self, method = 'run_app', message = 'Context Step...\n%s' % context.step['name'], verbose = False)
if context.step['name'] == 'Anm' or context.step['name'] == 'Blocking':
inprogressBar.updateProgress(percent = 10, doingWhat = 'processing scene info...')
cmds.cycleCheck(e = 1)
## Build an entity type to get some values from.
entity = self.context.entity ## returns {'type': 'Shot', 'name': 'ep100_sh010', 'id': 1166}
debug(app = self, method = 'run_app', message = 'entity... %s' % entity, verbose = False)
## Set the template to the maya publish folder
shot_root_template = tk.templates[self.get_setting('shot_root_template')]
debug(app = self, method = 'run_app', message = 'shot_root_template...\n%s' % shot_root_template, verbose = False)
## Now build the camera
shotName = entity['name']
cameraName = '%s_shotCam' % shotName
if self.doesAssetAlreadyExistInScene(cameraName):
inprogressBar.updateProgress(percent = 100, doingWhat = 'Camera found...')
inprogressBar.close()
cmds.warning("Scene currently has a valid shotCamera in it! Aborting ...")
QtGui.QMessageBox.information(None, "Scene currently has a valid shotCamera in it! Aborting ...")
raise tank.TankError("Scene currently has a valid shotCamera in it! Aborting ...")
else:
inprogressBar.updateProgress(percent = 50, doingWhat = 'Building camera...')
cmds.camera()
cmds.rename('camera1', cameraName)
self.tagShotCam(cameraName)
## Now set the default camera stuff up
settings._setCameraDefaults(cameraName)
settings._createCamGate(cameraName)
## Now set the renderGlobals up
width = self.get_setting('movie_width')
height = self.get_setting('movie_height')
inprogressBar.updateProgress(percent = 90, doingWhat = 'Setting render globals...')
settings._setRenderGlobals(width = width, height = height, animation = True)
inprogressBar.updateProgress(percent = 100, doingWhat = 'Finished...')
inprogressBar.close()
cmds.headsUpMessage("shotCam built successfully...", time = 1)
else:
cmds.headsUpMessage("Current context is not a valid Shot context. Please make sure you are under a valid shotgun Shot context!", time = 2)
cmds.warning("Current context is not a valid Shot context. Please make sure you are under a valid shotgun Shot context!")
QtGui.QMessageBox.information(None, "Current context is not a valid Shot context. Please make sure you are under a valid shotgun Shot context!")
raise tank.TankError("Current context is not a valid Shot context. Please make sure you are under a valid shotgun Shot context!")
开发者ID:vipul-rathod,项目名称:lsapipeline,代码行数:58,代码来源:app.py
示例15: make
def make(self, _make, **kwargs):
"""Can make a node in maya using this command.
Valid things to make are, group, circle, scriptNode, customCurve.
If customcurve, format type is sObjName..make(what = 'customCurve', curveType = 'validCurveType', orientation = 'Y')
The list of valid types:
triangle worldMove
angledCompass worldRotate
straightCompass twoDirRotate
square fourDirRotate
sphere moveRotate
plus worldMove02
halfDiamond toe
cube spineType01
cross jawEgg
bulb hand
star foot
eyes
"""
if cmds.objExists(self.name):
raise Exception, 'Object with name already exists in scene, you can not have duplicate names in scenes.'
else:
if _make == 'group':
#print 'Making group %s now.' % self.name
objects = kwargs.get('objects')
if objects:
cmds.group(objects, name = self.name, em = False)
else:
cmds.group(name = self.name, em = True)
elif _make == 'locator':
#print 'Building spacelocator %s now' % self.name
cmds.spaceLocator(n = self.name, **kwargs)
elif _make == 'circle':
cmds.circle(n = self.name, **kwargs)
self.name = '%s_ctrl' % self.name
elif _make == 'scriptNode':
cmds.scriptNode(n = self.name, **kwargs)
elif _make == 'customCurve':
## Curve options are
### curveType = 'circle', snapTo = False, cstTo = False, orientation = 'Y', grouped = False, scaleFactor = 1, color = 15, boundingBox = True, dest = '', suffix = True, addGeoShowHide = True
myNewCurve = BD_CurveBuilder.buildControlCurve(curveName = self.name, **kwargs)
if kwargs.get('suffix'):
self.name = '%s_ctrl' % myNewCurve
else:
self.name = '%s' % myNewCurve
elif _make == 'nurbsPlane':
cmds.nurbsPlane(n = '%s' % self.name, **kwargs)
elif _make == 'camera':
cmds.camera()
cmds.rename('camera1', '%s' % self.name)
开发者ID:jamesbdunlop,项目名称:defaultMayaLibrary,代码行数:56,代码来源:sceneObject.py
示例16: replaceDefaultPersp
def replaceDefaultPersp():
""" delete the default persp and recreate a new fresh one """
# find the default startup persp and delete it
defaultPersp = mel.eval('findStartUpCamera( "persp");')
cmds.camera(defaultPersp, e=True, sc=False)
cmds.delete(defaultPersp)
# create new persp, hide it and set it as default startup persp
newPersp = cmds.camera(n='persp', hc="viewSet -p %camera")
cmds.setAttr(newPersp[0]+'.visibility', False)
cmds.rename(newPersp[0], 'persp')
cmds.camera('persp', e=True, sc=True)
开发者ID:jonntd,项目名称:dmptools,代码行数:11,代码来源:mayaCommands.py
示例17: __init__
def __init__(self, logger):
self.logger = logger
self.cam_right = cmds.camera()[0]
cmds.move(1, 0, 0, self.cam_right)
self.cam_left = cmds.camera()[0]
cmds.move(-1, 0, 0, self.cam_left)
self.mpx_thread = cmds.createNode("transformServer", n="VRTransform")
cmds.connectAttr(self.mpx_thread + ".outputRotate", self.cam_right + ".rotate")
cmds.connectAttr(self.mpx_thread + ".outputRotate", self.cam_left + ".rotate")
mel.eval('setNamedPanelLayout("VR")')
mel.eval("lookThroughModelPanel " + self.cam_left + " modelPanel4;")
mel.eval("lookThroughModelPanel " + self.cam_right + " modelPanel1;")
开发者ID:sachabest,项目名称:vr-maya,代码行数:12,代码来源:scene_creator.py
示例18: silMode
def silMode(self):
'''
Turns silhouette mode on
'''
cmds.modelEditor( self.editor, edit=True, displayLights="selected" )
cmds.modelEditor( self.editor, edit=True,grid=False )
cmds.modelEditor( self.editor, edit=True,selectionHiliteDisplay=False )
cmds.modelEditor( self.editor, edit=True, displayAppearance='smoothShaded')
cmds.modelEditor( self.editor, edit=True, manipulators=False)
cmds.modelEditor( self.editor, edit=True, headsUpDisplay=False)
self.hideAll()
cmds.camera(self.camera, e=True, displayResolution=True )
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:12,代码来源:mecModelEditor_test.py
示例19: ConvertCamerasToStartUp
def ConvertCamerasToStartUp(self):
#Convert the snapshot cameras to startup
i = 0
while(cmds.objExists( "shot_" + str(i))):
cmds.camera("shot_" + str(i), edit = True, startupCamera = True)
i = i + 1
#Convert the turntable cameras to startup
i = 0
while(cmds.objExists( "CM_Turntable_Camera_" + str(i) )):
cmds.camera("CM_Turntable_Camera_" + str(i), edit = True, startupCamera = True)
i = i + 1
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:12,代码来源:ScenePrepFile.py
示例20: CreateCamera
def CreateCamera(self):
print "Creating new camera"
#Create Camera
cmds.select(None)
#Copy from the current active camera
cmds.duplicate( self.GetActiveCamera(), name = self.Camera)
try:cmds.delete(self.Camera + "|CMForegroundPlane")
except:pass
try:cmds.delete(self.Camera + "|CMBackgroundPlane")
except:pass
for i in SnapShotClass.SnapShots:
try:cmds.delete(self.Camera + "|" + i.Camera + "_ImagePlane")
except:pass
#Make the camera startup so that the user may not delete it directly
#Enable the resolution gate
cmds.camera(self.Camera, edit = True, startupCamera = True, displayResolution = True)
#Make the camera hidden
cmds.setAttr(self.Camera + ".visibility", False)
#Add render attributes
try:
cmds.select(self.Camera)
cmds.addAttr(longName='CMRenderProductShot', attributeType='bool', defaultValue = True)
cmds.addAttr(longName='CMRenderWireFrame', attributeType='bool', defaultValue = True)
cmds.addAttr(longName='CMSignature', attributeType='bool', defaultValue = self.Signature)
cmds.select(None)
except:
pass
#Default values
cmds.setAttr(self.Camera + '.CMRenderProductShot', True)
cmds.setAttr(self.Camera + '.CMRenderWireFrame', True)
cmds.setAttr(self.Camera + '.CMSignature', self.Signature)
#Assign the foreground plane to this camera if it is the signature camera
if self.Signature:
SnapShotClass.UpdateImagePlane("CMForegroundPlane", self.Camera)
#Create the background plane for the camera
CopyPlane = cmds.duplicate("CMBackgroundPlane")
CopyPlane = cmds.rename(CopyPlane, self.Camera + "_ImagePlane")
SnapShotClass.UpdateImagePlane(CopyPlane, self.Camera, False)
cmds.setAttr(CopyPlane +".sizeX", 50)
cmds.setAttr(CopyPlane +".sizeY", 50)
#Adjust render layer adjustments
RenderLayerManagerFile.RenderLayerManagerClass.assignSnapShots(self.Camera)
print "Camera created"
开发者ID:Kif11,项目名称:turbosquid_maya_publisher,代码行数:52,代码来源:SnapShotFile.py
注:本文中的maya.cmds.camera函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论