本文整理汇总了Python中pymel.core.delete方法的典型用法代码示例。如果您正苦于以下问题:Python core.delete方法的具体用法?Python core.delete怎么用?Python core.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pymel.core
的用法示例。
在下文中一共展示了core.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _fetch_system_from_scene
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def _fetch_system_from_scene(self):
"""
Get all SpaceSwitch system in the scene
"""
self.aSceneSpaceSwitch = []
self.ui.cbSysList.clear()
self.ui.cbSysList.addItem("--- Select a system ---")
lstNetworkNode = libSerialization.getNetworksByClass(SpaceSwitcherLogic.__name__)
for pNet in lstNetworkNode:
pData = libSerialization.import_network(pNet)
# Check to ensure the data is valid, delete it if not
if pData.nDriven is not None and pData.nSwConst is not None and pData.nSwConstRecept is not None:
self.ui.cbSysList.addItem(pData.nDriven.name())
self.aSceneSpaceSwitch.append(pData)
else:
print("System {0} will be deleted because some data is invalid. Driven = {1}, Const = {2}, "
"Const Recept = {3}".format(pNet, pData.nDriven, pData.nSwConst, pData.nSwConstRecept))
pymel.delete(pNet)
示例2: _update_lstParent
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def _update_lstParent(self, pSpData):
"""
Update the parent list for the selected system
"""
self.createModel.clear()
if pSpData:
self.ui.lstParent.setEnabled(True)
self.createModel.appendRow(self.parentItem)
for iIdx, nParentInfo in enumerate(pSpData.aDrivers):
newParentItem = QtGui.QStandardItem(nParentInfo.name())
newParentItem.setEditable(False)
# Prevent any delete action when the sysem is referenced
if pymel.referenceQuery(self.pSelSpSys.nSwConst, isNodeReferenced=True):
newParentItem.setCheckable(False)
else:
newParentItem.setCheckable(True)
self.createModel.appendRow(newParentItem)
else:
self.ui.lstParent.setEnabled(False)
self.createModel.appendRow(self.parentItem)
示例3: populateData
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def populateData(self):
lstNetworkNode = libSerialization.getNetworksByClass(PoseReaderData.__name__)
aToDel = []
for pNet in lstNetworkNode:
pData = libSerialization.import_network(pNet)
#Ensure that the network is valid, if not, delete the network node
for sVar in pData.__dict__ :
#print "{0} --> {1}".format(sVar, pData.__dict__[sVar])
if not (pData.__dict__[sVar]): #TODO --> Delete invalid system node ?
aToDel.append(pNet)
break;
if not aToDel: self.addItem(pData)
if aToDel:
pymel.delete(aToDel)
#We could use the function pymel.spaceLocator() :P
示例4: hold_ctrl_shapes
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def hold_ctrl_shapes(ctrl, parent=None):
"""
Make a snapshot of all shapes of a specific ctrls.
"""
shapes = filter(lambda x: isinstance(x, pymel.nodetypes.CurveShape), ctrl.getShapes())
snapshot_transform = pymel.duplicate(ctrl, parentOnly=True, returnRootsOnly=True)[0]
for shape in shapes:
shape_snapshot = _duplicate_shape(shape)
tmp_transform = shape_snapshot.getParent()
shape_snapshot.setParent(snapshot_transform, s=True, r=True)
pymel.delete(tmp_transform)
if parent:
snapshot_transform.setParent(parent)
else:
snapshot_transform.setParent(world=True)
snapshot_transform.rename('{0}Snapshot'.format(ctrl.name()))
return snapshot_transform
示例5: process
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def process(self, context, plugin):
import pymel.core as pm
# Get the errored instances
failed = []
for result in context.data["results"]:
if (result["error"] is not None and result["instance"] is not None
and result["instance"] not in failed):
failed.append(result["instance"])
# Apply pyblish.logic to get the instances for the plug-in
instances = api.instances_by_plugin(failed, plugin)
for instance in instances:
for node in instance[0].members():
io = pm.ls(node.getShapes(), intermediateObjects=True)
pm.delete(io)
示例6: process
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def process(self, context, plugin):
import pymel.core as pm
# Get the errored instances
failed = []
for result in context.data["results"]:
if (result["error"] is not None and result["instance"] is not None
and result["instance"] not in failed):
failed.append(result["instance"])
# Apply pyblish.logic to get the instances for the plug-in
instances = api.instances_by_plugin(failed, plugin)
for instance in instances:
for node in instance[0].members():
pm.delete(pm.cluster(node))
示例7: testPyCmds
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def testPyCmds():
start = time.time()
helix = cmds.polyHelix(**HELIX_OPTS)
pHelix = helix[0]
size = cmds.polyEvaluate(v=True)
for i in xrange(size):
x = RAND.uniform(LOW, HIGH)
attrib = '%s.vtx[%s]' % (pHelix, i)
cmds.move(x, attrib, x=True)
cmds.delete(pHelix)
end = time.time()
return end-start
示例8: testPyMel
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def testPyMel():
start = time.time()
helix = pm.polyHelix(**HELIX_OPTS)
pHelix = helix[0]
# 20020 loops
for v in pHelix.vtx:
# strangly, its faster to make a new vector
# object every time, as opposed to creating it
# once and changing the x value each time???
vector = pm.dt.Vector(x=RAND.uniform(LOW, HIGH))
v.translateBy(vector)
pm.delete(pHelix)
end = time.time()
return end-start
示例9: delete
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def delete(camera):
"""deletes the vertigo setup from the given camera
"""
global vertigo_attr_name
global vertigo_global_attr_name
camera_shape = camera.getShape()
expression = camera_shape.connections(type=pm.nt.Expression)
vertigo_loc = camera.attr(vertigo_attr_name).inputs()[0]
world_loc = camera.attr(vertigo_global_attr_name).inputs()[0]
# delete them
pm.delete(expression)
pm.delete(vertigo_loc)
pm.delete(world_loc)
示例10: duplicate
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def duplicate(self, class_=None, prefix="", suffix=""):
"""duplicates itself and returns a new joint hierarchy
:param class_: The class of the created JointHierarchy. Default value
is JointHierarchy
:param prefix: Prefix for newly created joints
:param suffix: Suffix for newly created joints
"""
if class_ is None:
class_ = self.__class__
new_start_joint = pm.duplicate(self.start_joint)[0]
all_hierarchy = list(reversed(new_start_joint.listRelatives(ad=1, type=pm.nt.Joint)))
new_end_joint = all_hierarchy[len(self.joints) - 2]
# delete anything below
pm.delete(new_end_joint.listRelatives(ad=1))
new_hierarchy = class_(start_joint=new_start_joint, end_joint=new_end_joint)
for j, nj in zip(self.joints, new_hierarchy.joints):
nj.rename("{prefix}{joint}{suffix}".format(prefix=prefix, suffix=suffix, joint=j.name()))
return new_hierarchy
示例11: delete_unused_intermediate_shapes
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def delete_unused_intermediate_shapes(cls):
"""clears unused intermediate shape nodes
"""
ignored_node_types = [
'nodeGraphEditorInfo',
'shadingEngine',
]
def filter_funct(x):
return x.type() not in ignored_node_types
unused_nodes = []
for node in pm.ls(type=pm.nt.Mesh):
if len(filter(filter_funct, node.inputs())) == 0 and \
len(filter(filter_funct, node.outputs())) == 0 \
and node.attr('intermediateObject').get():
unused_nodes.append(node)
pm.delete(unused_nodes)
示例12: delete_all_others
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def delete_all_others(self, shot): # delete all useless shots and cameras
special_cams = ['perspShape', 'frontShape', 'sideShape', 'topShape']
unused_shots = pm.ls(type="shot")
# unused_camera = pm.ls("camera*", type="transform")
unused_camera = [node.getParent()
for node in pm.ls(type='camera')
if node.name() not in special_cams]
clear_cams_list = set(unused_camera)
sel_camera = shot.currentCamera.get()
unused_shots.remove(shot)
clear_cams_list.remove(sel_camera)
pm.delete(unused_shots)
pm.delete(clear_cams_list)
shot.track.set(1)
print("shot is in order")
示例13: clear_scene
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def clear_scene(self, keep_shot):
# delete all other shot nodes
all_shots = pm.ls(type='shot')
shots_to_delete = []
for shot in all_shots:
if shot.name() != keep_shot.name():
shots_to_delete.append(shot)
for shot in shots_to_delete:
if shot:
pm.delete(shot)
# set some attrs and delete cameras
if keep_shot:
keep_shot.track.set(1)
keep_shot.shotName.lock()
shot_camera = keep_shot.currentCamera.get()
exclude_cams = ['perspShape', 'frontShape', 'sideShape', 'topShape', shot_camera.getShape()]
unused_cameras = [node.getParent()
for node in pm.ls(type='camera')
if node.name() not in exclude_cams]
pm.delete(unused_cameras)
示例14: cleanup_intermediate_objects
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def cleanup_intermediate_objects(progress_controller=None):
"""Delete unused intermediate objects
deletes any unused intermediate object in the current scene
"""
if progress_controller is None:
progress_controller = ProgressControllerBase()
unused_intermediate_objects = []
all_meshes = pm.ls(type='mesh')
progress_controller.maximum = len(all_meshes)
for node in all_meshes:
if len(node.inputs()) == 0 \
and len(node.outputs()) == 0 \
and node.intermediateObject.get() \
and node.referenceFile() is None:
unused_intermediate_objects.append(node)
progress_controller.increment()
pm.delete(unused_intermediate_objects)
progress_controller.complete()
示例15: orient_choose_direction
# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import delete [as 别名]
def orient_choose_direction(self, joint, jointUnder, frontAxis):
#TODO : Validate frontAxis
if frontAxis == "x":
frontInt = 0
elif frontAxis == "z":
frontInt = 2
returnVal = 1
transform_1 = DrawNode(Shape.transform, 'direction1')
transform_1.temp_constrain(joint)
transform_2 = DrawNode(Shape.transform, "direction2")
transform_2.temp_constrain(jointUnder)
frontTransform = transform_1.transform[frontInt] - \
transform_2.transform[frontInt]
if frontTransform > 0:
returnVal = -1
transform_1.delete()
transform_2.delete()
return returnVal