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


Python core.parent方法代码示例

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


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

示例1: info

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def info(self, title, description, text, align, width, height, *args):
        """ Create a window showing the text info with the description about any module.
        """
        # declaring variables:
        self.info_title       = title
        self.info_description = description
        self.info_text        = text
        self.info_winWidth    = width
        self.info_winHeight   = height
        self.info_align       = align
        # creating Info Window:
        if cmds.window('dpInfoWindow', query=True, exists=True):
            cmds.deleteUI('dpInfoWindow', window=True)
        dpInfoWin = cmds.window('dpInfoWindow', title='dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i013_info']+' - '+self.langDic[self.langName][self.info_title], iconName='dpInfo', widthHeight=(self.info_winWidth, self.info_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        infoColumnLayout = cmds.columnLayout('infoColumnLayout', adjustableColumn=True, columnOffset=['both', 20], parent=dpInfoWin)
        cmds.separator(style='none', height=10, parent=infoColumnLayout)
        infoLayout = cmds.scrollLayout('infoLayout', parent=infoColumnLayout)
        if self.info_description:
            infoDesc = cmds.text(self.langDic[self.langName][self.info_description], align=self.info_align, parent=infoLayout)
        if self.info_text:
            infoText = cmds.text(self.info_text, align=self.info_align, parent=infoLayout)
        # call Info Window:
        cmds.showWindow(dpInfoWin) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:26,代码来源:dpAutoRig.py

示例2: donateWin

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def donateWin(self, *args):
        """ Simple window with links to donate in order to support this free and openSource code via PayPal.
        """
        # declaring variables:
        self.donate_title       = 'dpAutoRig - v'+DPAR_VERSION+' - '+self.langDic[self.langName]['i167_donate']
        self.donate_description = self.langDic[self.langName]['i168_donateDesc']
        self.donate_winWidth    = 305
        self.donate_winHeight   = 300
        self.donate_align       = "center"
        # creating Donate Window:
        if cmds.window('dpDonateWindow', query=True, exists=True):
            cmds.deleteUI('dpDonateWindow', window=True)
        dpDonateWin = cmds.window('dpDonateWindow', title=self.donate_title, iconName='dpInfo', widthHeight=(self.donate_winWidth, self.donate_winHeight), menuBar=False, sizeable=True, minimizeButton=False, maximizeButton=False)
        # creating text layout:
        donateColumnLayout = cmds.columnLayout('donateColumnLayout', adjustableColumn=True, columnOffset=['both', 20], rowSpacing=5, parent=dpDonateWin)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        infoDesc = cmds.text(self.donate_description, align=self.donate_align, parent=donateColumnLayout)
        cmds.separator(style='none', height=10, parent=donateColumnLayout)
        brPaypalButton = cmds.button('brlPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - R$ - Real", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"BRL"), parent=donateColumnLayout)
        #usdPaypalButton = cmds.button('usdPaypalButton', label=self.langDic[self.langName]['i167_donate']+" - USD - Dollar", align=self.donate_align, command=partial(utils.visitWebSite, DONATE+"USD"), parent=donateColumnLayout)
        # call Donate Window:
        cmds.showWindow(dpDonateWin) 
开发者ID:nilouco,项目名称:dpAutoRigSystem,代码行数:24,代码来源:dpAutoRig.py

示例3: get_no_parent_transform

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def get_no_parent_transform(cls, ref):
        """returns the top most parent node in the given subReferences

        :param ref: pm.nt.FileReference instance
        """
        all_referenced_nodes = ref.nodes()
        for node in all_referenced_nodes:
            if isinstance(node, pm.nt.Transform):
                #print('%s has parent' % node.name())
                parent_node = node.getParent()
                if parent_node not in all_referenced_nodes:
                    return node

        # check sub references
        sub_refs = pm.listReferences(ref)
        for sub_ref in sub_refs:
            no_parent_transform = cls.get_no_parent_transform(sub_ref)
            if no_parent_transform:
                return no_parent_transform 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:reference.py

示例4: setup

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def setup(self):
        """setups specified object for pivot switching
        """

        # if it is setup before, don't do anything
        if self._isSetup:
            return

        if not self.is_good_for_setup():
            pm.PopupError(
                "the objects pivots are connected to something\n"
                "THE OBJECT CANNOT BE SETUP!!!"
            )
            return

        # create the parent constraint
        self._create_future_pivot()

        # create attributes for data holding
        self._create_data_attribute()

        # save the settings
        self._save_settings()

        self._isSetup = True 
开发者ID:eoyilmaz,项目名称:anima,代码行数:27,代码来源:pivot_switcher.py

示例5: rivet_per_face

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

示例6: finalize_setup

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def finalize_setup(self):
        """does final clean up
        """
        self.check_main_control()

        # group the node together
        parent_group = pm.nt.Transform(name='SquashStretchBendRiggerGroup#')
        pm.parent(self.main_control.getParent(), parent_group)
        pm.parent(self.aim_locator1, parent_group)
        if self.use_squash:
            pm.parent(self.squash_handle, parent_group)

        pm.parent(self.bend_handle, parent_group)

        # set visibilities
        self.aim_locator1.v.set(0)
        if self.use_squash:
            self.squash_handle.v.set(0)
        self.bend_handle.v.set(0)

        # as a gesture select the main control
        pm.select(self.main_control) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:24,代码来源:rigging.py

示例7: create_camera_space_locator

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def create_camera_space_locator(frustum_curve):
    """Creates a locator under the given frame_curve

    :param frustum_curve:
    :return:
    """
    # create the locator
    locator = pm.spaceLocator()
    locator_shape = locator.getShape()
    pm.parent(locator, frustum_curve, r=True)
    locator.tz.set(lock=True, keyable=False)
    locator.rx.set(lock=True, keyable=False)
    locator.ry.set(lock=True, keyable=False)
    locator.rz.set(lock=True, keyable=False)
    pm.transformLimits(locator, tx=(-0.5, 0.5), etx=(True, True))
    pm.transformLimits(locator, ty=(-0.5, 0.5), ety=(True, True))
    locator_shape.localScaleZ.set(0)
    return locator 
开发者ID:eoyilmaz,项目名称:anima,代码行数:20,代码来源:camera_tools.py

示例8: publish_checker

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def publish_checker(cls):
        """Opens the Publish Checker window without publishing the current
        scene
        """
        import functools
        from anima.env import mayaEnv
        m = mayaEnv.Maya()
        version = m.get_current_version()

        # create the publish window
        from anima.ui import publish_checker
        dialog = publish_checker.UI(
            environment=m,
            publish_callback=None,
            version=version,
            parent=mayaEnv.get_maya_main_window()
        )
        dialog.auto_delete_new_version_on_exit = False
        dialog.show() 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:general.py

示例9: create_local_parent

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def create_local_parent(self):
        """creates local parent and axial correction group of local parent
        """
        # create the localParent group
        self._local_parent = pm.group(
            em=True,
            n=self._object.name() + "_local_parent"
        )

        # move it to the same place where constrainedParent is
        matrix = pm.xform(self._constrained_parent, q=True, ws=True, m=True)
        pm.xform(self._local_parent, ws=True, m=matrix)

        # parent it to the constrained parents parent
        parents = pm.listRelatives(self._constrained_parent, p=True)

        if len(parents) != 0:
            temp = pm.parent(self._local_parent, parents[0], a=True)
            self._local_parent = temp[0]

        self._local_parent = pm.nodetypes.DagNode(self._local_parent)
        index = self._object.attr('pickedData.createdNodes').numElements()
        self._local_parent.attr('message') >> \
            self._object.attr('pickedData.createdNodes[' + str(index) + ']') 
开发者ID:eoyilmaz,项目名称:anima,代码行数:26,代码来源:picker.py

示例10: create_stabilizer_parent

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def create_stabilizer_parent(self):
        """creates the stabilizer parent
        """
        # the new stabilizer parent should be at the origin of the original
        # objects parent so that the keyframes of the object should not be altered

        self._stabilizer_parent = pm.nodetypes.DagNode(
            auxiliary.axial_correction_group(
                self._object,
                to_parents_origin=True
            )
        )

        self._stabilizer_parent = pm.nodetypes.DagNode(
            pm.rename(
                self._stabilizer_parent,
                self._object.name() + "_stabilizer_parent"
            )
        )

        # connect it to the created nodes attribute
        index = self._object.attr('pickedData.createdNodes').numElements()
        self._stabilizer_parent.attr('message') >> \
            self._object.attr('pickedData.createdNodes[' + str(index) + ']') 
开发者ID:eoyilmaz,项目名称:anima,代码行数:26,代码来源:picker.py

示例11: get_weight_alias

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def get_weight_alias(self, parent):
        """finds weightAlias of given parent\n
        if it couldn't find any it returns None
        """
        if not self._is_setup:
            return

        parent = pm.nodetypes.DagNode(parent)

        assert( isinstance(parent, pm.nodetypes.Transform) )

        weightAliasList = self.get_weight_alias_list()
        parentList = self.get_parent_list()

        weightAlias = None

        for i in range(len(parentList)):
            if parentList[i] == parent:
                weightAlias = weightAliasList[i]
                break

        return weightAlias 
开发者ID:eoyilmaz,项目名称:anima,代码行数:24,代码来源:picker.py

示例12: add_parent_to_DAG_menu

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def add_parent_to_DAG_menu(self, parent):
        """adds the given parent to the DAG menu

        oyParSw - switch to --> %PARENTNAME%
        """
        # simply add "python(import oyObjectPicker as oyOP; oyOP.setObjectsParentTo( %s, %s+\".pickedData.constrainedParent[ %number% ]\" ))"

        commandLabel = "oyObjectPicker - switch to --> " + parent.name()
        parentIndex = self.get_parent_index(parent)

        if parentIndex == -1:
            return

        commandString = "{\n \
        int $parentIndex = " + str(parentIndex) + ";\n \
        string $parentConstraint[] = `listConnections (\"%s.pickedData.parentConstraint\")`;\n \
        string $parents[] = `parentConstraint -q -tl $parentConstraint[0]`;\n \
        string $parentName = $parents[ $parentIndex ];\n \
        python(\"import oyObjectPicker as oyOP; oyOP.set_objects_parent( '%s', '\"+$parentName+\"')\");\n \
        }"

        # pm.mel.source("oyAddDAGMenuCommands")
        # pm.mel.oyADMC_addSpecialCommandsToObject(
        #     self._object.name(), commandLabel, commandString
        # ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:27,代码来源:picker.py

示例13: set_parent_weight

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def set_parent_weight(self, parent):
        """sets the weight of the parent to 1 and the others to 0
        """
        parent = pm.nodetypes.DagNode(parent)

        # get the weightAlias of the parent
        parent_weightAlias = self.get_weight_alias(parent)

        # set the weight of the other parents to 0 and the current to 1
        weightAliasList = self.get_weight_alias_list()

        for weightAlias in weightAliasList:
            if weightAlias == parent_weightAlias:
                weightAlias.setKey(v=1, ott="step")
            else:
                currentWeight = weightAlias.get()
                print("currentWeight = %s" % currentWeight)
                if currentWeight > 0:
                    weightAlias.setKey(v=0, ott="step") 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:picker.py

示例14: set_objects_parent

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def set_objects_parent(object_, parent):
#    import oyObjectPicker as oyOP

    selList = pm.ls(sl=True)

#    myPickedObj = oyOP.PickedObject(object_)
    myPickedObj = PickedObject(object_)

    # before seting up check if there is a cycle with the parent
    if myPickedObj.check_cycle(parent):
        object_ = pm.nodetypes.DagNode(object_)
        parent = pm.nodetypes.DagNode(parent)
        pm.PopupError(
            "CYCLE ERROR!!!\n%s is a parent or special object for %s" % (
            object_.name(), parent.name() ))
        # do not setup any object
        return

    myPickedObj.setup_to_be_picked_up()
    myPickedObj.add_new_parent(parent)
    myPickedObj.set_active_parent(parent)
    # reselect selList
    pm.select(selList) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:25,代码来源:picker.py

示例15: save_as

# 需要导入模块: from pymel import core [as 别名]
# 或者: from pymel.core import parent [as 别名]
def save_as(self, shot_name, child_task_name='Previs'):
        """saves the file under the given shot name
        """
        # first find the shot
        from stalker import Version, Shot, Task
        shot = Shot.query.filter(Shot.name == shot_name).first()
        if not shot:
            raise RuntimeError('No shot found with shot name: %s' % shot_name)

        # get the child task
        child_task = Task.query\
            .filter(Task.parent == shot)\
            .filter(Task.name == child_task_name)\
            .first()

        logged_in_user = LocalSession().logged_in_user

        v = Version(task=child_task, created_by=logged_in_user)
        self.m_env.save_as(v) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:21,代码来源:previs.py


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