def mkBakeExecution(): Uiinfo = myclass() if Uiinfo.result == 0: # Apply imgFormat = Uiinfo.dlg.getValue("formats") imgres = Uiinfo.dlg.getValue("resolution") surfShdr = Uiinfo.mkCreateCamNrml() TimeLine = Uiinfo.dlg.getValue("Frame range") TimeLine = TimeLine.split('-') startFrame = int(TimeLine[0]) endFrame = int(TimeLine[1]) cameraName = Uiinfo.dlg.getValue("Load camera") ShaderName = Uiinfo.dlg.getValue("Load shader") objectName = Uiinfo.dlg.getValue("Load object") fileImageName = Uiinfo.dlg.getValue("Image name") normalCheck = Uiinfo.dlg.getValue("Normal map") cmds.cameraView(camera=cameraName) cmds.currentTime( startFrame, edit=True ) for i in range (startFrame,endFrame): mKcurentFrame = cmds.currentTime( query=True ) intFrame = int(mKcurentFrame) intFrame = str(intFrame).zfill(4) cmds.convertSolidTx( ShaderName, objectName, fileImageName=fileImageName+"_"+intFrame+'.'+imgFormat, fil =imgFormat,rx= int(imgres), ry= int(imgres)) if normalCheck== 1 : cmds.convertSolidTx( surfShdr['surface'],objectName, fileImageName= fileImageName+"_nrml."+intFrame+'.'+imgFormat, fil = imgFormat,rx= int(imgres), ry= int(imgres)) cmds.currentTime( mKcurentFrame+1, edit=True )
def set_to_bookmark(self, bmark=None): """ set camera to specified bookmark position otherwise set position to current bookmark if available :type bmark: C{str} :param bmark: bookmark for camera position """ if bmark and bmark in self.bookmarks: mc.cameraView(bmark, edit=True, camera=self.camera, setCamera=True) self.current_bookmark = bmark elif self.current_bookmark: mc.cameraView(self.current_bookmark, edit=True, camera=self.camera, setCamera=True)
def set_to_bookmark(self, bmark=None): ''' set camera to specified bookmark position otherwise set position to current bookmark if available :type bmark: C{str} :param bmark: bookmark for camera position ''' if bmark and bmark in self.bookmarks: mc.cameraView(bmark, edit=True, camera=self.camera, setCamera=True) self.current_bookmark = bmark elif self.current_bookmark: mc.cameraView(self.current_bookmark, edit=True, camera=self.camera, setCamera=True)
def home_position(self, cam): """ set the original view position of camera before processing :type cam: C{str} :param cam: camera for view position """ self._home_position = mc.cameraView(camera=cam)
def home_position(self, cam): ''' set the original view position of camera before processing :type cam: C{str} :param cam: camera for view position ''' self._home_position = mc.cameraView(camera=cam)
def mkBakeExecution(): Uiinfo = myclass() if Uiinfo.result == 0: # Apply imgFormat = Uiinfo.dlg.getValue("formats") imgres = Uiinfo.dlg.getValue("resolution") surfShdr = Uiinfo.mkCreateCamNrml() TimeLine = Uiinfo.dlg.getValue("Frame range") TimeLine = TimeLine.split('-') startFrame = int(TimeLine[0]) endFrame = int(TimeLine[1]) cameraName = Uiinfo.dlg.getValue("Load camera") ShaderName = Uiinfo.dlg.getValue("Load shader") objectName = Uiinfo.dlg.getValue("Load object") fileImageName = Uiinfo.dlg.getValue("Image name") normalCheck = Uiinfo.dlg.getValue("Normal map") cmds.cameraView(camera=cameraName) cmds.currentTime(startFrame, edit=True) for i in range(startFrame, endFrame): mKcurentFrame = cmds.currentTime(query=True) intFrame = int(mKcurentFrame) intFrame = str(intFrame).zfill(4) cmds.convertSolidTx(ShaderName, objectName, fileImageName=fileImageName + "_" + intFrame + '.' + imgFormat, fil=imgFormat, rx=int(imgres), ry=int(imgres)) if normalCheck == 1: cmds.convertSolidTx(surfShdr['surface'], objectName, fileImageName=fileImageName + "_nrml." + intFrame + '.' + imgFormat, fil=imgFormat, rx=int(imgres), ry=int(imgres)) cmds.currentTime(mKcurentFrame + 1, edit=True)
attribute="translateY", value=posy, t=(itr * 42) + tx) #if tx in range(30,42): #cmds.setKeyframe( myList[temp], attribute="translateX", value=posx, t=(itr*42) + tx ) temp += 1 if temp >= listSize: temp = 0 #if tx in range(30,42): #cmds.setKeyframe( myList[temp], attribute="translateX", value=tm, t=tx ) return homeName = cmds.cameraView(camera='persp') cmds.cameraView(homeName, e=True, camera='persp', ab=True) cmds.play() waves() playCoolStuff() cmds.cameraView(homeName, e=True, camera='persp', sc=True) #just a short example that moves a cube for 120 'seconds' cmds.polyCube() cmds.setKeyframe(attribute="translateX", value=0, t=94) for x in xrange(0, 60): x += 1 cmds.setKeyframe(attribute="translateX", value=x) meme = cmds.textCurves(f='Courier', t='Meme', o=True)
for time in [1, 15, 30, 45, 60, 72]: # for each frame calculate sub-steps #mc.setKeyframe( bubble, attribute='translateX', value=px, t=f ) # set keyframes cmds.setKeyframe( bubble, attribute='translateY', value=size+0.1*time, t=time ) cmds.setKeyframe( bubble, attribute='scaleX', value=size+0.02*time, t=time ) cmds.setKeyframe( bubble, attribute='scaleY', value=size+0.02*time, t=time ) cmds.setKeyframe( bubble, attribute='scaleZ', value=size+0.02*time, t=time ) #mc.setKeyframe( bubble, attribute='translateZ', value=pz, t=f ) #cmds.rename(obj[1], "bubbleCamShape") # Save the current position of the persp camera. homeName = cmds.cameraView(camera='persp') # Add this view to the persp bookmark menu. cmds.cameraView( homeName, e=True, camera='bubbleCam', ab=True ) # Change the persp camera position. cmds.dolly( 'bubbleCam', distance=-30 ) # Create another bookmark for the zoomed position. cmds.cameraView( camera='bubbleCam', name='zoom', ab=True ) # Restore original camera position. cmds.cameraView( homeName, e=True, camera='bubbleCam', sc=True ) # Save the current 2D pan/zoom attributes of the persp camera panZoomBookmark = cmds.cameraView( camera='bubbleCam', ab=True, typ=1 )
def cameraView(*args, **kwargs): res = cmds.cameraView(*args, **kwargs) if not kwargs.get('query', kwargs.get('q', False)): res = _factories.maybeConvert(res, _general.PyNode) return res
def CamSet3(): if cmds.objExists('saveCam_3'): cmds.cameraView('saveCam_3',e=1,sc=1) if not cmds.objExists('saveCam_3'): cmds.cameraView(n='saveCam_3',ab=1)