当前位置: 首页>>代码示例>>Python>>正文


Python core.selected方法代码示例

本文整理汇总了Python中pymel.core.selected方法的典型用法代码示例。如果您正苦于以下问题:Python core.selected方法的具体用法?Python core.selected怎么用?Python core.selected使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pymel.core的用法示例。


在下文中一共展示了core.selected方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _update_lstParent

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [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

示例2: _event_cbSys_selChanged

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def _event_cbSys_selChanged(self, _iIdx):
        """
        Manage the system change with the combo box. select the node related to the system selected in the combo box
        """
        # Prevent a node selection when the comboBox index changed during selection changed callback
        if not self.bInSelChanged:
            if _iIdx > 0:
                pCurSys = self.aSceneSpaceSwitch[_iIdx - 1]
                pymel.select(pCurSys.nDriven)
            else:  # If the no system index is selected, but a node is selected in the scene, put back the selected system
                for i, pSp in enumerate(self.aSceneSpaceSwitch):
                    if pSp.nDriven == self.nSelDriven:
                        # Change the index, but prevent the event to select back the node
                        self.bInSelChanged = True
                        self.ui.cbSysList.setCurrentIndex(i + 1)
                        self.bInSelChanged = False
                        break 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:19,代码来源:sqSpaceSwitcher.py

示例3: controllerWalkUp

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def controllerWalkUp(node, add=False):
    """Walk up in the hierachy using the controller tag

    Arguments:
        node (dagNode or list of dagNode): Node with controller tag
        add (bool, optional): If true add to selection

    """
    oParent = []
    if not isinstance(node, list):
        node = [node]
    for n in node:
        tag = getWalkTag(n)
        if tag:
            cnx = tag.parent.connections()
            if cnx:
                oParent.append(cnx[0])
        else:
            pm.displayWarning("The selected object: %s without Controller tag "
                              "will be skipped" % n.name())
    if oParent:
        pm.select(_getControllerWalkNodes(oParent), add=add)
    else:
        pm.displayWarning("No parent to walk Up.") 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:26,代码来源:pickWalk.py

示例4: smart_reset

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def smart_reset(*args):
    """Reset the SRT or the selected channels

    Checks first if we have channels selected. If not, will try to reset SRT

    Args:
        *args: Dummy
    """
    attributes = getSelectedChannels()
    if attributes:
        reset_selected_channels_value(objects=None, attributes=attributes)
    else:
        reset_SRT()

##########################################################
# GETTERS
########################################################## 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:19,代码来源:attribute.py

示例5: getSelectedChannels

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def getSelectedChannels(userDefine=False):
    """Get the selected channels on the channel box

    Arguments:
        userDefine (bool, optional): If True, will return only the user
            defined channels. Other channels will be skipped.

    Returns:
        list: The list of selected channels names

    """
    # fetch core's main channelbox
    attrs = pm.channelBox(get_channelBox(), q=True, sma=True)
    if userDefine:
        oSel = pm.selected()[0]
        uda = oSel.listAttr(ud=True)
        if attrs:
            attrs = [x for x in attrs if oSel.attr(x) in uda]
        else:
            return None

    return attrs 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:24,代码来源:attribute.py

示例6: getSelectedObjectChannels

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def getSelectedObjectChannels(oSel=None, userDefine=False, animatable=False):
    """Get the selected object channels.

    Arguments:
        oSel (None, optional): The  pynode with channels to get
        userDefine (bool, optional): If True, will return only the user
            defined channels. Other channels will be skipped.
        animatable (bool, optional): If True, only animatable parameters
            will be return

    Returns:
        list: The list of the selected object channels names
    """
    if not oSel:
        oSel = pm.selected()[0]

    channels = [x.name().rsplit(".", 1)[1]
                for x in oSel.listAttr(ud=userDefine, k=animatable)]

    return channels


##########################################################
# UTIL
########################################################## 
开发者ID:mgear-dev,项目名称:mgear_core,代码行数:27,代码来源:attribute.py

示例7: rivet_per_face

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def rivet_per_face():
    """creates hair follicles per selected face
    """
    sel_list = pm.ls(sl=1, fl=1)

    follicles = []
    locators = []
    for face in sel_list:
        # use the center of the face as the follicle position
        p = reduce(lambda x, y: x + y, face.getPoints()) / face.numVertices()
        obj = pm.spaceLocator(p=p)
        locators.append(obj)
        shape = face.node()
        uv = face.getUVAtPoint(p, space='world')

        follicle_transform, follicle = create_follicle(shape, uv)

        pm.parent(obj, follicle_transform)
        follicles.append(follicle)

    return follicles, locators 
开发者ID:eoyilmaz,项目名称:anima,代码行数:23,代码来源:auxiliary.py

示例8: create_bbox

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def create_bbox(nodes, per_selection=False):
    """creates bounding boxes for the selected objects

    :param bool per_selection: If True will create a BBox for each
      given object
    """

    if per_selection:
        for node in nodes:
            return cube_from_bbox(node.boundingBox())
    else:
        bbox = pm.dt.BoundingBox()
        for node in nodes:
            bbox.expand(node.boundingBox().min())
            bbox.expand(node.boundingBox().max())
        return cube_from_bbox(bbox) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:18,代码来源:auxiliary.py

示例9: reset_tweaks

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def reset_tweaks(cls):
        """Resets the tweaks on the selected deformed objects
        """
        for obj in pm.ls(sl=1):
            for tweak_node in pm.ls(obj.listHistory(), type=pm.nt.Tweak):

                try:
                    for i in tweak_node.pl[0].cp.get(mi=1):
                        tweak_node.pl[0].cv[i].vx.set(0)
                        tweak_node.pl[0].cv[i].vy.set(0)
                        tweak_node.pl[0].cv[i].vz.set(0)
                except TypeError:
                    try:
                        for i in tweak_node.vl[0].vt.get(mi=1):
                            tweak_node.vl[0].vt[i].vx.set(0)
                            tweak_node.vl[0].vt[i].vy.set(0)
                            tweak_node.vl[0].vt[i].vz.set(0)
                    except TypeError:
                        pass 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:rigging.py

示例10: create

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def create(self):
        # reverse_foot_controller = pm.selected()[0]
        # foot_ik_ankle_joint = pm.selected()[0]
        # foot_ik_ball_joint = pm.selected()[0]
        # foot_ik_tip_joint = pm.selected()[0]
        #
        # attrs = [
        #     'tipHeading',
        #     'tipRoll',
        #     'tipBank',
        #     'ballRoll',
        #     'ballBank'
        # ]
        #
        #
        # for attr in attrs:
        #     pm.addAttr(reverse_foot_controller, ln=attr, at='float', k=1)
        #
        # reverse_foot_controller.tipHeading >> foot_ik_tip_joint.ry
        # reverse_foot_controller.tipRoll >> foot_ik_tip_joint.rx
        # reverse_foot_controller.tipBank >> foot_ik_tip_joint.rz
        #
        # reverse_foot_controller.ballRoll >> foot_ik_ball_joint.rx
        # reverse_foot_controller.ballBank >> foot_ik_ball_joint.rz
        pass 
开发者ID:eoyilmaz,项目名称:anima,代码行数:27,代码来源:rigging.py

示例11: assign_random_material_color

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def assign_random_material_color(cls):
        """assigns a lambert with a random color to the selected object
        """
        selected = pm.selected()

        # create the lambert material
        lambert = pm.shadingNode('lambert', asShader=1)

        # create the shading engine
        shading_engine = pm.nt.ShadingEngine()
        lambert.outColor >> shading_engine.surfaceShader

        # randomize the lambert color
        import random
        h = random.random()  # 0-1
        s = random.random() * 0.5 + 0.25  # 0.25-0.75
        v = random.random() * 0.5 + 0.5  # 0.5 - 1

        from anima.utils import hsv_to_rgb
        r, g, b = hsv_to_rgb(h, s, v)
        lambert.color.set(r, g, b)

        pm.sets(shading_engine, fe=selected)
        pm.select(selected) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:26,代码来源:render.py

示例12: open_node_in_browser

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def open_node_in_browser(cls):
        # get selected nodes
        node_attrs = {
            'file': 'fileTextureName',
            'aiImage': 'filename',
            'aiStandIn': 'dso',
        }
        import os
        from anima.utils import open_browser_in_location

        for node in pm.ls(sl=1):
            type_ = pm.objectType(node)
            # special case: if transform use shape
            if type_ == 'transform':
                node = node.getShape()
                type_ = pm.objectType(node)
            attr_name = node_attrs.get(type_)
            if attr_name:
                # if any how it contains a "#" character use the path
                path = node.getAttr(attr_name)
                if "#" in path:
                    path = os.path.dirname(path)
                open_browser_in_location(path) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:25,代码来源:render.py

示例13: export_shader_attributes

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def export_shader_attributes(cls):
        """exports the selected shader attributes to a JSON file
        """
        # get data
        data = []
        nodes = pm.ls(sl=1)
        for node in nodes:
            node_attr_data = {}
            attrs = node.listAttr()
            for attr in attrs:
                try:
                    value = attr.get()
                    if not isinstance(value, pm.PyNode):
                        node_attr_data[attr.shortName()] = value
                except TypeError:
                    continue
            data.append(node_attr_data)

        # write data
        import json
        with open(cls.node_attr_info_temp_file_path, 'w') as f:
            json.dump(data, f) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:24,代码来源:render.py

示例14: randomize_light_color_temp

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def randomize_light_color_temp(cls, min_field, max_field):
        """Randomizes the color temperature of selected lights

        :param min:
        :param max:
        :return:
        """
        min = pm.floatField(min_field, q=1, v=1)
        max = pm.floatField(max_field, q=1, v=1)
        cls.randomize_attr(
            [node.getShape() for node in pm.ls(sl=1)],
            'aiColorTemperature',
            min,
            max,
            1
        ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:18,代码来源:render.py

示例15: randomize_light_intensity

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import selected [as 别名]
def randomize_light_intensity(cls, min_field, max_field):
        """Randomizes the intensities of selected lights

        :param min:
        :param max:
        :return:
        """
        min = pm.floatField(min_field, q=1, v=1)
        max = pm.floatField(max_field, q=1, v=1)
        cls.randomize_attr(
            [node.getShape() for node in pm.ls(sl=1)],
            'aiExposure',
            min,
            max,
            0.1
        ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:18,代码来源:render.py


注:本文中的pymel.core.selected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。