本文整理汇总了Python中Vector.mult方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.mult方法的具体用法?Python Vector.mult怎么用?Python Vector.mult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vector
的用法示例。
在下文中一共展示了Vector.mult方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: construct
# 需要导入模块: import Vector [as 别名]
# 或者: from Vector import mult [as 别名]
def construct(self,name=None):
""" builds the trace """
minVel = 99999.0
maxVel = 0.0
pPos = None
if not self.points: # if points is not yet defined, iterate through keys and gather the points
self.points = []
frames = [x*self.timestep+self.timeSpan[0] for x in range(0, int((self.timeSpan[1]-self.timeSpan[0])/self.timestep)+1)]
frames.append(self.timeSpan[1])
for t in frames:
mc.currentTime(t)
pos = mc.xform( self.object, q=True, ws=True, translation=True )
if not pPos == None:
vel = Vector(pos) - Vector(pPos)
if( vel.mag() > maxVel ):
maxVel = vel.mag()
if( vel.mag() < minVel ):
minVel = vel.mag()
if( len(self.points) == 0 or
(Vector(pos) - Vector(self.points[-1])).mag() > 0.001 ):
self.points.append(pos)
pPos = pos
self.origCurve = mc.curve(d=1, ep=self.points, n="nurbsCurveTrace")
self.origCurve = mc.rebuildCurve(self.origCurve,
constructionHistory=0,
replaceOriginal=1,
rebuildType=0,
endKnots=1,
keepRange=1,
keepControlPoints=0,
keepEndPoints=1,
keepTangents=0,
spans=len(self.points)*self.timestep*self.smooth,
degree=3,
tolerance=0.01)[0]
if name:
self.origCurve = mc.rename(self.origCurve,name)
if( self.tube == True ):
self.extrusion = self.extrude()
frames = [x*self.timestep+self.timeSpan[0] for x in range(0, int((self.timeSpan[1]-self.timeSpan[0])/self.timestep)+1)]
frames.append(self.timeSpan[1])
for t in frames:
mc.currentTime(t)
end = cu.curveArcLen( self.origCurve )
mc.select( self.object )
pt = mc.xform( q=True, ws=True, t=True )
now = cu.findArcLenAtParam( self.origCurve, cu.findParamAtPoint( self.origCurve, pt ) )
# find subCurve2 of the extrusion
shape = mc.listRelatives(self.curve2, fullPath=True, shapes=True)[0]
for sub in mc.listConnections(shape):
if(sub.startswith("subCurve")):
mc.setKeyframe( "%s.maxValue"%sub, t=t, v=max(0.0001,now/end) ) # key the visibility
prev = None
frames = [x*self.timestep+self.timeSpan[0] for x in range(0, int((self.timeSpan[1]-self.timeSpan[0])/self.timestep)+1)]
frames.append(self.timeSpan[1])
for prevT in frames:
mc.currentTime(prevT)
mc.select( self.object )
pt = mc.xform( q=True, ws=True, t=True )
scalePivot = Vector()
for i in range(0,8):
mc.select( "%s.cv[%d][%d]"%( self.extrusion, i, int(t/self.timestep) ) )
scalePivot.add( Vector( mc.xform(q=True, ws=True, t=True) ) )
scalePivot.mult(1.0/8.0)
mc.select( "%s.cv[0:7][%d]"%( self.extrusion,int(t/self.timestep) ) )
if( self.multVel ):
sz = 1.0
if( prev == None ):
sz = 0.0
else:
vel = Vector(pt) - Vector(prev)
if( self.invertVel ):
sz = self.taper(prevT, self.timeSpan[0], self.timeSpan[1], 0.2, 0.8) #remap(vel.mag(), minVel, maxVel, 1, 0)
else:
sz = 1-self.taper(prevT, self.timeSpan[0], self.timeSpan[1], 0.2, 0.8) #remap(vel.mag(), minVel, maxVel, 0, 1)
mc.scale( sz, sz, sz, centerPivot=True, relative=True, p=scalePivot )
prev = pt
groupName = mc.group(self.traceBits,n=self.object+"TubeTraceGroup")
mc.setKeyframe( groupName+".visibility", t=self.timeSpan[0]-1, v=0.0 )
mc.setKeyframe( groupName+".visibility", t=self.timeSpan[0], v=1.0 )
# center the pivot on the newly created trace
mc.select(groupName)
mc.xform(cp=True)
return groupName
else:
# center the pivot on the newly created trace
mc.select(self.origCurve)
mc.xform(cp=True)
return self.origCurve