本文整理汇总了Python中pymel.core.delete函数的典型用法代码示例。如果您正苦于以下问题:Python delete函数的具体用法?Python delete怎么用?Python delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: delete_system
def delete_system(self):
if self.delete == True:
pm.delete(self.main_group)
self.kill()
if self.delete == False:
self.kill()
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:rigid_body.py
示例2: createEmitter
def createEmitter(self, mesh, name="particleEmitter_msh"):
# Create boundingBox of the mesh
bbx = pm.polyEvaluate(mesh, b=True)
cube = pm.polyCube(
w=abs(bbx[0][1] - bbx[0][0]),
h=abs(bbx[1][1] - bbx[1][0]),
d=abs(bbx[2][1] - bbx[2][0]),
sx=1,
sy=1,
sz=1,
ax=(0, 1, 0),
cuv=4,
ch=0,
name=name,
)
cube = cube[0]
cube.setAttr("t", ((bbx[0][1] + bbx[0][0]) / 2, (bbx[1][1] + bbx[1][0]) / 2, (bbx[2][1] + bbx[2][0]) / 2))
# Keep only face 1 for emit
pm.delete([cube + ".f[2:6]", cube + ".f[0]"])
# Connection of mesh and the emitter
self.connectOriginaleMesh(mesh, cube)
# Move emitter in y in a percentage of area of face.
face = pm.PyNode(cube + ".f[1]")
area = face.getArea(space="world")
pm.select(cube)
y = pow(area, 0.1) * 100
pm.move(0, y, 0, r=1, os=1, wd=1)
return cube
开发者ID:nicolasboselli,项目名称:test,代码行数:31,代码来源:forestGenerator.py
示例3: buildMainControls
def buildMainControls(self):
# Get the ctrl postion
ctrlPosition = utils.recalculatePosition(self.jointSystem.positions, self.numHighLevelCtrls)
metaCtrls = []
# Iterate though all the position
for i in range(self.numHighLevelCtrls):
output_window("Build Main Control: {}".format(i))
# Create a control object
ctrl = self.createCtrlObj("%s%i" % (self.part, i))
# Set the position
ctrl.prnt.translate = list(ctrlPosition[i])
# Lock the scale
ctrl.lockScale()
metaCtrls.append(ctrl)
# Is orientation set to world
if not self.ikControlToWorld:
# Get the closest joint position
closestJoints = libMath.spread(0, len(self.jointSystem) - 1, self.numHighLevelCtrls)
for jointPosition, i in zip(closestJoints, range(self.numHighLevelCtrls)):
# Is a closest joint a fraction
if jointPosition % 1:
# Orient between current and next
pm.delete(pm.orientConstraint(
self.jointSystem.jointList[int(jointPosition)],
self.jointSystem.jointList[int(jointPosition) + 1],
metaCtrls[i].prnt.pynode))
else:
pm.delete(pm.orientConstraint(
self.jointSystem.jointList[int(jointPosition)],
metaCtrls[i].prnt.pynode))
self.mainCtrls = metaCtrls
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:33,代码来源:spine.py
示例4: getMirrorAttrDrivenCurve
def getMirrorAttrDrivenCurve(animUL):
driverName, driverAttr, drivenName, drivenAttr = getDrivenName(animUL)
mirrorDriver = getMirrorCtrl(pm.PyNode(driverName))
mirrorDriven = getMirrorCtrl(pm.PyNode(drivenName))
mirrorAnimUL = getAttrDrivenCurve(mirrorDriver, driverAttr, mirrorDriven, drivenAttr)
if mirrorAnimUL:
pm.delete(mirrorAnimUL)
mirrorAnimULName = "{driver}_{driverAttr}_to_{driven}_{drivenAttr}".format(driver=mirrorDriver.name(), driverAttr=driverAttr, driven=mirrorDriven.name(), drivenAttr=drivenAttr)
mirrorAnimUL = pm.createNode("animCurveUL", name = mirrorAnimULName)
mfnAnimUL = mirrorAnimUL.__apimfn__()
for i in range(animUL.numKeys()):
input = animUL.getUnitlessInput(i)
value = animUL.getValue(i)
if driverAttr == 'tx' and drivenAttr == 'tx':
if input != 0:
newInput = -1*input
newValue = -1*value
elif driverAttr == 'tx' and drivenAttr != 'tx':
if input != 0:
newInput = -1*input
newValue = value
else :
newInput = input
newValue = value
mfnAnimUL.addKey(newInput, newValue, 1, 1)
return mirrorAnimUL
开发者ID:TianD,项目名称:TianD_KX_TOOL,代码行数:28,代码来源:TFM_mirrorCmd.py
示例5: rebuildDagPose
def rebuildDagPose():
"""
Walks through bind pose data in selected skeleton and consolidates it down to one new bindPose node
Directly inspired by Nathan Horne's NT_rebuildDagPose.mel script
"""
dagPoses = set()
connectedSkinClusters = set()
selection = pmc.selected()
joints = pmc.listRelatives(selection[0], path=True, allDescendents=True, type="joint")
joints.insert(0, selection[0])
for jnt in joints:
dagPoses.update(jnt.listConnections(type="dagPose"))
for dag in dagPoses:
connectedSkinClusters.update(dag.listConnections(type="skinCluster"))
pmc.delete(dagPoses)
pmc.select(joints, replace=True)
newDagPose = pmc.dagPose(save=True, selection=True, bindPose=True)
print "New dagPose, {0}, created".format(newDagPose.shortName())
for sc in connectedSkinClusters:
print "Connecting {0}.message to {1}.bindPose".format(newDagPose.shortName(), sc.shortName())
newDagPose.message.connect(sc.bindPose)
开发者ID:taozenforce,项目名称:cogswelladvancedrigging2015,代码行数:27,代码来源:skinutils.py
示例6: export_hierarchy_obj
def export_hierarchy_obj(self):
"""Export the individual meshes in the hierarchy"""
file_info = {}
# Reverse the geo list so that the deepest geo is deleted first in case there is a geo inside geo
geo_list = self.geo_list
geo_list.reverse()
for self.current_target in geo_list:
pm.delete(self.current_target, ch=1)
parent = pm.listRelatives(self.current_target, parent=True)
pm.parent(self.current_target, w=True)
pm.select(self.current_target)
path = libFile.linux_path(libFile.join(self.export_dir, self.current_target + ".obj"))
# Load the obj plugin
cmds.file(path,
pr=1,
typ="OBJexport",
force=1,
options="groups=0;ptgroups=0;materials=0;smoothing=0;normals=0",
es=1)
file_info[self.current_target] = path
logger.info("Exporting\n%s" % file_info[self.current_target])
if not self.new_scene and self.cleansing_mode:
pm.delete(self.current_target)
pm.refresh()
else:
pm.parent(self.current_target, parent)
self.update_progress()
# Write the geo file_info
self.geo_file_info = file_info
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:31,代码来源:libGeo.py
示例7: create_point_on_mesh
def create_point_on_mesh(geo, position, sticky_target, free_rotation=True):
"""
Create point on mesh setup
@param position:
@param geo:
@parem sticky:
@return:
"""
pom = pm.createNode("closestPointOnMesh")
pom.inPosition.set(position)
geo.worldMatrix[0] >> pom.inputMatrix
geo.worldMesh[0] >> pom.inMesh
pom.position >> sticky_target.translate
index = pom.closestVertexIndex.get()
locator = pm.spaceLocator()
libUtilities.snap(locator, geo.vtx[index], rotate=False)
libUtilities.freeze_transform(locator)
pm.pointOnPolyConstraint(geo.vtx[index], locator, maintainOffset=True)
pm.delete(pom)
constraint = pm.listRelatives(locator, type="constraint")[0]
if free_rotation:
for attr in ["rx", "rz", "ry"]:
libUtilities.break_connection(locator, attr)
locator.attr(attr).set(0)
return {"constraint": constraint, "locator": locator}
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:31,代码来源:libGeo.py
示例8: bdLocOnJnt
def bdLocOnJnt():
try:
rootJnt = pm.ls(sl=True)[0]
except:
pm.warning('Nothing selected')
return
try:
crvPath = pm.ls(sl=True)[1]
except:
pm.warning('No curve selected')
return
allJnt = rootJnt.listRelatives(f=True, ad=True,type='joint')
allJnt = allJnt + [rootJnt]
allJnt.reverse()
locators = []
for jnt in allJnt:
print jnt
loc = pm.spaceLocator(name = jnt.name().replace( '_jnt','_loc'))
locGrp = pm.group(n = loc.name() + '_grp')
tempCnstr = pm.pointConstraint(jnt,locGrp,mo=0);
pm.delete(tempCnstr )
locators.append(locGrp)
bdMultiMotionPath(crvPath, locators)
bdParentJntToLocs(allJnt)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:28,代码来源:bdRigUtils.py
示例9: _parentSurfaceFLCL
def _parentSurfaceFLCL(self, constrained_obj, geo, deleteCPOMS=1):
"""
Parents object to follicle at closest point on surface.
Select child transform, then select mesh to hold parent follicle.
"""
cpos = pmc.createNode('closestPointOnSurface', n='cpos_flcl_' + geo)
mc.connectAttr(pmc.listRelatives(geo, shapes=True, children=True)[0] + '.local', cpos + '.inputSurface')
obj_mtx = pmc.xform(constrained_obj, q=True, m=True)
pmc.setAttr(cpos + '.inPosition', [obj_mtx[12], obj_mtx[13], obj_mtx[14]])
flclShape = pmc.createNode('follicle', n='flclShape' + geo)
flcl = pmc.listRelatives(flclShape, type='transform', parent=True)
pmc.rename(flcl, 'flcl_' + geo + '_1')
mc.connectAttr(flclShape + '.outRotate', flcl[0] + '.rotate')
mc.connectAttr(flclShape + '.outTranslate', flcl[0] + '.translate')
mc.connectAttr(geo + '.worldMatrix', flclShape + '.inputWorldMatrix')
mc.connectAttr(geo + '.local', flclShape + '.inputSurface')
mc.setAttr(flclShape + '.simulationMethod', 0)
u = mc.getAttr(cpos + '.result.parameterU')
v = mc.getAttr(cpos + '.result.parameterV')
pmc.setAttr(flclShape + '.parameterU', u)
pmc.setAttr(flclShape + '.parameterV', v)
pmc.parent(constrained_obj, flcl)
if deleteCPOMS == 1:
pmc.delete(cpos)
return flcl
开发者ID:scorza,项目名称:variableFK,代码行数:32,代码来源:vfk_UI.py
示例10: position_joint
def position_joint(self):
'''
# positions the joint
'''
temp_parent_constraint = pm.parentConstraint(self.bound_geo, self.joint,
maintainOffset= False)
pm.delete(temp_parent_constraint)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:baker.py
示例11: bdAddExtraGrp
def bdAddExtraGrp(nameMaskCon,grpType,empty):
controllers = pm.ls(nameMaskCon,type = 'transform')
conPyNodes = []
for con in controllers:
conPyNodes.append(con)
for node in conPyNodes:
if empty:
pm.select(cl=True)
conGrp = pm.group(name = node.name() + '_' + grpType)
pos = node.getTranslation(space='world')
rot = node.getRotation(space='world')
conGrp.setTranslation(pos)
conGrp.setRotation(rot)
parent = node.getParent()
pm.parent(conGrp,parent)
else:
conGrp = pm.duplicate(node,name = node.name().replace('CON',grpType))
'''
for axis in ['X','Y','Z']:
conGrp[0].attr('translate' + axis).setKeyable(True)
conGrp[0].attr('translate' + axis).setLocked(False)
'''
conGrpRelatives = pm.listRelatives(conGrp,ad = True)
#print sdkConRelatives
pm.delete(conGrpRelatives)
pm.parent(node,conGrp)
开发者ID:Mortaciunea,项目名称:bdScripts,代码行数:29,代码来源:bdRigUtils.py
示例12: removeBindPose
def removeBindPose(cls, skin_node):
"""
[email protected] Remove BindPose of SkinCluster
:rtype: bool
:return: True if bindPose is deleted
"""
# Check
if isinstance(skin_node, basestring):
skin_node = pmc.PyNode(skin_node)
if isinstance(skin_node, pmc.nodetypes.SkinCluster):
raise RuntimeError("\n\tThis node -- %s -- is not a SkinCluster !!!\n" % skin_node.name())
# Get BindPose
bindpose_node = self.SKIN_NODE.inputs(type='dagPose')
if not bindpose_node:
raise RuntimeError("\n\tSkinCluster doesn't have bindPose !!!\n")
# Remove
pmc.delete(bindpose_node)
return True
开发者ID:AtonLerin,项目名称:Maya_Tools,代码行数:25,代码来源:skinTools.py
示例13: checkTwoSkin
def checkTwoSkin(cls, skin_from, skin_to):
"""
[email protected] Check two skin. If skin_to is different of skin_from delete it and apply new skin
with same influences of skin_from.
:type skin_from: pymel.core.nodetypes.SkinCluster
:param skin_from: Skin reference for check
:type skin_to: pymel.core.nodetypes.SkinCluster
:param skin_to: Skin you want to check
:rtype: pymel.core.nodetypes.SkinCluster
:return: SkinCluster checked
"""
# Get influences
influences_ref = pmc.skinCluster(skin_from, query=True, influence=True)
influences_check = pmc.skinCluster(skin_to, query=True, influence=True)
# If is same return check skinCluster
if influences_check == influences_ref:
return skin_to
# If is not same apply new skin
skin_check_geo = pmc.skinCluster(skin_to, query=True, geometry=True)
pmc.delete(skin_to)
for geo in skin_check_geo:
skin_to = cls.skinFromOther(skin_from, geo)
return skin_to
开发者ID:AtonLerin,项目名称:Maya_Tools,代码行数:31,代码来源:skinTools.py
示例14: duplicate_rigid_body
def duplicate_rigid_body(self):
self.bound_geo = pm.duplicate(self.rigid_body,
name= '%s_rb' % (self.rigid_body))[0]
shape_nodes = self.bound_geo.getShapes()
for shape_node in shape_nodes:
if 'rigidBody' in '%s' % (shape_node):
pm.delete(shape_node)
开发者ID:creuter23,项目名称:fs-tech-artist,代码行数:7,代码来源:rigid_body.py
示例15: AlignBindNode
def AlignBindNode(self, **kws):
'''
Overwrite the default behaviour: Align the newly made BindNode as required for this bind
'''
#Parent the BindNode/UpVector Object to the upVectorParent Node
#Parent the AimLocator Object to the Source node -used to modify the AimPoint
pm.parent(self.BindNode['Root'], self.upVectorParent)
pm.parent(self.BindNode['Up'], self.upVectorParent)
pm.parent(self.BindNode['AimOffset'], self.SourceNode)
#self.BindNode['Root'].scale.set(self.Settings.BaseScale,self.Settings.BaseScale,self.Settings.BaseScale)
self.BindNode['Main'].rotateOrder.set(self.SourceNode.rotateOrder.get())
self.BindNode['Root'].rotateOrder.set(self.DestinationNode.rotateOrder.get())
#Aim Alignment
pm.aimConstraint(self.BindNode['AimOffset'], self.BindNode['Root'], aimVector=(0,1,0),upVector=(0,0,1),\
worldUpType="object",worldUpObject=self.BindNode['Up'])
#Positional Alignment
pm.delete(pm.pointConstraint(self.SourceNode, self.BindNode['AimOffset']))
pm.makeIdentity(self.BindNode['AimOffset'], apply=True, t=1, r=1, s=0)
pm.delete(pm.pointConstraint(self.upVectorParent, self.BindNode['Root']))
pm.makeIdentity(self.BindNode['Root'], apply=True, t=1, r=0, s=0)
pm.delete(pm.pointConstraint(self.upVectorParent, self.BindNode['Up']))
pm.makeIdentity(self.BindNode['Up'], apply=True, t=1, r=0, s=0)
pm.delete(pm.pointConstraint(self.DestinationNode, self.BindNode['Root']))
#Rotate Alignment
pm.delete(pm.orientConstraint(self.DestinationNode, self.BindNode['Main']))
开发者ID:miketon,项目名称:SymLink,代码行数:30,代码来源:AnimationBinder.py
示例16: loadTranslationControl
def loadTranslationControl(root_joint, module_name, container, module_control_grp, control_type = "translation", color = [1, 0, 0]):
""" loads translation control onto the root_joint """
path = os.path.join(environ.ControlObjectsPath, "translation_control.ma")
pm.importFile(path, renameAll = True, loadReferenceDepth = "all", namespace =":") # renamePrefix == namespace
# rename default module
translation_control = pm.rename("translation_control", module_name + ":" + root_joint.stripNamespace() + "_translation_control", ignoreShape = False)
translation_control_grp = pm.group(translation_control, name = module_name + ":" + root_joint.stripNamespace() + "_translation_controlGrp")
# move control to root root_joint
pm.delete(pm.pointConstraint(root_joint, translation_control_grp, maintainOffset=False))
translation_control_grp.setParent(module_control_grp)
pm.addAttr(translation_control, longName="ControlType", dataType="string", keyable=False)
pm.addAttr(translation_control, longName="ParentObject", at="message", multi = True)
translation_control.ControlType.set(control_type, type = "string", lock = True)
utils.addNodeToContainer(container, [translation_control, translation_control_grp], ihb = True, includeNetwork = True)
pm.container(container, edit=True, publishAndBind=[translation_control + ".rotate", translation_control.stripNamespace() + "_rotate"])
pm.container(container, edit=True, publishAndBind=[translation_control + ".translate", translation_control.stripNamespace() + "_translate"])
return translation_control, translation_control_grp
开发者ID:jeffhong21,项目名称:scripts,代码行数:25,代码来源:controls.py
示例17: __transformToBone__
def __transformToBone__(obj):
name = obj.name()
# create joint
jnt = pmc.createNode('joint', name=name+'_')
# set parent
if obj.getParent():
jnt.setParent(obj.getParent())
# set transformation
jnt.setTranslation(obj.getTranslation(space='object'), space='object')
jnt.setRotationOrder(obj.getRotationOrder(), reorder=True)
jnt.jointOrientX.set(obj.getRotation(space='object')[0])
jnt.jointOrientY.set(obj.getRotation(space='object')[1])
jnt.jointOrientZ.set(obj.getRotation(space='object')[2])
jnt.setScale(obj.getScale())
jnt.setShear(obj.getShear())
# get children
children = obj.getChildren()
for child in children:
child = various.checkObj(child, type=['transform', 'joint'], echo=False)
if child:
child.setParent(jnt)
# parent shape
if obj.getShape():
pmc.parent(obj.getShape(), jnt, shape=True, relative=True)
# deleting and renaming properly
pmc.delete(obj)
jnt.rename(name)
return jnt
开发者ID:loichuss,项目名称:maya,代码行数:35,代码来源:bone.py
示例18: rtb_remove
def rtb_remove(highresListDropdown, *args, **kwargs):
''' remove item from the list and delete live-mesh and groups '''
global defaultString
high = highresListDropdown.getValue()
if not high == defaultString:
high = pm.PyNode(high.split("'")[0]) #get rid of unicode crap
high.rename(high.rstrip('_high'))
pm.parent(high, world=True)
high.setScale([1,1,1])
pm.disconnectAttr('persp.translate', high.scalePivot)
if pm.displaySurface(high, query=True, xRay=True)[0] == True:
pm.displaySurface(high, xRay=False)
if not high.visibility.get():
high.visibility.set(True)
highShape = high.getShape()
highShape.overrideDisplayType.set(0) #sets to normal mode
highShape.overrideEnabled.set(0) #disable display overrides
pm.delete(str(high)+'_RETOPO')
rtb_highres_list_populate(highresListDropdown)
开发者ID:kotchin,项目名称:mayaSettings,代码行数:25,代码来源:lcRetopoBasic.py
示例19: import_hierarchy_geo
def import_hierarchy_geo(self):
"""Import all the obj objects"""
file_info = self.geo_file_info
for self.current_target in file_info.keys():
cmds.file(file_info[self.current_target],
rpr="PKD_Temp",
i=1,
type="OBJ",
loadReferenceDepth="all",
ra=True,
mergeNamespacesOnClash=False,
options="mo=1")
# Delete Existing geo if it exists
if not self.cleansing_mode:
if pm.objExists(self.current_target):
pm.delete(self.current_target)
logger.info("Importing\n%s" % file_info[self.current_target])
if self.cleansing_mode:
os.remove(file_info[self.current_target])
for top in pm.ls(assemblies=True, ud=True):
if top.getShape():
if top.getShape().type() == "mesh" and top.name() == "PKD_Temp_Mesh":
top.rename(self.current_target)
pm.select(self.current_target)
mel.eval("polySetToFaceNormal")
mel.eval("polySoftEdge -a 180 -ch 1 %s" % self.current_target)
pm.delete(self.current_target, ch=1)
pm.refresh()
self.update_progress()
开发者ID:pritishd,项目名称:PKD_Tools,代码行数:29,代码来源:libGeo.py
示例20: carBodyFix
def carBodyFix():
constraints=['l_frontDoorOffset_GRP_parentConstraint1',
'r_frontDoorOffset_GRP_parentConstraint1',
'l_rearDoorOffset_GRP_parentConstraint1',
'r_rearDoorOffset_GRP_parentConstraint1',
'frontBumperOffset_GRP_parentConstraint1',
'hoodOffset_GRP_parentConstraint1',
'rearBumperOffset_GRP_parentConstraint1',
'antennaOffset_GRP_parentConstraint1',
'trunkOffset_GRP_parentConstraint1',
'l_wiperOffset_GRP_parentConstraint1',
'r_wiperOffset_GRP_parentConstraint1']
pm.delete(constraints)
groups = ['r_wiperOffset_GRP',
'l_wiperOffset_GRP',
'trunkOffset_GRP',
'antennaOffset_GRP',
'rearBumperOffset_GRP',
'hoodOffset_GRP',
'frontBumperOffset_GRP',
'r_rearDoorOffset_GRP',
'l_rearDoorOffset_GRP',
'r_frontDoorOffset_GRP',
'l_frontDoorOffset_GRP']
for group in groups:
pm.parentConstraint('bodyJA_JNT', group, mo=True)
开发者ID:creuter23,项目名称:tools,代码行数:26,代码来源:carBodyFix.py
注:本文中的pymel.core.delete函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论