def Cas_MCW_restoreMisc(undoState , texWindowState):
    if undoState == 1:
        cmds.undoInfo(swf=1)
    if texWindowState == 1:
        texWin = cmds.getPanel(sty ="polyTexturePlacementPanel")
        cmds.textureWindow(texWin[0],e=1,id=1)
    cmds.progressWindow(ep=1)
Пример #2
0
def makeSnowflakes(number,size,sizeVar,rgb1,rgb2,transparency,glow):
    '''
    Creates a number of snowflakes
    
    number       : Number of particles to create
    size         : Radius of the snowflakes
    sizeVar      : Variation in the radius
    rgb1         : One end of the colour range in the form (r,g,b)
    rgb2         : The other end of the colour range in the form (r,g,b)
    transparency : Alpha value for the shader
    glow         : Glow value for the shader
    
    The progress window is updated and the shading group list is created. 
    A while loop is initiated to create snowflakes, add them to the list 
    and assign shaders. The list of objects is returned.
    '''
    cmds.progressWindow(e=1,progress=0,status='Making Snowflakes...')
    SGList = createColourList(rgb1,rgb2,transparency,glow,5)
    list=[]
    count=0
    while count<number:
        radius = size+random.uniform(-(size*sizeVar*0.01),(size*sizeVar*0.01))
        list[len(list):] = [makeFlake(random.randint(5,8),radius)]
        cmds.sets(list[-1], e=1, forceElement=SGList[random.randint(0,4)])
        cmds.progressWindow(e=1,step=100/number)
        count += 1
    return list
Пример #3
0
def updateProgressWindow(i, maxSize):
    if cmds.progressWindow(q=True, ic=True):
        return False
    else:
        cmds.progressWindow(e=True, pr=i, st=("Building: " +
            str(i) + "/" + str(maxSize)))
        return True
Пример #4
0
 def setup(self):
     cm.progressWindow(
         title=self.text_to_display,
         min=self.start,
         max=self.end,
         status="""
         {disp}: {perc}%
         {elps}: {etim}
         {left}: {ltim}
         {comp}: {cur}/{end}
         """.format(
             disp="% Completed\t",
             perc=0,
             elps="Elapsed\t\t",
             etim=0.00,
             left="Time Left\t",
             ltim="-",
             comp="Completed\t",
             cur=0,
             end=self.end,
             n=2,
             ii=1,
         ),
         pr=0,
     )
Пример #5
0
def loadCtrls(assetName=None, prompt=False):
    """ Loads all the saved rig control shapes.
    [Args]:
    assetName (string) - The name of the asset
    prompt (bool) - Toggles a window prompt for asset name
    """
    if cmds.progressWindow(q=1, isCancelled=True):
        return False
    cmds.progressWindow(e=1, s='Loading Rig Controls.')
    if prompt:
        assetName = fileFn.assetNamePrompt()
    if not assetName:
        assetName = fileFn.getAssetName()
    if not assetName:
        assetName = fileFn.assetNamePrompt()
    if not assetName:
        print 'Asset Name not specified.'
        return False
    path = fileFn.getAssetDir()
    allCtrls = getAllControls('C_global_CTRL')
    if not allCtrls:
        allCtrls = []
    allCtrls.append('C_global_CTRL')
    for ctrl in allCtrls:
        fo = fileFn.getLatestVersion(assetName,
                                     path,
                                     'rig/WIP/controlShapes',
                                     name=ctrl)
        if fo:
            crvData = fileFn.loadJson(fileOverride=fo)
            if crvData:
                applyShapeData(ctrl, crvData)
Пример #6
0
	def update(self, step=1):
		self.value += step
		cmds.progressWindow(self.ui, e=True, progress=self.value)

		if self.value >= self.max:
			self.reachedMax = True
			self.kill()
Пример #7
0
    def downloadOSM(self, *args):
        left = cmds.textField(self.widgets["osmLeftTextField"], q = True, fi = True)
        bot = cmds.textField(self.widgets["osmBotTextField"], q = True, fi = True)
        right = cmds.textField(self.widgets["osmRightTextField"], q = True, fi = True)
        top = cmds.textField(self.widgets["osmTopTextField"], q = True, fi = True)

        url = "http://api.openstreetmap.org/api/0.6/map?bbox=" + left + "," + bot + "," + right + "," + top
        filePath = cmds.fileDialog2(fileFilter="OSM XML (*.osm)", fileMode = 0, dialogStyle=2)
        if filePath is None:
            return
        file_name = filePath[0]

        try:
            u = urllib2.urlopen(url)
        except urllib2.HTTPError as err:
            if err.code == 400:
                cmds.confirmDialog(title='Error', message="HTTPError {0}: Incorrect borders".format(err.code))
            elif err.code == 509:
                cmds.confirmDialog(title='Error', message="HTTPError {0}: You have downloaded too much data. Please try again later".format(err.code))
            else:
                cmds.confirmDialog(title='Error', message="HTTPError {0}".format(err.code))
            return

        f = open(file_name, 'wb')
        cmds.progressWindow(title='Downloading map', min = 0, max = 100,  progress = 0, status = "Downloading: %s " % (file_name), isInterruptable = False)

        while True:
            buffer = u.read(8192)
            if not buffer:
                break
            f.write(buffer)
        f.close()
        cmds.progressWindow(endProgress = True)
        cmds.textField(self.widgets["osmFileTextField"], edit = True, fi = filePath[0])
Пример #8
0
def makeSnowflakes(number, size, sizeVar, rgb1, rgb2, transparency, glow):
    '''
    Creates a number of snowflakes
    
    number       : Number of particles to create
    size         : Radius of the snowflakes
    sizeVar      : Variation in the radius
    rgb1         : One end of the colour range in the form (r,g,b)
    rgb2         : The other end of the colour range in the form (r,g,b)
    transparency : Alpha value for the shader
    glow         : Glow value for the shader
    
    The progress window is updated and the shading group list is created. 
    A while loop is initiated to create snowflakes, add them to the list 
    and assign shaders. The list of objects is returned.
    '''
    cmds.progressWindow(e=1, progress=0, status='Making Snowflakes...')
    SGList = createColourList(rgb1, rgb2, transparency, glow, 5)
    list = []
    count = 0
    while count < number:
        radius = size + random.uniform(-(size * sizeVar * 0.01),
                                       (size * sizeVar * 0.01))
        list[len(list):] = [makeFlake(random.randint(5, 8), radius)]
        cmds.sets(list[-1], e=1, forceElement=SGList[random.randint(0, 4)])
        cmds.progressWindow(e=1, step=100 / number)
        count += 1
    return list
