本文整理汇总了Python中maya.cmds.rebuildCurve函数的典型用法代码示例。如果您正苦于以下问题:Python rebuildCurve函数的具体用法?Python rebuildCurve怎么用?Python rebuildCurve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rebuildCurve函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: createOnCurve
def createOnCurve( curve=None, numOfJnts=5, parent=True ):
"""
create specified number of joints on input curve
"""
curve = curveUtil.getShape(curve)
if numOfJnts < 2 :
cmds.error( "number of joints must be greater than 1.")
newJnts = []
curve = cmds.duplicate(curve)[0]
cmds.rebuildCurve (curve , ch=False ,rpo=True ,rt=0 ,end=1 ,kr=0 ,kcp=False ,kep=True ,kt=0 , s=200 , d=1 , tol=0.01 )
curveShape = curveUtil.getShape(curve)
cmds.select(clear=True)
segSize = 1.0/ (numOfJnts-1)
for i in range(numOfJnts):
pos = curveUtil.getPointAtParam(curveShape, segSize*i, 'world')
if not parent:
cmds.select(clear=True)
newJnts.append( cmds.joint(p=pos) )
cmds.delete(curve)
return newJnts
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:25,代码来源:joint.py
示例2: finalize
def finalize(self):
log.debug("returnList: %s"% self.returnList)
log.debug("createdList: %s"% self.createdList)
buffer = [] #self.i_module.templateNull.templateStarterData
log.debug("starting data: %s"% buffer)
#Make sure we have enough points
#==============
handles = self.i_module.templateNull.handles
if len(self.returnList) < handles:
log.warning("Creating curve to get enough points")
curve = curves.curveFromPosList(self.returnList)
mc.rebuildCurve (curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0,s=(handles-1), d=1, tol=0.001)
self.returnList = curves.returnCVsPosList(curve)#Get the pos of the cv's
mc.delete(curve)
#Store info
#==============
for i,p in enumerate(self.returnList):
buffer.append(p)#need to ensure it's storing properly
#log.info('[%s,%s]'%(buffer[i],p))
#Store locs
#==============
log.debug("finish data: %s"% buffer)
self.templateNull.__setattr__('templateStarterData',buffer,lock=True)
#self.i_module.templateNull.templateStarterData = buffer#store it
log.info("'%s' sized!"%self.i_module.getShortName())
dragFactory.clickMesh.finalize(self)
开发者ID:jakebarnwell,项目名称:PythonGenerator,代码行数:29,代码来源:ModuleFactory.py
示例3: createCurve
def createCurve(ptList,start,end,group=''):
'''
'''
# Initialize Curves
crvList = []
for pt in ptList:
pos = mc.pointPosition(pt)
curve = mc.curve(p=[pos,pos],d=1)
curve = mc.rename(curve,pt+'_curve')
crvList.append(curve)
# Track Curves
for i in range(start,end+1):
mc.currentTime(i)
for n in range(len(ptList)):
pos = mc.pointPosition(ptList[n])
mc.curve(crvList[n],a=True,p=pos)
# Remove Initial CV and Rebuild
for crv in crvList:
mc.delete(crv+'.cv[0]')
mc.rebuildCurve(crv,ch=False,rpo=True,rt=0,end=1,kr=2,kcp=True,kep=True)
# Group Curves
if group:
# Check Group
if not mc.objExists(group): group = mc.group(em=True,n=group)
# Parent Curves to Group
mc.parent(crvList,group)
# Return Result
if group: return [group]
else: return crvList
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:33,代码来源:motionPath.py
示例4: crvTendon
def crvTendon(curve,geo,precision=4,prefix='tendon'):
'''
'''
# rebuildCurve degree 1
baseCurve = mc.rebuildCurve(curve,ch=0,s=1,d=1,rpo=1,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
# create cv locators
baseLocs = glTools.utils.curve.locatorCurve(baseCurve,prefix=prefix+'_baseCrv')
# generate geo constraint curve
geoCurve = mc.rebuildCurve(baseCurve,ch=1,s=precsion,d=1,rpo=0,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
geoCurveLocs = glTools.utils.curve.locatorCurve(geoCurve,prefix=prefix+'_geoCrv')
# generate reference curve
refCurve = mc.rebuildCurve(baseCurve,ch=1,s=precsion,d=1,rpo=0,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1)
refCurveInfo = mc.createNode('curveInfo',n=prefix+'_ref_curveInfo')
mc.connectAttr(refCurve+'.worldSpace[0]',refCurveInfo+'.inputCurve',f=True)
refCurveLocs = []
for i in range(precsion+1):
refNull = mc.group(em=True,n=prefix+'_ref'+str(i)+'_null')
mc.connectAttr(refCurveInfo+'.controlPoints['+str(i)+']',refNull+'.t')
refCurveLocs.append(refNull)
# Locator Constraints
for i in range(precsion+1):
mc.pointConstraint(refCurveLocs[i],geoCurveLocs[i])
mc.geometryConstraint(geo,geoCurveLocs[i])
# fitBspline
bSpline = mc.fitBspline(geoCurve,ch=1)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:30,代码来源:tendon.py
示例5: createCurveaBasedOnLocator
def createCurveaBasedOnLocator( prevLoc, loc, baseName, hrsSys ):
leastSquaresMod = mn.createNode( 'leastSquaresModifier' )
origCurv = crv.Curve( mc.curve( d = 1, ep = [prevLoc.worldPosition, loc.worldPosition] ) )
index = mm.eval( 'getNextFreeMultiIndex( "'+ hrsSys.name +'.inputHair", 0 )' )
origCurv.name = 'spiderWeb_base_'+ baseName + '_' + str( index ) + '_CRV'
mc.rebuildCurve( origCurv.name, rpo = 1, rt = 0, end = 1, kr = 0, kcp = 1, kep = 1, kt =0, s= 4, d = 1, tol = 0.01 )
origCurv.a.intermediateObject.v = 1
controledCurv = origCurv.duplicate()
origCurv.shape.attr( 'worldSpace[0]' ) >> leastSquaresMod.a.inputNurbsObject
prevLoc.attr( 'worldPosition[0]') >> leastSquaresMod.attr( 'pointConstraint[0].pointPositionXYZ' )
leastSquaresMod.attr( 'pointConstraint[0].pointConstraintU' ).v = 0
loc.attr( 'worldPosition[0]') >> leastSquaresMod.attr( 'pointConstraint[1].pointPositionXYZ' )
leastSquaresMod.attr( 'pointConstraint[1].pointConstraintU' ).v = 1
leastSquaresMod.a.outputNurbsObject >> controledCurv.shape.a.create
controledCurv.shape.attr( 'worldMatrix[0]' ) >> leastSquaresMod.a.worldSpaceToObjectSpace
fol = mn.createNode( 'follicle' )
fol.a.restPose.v = 1
fol.a.startDirection.v = 1
fol.a.pointLock.v = 3
fol.a.degree.v = 3
fol.a.sampleDensity.v = 3
fol.a.outHair >> hrsSys.attr( 'inputHair[' + str( index ) + ']' )
hrsSys.attr( 'outputHair[' + str( index ) + ']' ) >> fol.a.currentPosition
controledCurv.shape.attr( 'worldSpace[0]' ) >> fol.a.startPosition
curv = crv.Curve( mc.curve( d = 3, ep = [prevLoc.worldPosition, loc.worldPosition] ) )
curv.name = 'spiderWeb_' + baseName + '_' + str( index ) + '_CRV'
fol.a.outCurve >> curv.a.create
folPar = fol.parent
folPar.name = 'spiderWeb_' + baseName + '_' + str( index ) + '_FOL'
return curv, folPar
开发者ID:skarone,项目名称:PipeL,代码行数:30,代码来源:spiderWebCreator.py
示例6: __init__
def __init__(self, curve_sel, vertex_list):
self.curve_sel = curve_sel
self.verts = vertex_list
self.find_length = Find_Out()
self.link_length = self.find_length.edge_length(self.verts)
self.chain_length = self.find_length.curve_length(self.curve_sel)
self.link_total = int(self.chain_length/self.link_length)
cmds.duplicate(self.curve_sel, n = 'buildCurve')
cmds.rebuildCurve('buildCurve', ch = 1, rpo = 1, rt = 0, end = 1, kr = 2, kep = 1, kt = 0, kcp = 0, s = self.link_total/2, d = 3, tol = 0.01 )
self.num_cv = int(cmds.getAttr ('buildCurve.degree'))+ (cmds.getAttr ('buildCurve.spans'))
for dummy_cv in range(self.num_cv):
dummy_cv_pos = (cmds.getAttr ('buildCurve.cv['+ str(dummy_cv) +']'))
if dummy_cv == 0:
cmds.joint(n=self.curve_sel+'_jointRoot',p = dummy_cv_pos[0])
elif dummy_cv == self.num_cv - 1:
cmds.joint(n=self.curve_sel+'_jointEnd', p = dummy_cv_pos[0])
else:
cmds.joint(n=self.curve_sel+'_joint_'+(str(dummy_cv)),p = dummy_cv_pos[0])
cmds.delete('buildCurve')
cmds.ikHandle( sj = (self.curve_sel+'_jointRoot'), ee = (self.curve_sel+'_jointEnd'), c = self.curve_sel,
sol = 'ikSplineSolver', scv = 0, pcv = 0, ccv = 0, ns = 4)
开发者ID:XJZeng,项目名称:ChainMaker,代码行数:27,代码来源:chain_maker.py
示例7: buidleUpCurve
def buidleUpCurve(startOBJ, endObj, upOBJ):
startPosition = mc.xform(startOBJ, q=True, ws=True, t=True)
endPosition = mc.xform(endObj, q=True, ws=True, t=True)
upPosition = mc.xform(upOBJ, q=True, ws=True, t=True)
offsetVector = (upPosition[0] - startPosition[0]) * 0.25, (upPosition[1] - startPosition[1]) * 0.25, (upPosition[2] - startPosition[2]) * 0.25
startPosition = (startPosition[0] + offsetVector[0]), (startPosition[1] + offsetVector[1]), (startPosition[2] + offsetVector[2])
endPosition = (endPosition[0] + offsetVector[0]), (endPosition[1] + offsetVector[1]), (endPosition[2] + offsetVector[2])
Curve = mc.curve(d=1, p=(startPosition, endPosition))
mc.rebuildCurve(Curve, ch=0, s=3, d=3)
return Curve
开发者ID:AtonLerin,项目名称:RiggingTeamTools,代码行数:12,代码来源:cmds.py
示例8: build
def build( curve=None, numOfJnts=10, name="brow" ):
# soften input curve and delete history
curve = util.rename(curve, name=(name+"Low"), suffix="crv")[0]
curve = curveUtil.getShape( curve=curve )
cmds.rebuildCurve(curve, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=1, kep=1, kt=0, s=4, d=3, tol=0.01 )[0]
cmds.makeIdentity(curve, apply=True, t=1, r=1, s=1 )
# create the high res curve
curveHigh = cmds.rebuildCurve(curve, ch=0, rpo=0, rt=0, end=1, kr=0, kcp=0, kep=1, kt=0, s=numOfJnts, d=1, tol=0.01 )[0]
curveHigh = util.rename(curveHigh, name=(name+"High"), suffix="crv")[0]
return curve, curveHigh
开发者ID:satishgoda,项目名称:EHM_tools,代码行数:12,代码来源:eyebrow.py
示例9: RebuildWithNCVs
def RebuildWithNCVs (self,numberOfCvs,curve ):
if cmds.getAttr (curve+".form")==2:
if numberOfCvs >= 3:
curve = cmds.rebuildCurve(curve, spans = numberOfCvs,keepRange = 2)[0]
return curve
else:
return None
else:
if numberOfCvs >= 4:
curve = cmds.rebuildCurve(curve, spans = numberOfCvs - 3,keepRange = 2)[0]
return curve
else:
return None
开发者ID:rendermotion,项目名称:RMMel,代码行数:13,代码来源:RMLaces.py
示例10: createInterpolatedCurve
def createInterpolatedCurve(curve1, curve2, v):
interpolatedCurve = mc.duplicate(curve1, rr=True, rc=True)[0]
for shape in mc.listRelatives(curve2,shapes=True,fullPath=True):
cvList = (mc.ls([shape+'.cv[*]'],flatten=True))
mc.rebuildCurve(interpolatedCurve, ch=0, rpo=1, rt= 0, end = 1, kr = 0, kcp = 0, kep = 1, kt = 0, s = len(cvList)-3, d = 3, tol = 0)
for i in range(len(cvList)):
pos1 = mc.pointPosition('%s.cv[%i]' % (interpolatedCurve,i))
pos2 = mc.pointPosition('%s.cv[%i]' % (curve2,i))
newPos = ((pos2[0]-pos1[0])*v+pos1[0], (pos2[1]-pos1[1])*v+pos1[1], (pos2[2]-pos1[2])*v+pos1[2])
mc.move(newPos[0], newPos[1], newPos[2], '%s.cv[%i]' % (interpolatedCurve,i), a=True)
return interpolatedCurve
开发者ID:cgfile,项目名称:hairTools,代码行数:14,代码来源:hairTools.py
示例11: makeCenterCurve
def makeCenterCurve( crvs, rebuildSpanRate= 1.0 ):
crvShapes = []
for crv in crvs:
crvShape = getShape( crv )
if not crvShape: continue
crvShapes.append( crvShape )
lengthAll = 0.0
crvInfo = cmds.createNode( 'curveInfo' )
for crvShape in crvShapes:
if not cmds.isConnected( crvShape+'.local', crvInfo+'.inputCurve' ):
cmds.connectAttr( crvShape+'.local', crvInfo+'.inputCurve', f=1 )
length = cmds.getAttr( crvInfo+'.arcLength' )
lengthAll += length
cmds.delete( crvInfo )
lengthAverage = lengthAll / len( crvShapes )
rebuildSpans = int( lengthAverage * rebuildSpanRate )
for crvShape in crvShapes:
cmds.rebuildCurve( crvShape, constructionHistory=0,
replaceOriginal=1,
rebuildType=0,
endKnots=1,
keepRange=0,
keepControlPoints=0,
keepEndPoints=1,
keepTangents=0,
s=rebuildSpans, d=3, tol=0.01 )
fnNurbsCurve = om.MFnNurbsCurve( getDagPath( crvShapes[0] ) )
numCVs = fnNurbsCurve.numCVs()
points = []
for i in range( numCVs ):
points.append( [0,0,0] )
curve = cmds.curve( p=points, d=3 )
for i in range( numCVs ):
sumPoints = om.MVector(0,0,0)
for crvShape in crvShapes:
sumPoints += om.MVector( *cmds.xform( crvShape+'.controlPoints[%d]' % i, q=1, os=1, t=1 ) )
averagePoints = sumPoints / len( crvShapes )
cmds.move( averagePoints.x, averagePoints.y, averagePoints.z, curve+'.controlPoints[%d]' % i, os=1 )
return curve
开发者ID:jonntd,项目名称:mayadev-1,代码行数:50,代码来源:hairSymulationSetting.py
示例12: CurveShapes
def CurveShapes(self):
getSel=self.selection_grab()
if getSel:
pass
else:
return
getNames=cmds.ls(sl=1, fl=1)
if ".e[" not in str(getNames[0]):
print "selection needs to be continuous edges of two seperate polygon objects: first select one, then continuous edge and then the continuous edge on a seperate poly object that you want to deform it along"
return
else:
pass
getFirstGrp = getNames[0].split(".")[0]
getSecondGrp = getNames[-1:][0].split(".")[0]
if getFirstGrp == getSecondGrp:
print "Only one poly object has been detected. Select one object and it's continuous edge and then select another object and select it's continuous edge for the first object to align to."
return
else:
pass
firstList=[(each) for each in getNames if each.split(".")[0]==getFirstGrp]
secondList=[(each) for each in getNames if each.split(".")[0]==getSecondGrp]
'''create childfirst curve'''
cmds.select(firstList)
cmds.CreateCurveFromPoly()
getFirstCurve=cmds.ls(sl=1, fl=1)
'''get cv total of curve'''
getFirstCurveInfo=cmds.ls(sl=1, fl=1)
numberCV=str(pm.PyNode(getFirstCurveInfo[0]).numCVs())
cmds.delete(getFirstCurve[0], ch=1)
'''wrap child mesh to curve'''
cmds.select(cmds.ls(getFirstGrp)[0], r=1)
cmds.wire(w=getFirstCurve[0], gw=0, en=1.000000, ce=0.000000, li=0.000000, dds=[(0, 500)] )
'''create parent curve'''
cmds.select(secondList)
cmds.CreateCurveFromPoly()
getSecondCurve=cmds.ls(sl=1, fl=1)
getSecondCurveInfo=cmds.ls(sl=1, fl=1)
'''rebuilt curve to match first curve built'''
cmds.rebuildCurve(getSecondCurve[0], getFirstCurve[0], rt=2 )
getSecondCurve=cmds.ls(sl=1, fl=1)
getSecondCurveInfo=cmds.ls(sl=1, fl=1)
cmds.delete(getSecondCurve[0], ch=1)
'''wrap parent curve to parent mesh'''
cmds.select(getSecondCurve[0], r=1)
cmds.select(cmds.ls(getSecondGrp)[0], add=1)
cmds.CreateWrap()
'''blend child curve to parent curve'''
cmds.blendShape(getSecondCurve[0], getFirstCurve[0],w=(0, 1.0))
return getFirstGrp, getSecondGrp
开发者ID:edeglau,项目名称:storage,代码行数:49,代码来源:plot.py
示例13: build
def build(startPt=[-1,0,0],endPt=[1,0,0],attachments=2,outputMesh=False,radius=0.2,prefix='tendon'):
'''
'''
#
# Get points
startPt = glTools.utils.base.getMPoint(startPt)
endPt = glTools.utils.base.getMPoint(endPt)
# Get offset
offsetVec = endPt - startPt
offsetInc = 1.0/(attachments-1)
# Get Point List
ptList = []
for i in range(attachments-1):
pt = startPt + (offsetVec * offsetInc)
ptList.append(pt[0],pt[1],pt[2])
# Build tendon curve base
tendonCrv = glTools.utils.curve.createFromPointList(ptList,1,prefix)
# Generate tendon curve locators
tendonLocList = glTools.utils.curve.locatorCurve(tendonCrv,freeze=False,prefix=prefix)
# Rebuild tendon curve
if attachments > 2:
tendonRebuild = mc.rebuildCurve(tendonCrv,ch=1,rpo=1,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1,s=0,d=3,tol=0.01)
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:26,代码来源:tendon.py
示例14: edgeLoopCrv
def edgeLoopCrv(meshEdgeList,rebuild=False,rebuildSpans=0,form=2,keepHistory=True,prefix=''):
'''
Generate a curve from a mesh edge loop.
@param meshEdgeList: List of mesh edges to generate curve from
@type meshEdgeList: list
@param rebuild: Rebuild curve to degree 3
@type rebuild: bool
@param rebuildSpans: Number of spans to rebuild the resulting curve to
@type rebuildSpans: int
@param form: Form of the resulting curve. 0 = Open, 1 = Periodic, 2 = Best Guess.
@type form: str
@param keepHistory: Maintain construction history
@type keepHistory: bool
@param prefix: Name prefix for newly created nodes
@type prefix: str
'''
# Check edge list
if not meshEdgeList:
raise Exception('Invalid mesh edge list provided!!')
meshEdgeList = mc.ls(meshEdgeList,fl=True)
# Check prefix
if not prefix: prefix = glTools.utils.stringUtils.stripSuffix(meshEdgeList[0].split('.')[0])
# Convert edge selection to nurbs curve
crvDegree = 1
if rebuild: crvDegree = 3
curve = mc.polyToCurve(ch=keepHistory,form=form,degree=crvDegree)[0]
# Rebuild as degree 3
if rebuild and rebuildSpans:
curve = mc.rebuildCurve(curve,ch=keepHistory,rpo=1,rt=0,end=1,kr=0,kcp=1,kep=1,kt=1,s=rebuildSpans,d=3,tol=0.01)[0]
# Rename curve
curve = mc.rename(curve,prefix+'_curve')
# Return result
return curve
开发者ID:auqeyjf,项目名称:glTools,代码行数:34,代码来源:curve.py
示例15: trimFromBeginning
def trimFromBeginning(inputCurves, shortestLength):
newCurves = []
for obj in inputCurves:
parent = mc.listRelatives(obj, parent=True)
r = random.random()*(1-shortestLength)
obj = mc.rebuildCurve(obj, ch=0, rpo=1, rt=0, end=1, kr=0, kcp=1, kep=1, kt=0, s = 10, d = 3, tol = 0)[0]
curves = mc.detachCurve( '%s.u[%f]' % (obj, r), ch=0, cos=True, rpo=1 )
mc.delete(curves[-1])
mc.rebuildCurve(curves[0], ch=1, rpo=1, rt=0, end=1, kr=0, kcp=0, kep=1, kt= 0, s = 0, d = 3, tol = 0)
curves[0] = mc.rename(curves[0], obj)
if parent:
curves[0] = mc.parent(curves[0], parent)[0]
newCurves.append(curves[0])
return newCurves
开发者ID:cgfile,项目名称:hairTools,代码行数:16,代码来源:hairTools.py
示例16: rebuildCurveWithHistory
def rebuildCurveWithHistory(crv,
degree=None,
spans=None,
range=0,
keepCVs=False,
keepEnds=False,
fitRebuild=True):
"""
@param crv: Curve to rebuild
@type crv: str
@param degree: Rebuild degree. If None, keep original.
@type degree: str
@param spans: Number of rebuild spans. If None, keep original.
@type spans: str
@param range: Parameterization for the curve. 0 = 0-1, 1 = original, 2 = 0-Nspans
@type range: int
@param keepCVs: Keep all original CVs.
@type keepCVs: bool
@param keepEnds: Keep end points.
@type keepEnds: bool
@param fitRebuild: Fit rebuild
@type fitRebuild: bool
"""
# Check Curve
if not isCurve(crv): raise Exception('Object "' + crv + '" is not a valid curve!')
# Get Shape
crvShape = cmds.ls(cmds.listRelatives(crv, s=True, ni=True) or [], type='nurbsCurve') or []
if not crvShape: raise Exception('Unable to determine curve shape for "' + crv + '"!')
crvShape = crvShape[0]
# Check Inputs
if spans == 0: spans = 0
if degree == None: degree = cmds.getAttr(crvShape + '.degree')
# Get Input Shape
try:
glTools.utils.shape.findInputShape(crvShape)
except:
glTools.utils.shape.createIntermediate(crvShape)
# Rebuild Curve
rebuildCrv = cmds.rebuildCurve(crvShape,
ch=True,
rpo=True,
rebuildType=0, # Uniform
endKnots=1, # Multiple
keepRange=range,
keepControlPoints=keepCVs,
keepEndPoints=keepEnds,
keepTangents=False,
spans=spans,
degree=degree)
# Rename Node
rebuildCrv = cmds.rename(rebuildCrv, crv.replace('_crv', '') + '_rebuildCurve')
# Return Result
return rebuildCrv[1]
开发者ID:bennymuller,项目名称:glTools,代码行数:59,代码来源:curve.py
示例17: initializeRibbonSpine
def initializeRibbonSpine(startJoint,endJoint,numJoints,spans,prefix='cn_spine'):
'''
'''
# ==========
# - Checks -
# ==========
if not mc.objExists(startJoint):
raise Exception('Start joint "'+startJoint+'" does not exist!')
if not mc.objExists(endJoint):
raise Exception('End joint "'+endJoint+'" does not exist!')
# =====================
# - Build Spine Curve -
# =====================
# Get Spine Joint List
spineJnts = glTools.utils.joint.getJointList(startJoint,endJoint)
# Build Spine Locators
locList = []
for i in range(len(spineJnts)):
pt = glTools.utils.base.getPosition(spineJnts[i])
strInd = glTools.utils.stringUtils.alphaIndex(i)
loc = mc.spaceLocator(p=(0,0,0),n=prefix+strInd+'_loc')[0]
mc.move(pt[0],pt[1],pt[2],loc,ws=True,a=True)
mc.parent(loc,spineJnts[i])
locList.append(loc)
# Build Spine Curve
spineCurve = glTools.utils.curve.createFromLocators(locList,degree=1,attach=True,prefix=prefix)
spineCurveShape = mc.listRelatives(spineCurve,s=True,pa=True)[0]
glTools.utils.shape.createIntermediate(spineCurveShape)
# Rebuild Spine Curve
if not spans: spans = len(spineJnts) - 1
rebuildCrv = mc.rebuildCurve(spineCurve,ch=1,rpo=1,rt=0,end=1,kr=0,kcp=0,kep=1,kt=1,s=spans,d=3,tol=0)
rebuildCrv = mc.rename(rebuildCrv[1],prefix+'A_rebuildCurve')
# ================================
# - Attach Joints to Spine Curve -
# ================================
ribbonJoints = []
inc = 1.0 / (numJoints - 1)
for i in range(numJoints):
mc.select(cl=1)
strInd = glTools.utils.stringUtils.alphaIndex(i)
joint = mc.joint(n=prefix+'Ribbon'+strInd+'_jnt')
glTools.utils.attach.attachToCurve(spineCurve,joint,uValue=inc*i,orient=False,prefix=prefix+'Ribbon'+strInd)
ribbonJoints.append(joint)
# =================
# - Return Result -
# =================
return ribbonJoints
开发者ID:RiggingDojoAdmin,项目名称:glTools,代码行数:58,代码来源:spine.py
示例18: snap_root_CV_to_mesh
def snap_root_CV_to_mesh(*args):
'''
Snap root CV of curve to closest point on mesh for selected mesh
and curves which are currently selected.
'''
initialSelection = cmds.ls(sl=True)
scalpMesh = cmds.ls(sl=True, dag=True, type='mesh')[0]
curveSet = cmds.listRelatives(cmds.ls(sl=True, dag=True, type='nurbsCurve'), parent=True)
CPOM_A = cmds.createNode('closestPointOnMesh')
CPOM_B = cmds.createNode('closestPointOnMesh')
cmds.connectAttr(scalpMesh+'.outMesh', CPOM_A+'.inMesh')
cmds.connectAttr(scalpMesh+'.outMesh', CPOM_B+'.inMesh')
for CRV in curveSet:
#CRV = curveSet[0]
curveLen = int(cmds.arclen(CRV)/3+4)
rebuildCRV = cmds.rebuildCurve(CRV, d=3, spans=curveLen)
#print CRV
CRVroot = cmds.pointPosition(CRV+'.cv[0]', world=True)
CRVvec = cmds.pointPosition(CRV+'.cv[2]', world=True)
abc = ['X', 'Y', 'Z']
for x in abc:
cmds.setAttr(CPOM_A+'.inPosition'+x, CRVroot[abc.index(x)])
cmds.setAttr(CPOM_B+'.inPosition'+x, CRVvec[abc.index(x)])
CPOM_rootPOS = cmds.getAttr(CPOM_A+'.position')[0]
CPOM_vecPOS = cmds.getAttr(CPOM_B+'.position')[0]
#print CRV, CRVroot, CPOM_POS
cmds.reverseCurve(CRV)
CRVcvs = cmds.getAttr(CRV+'.spans')
#print CRV, curveLen, CRVcvs, rebuildCRV
cmds.delete(CRV, constructionHistory=True)
CRVshape = cmds.listRelatives(CRV, children=True)
cmds.curve(CRVshape, a=True, ws=True, p=[CPOM_vecPOS, CPOM_rootPOS])#[(0,0,0) for x in range(CRVcvs/5)])
cmds.reverseCurve(CRV)
cmds.rebuildCurve(CRV, degree=3, spans=CRVcvs+2)
cmds.smoothCurve(CRV+'.cv[*]', smoothness=10)
#break
cmds.select(initialSelection)
开发者ID:dmajorstudio,项目名称:sandbox,代码行数:45,代码来源:curve_root_snapper.v001.py
示例19: point2Curve
def point2Curve(spans) :
sels = mc.ls(sl = True)
if len(sels) == 2 :
point1 = sels[0]
point2 = sels[1]
pos1 = mc.xform(point1, q = True, ws = True, t = True)
pos2 = mc.xform(point2, q = True, ws = True, t = True)
result = mc.curve(d = 1, p=[pos1, pos2], k=[0,1] )
mc.rebuildCurve(result, rpo = 1, rt = 0, end = 1, kr = 0, kcp = 0, kep = 1, kt = 0, s = spans, d = 3, tol = 0.0001)
mc.select(result)
mm.eval('CenterPivot')
return result
开发者ID:myCodeTD,项目名称:rigTools,代码行数:18,代码来源:createCurve.py
示例20: makeCurveFromPoints
def makeCurveFromPoints(p, close=True):
curve = mc.curve(p=p, d=3)
if close:
curve = mc.closeCurve(curve, ps=0, rpo=1, bb=0.5, bki=0, p=0.1)
curve = mc.rebuildCurve(curve, rpo=1, rt=0, end=1, kr=0, kcp=1, kep=1, kt=0, s=4, d=3, tol=0.000129167)
mc.xform(curve, centerPivots=True)
return curve
开发者ID:cgfile,项目名称:hairTools,代码行数:9,代码来源:hairTools.py
注:本文中的maya.cmds.rebuildCurve函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论