本文整理汇总了Python中maya.cmds.progressWindow函数的典型用法代码示例。如果您正苦于以下问题:Python progressWindow函数的具体用法?Python progressWindow怎么用?Python progressWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了progressWindow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Cas_MCW_restoreMisc
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: updateProgressWindow
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
示例3: makeSnowflakes
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
示例4: func
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 )
示例5: __exit__
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
示例6: planeEmit
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
示例7: loadCharacter
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)
示例8: emitCurve
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
示例9: func
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
示例10: do
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
示例11: parse_rib_archives
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)
示例12: __enter__
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)
示例13: defaultButtonPush08
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()
示例14: _parse_rib_archive
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)
示例15: refresh
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