Пример #9
0
    def eval_cost(params01_vec_dst):
        global Cost_best, params_01_vec_best
        global num_iter, success
        num_iter += 1

        params_dict = convert_param_func(params01_vec_dst)

        path_dst          = '{0}/iter_{1:04d}'.format(folder_path, num_iter)
        img_dst_cv2, _, _ = render_and_load(params_dict, path_dst)
        G_dst, _          = get_feature_func(img_dst_cv2)
        Cost_this         = calc_cost_func(G_ref, G_dst)

        img_text = "Cost: {0}\n#iter {1}".format(Cost_this, num_iter)
        Misc.show_text_on_image_cv2(img_dst_cv2, img_text, "find_step")

        ## change the best result
        if  Cost_this < Cost_best:
            Cost_best = Cost_this
            params_01_vec_best = params01_vec_dst[:]
    
        ## show the progress bar here
        prog = num_iter + 1
        cmds.progressWindow(edit=True, progress=prog)
        if cmds.progressWindow(query=1, isCancelled=1):
            success = False ## [ABORT]
            raise StopIteration

        return Cost_this
Пример #10
0
 def setText(self, text):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar,
                              edit=True,
                              status=text)
         else:
             cmds.progressWindow(edit=True, status=text)
Пример #11
0
 def setProgress(self, value):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar,
                              edit=True,
                              progress=int(value))
         else:
             cmds.progressWindow(edit=True, progress=int(value))
Пример #12
0
    def next(self):
        if self.current >= self.end:
            ExtremeProgressWnd(self.start, self.end, self.step,
                               self.text_to_display).end_pw()
            raise StopIteration

        sta = self.start
        self.current += self.step
        _perc = ExtremeProgressWnd(self.current, self.end, self.step,
                                   self.text_to_display).percentage(
                                       self.current - self.step, sta)

        _prct = _perc[1]
        _elapsed = time() - self.start_time

        if _elapsed > 60.0:
            _elapse = "{} {}".format(round(float((_elapsed + 0.0) / 60.0), 2),
                                     "mins")
        else:
            _elapse = "{} {}".format(round(_elapsed, 2), "secs")

        try:
            estimate = float(_elapsed / (_perc[0] - _elapsed))
            if estimate > 60.0:
                _estleft = "{} {}".format(
                    round(float((estimate + 0.0) / 60.0), 2), "mins")
            else:
                _estleft = "{} {}".format(round(estimate, 2), "secs")
        except:
            _estleft = 0

        cm.progressWindow(
            e=1,
            step=self.step,
            status="""
            {disp}: {perc}%
            {elps}: {etim}
            {left}: {ltim}
            {comp}: {cur}/{end}
            {item}: {item_list}
            """.format(
                disp="% Completed\t",
                perc=_prct,
                elps="Elapsed\t\t",
                etim=_elapse,
                left="Time Left\t",
                ltim=_estleft,
                comp="Completed\t",
                cur=self.current,
                end=self.end,
                item="Processing\t",
                item_list=self.main_list[self.current - 1],
                n=2,
                ii=1,
            ),
        )

        return self.current - self.step
Пример #13
0
		def func( *args, **kwargs ):
			try:
				cmd.progressWindow( **dec_kwargs )
			except: print 'error init-ing the progressWindow'

			try:
				return f( *args, **kwargs )
			finally:
				cmd.progressWindow( ep=True )
Пример #14
0
		def func( *args, **kwargs ):
			try:
				cmd.progressWindow( **dec_kwargs )
			except: print 'error init-ing the progressWindow'

			try:
				return f( *args, **kwargs )
			finally:
				cmd.progressWindow( ep=True )
Пример #15
0
 def reportProgress(self):
     """
     If the window is enabled put progress information consisting of the
     percentage done, the current file, and the current phase
     """
     if not self.enable:
         return
     progressPct = self.totalProgress * 100
     statusString = '%s:%s' % (self.currentPhaseName,self.currentFileName)
     cmds.progressWindow( edit=True, progress=progressPct, status=statusString )
Пример #16
0
 def __exit__(self, exc_type, exc_value, traceback):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar, edit=True, endProgress=True)
         else:
             cmds.progressWindow(endProgress=True)
         if exc_type:
             log.exception('%s : %s' % (exc_type, exc_value))
         del(self)
         return False  # False so that the exception gets re-raised
Пример #17
0
 def __exit__(self, exc_type, exc_value, traceback):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar, edit=True, endProgress=True)
         else:
             cmds.progressWindow(endProgress=True)
         if exc_type:
             log.exception('%s : %s'%(exc_type, exc_value))
         del(self)
         return False  # False so that the exception gets re-raised
Пример #18
0
def resetVtx(*args):
    selList = cmds.ls(sl = True)

    # progress window
    cmds.progressWindow(title = 'Reset Vertex', minValue = 0, maxValue = len(selList), progress = 0, status = 'Stand by', isInterruptable = True)

    for sel in selList:
        if cmds.progressWindow(q = True, isCancelled = True):
        	break

        cmds.progressWindow(e = True, progress = selList.index(sel), status = 'Working on \'%s\'' %(sel))

        if not cmds.listRelatives(sel, path = True, s = True, ni = True):
            continue
        else:
            # Reset vertex
            try:
                cmds.polyMoveVertex(sel, localTranslate = (0, 0, 0))
            except:
                pass

    cmds.progressWindow(e = True, progress = 0, status = 'Reset Vertex Work Done.')
    cmds.progressWindow(endProgress = True)

    cmds.select(selList, r = True)
Пример #19
0
 def upLoadFile(self):
     self.getFileInfo()
     mc.progressWindow(title=u'上传cache文件',
                       status=u'开始上传',
                       isInterruptable=True)
     self.getAlembicCache()
     self.copyTxsFile()
     self.addVideo()
     self.saveFile()
     mc.progressWindow(endProgress=True)
     self.insertData()
def checkBadObjects(strict = 0):
	def check(connections, *cases):
		result = False
		sources = connections[::2]
		destinations = connections[1::2]
		for case in cases:
			if [x for x in sources if case in x]:
				result = True
				break
			elif [x for x in destinations if case in x]:
				result = True
				break
		return result

	global BadObjects
	BadObjects = []
	objects = cmds.ls(s = 1)
	amount = 0
	count = 0
	num = len(objects)
	cmds.progressWindow(t = u'检测中...', pr = amount, ii = 1)
	cmds.scrollField('ScrollText', e = 1, cl = 1)
	mytext = u'检测结果'.center(57, '-') + '\n'
	cmds.scrollField('ScrollText', e = 1, it = mytext, ip = 0)
	cmds.editRenderLayerGlobals(crl = 'defaultRenderLayer')
	feedBackCaseA, feedBackCaseB = [], []
	for object in objects:
		if cmds.nodeType(object) in ('mesh', 'nurbsSurface'):
			connections = cmds.listConnections(object, c = 1, t = 'shadingEngine')
			if not connections:
				connections = cmds.listConnections(object, c = 1)
				if (connections and not check(connections, 'groupParts', 'outMesh', 'worldMesh', 'worldSpace')) or strict:
					if not cmds.ls(object, io = 1):
						BadObjects.append(object)
						addText = u'>>> %s 没有和SG节点连接\n' % object
						feedBackCaseA.append(addText)
			elif check(connections, 'compInstObjGroups'):
				BadObjects.append(object)
				addText = u'>>> %s 与SG节点之间可能存在异常连接\n' % object
				feedBackCaseB.append(addText)
		count += 1
		if count*50 % num == 0:
			amount += 2
			cmds.progressWindow(e = 1, pr = amount)
		elif count == num:
			amount = 100
			cmds.progressWindow(e = 1, pr = amount)
		if cmds.progressWindow(q = 1, ic = 1):
			break
		if cmds.progressWindow(q = 1, pr = 1) >= 100:
			break
	cmds.scrollField('ScrollText', e = 1, it = ''.join(feedBackCaseA), ip = 0)
	cmds.scrollField('ScrollText', e = 1, it = ''.join(feedBackCaseB), ip = 0)
	cmds.progressWindow(ep = 1)
