當前位置: 首頁>>代碼示例>>Python>>正文


Python core.delete方法代碼示例

本文整理匯總了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) 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:21,代碼來源:sqSpaceSwitcher.py

示例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) 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:22,代碼來源:sqSpaceSwitcher.py

示例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 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:19,代碼來源:dpPoseReader.py

示例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 
開發者ID:nilouco,項目名稱:dpAutoRigSystem,代碼行數:19,代碼來源:sqCopyPasteShapes.py

示例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) 
開發者ID:bumpybox,項目名稱:pyblish-bumpybox,代碼行數:19,代碼來源:validate_intermediate_shapes.py

示例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)) 
開發者ID:bumpybox,項目名稱:pyblish-bumpybox,代碼行數:18,代碼來源:validate_points.py

示例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 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:20,代碼來源:benchmark.py

示例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 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:22,代碼來源:benchmark.py

示例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) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:19,代碼來源:vertigo.py

示例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 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:25,代碼來源:rigging.py

示例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) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:20,代碼來源:general.py

示例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") 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:20,代碼來源:previs.py

示例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) 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:24,代碼來源:previs.py

示例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() 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:22,代碼來源:publish.py

示例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 
開發者ID:eoyilmaz,項目名稱:anima,代碼行數:24,代碼來源:joint.py


注:本文中的pymel.core.delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。