Пример #21
0
def planeEmit(sourcePlane,start,emitTime,particleList,maxDistance,minDistance,maxAngle,forceTime,lifeTime,lifeTimeVar,fadeOut,turbulenceAmp,turbulencePer,drift):
    '''
    Emits particles from a plane
    
    sourcePlane   : Name of the plane particles will emit from
    start         : Frame to start emission
    emitTime      : Number of frames to emit for
    particleList  : List containing names of all the particles to be animatied
    maxDistance   : Maximum distance particles will be emitted from at the middle of the curve
    minDistance   : Maximum distance particles will be emitted from at the start and end of the curve
    maxAngle      : Maximum angle to emit particles at
    forceTime     : Number of frames particles will be affected by the emission force
    lifeTime      : Average lifetime of a particle
    lifeTimeVar   : Variation from average lifetime as a percentage
    fadeOut       : Number of frames to scale down particles at the end of their lifetime
    turbulenceAmp : Amplitude of the turbulence animation graph
    turbulencePer : Period of the turbulence animation graph
    drift         : Distance a particle will drift 10 frames. Contains (x,y,z)
    
    Updates the progress window and assigns all the elements in particleList to the class particles. 
    Constrains particle to plane to copy its location and orientation then deletes the constraint 
    and adds a random rotation in the object y axis and moves the particle a random distance away 
    from the plane centre along its surface. Emission angle is randomly chosen and applied to object 
    z axis so that all particles move in line with the plane centre. Runs the relevant class specific 
    procedures to animate the particle.
    '''
    cmds.progressWindow(e=1,progress=0,status='Animating Particles...')
    for i in range(0,len(particleList)):
        particleList[i]=particles(particleList[i])
    count=0
    for x in particleList:
        x.born = start+random.randint(0,emitTime)
        constraint = cmds.parentConstraint(sourcePlane,x.name)
        cmds.delete(constraint)
        rotation = random.uniform(0,360)
        cmds.rotate(0,rotation,0,x.name,r=1,os=1)
        [x0,y0,z0,x1,y1,z1]=cmds.xform(sourcePlane+'.vtx[0:1]',t=1,q=1,ws=1)
        sideLength=((x0-x1)**2+(y0-y1)**2+(z0+z1)**2)**0.5
        distance=random.uniform(0,sideLength/2)
        cmds.move(distance,0,0,x.name,r=1,os=1)
        angle=random.uniform(-maxAngle,maxAngle)
        cmds.rotate(0,0,angle,x.name,r=1,os=1)
        x.explode(x.born,forceTime,random.uniform(minDistance,maxDistance))
        x.drift(x.born,drift,turbulenceAmp*random.random(),turbulencePer+random.randint(-2,2))
        x.lifeTime=int(lifeTime+random.uniform(-lifeTime*lifeTimeVar*0.01,lifeTime*lifeTimeVar*0.01))
        x.fadeOut=random.randint(fadeOut-2,fadeOut+2)
        x.bake()
        cmds.keyframe(x.name,at='visibility',a=1,vc=0)
        count+=1
        cmds.progressWindow(e=1,progress=int((100.0/len(particleList))*count))
    for x in particleList:
        x.birth()
        x.death()
    return
Пример #22
0
def sendData():
    cmds.progressWindow(isInterruptable=1)
    ser = serial.Serial(serialPort, baudRate, timeout=0.5)
    while 1:
        if cmds.progressWindow(query=1, isCancelled=1):
            ser.close()
            break
        data = utils.executeInMainThreadWithResult(getCurrentData)
        ser.write("<" + data + ">")
        time.sleep(sendRate)
    cmds.progressWindow(endProgress=1)
Пример #23
0
    def CorrectQuit(self, *args):
        self.closeWin(self._windowName)
        self.CloseAllPBWin()
        try:
            mc.progressWindow(endProgress=True)
        except:
            pass


# i = QuickPlayAllBlast_C_zwz()
# i.show()
Пример #24
0
def loadSkin(geo, assetName=None, prompt=False):
    """ Load skin values for the specified geometry from a file.
    [Args]:
    geo (string) - The name of the geometry to apply the skin to
    assetName (string) - The name of the rig the geometry is part of
    prompt (bool) - Toggles prompting the user to select the
                    assetName
    [Returns]:
    True
    """
    cmds.progressWindow(e=1, s='Skinning Rig')
    if cmds.progressWindow(q=1, isCancelled=True):
        return False
    assetName = fileFn.assetNameSetup(assetName, prompt)
    path = fileFn.getAssetDir()
    fileName = fileFn.getLatestVersion(assetName,
                                       path,
                                       'rig/WIP/skin',
                                       name=geo)
    if not fileName:
        return False
    fileFn.printToMaya('Currently Skinning: {}'.format(geo))
    skinCls = getSkinInfo(geo)
    if not skinCls:
        skinInfo = {'joints': []}
        xmlRoot = xml.etree.cElementTree.parse(fileName).getroot()
        # skinInfo['joints'] = [each.get('source') for each in xmlRoot.findall('weights')]
        # skinInfo['joints'] = [each.get('source') for each in xmlRoot.findall('weights') if int(each.get('size')) > 1]
        for each in xmlRoot.findall('weights'):
            if int(each.get('size')) > 1:
                skinInfo['joints'].append(each.get('source'))
        skinInfo['unknownJnts'] = []
        for each in skinInfo['joints']:
            if not cmds.objExists(each):
                skinInfo['unknownJnts'].append(each)
                # skinInfo['joints'].remove(each)
        skinInfo['joints'] = list(
            set(skinInfo['joints']) - set(skinInfo['unknownJnts']))
        skinCls = cmds.skinCluster(geo, skinInfo['joints'], tsb=1)[0]
        # try:
        #     skinCls = cmds.skinCluster(geo, skinInfo['joints'], tsb=1)[0]
        # except ValueError:
        #     print 'Errored whilst skinning {}, Skipping.'.format(geo)
        #     return False
        cmds.select(cl=1)
    cmds.deformerWeights(fileName,
                         path='',
                         deformer=skinCls,
                         im=1,
                         wp=5,
                         wt=0.00001)
    cmds.skinCluster(skinCls, e=1, fnw=1)
    return True
Пример #25
0
def emitCurve(sourceCurve,curveStart,duration,particleList,maxDistance,minDistance,emitTime,lifeTime,lifeTimeVar,fadeOut,turbulenceAmp,turbulencePer,drift):
    '''
    Emits particles from a curve
    
    sourceCurve   : Name of the curve particles will emit from
    curveStart    : Frame to start emission
    duration      : Number of frames to emit for
    particleList  : List containing names of all the particles to be animatied
    maxDistance   : Maximum distance particles will be emitted from at the middle of the curve
    minDistance   : Maximum distance particles will be emitted from at the start and end of the curve
    emitTime      : Number of frames particles will be affected by the emission force
    lifeTime      : Average lifetime of a particle
    lifeTimeVar   : Variation from average lifetime as a percentage
    fadeOut       : Number of frames to scale down particles at the end of their lifetime
    turbulenceAmp : Amplitude of the turbulence animation graph
    turbulencePer : Period of the turbulence animation graph
    drift         : Distance a particle will drift 10 frames. Contains (x,y,z)
    
    Updates the progress window and assigns all the elements in particleList to the class particles. 
    Creates a locator and keys it to follow the curve linearly over the emission time. At the emit 
    time, copies the coordinates of the locator and moves particle to that location and add a random 
    rotation. The distance is calculated depending on the time the particle is emitted. Runs the 
    relevant class specific procedures to animate the particle.
    '''
    cmds.progressWindow(e=1,progress=0,status='Animating Particles...')
    for i in range(0,len(particleList)):
        particleList[i]=particles(particleList[i])
    count=0
    [emitter] = [cmds.spaceLocator(n='emitter')[0]]
    motionPath = cmds.pathAnimation(fm=1, stu=curveStart,etu=curveStart+duration,c=sourceCurve)
    cmds.keyTangent(motionPath,at='uValue',itt='Linear',ott='Linear')
    for x in particleList:
        launchTime=random.uniform(0,duration)
        [(emitX,emitY,emitZ)]=cmds.getAttr(emitter+'.translate',t=curveStart+launchTime)
        cmds.move(emitX,emitY,emitZ,x.name)
        cmds.rotate(random.uniform(0,360),random.uniform(0,360),random.uniform(0,360),x.name)
        if launchTime/duration <=0.5:
            distance=(launchTime/duration)*2*(maxDistance-minDistance)+minDistance
        else:
            distance=(1-(launchTime/duration))*2*(maxDistance-minDistance)+minDistance
        x.born = int(curveStart+launchTime+random.randint(-1,1))
        x.explode(x.born,emitTime,distance)
        x.drift(x.born,drift,turbulenceAmp*random.random(),turbulencePer+random.randint(-2,2))
        x.lifeTime=int(lifeTime+random.uniform(-lifeTime*lifeTimeVar*0.01,lifeTime*lifeTimeVar*0.01))
        x.fadeOut=random.randint(fadeOut-2,fadeOut+2)
        x.bake()
        cmds.keyframe(x.name,at='visibility',a=1,vc=0)
        count+=1
        cmds.progressWindow(e=1,progress=int((100.0/len(particleList))*count))
    for x in particleList:
        x.birth()
        x.death()
    return
Пример #26
0
 def loadCharacter(self, x=None) :
     ''' TODO: Stub '''
     item = self.getSelectedCharacter()
     print item
     self.loadTemplate(item)
     return
     print "Loading Character: " + str(x)
     m.progressWindow("peelMocap_progressWindow", st="Loading Character", progress=0)
     loadChar = "%s/character/%s/%s" % (self.pathPrefix, item['group']['title'], item['file'])
     print "load character: %s" % loadChar
     self.cache.importUrl(loadChar)
     m.progressWindow(endProgress=True)
Пример #27
0
		def func(*args, **kwargs):
			try:
				cmd.progressWindow(**dec_kwargs)
			except: print 'error init-ing the progressWindow'

			try: ret = f(*args, **kwargs)
			except:
				#end the progressWindow on any exception and re-raise...
				raise
			finally:
				cmd.progressWindow(ep=True)

			return ret
def testButton(objects, *args):
    #print(objects)
    basicFilter = "*.json"
    path = cmds.fileDialog2(fileFilter=basicFilter, dialogStyle=2)
    #print(path[0])
    cmds.progressWindow(title='Exporting',
                        progress=progress,
                        status='Exporting: 0%',
                        isInterruptable=True )
    exporting = True
    #shaders_to_json(objA=objects, file_path=path[0])
    #shaders_to_json(objA=['BATIMENT_PAUVRE_01'], file_path=path[0])
    shaders_to_json(objA=['pSphere1'], file_path=path[0])
Пример #29
0
		def func(*args, **kwargs):
			try:
				cmd.progressWindow(**dec_kwargs)
			except: print 'error init-ing the progressWindow'

			try: ret = f(*args, **kwargs)
			except:
				#end the progressWindow on any exception and re-raise...
				raise
			finally:
				cmd.progressWindow(ep=True)

			return ret
Пример #30
0
 def __init__(self, fileCount, phaseCount, enable):
     'Initialize all of the progress information and open the window if requested'
     self.enable = enable
     self.currentFileName = 'Startup'
     self.progressPerFile = 1.0 / fileCount
     self.totalProgress = 0
     self.currentFile = 0
     self.currentPhase = 0
     self.currentPhaseName = 'Reading'
     self.progressPerPhase = self.progressPerFile / phaseCount
     if enable:
         winTitle = 'Processing %d file(s)' % fileCount
         cmds.progressWindow( title=winTitle, progress=0, status='Initializing: 0%%', isInterruptable=True )
Пример #31
0
def cmdKeyframe(val=None):
    try:
        if val != None: offset = val
        else: offset = int(cmds.textField("animOffsetInput", q=True, tx=True))
        if not offset: return
    except:
        cmds.headsUpMessage(u'请输入有效数值:负值为向左移动,正值为向右移动', time=3)
        return

    tc = mel.eval("$tmpVar = $gPlayBackSlider;")
    sound = cmds.timeControl(tc, q=True, sound=True)
    if sound:
        cmds.setAttr(sound + ".offset",
                     cmds.getAttr(sound + ".offset") + offset)

    animCurves = []
    for ac in cmds.ls(type="animCurveTL"):
        animCurves.append(ac)
    for ac in cmds.ls(type="animCurveTA"):
        animCurves.append(ac)
    for ac in cmds.ls(type="animCurveTU"):
        animCurves.append(ac)

    if not len(animCurves): return

    cmds.progressWindow(title=u"进度", status=u"处理中...")
    cmds.progressWindow(e=True, progress=0, max=len(animCurves))

    for ac in animCurves:
        cmds.select(ac, r=True)
        cmds.keyframe(edit=True, relative=True, timeChange=offset)
        cmds.progressWindow(e=True, step=1)

    cmds.select(clear=True)
    cmds.progressWindow(endProgress=1)
Пример #32
0
 def __enter__(self):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar,
                           edit=True,
                           beginProgress=True,
                           step=self.step,
                           isInterruptable=self._interruptable,
                           maxValue=self._maxValue)
         else:
             cmds.progressWindow(step=self.step,
                             title=self.title,
                             isInterruptable=self._interruptable,
                             maxValue=self._maxValue)
Пример #33
0
def objExport(filepath, startFrame, endFrame, inc):
    (difName, basename) = getDirFromParh(filepath)
    # Here we dont specify "op" (option) parameter, because we want to have option to get it from maya "export Selection" dialog, so whetever is active there, will be exported using this command
    amount = 0
    frameRange = (endFrame - startFrame) + 1
    cmds.progressWindow(title='Exporting sequence',
                        progress=amount,
                        status='Finished: 0%',
                        isInterruptable=True,
                        maxValue=frameRange)

    for frame in range(startFrame, endFrame, inc):
        if cmds.progressWindow(query=True, isCancelled=True):
            break
        cmds.currentTime(frame, edit=True)
        cmds.file(difName + "/" + basename + "." + str(frame).zfill(5) +
                  ".obj",
                  op="groups=1;ptgroups=1;materials=0;smoothing=1;normals=1",
                  typ="OBJexport",
                  pr=1,
                  es=1,
                  force=1)
        if cmds.progressWindow(query=True, progress=True) >= frameRange:
            break
        amount += 1
        cmds.progressWindow(edit=True,
                            progress=amount,
                            status=('Finished: ' + ` amount ` + '%'))
    cmds.progressWindow(endProgress=1)
Пример #34
0
 def __enter__(self):
     if not self.disable:
         if self.ismain:
             cmds.progressBar(self._gMainProgressBar,
                              edit=True,
                              beginProgress=True,
                              step=self.step,
                              isInterruptable=self._interruptable,
                              maxValue=self._maxValue)
         else:
             cmds.progressWindow(step=self.step,
                                 title=self.title,
                                 isInterruptable=self._interruptable,
                                 maxValue=self._maxValue)
Пример #35
0
def alignedPopulation(subMeshNames, width, height, depth, randRotation):
    ''' Populate the base mesh by projecting rays from uniformly subdivided imaginary planes perpendicular to the 3 global axis.
    
    - subMeshNames: list of names of the submeshes
    - width: number of subdivisions along the X global axis
    - height: number of subdivisions along the Y global axis
    - depth: number of subdivisions along the X global axis
    - randRotation: whether the submesh is to receive a random rotation on the local Y axis after it has been instantiated '''

    bbox = mc.exactWorldBoundingBox(baseMeshName)

    planeOriginX = bbox[0]
    planeOriginY = bbox[1]
    planeOriginZ = bbox[2]
    planeEndX = bbox[3]
    planeEndY = bbox[4]
    planeEndZ = bbox[5]

    planeWidth = abs(planeEndX - planeOriginX)
    planeHeight = abs(planeEndY - planeOriginY)
    planeDepth = abs(planeEndZ - planeOriginZ)

    # We take the mesh bounding box and treat each side of it as one of the 3 "Imaginary Planes". We then calculate how big
    # each subdivision would be on each axis.
    cellWidth = planeWidth / width
    cellHeight = planeHeight / height
    cellDepth = planeDepth / depth

    totalRayCasts = (width + 1) * (height + 1) + (width + 1) * (depth + 1) + (
        height + 1) * (depth + 1)

    progrWindow = mc.progressWindow(title='Progress',
                                    progress=0,
                                    status='Populating mesh...',
                                    isInterruptable=True,
                                    max=totalRayCasts)

    # Take each of the 3 imaginary planes and project rays from their "vertices" onto the base mesh
    projectPlane(planeOriginX, planeOriginY, planeEndZ, planeEndX, planeEndY,
                 [0, 0, -1], subMeshNames, cellWidth, cellHeight, progrWindow,
                 randRotation)

    projectPlane(planeOriginZ, planeOriginY, planeEndX, planeEndZ, planeEndY,
                 [-1, 0, 0], subMeshNames, cellDepth, cellHeight, progrWindow,
                 randRotation)

    projectPlane(planeOriginX, planeOriginZ, planeEndY, planeEndX, planeEndZ,
                 [0, -1, 0], subMeshNames, cellWidth, cellDepth, progrWindow,
                 randRotation)
    mc.progressWindow(endProgress=1)
 def do(self, *args):
     try:
         sel = mc.ls(sl=1)
         sum = 0.0
         sum = len(sel)
         amount = 0.0
         for item in sel:
             mc.progressWindow(
                 title="Removing References", progress=amount, status="Removing: 0%", isInterruptable=True
             )
             if mc.progressWindow(query=True, isCancelled=True):
                 break
             if mc.progressWindow(query=True, progress=True) >= 100:
                 break
             RN = mc.referenceQuery(item, referenceNode=1)
             Nodes = mc.referenceQuery(RN, referenceNode=True, topReference=True)
             referenceFile = mc.referenceQuery(Nodes, f=1)
             reLoaded = mc.referenceQuery(referenceFile, il=True)
             if reLoaded == 1:
                 mc.file(referenceFile, unloadReference=1)
             amount = float((sel.index(item) + 1)) / float(len(sel)) * 100.0
             mc.progressWindow(edit=True, progress=amount, status=("Removing: " + ` amount ` + "%"))
             # mc.pause( seconds=1 )
         mc.progressWindow(endProgress=1)
     except:
         pass
Пример #37
0
  def parse_rib_archives(self):
    queue = Queue()
    self._enqueue_rib_files(queue)
    if queue.empty():
      return

    for file in self._process_rib_queue(queue):
      yield file

    if cmds.progressWindow(query=1, isCancelled=1):
      cmds.progressWindow(endProgress=1)
      raise maya_common.MayaZyncException("Submission cancelled")

    cmds.progressWindow(endProgress=1)
Пример #38
0
    def build(self):
        self._cleanOldShelf()

        progressAmount = len(SCRIPT_PATH) + len(QTUI_PATH)
        prog = 0

        mc.progressWindow(title="Construct",
                          progress=0,
                          max=progressAmount,
                          status="Loading")

        # スクリプトのダウンロード
        for name in SCRIPT_NAME:
            prog += 1
            mc.progressWindow(edit=True,
                              progress=prog,
                              status="Loading Script: " + name)
            self.addButon(name, command=self.downloadScriptsFromGitHub(name))

        # QTUIのダウンロード
        for name in QTUI_PATH:
            prog += 1
            mc.progressWindow(edit=True,
                              progress=prog,
                              status="Loading QTUI: " + name)

            self.downloadQTUIFromGitHub(name)

        mc.progressWindow(endProgress=True)
        return "Construct Success"
Пример #39
0
  def parse_rib_archives(self):
    queue = Queue()
    self._enqueue_rib_files(queue)
    if queue.empty():
      return

    for file in self._process_rib_queue(queue):
      yield file

    if cmds.progressWindow(query=1, isCancelled=1):
      cmds.progressWindow(endProgress=1)
      raise maya_common.MayaZyncException("Submission cancelled")

    cmds.progressWindow(endProgress=1)
Пример #40
0
def loop(seq, title=''):
    cmds.progressWindow(title=title, progress=0.0, isInterruptable=True)
    total = len(seq)
    for i, item in enumerate(seq):
        try:
            if cmds.progressWindow(query=True, isCancelled=True): break
            cmds.progressWindow(e=True, progress=float(i) / total * 100)
            yield item  # with body executes here
        except:
            traceback.print_exc()
            cmds.progressWindow(ep=1)
    cmds.progressWindow(ep=1)
Пример #41
0
def defaultButtonPush08(*args):
	cmds.progressWindow(isInterruptable = 1)

	while True:
		WindowCheck = cmds.window(title = '"Press Esc"', widthHeight = (400, 200))
		cmds.paneLayout()
		cmds.scrollField(wordWrap=True, text='"Press Esc"')
		cmds.showWindow(WindowCheck)
		cmds.showSelectionInTitle(WindowCheck)
		cmds.deleteUI(WindowCheck)
	
		if cmds.progressWindow(query = 1, isCancelled = 1):
			cmds.progressWindow(endProgress = 1)
			break
		
		cmds.refresh()
Пример #42
0
 def getProgress(self):
     if not self.disable:
         if self.ismain:
             return cmds.progressBar(
                 self._gMainProgressBar, q=True, progress=True) or 0
         else:
             return cmds.progressWindow(q=True, progress=True) or 0
Пример #43
0
  def _parse_rib_archive(self, ribArchivePath):
    """Parses RIB archive file and tries to extract texture file names and other .rib files to parse.
       It read the file line by line with buffer limit, because the files can be very big.
       RIB files can be binary, in which case parsing them would be possible, but hacky,
       so we won't do that.
       We also check if the user has cancelled."""

    fileSet = set()

    # Please see the link to easily see what those regex match: https://regex101.com/r/X1hBUJ/1
    patterns = [(r'\"((?:(?!\").)*?\.rib)\"', 'rib'),
                (r'\"string fileTextureName\" \[\"((?:(?!\").)*?)\"', 'tex'),
                (r'\"string lightColorMap\" \[\"((?:(?!\").)*?)\"', 'tex'),
                (r'\"string filename\" \[\"((?:(?!\").)*?)\"', 'tex')]
    with open(ribArchivePath, 'r') as content_file:
      line = content_file.readline(10000)
      while line != '' and not cmds.progressWindow(query=1, isCancelled=1):
        for (pattern, t) in patterns:
          for file in re.findall(pattern, line):
            if os.path.exists(file):
              fileSet.add((file, t))
        line = content_file.readline(10000)

    for (f, t) in fileSet:
      yield (f, t)
Пример #44
0
	def refresh( self, message = None ):
		"""Finally show the progress window"""
		mn,mx = ( self.isRelative() and ( 0,100) ) or self.range()
		p = self.get()

		myargs = dict()
		myargs[ "e" ] = 1
		myargs[ "min" ] = mn
		myargs[ "max" ] = mx
		myargs[ "pr" ] = p
		myargs[ "status" ] = message or ( "Progress %s" % ( "." * ( int(p) % 4 ) ) )

		try:
			cmds.progressWindow( **myargs )
		except RuntimeError,e:
			log.warn(str( e ))
			pass 		# don't know yet why that happens
Пример #45
0
def dump():

    path = mc.fileDialog2(dialogStyle=1, fileMode=2)
    path = path and path[0]
    if not path:
        return

    mc.progressWindow(
        title='Geo.D Export',
        status='Initializing...',
        progress=0,
        isInterruptable=True,
    )

    scene = Scene(path, object_class=Object)

    selection = mc.ls(selection=True, long=True) or []
    transforms = mc.listRelatives(selection, allDescendents=True, fullPath=True, type='transform') or []
    transforms.extend(x for x in selection if mc.nodeType(x) == 'transform')

    for transform in transforms:
        scene.add_object(Object(transform))
    scene.finalize_graph()
    
    for i, total, path, obj in scene.iter_dump():
        mc.progressWindow(e=True, progress=int(100 * i / total), status=obj.transform.split('|')[-1])
        if mc.progressWindow(q=True, isCancelled=True):
            break

    mc.progressWindow(endProgress=True)
Пример #46
0
def batchResizeTexture(*args):

	imgPathList = getImgPath()
	sizeScale = cmds.optionMenu('TR_sizeScale', q= 1, v= 1)

	maxValue = len(imgPathList.keys())
	cmds.progressWindow( title= 'TextureResize', progress= 0, max= maxValue, status= 'Scaling...', isInterruptable= 1 )

	processStop = 0

	for i, tex in enumerate(imgPathList.keys()):
		if cmds.progressWindow( query= 1, isCancelled= 1 ):
			processStop = 1
			break
		
		newPath = resizeTexture(imgPathList[tex], sizeScale)
		#print newPath
		if not cmds.checkBox('TR_modify', q= 1, v= 1):
			cmds.setAttr(tex + '.fileTextureName', newPath, typ= 'string')

		cmds.progressWindow( e= 1, step= 1, status= str(i) + ' / ' + str(maxValue) )

	cmds.progressWindow(endProgress=1)

	# refresh
	fileNodeSelect()
Пример #47
0
 def isCancelled(self):
     '''
     fixed naming but previous left for legacy calls
     '''
     if not self.disable:
         if self.ismain:
             return cmds.progressBar(self._gMainProgressBar, query=True, isCancelled=True)
         else:
             return cmds.progressWindow(query=True, isCancelled=True)
Пример #48
0
  def _process_rib_queue(self, queue):
    files_parsed = 0
    cmds.progressWindow(title='Parsing rib files for dependencies...',
                        progress=files_parsed, maxValue=files_parsed + queue.qsize(),
                        status='Parsing: %d of %d' % (files_parsed, files_parsed + queue.qsize()), isInterruptable=True)

    while not queue.empty() and not cmds.progressWindow(query=1, isCancelled=1):
      (file, node, file_type) = queue.get()
      files_parsed += 1
      cmds.progressWindow(edit=True, progress=files_parsed, maxValue=files_parsed + queue.qsize(),
                          status='Parsing: %d of %d' % (files_parsed, files_parsed + queue.qsize()))

      scene_file = file.replace('\\', '/')
      print 'found file dependency from %s node %s: %s' % ('RenderManArchive', node, scene_file)
      yield scene_file

      if file_type == 'rib':
        for (f, t) in self._parse_rib_archive(file):
          queue.put((f, node, t))
Пример #49
0
def GenTerrain(DATA_SIZE, SEED, h, j):
	
	createTerrainData(DATA_SIZE, SEED, h, j)
	
	name = 'Terrain'
	totalPoints=(DATA_SIZE)*(DATA_SIZE)
	
	if (cmds.objExists(name) == True):
		cmds.delete(name)
    
	cmds.polyPlane( n=name, sx=(DATA_SIZE-1), sy=(DATA_SIZE-1), h=20, w=20)
	count = 0
	
	cmds.progressWindow(title='Setting Points', progress=count, max = totalPoints, status='Setting: 0/'+str(totalPoints))            
                         
	for i in xrange(DATA_SIZE):
		if True: cmds.refresh()
		cmds.delete(name, ch = True)
		for j in xrange(DATA_SIZE):
					offset = dataArray[i][j]
					cmds.polyMoveVertex( name+'.vtx['+str(count)+']', ws = True, ty = offset, cch=True)
					cmds.progressWindow(edit=True, progress=count, status='Setting: '+str(count))
					count+=1
                                    
	cmds.progressWindow(endProgress=1)

	#cmds.polySmooth(n=name, cch = True)
	cmds.delete(name, ch = True)
Пример #50
0
def exportL2F():#EXPORT RL 2 FILES
	#list ON LAYERS
	onlayers=[] 
	for each in getSceneData()['layers']:
		if mc.getAttr(str(each)+'.renderable'):
			if not ':' in each:
				onlayers.append(each)       
	fileNames=[]
	for each in l2fOutputFiles():
		fileNames.append(l2fOutputFolder()+each)
		
	#PROCEDURE
	if mc.getAttr('renderLayerManager.enableSingleFileName')==True:#IF SINGLE FILE OPTION 
		try:
			mc.file(os.path.normpath(fileNames[0]),ea=1,typ='mayaBinary')
		finally:
			print 'OUTPUT FILE:\n'+ os.path.normpath(fileNames[0])
	else:#MULTI FILE OPTION
		progress=1/len(onlayers)
		for each in onlayers: mc.setAttr(str(each)+'.renderable',0) #TURN OFF ON
		#MULTIPLE EXPORT
		mc.progressWindow(t='Saving..',min=0,max=len(onlayers),pr=progress,st='Copying\n'+onlayers[0])
		try:
			for index,each in enumerate(onlayers): #SEQUENTIALLY TURN ON, EXPORT, THEN TURN OFF
				mc.setAttr(str(each)+'.renderable',1)
				mc.file(os.path.normpath(fileNames[index]),ea=1,typ='mayaBinary')
				print 'OUTPUT FILE:'+ os.path.normpath(os.path.join(l2fOutputFolder()+each+'.mb'))
				progress=progress+1
				mc.progressWindow(e=1,pr=progress,st='Save Success \n'+ each)  
				mc.setAttr(str(each)+'.renderable',0)
		finally: mc.progressWindow(ep=1)        
		for each in onlayers: mc.setAttr(str(each)+'.renderable',1)#TURN BACK ON ONLAYERS
Пример #51
0
 def runFlakeGen(self,state):
     '''
     Executes the code to generate snowflakes and starts the progress window using the variables defined in snowflakeUI.flakeGenUI and starts the progress window
     '''
     cmds.progressWindow(title='SnowFX',
                                   progress=0,
                                   status='Starting up...')
     try:
         particles=makeSnowflakes.makeSnowflakes(cmds.intField(self.flakeNumber,v=1,q=1),
                                                                   cmds.floatField(self.flakeRadius,v=1,q=1),
                                                                   cmds.intField(self.flakeRadiusVar,v=1,q=1),
                                                                   cmds.canvas(self.colour1,rgb=1,q=1),
                                                                   cmds.canvas(self.colour2,rgb=1,q=1),
                                                                   cmds.floatField(self.transparency,v=1,q=1),
                                                                   cmds.floatField(self.glow,v=1,q=1))
         for i in range(0,len(particles)):
             cmds.move(0,0,cmds.floatField(self.flakeRadius,v=1,q=1)*2*i,particles[i])
         group = cmds.group(em=1,n='snowFX')
         for x in particles:
             cmds.parent(x,group)
         cmds.progressWindow(ep=1)
     except Exception, err:
         sys.stderr.write('ERROR: %s\n' % str(err))
         cmds.progressWindow(ep=1)
         errorPopup('Something went wrong :( \n Check the script editor for detials')
Пример #52
0
def mddExport(filepath, exportedObjects, startFrame, endFrame, fps):
	(difName,basename) = getDirFromParh(filepath)
	filepath = difName+"/"+basename+".mdd"
	filepathObj = difName+"/"+basename+".obj"

	mddFile = open(filepath, 'wb') #no Errors yet:Safe to create file
	numframes = endFrame-startFrame+1
	# set reference frame time
	cmds.currentTime( startFrame, edit=True )
	cmds.file(filepathObj,op="groups=1;ptgroups=1;materials=0;smoothing=1;normals=1",typ="OBJexport",pr=1,es=1,force=1)

	# Write the header
	numverts = getVertexCount(exportedObjects)
	mddFile.write(pack(">2i", numframes, numverts))
	
	## Write the frame times, sec
	mddFile.write( pack(">%df" % (numframes), *[frame/fps for frame in xrange(numframes)]) ) # seconds	
	#checking vertex count for the model
	check_vertcount(exportedObjects,numverts,mddFile)
	
	# Use that iterator for something - here it's returning a list of vertex positions
	vertexPositionList= getSelectedVertexPositions(exportedObjects)
	# write out referece model vertex position
	mddFile.write(pack(">%df" % (numverts*3), *[v for v in vertexPositionList]))
	vertexPositionList = None
	amount = 0
	frameRange = (endFrame-startFrame)+1

	cmds.progressWindow(	title='Exporting sequence',
					progress=amount,
					status='Finished: 0%',
					isInterruptable=True ,
	                                maxValue = frameRange)
	for frame in xrange(startFrame,endFrame+1):#in order to start at desired frame
		if cmds.progressWindow( query=True, isCancelled=True ) :
			break
		cmds.currentTime( frame, edit=True )
		# Check vertex  count, its shouldnt be changed over time
		check_vertcount(exportedObjects,numverts,mddFile)
		vertexPositionList= getSelectedVertexPositions(exportedObjects)
		# Write the vertex data
		mddFile.write(pack(">%df" % (numverts*3), *[v for v in vertexPositionList]))
		if cmds.progressWindow( query=True, progress=True ) >= frameRange  :
			break
		amount += 1
		cmds.progressWindow( edit=True, progress=amount, status=('Finished: ' + `amount` + '%' ) )
	cmds.progressWindow(endProgress=1)
	vertexPositionList = None
	mddFile.close()
Пример #53
0
def exportShaders(export_path, mode):
    if not export_path:
        mc.warning('Please enter a output folder!')
        return -1
    if not exists(export_path):
        mc.warning('Directory is not exists :'+export_path)
        return -1
    shading_groups = []
    if mode == 0:
        shading_groups = [s for s in mc.ls(type='shadingEngine')
            if s not in ('initialParticleSE', 'initialShadingGroup')]
    elif mode == 1:
        selections = mc.ls(sl=True)
        if not selections:
            mc.warning(
                'Please select at least one shader or mesh, nurbsShapes.')
            return -1
        for sel in selections:
            connected_sg = mc.listConnections(sel, s=False,
                d=True, type='shadingEngine')
            if not connected_sg:
                continue
            shading_groups.extend([s for s in connected_sg
                if s not in ('initialParticleSE', 'initialShadingGroup')])
        shading_groups = list(set(shading_groups))
    else:
        return -1
    if not shading_groups:
        mc.warning('There are no any shaders can be export!')
        return -1
    if not _userConfirm('Export Shaders', '\n'.join(shading_groups)):
        return -1
    connections = []
    fullpath = ''
    amout = 0
    process_max = len(shading_groups)
    mc.progressWindow(title='Export Shaders', progress=amout,
        status='Export start...', isInterruptable=True, max=process_max)
    for sg in shading_groups:
        if mc.progressWindow(q=True, isCancelled=True):
            break
        fullpath = '{0}{1}.ma'.format(export_path, sg.replace(':', '_'))
        connections = mc.listHistory(sg, allFuture=True, pruneDagObjects=True)
        mc.select(connections, replace=True, noExpand=True)
        try:
            mc.file(fullpath, force=True, exportSelected=True,
                type='mayaAscii', options='v=0;')
            amout += 1
            mc.progressWindow(e=True, progress=amout, 
                status='Export : {0} / {1}'.format(amout,  process_max))
        except:
            raise
        mc.select(cl=True)
    mc.progressWindow(endProgress=True)
Пример #54
0
def main( *args ):
    selObject = mc.ls(sl=1)
    amount = 0.0
    for item in selObject:
        mc.progressWindow(    title='Reedit Keys',
                                            progress=amount,
                                            status='Reediting: 0%',
                                            isInterruptable=True )
        if mc.progressWindow( query=True, isCancelled=True ) :
                        break
        if mc.progressWindow( query=True, progress=True ) >= 100 :
                        break
        if selAnimNodes(item) == 'Error:':continue
        amount = (float((selObject.index(item)+1))/float(len(selObject))*100.0)
        mc.progressWindow( edit=True, progress=amount, status=('Reediting: ' + `amount` + '%' ) )
    mc.progressWindow(endProgress=1)
Пример #55
0
def objExport(filepath,  startFrame, endFrame, inc):
	(difName,basename) = getDirFromParh(filepath)
	# Here we dont specify "op" (option) parameter, because we want to have option to get it from maya "export Selection" dialog, so whetever is active there, will be exported using this command
	amount = 0
	frameRange = (endFrame-startFrame)+1
	cmds.progressWindow(	title='Exporting sequence',
					progress=amount,
					status='Finished: 0%',
					isInterruptable=True ,
	                                maxValue = frameRange)
	
	for frame in range(startFrame,endFrame,inc):
		if cmds.progressWindow( query=True, isCancelled=True ) :
			break
		cmds.currentTime( frame, edit=True )
		cmds.file(difName+"/"+basename+"."+str(frame).zfill(5)+".obj",op="groups=1;ptgroups=1;materials=0;smoothing=1;normals=1",typ="OBJexport",pr=1,es=1,force=1)
		if cmds.progressWindow( query=True, progress=True ) >= frameRange  :
			break
		amount += 1
		cmds.progressWindow( edit=True, progress=amount, status=('Finished: ' + `amount` + '%' ) )
	cmds.progressWindow(endProgress=1)
Пример #56
0
    def getProgress(self, stage, current, maxval, message ) :
        
        if stage == 0 and current == 0 :
            m.progressWindow(title="Loading", max=100)
            
        if stage == 5:
            m.progressWindow(ep=True)
            return

        if maxval == 0 : return
            
        value = stage * 25 + 25 * current / maxval;
        
        m.progressWindow(e=True, status=message, progress=value)
Пример #57
0
 def runPlaneEmit(self,state):
     '''
     Executes the code to emit particles from a plane using the variables defined in snowflakeUI.planeEmitUI and starts the progress window
     Will create an error popup if the variable values would stop the code from functioning correctly
     '''
     if cmds.intField(self.endFrame,v=1,q=1)<=cmds.intField(self.startFrame,v=1,q=1):
         errorPopup('End Frame must be after Start Frame')
         return
     if cmds.intField(self.lifeTime,v=1,q=1)<=0:
         errorPopup('Particles have to have a lifetime')
         return
     if cmds.intField(self.fadeOut,v=1,q=1)>cmds.intField(self.lifeTime,v=1,q=1):
         errorPopup('Lifetime must be larger than fadeout time')
         return
     try:
         vtxCount = cmds.polyEvaluate(cmds.textField(self.sourcePlane,tx=1,q=1),v=1)
         if vtxCount!=4:
             errorPopup('Select an unsubdivided plane')
             return
     except:
         errorPopup('Choose a source plane')
         return
     particleFX.reloadFile()
     cmds.progressWindow(title='SnowFX',
                                   progress=0,
                                   status='Starting up...')
     try:
         particles=self.makeAllParticles()
         particleFX.planeEmit(cmds.textField(self.sourcePlane,tx=1,q=1),
                                        cmds.intField(self.startFrame,v=1,q=1),
                                        cmds.intField(self.endFrame,v=1,q=1)-cmds.intField(self.startFrame,v=1,q=1),
                                        particles,
                                        cmds.floatField(self.maxDistance,v=1,q=1),
                                        cmds.floatField(self.minDistance,v=1,q=1),
                                        cmds.floatField(self.maxAngle,v=1,q=1),
                                        cmds.intField(self.forceTime,v=1,q=1),
                                        cmds.intField(self.lifeTime,v=1,q=1),
                                        cmds.intField(self.lifeTimeVar,v=1,q=1),
                                        cmds.intField(self.fadeOut,v=1,q=1),
                                        cmds.floatField(self.turbulenceAmp,v=1,q=1),
                                        cmds.intField(self.turbulencePer,v=1,q=1),
                                        (cmds.floatField(self.driftX,v=1,q=1),cmds.floatField(self.driftY,v=1,q=1),cmds.floatField(self.driftZ,v=1,q=1)))
         group = cmds.group(em=1,n='snowFX')
         for x in particles:
             cmds.parent(x.name,group)
         cmds.progressWindow(ep=1)
     except Exception, err:
         sys.stderr.write('ERROR: %s\n' % str(err))
         cmds.progressWindow(ep=1)
         errorPopup('Something went wrong :( \n Check the script editor for detials')
Пример #58
0
def renderLocal(start,end):

        y = start
        x = end
        amount = int(end) - int(start)
        per = 100 / amount
        cmds.progressWindow( title='local Rendering', progress=int(0), status='Rendering: 0%', isInterruptable=True )

        while y <= x:
                if cmds.progressWindow( query=True, isCancelled=True ) :
                        break
                cmds.currentTime(y)
                mel.eval('renderWindowRender redoPreviousRender renderView;')
                cmds.progressWindow( edit=True, progress=int(per), status=('Rendering: ' + `per` + '%' ) )
                y = y + 1
                per = per + per

        cmds.progressWindow(endProgress=1)
Пример #59
0
 def creatPropGeoCacheSelect(self, *args):
     num = self.selectProp()
     try:
         count = len(num)
         j = 0
         amount = 0
         # self.core.progressBarWin( count )
         mc.progressWindow(title="Export caches", progress=amount, status="Starting", isInterruptable=1)
         for i in num:
             if mc.progressWindow(q=1, isCancelled=1):
                 break
             amount = (j + 1) * 100 / count
             mc.progressWindow(e=1, progress=amount, status=("Exporting: " + ` amount ` + "%"))
             mc.pause(seconds=0)
             # mc.progressBar(self.core.progressControl, edit=True, step=1.0)
             self.doCreateGeoCache(int(i))
             j += 1
         # self.core.close()
         mc.progressWindow(endProgress=1)
     except:
         pass