Python pymel.core.rename() Examples

The following are 29 code examples of pymel.core.rename(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module pymel.core , or try the search function .
Example #1
Source File: primitive.py    From mgear_core with MIT License 6 votes vote down vote up
def addLocator(parent, name, m=datatypes.Matrix(), size=1):
    """Create a space locator dagNode.

    Arguments:
        parent (dagNode): The parent for the node.
        name (str): The Node name.
        m (matrix): The matrix for the node transformation (optional).
        size (float): The space locator shape size (optional).

    Returns:
        dagNode: The newly created node.

    """
    node = pm.PyNode(pm.createNode("locator")).getParent()
    node.rename(name)
    node.setTransformation(m)
    node.setAttr("localScale", size, size, size)

    if parent is not None:
        parent.addChild(node)

    return node 
Example #2
Source File: primitive.py    From mgear_core with MIT License 6 votes vote down vote up
def addLocatorFromPos(parent, name, pos=datatypes.Vector(0, 0, 0), size=1):
    """Create a space locator dagNode.

    Arguments:
        parent (dagNode): The parent for the node.
        name (str): The Node name.
        pos (vector): The vector for the node position (optional).
        size (float): The space locator shape size (optional).

    Returns:
        dagNode: The newly created node.

    """
    node = pm.PyNode(pm.createNode("locator")).getParent()
    node.rename(name)
    node.setTranslation(pos, space="world")
    node.setAttr("localScale", size, size, size)

    if parent is not None:
        parent.addChild(node)

    return node

# ===========================================
# JOINT 
Example #3
Source File: rigutils.py    From DynRigBuilder with MIT License 6 votes vote down vote up
def createFollicle(target=None, param=[0.5,0.5], name="follicle"):
    """
    Create follicle.
    :param target: `PyNode` target that the follicle connected to
    :param param: `list` [u, v] follicle uv parameter
    :param name: `string` follicle name
    :return: `PyNode` follicle ransform node
    """
    follicle = pm.createNode("follicle")
    follicle.parameterU.set(param[0])
    follicle.parameterV.set(param[1])

    if target:
        targetShape = target.getShape()
        targetShape.worldMatrix.connect(follicle.inputWorldMatrix)
        if targetShape.nodeType() == "nurbsSurface":
            targetShape.local.connect(follicle.inputSurface)
        elif targetShape.nodeType() == "mesh":
            targetShape.outMesh.connect(follicle.inputMesh)

    folTransform = follicle.getParent()
    follicle.outRotate.connect(folTransform.rotate)
    follicle.outTranslate.connect(folTransform.translate)
    pm.rename(folTransform, name)
    return folTransform 
Example #4
Source File: limb.py    From anima with MIT License 6 votes vote down vote up
def create_spine(self, name_in, curve_in, frontAxis="z"):
        #self._network = Network(name_in)
        self._limbName = name_in
        # You can change createion method with a Joint Chain Class
        # JointChain(name_in, jointPositions)
        # self.joint.orientChain

        self.joints = SpineJoints(name_in, curve_in)
        self.joints.orient_spine(frontAxis)

        ikSolver = pm.ikHandle(sj=self.joints.startJoint,
                               ee=self.joints.endJoint,
                               tws="linear",
                               cra=True,
                               pcv=False,
                               ns=2,
                               sol="ikSplineSolver",
                               name=(name_in + "_IKSpine"))

        self._ikHandle = pm.rename(ikSolver[0], (name_in + "_IK_Spine"))
        self._effector = pm.rename(ikSolver[0],
                                   (name_in + "_IK_SpineEffector"))
        self._curve = Curve((name_in + "_IKSpineCurve"), ikSolver[2]) 
Example #5
Source File: picker.py    From anima with MIT License 6 votes vote down vote up
def create_constrained_parent(self):
        """creates parents for the object
        """
        # check if there is a stabilizerParent
        try:
            pm.nodetypes.DagNode(self._stabilizer_parent)
        except pm.MayaNodeError:
            return

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

        index = self._object.attr('pickedData.createdNodes').numElements()
        self._constrained_parent.attr('message') >> \
            self._object.attr('pickedData.createdNodes[' + str(index) + ']') 
Example #6
Source File: picker.py    From anima with MIT License 6 votes vote down vote up
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) + ']') 
Example #7
Source File: rigging.py    From anima with MIT License 6 votes vote down vote up
def get_pin_shader(self):
        """this creates or returns the existing pin shader
        """
        shaders = pm.ls("%s*" % self.pin_shader_prefix)
        if shaders:
            # try to find the shader with the same color
            for shader in shaders:
                if list(shader.color.get()) == self.color:
                    return shader

        # so we couldn't find a shader
        # lets create one
        shader = pm.shadingNode("lambert", asShader=1)
        shader.rename("%s#" % self.pin_shader_prefix)
        shader.color.set(self.color)

        # also create the related shadingEngine
        shading_engine = pm.nt.ShadingEngine()
        shading_engine.rename("%sSG#" % self.pin_shader_prefix)
        shader.outColor >> shading_engine.surfaceShader

        return shader 
Example #8
Source File: rigging.py    From anima with MIT License 6 votes vote down vote up
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 
Example #9
Source File: utilityFuncs.py    From anima with MIT License 5 votes vote down vote up
def renameHierarchy(hierarchy, name):
        #rename the hiearachy
        for s in hierarchy:
            pm.rename(s, (name + "#"))
        return hierarchy 
Example #10
Source File: curve.py    From anima with MIT License 5 votes vote down vote up
def __init__(self, name_in, curve):

        self._curveNode = pm.nt.Transform(pm.rename(curve, name_in))

        self._curveInfo = self._create_curveInfo()

        self._degree = None
        self._spans = None
        self._arcLen = None
        self._numCVs = None

        self._cvPositions = []
        for j in range (0, self.numCVs):
            self._cvPositions.append(pm.pointPosition(self.curveNode.cv[j], w = 1)) 
Example #11
Source File: joint.py    From anima with MIT License 5 votes vote down vote up
def jointName(self, name_in):
        self._jointName = pm.rename(self._jointName, name_in) 
Example #12
Source File: network.py    From anima with MIT License 5 votes vote down vote up
def name(self, name_in):
        self._name = pm.rename(self._name, name_in) 
Example #13
Source File: limb.py    From anima with MIT License 5 votes vote down vote up
def hipCtrl(self, name_in):
        if self._hipCtrl is not None:
            pm.rename(self._hipCtrl.drawnNode, name_in) 
Example #14
Source File: selection_manager.py    From anima with MIT License 5 votes vote down vote up
def name(self, new_name):
        """setter for the self.__name__
        """
        self.__name__ = new_name
        if self.__selectionSet__:
            pm.rename(self.__selectionSet__, new_name) 
Example #15
Source File: general.py    From anima with MIT License 5 votes vote down vote up
def rename_unique(cls):
        """renames the selected nodes with unique names
        """
        import re
        [node.rename(re.sub('[\d]+', '#', node.name()))
         for node in pm.selected()] 
Example #16
Source File: general.py    From anima with MIT License 5 votes vote down vote up
def remove_pasted(cls):
        """removes the string 'pasted__' from selected object names
        """
        rmv_str = "pasted__"
        [
            obj.rename(obj.name().split('|')[-1].replace(rmv_str, ''))
            for obj in pm.ls(sl=1)
            if rmv_str in obj.name()
        ] 
Example #17
Source File: general.py    From anima with MIT License 5 votes vote down vote up
def remove_colon_from_names(cls):
        selection = pm.ls(sl=1)
        for item in selection:
            temp = item.split(':')[-1]
            pm.rename(item, temp)
            pm.ls(sl=1) 
Example #18
Source File: rigging.py    From anima with MIT License 5 votes vote down vote up
def replace_controller_shape(cls):
        selection = pm.ls(sl=1)
        if len(selection) < 2:
            return
        objects = selection[0]
        joints = selection[1]
        shape = pm.listRelatives(objects, s=True)
        joint_shape = pm.listRelatives(joints, s=True)
        parents = pm.listRelatives(objects, p=True)
        if len(parents):
            temp_list = pm.parent(objects, w=True)
            objects = temp_list
        temp_list = pm.parent(objects, joints)
        objects = temp_list[0]
        pm.makeIdentity(objects, apply=True, t=1, r=1, s=1, n=0)
        temp_list = pm.parent(objects, w=True)
        objects = temp_list[0]
        if len(joint_shape):
            pm.delete(joint_shape)
        for i in range(0, len(shape)):
            name = "%sShape%f" % (joints, (i + 1))
            shape[i] = pm.rename(shape[i], name)
            temp_list = pm.parent(shape[i], joints, r=True, s=True)
            shape[i] = temp_list[0]
        pm.delete(objects)
        pm.select(joints) 
Example #19
Source File: rigging.py    From anima with MIT License 5 votes vote down vote up
def add_controller_shape(cls):
        selection = pm.ls(sl=1)
        if len(selection) < 2:
            return
        objects = []
        for i in range(0, (len(selection) - 1)):
            objects.append(selection[i])
        joints = selection[len(selection) - 1]
        for i in range(0, len(objects)):
            parents = pm.listRelatives(objects[i], p=True)
            if len(parents) > 0:
                temp_list = pm.parent(objects[i], w=1)
                objects[i] = temp_list[0]
            temp_list = pm.parent(objects[i], joints)
            objects[i] = temp_list[0]
            pm.makeIdentity(objects[i], apply=True, t=1, r=1, s=1, n=0)
            temp_list = pm.parent(objects[i], w=True)
            objects[i] = temp_list[0]
        shapes = pm.listRelatives(objects, s=True, pa=True)
        for i in range(0, len(shapes)):
            temp_list = pm.parent(shapes[i], joints, r=True, s=True)
            shapes[i] = temp_list[0]
        joint_shapes = pm.listRelatives(joints, s=True, pa=True)
        for i in range(0, len(joint_shapes)):
            name = "%sShape%f" % (joints, (i + 1))
            temp = ''.join(name.split('|', 1))
            pm.rename(joint_shapes[i], temp)
        pm.delete(objects)
        pm.select(joints) 
Example #20
Source File: auxiliary.py    From anima with MIT License 5 votes vote down vote up
def _create_shader(self):
        self._shader = pm.shadingNode('surfaceShader', asShader=1)
        self._shader.rename(self.shader_name)

        self._shader.outColor >> self.shading_engine.surfaceShader

        # create the ramp
        import maya.cmds as cmds

        kelvin_ramp = pm.shadingNode('ramp', asTexture=1)
        intensity_ramp = pm.shadingNode('ramp', asTexture=1)
        intensity_ramp.attr('type').set(1)
        intensity_ramp.interpolation.set(2)

        intensity_ramp.colorEntryList[0].color.set(0, 0, 0)
        intensity_ramp.colorEntryList[0].position.set(0)

        kelvin_ramp.outColor >> intensity_ramp.colorEntryList[1].color
        intensity_ramp.colorEntryList[1].position.set(0.707)

        intensity_ramp.colorEntryList[2].color.set(1, 1, 1)
        intensity_ramp.colorEntryList[2].position.set(1)

        # set the colors of the ramp
        kelvin_range = range(self.kelvin_min, self.kelvin_max, 1000)
        total_colors = len(kelvin_range)
        for i, kelvin in enumerate(kelvin_range):
            color = cmds.arnoldTemperatureToColor(kelvin)
            kelvin_ramp.colorEntryList[i].color.set(color)
            kelvin_ramp.colorEntryList[i].position.set(float(i) / float(total_colors))

        # connect ramp to the surfaceShaders.outColor
        intensity_ramp.outColor >> self.shader.outColor 
Example #21
Source File: utilityFuncs.py    From anima with MIT License 5 votes vote down vote up
def rename(object, name_in):
        return (pm.rename(object, name_in)) 
Example #22
Source File: primitive.py    From mgear_core with MIT License 5 votes vote down vote up
def addIkHandle(parent, name, chn, solver="ikRPsolver", poleV=None):
    """Creates and connect an IKhandle to a joints chain.

    Arguments:
        parent (dagNode): The parent for the IKhandle.
        name (str): The node name.
        chn (list): List of joints.
        solver (str): the solver to be use for the ikHandel. Default
            value is "ikRPsolver"
        poleV (dagNode): Pole vector for the IKHandle

    Returns:
        dagNode: The IKHandle

    >>> self.ikHandleUpvRef = pri.addIkHandle(
        self.root,
        self.getName("ikHandleLegChainUpvRef"),
        self.legChainUpvRef,
        "ikSCsolver")

    """
    # creating a crazy name to avoid name clashing before convert to pyNode.
    node = pm.ikHandle(n=name + "kjfjfklsdf049r58420582y829h3jnf",
                       sj=chn[0],
                       ee=chn[-1],
                       solver=solver)[0]
    node = pm.PyNode(node)
    pm.rename(node, name)
    node.attr("visibility").set(False)

    if parent:
        parent.addChild(node)

    if poleV:
        pm.poleVectorConstraint(poleV, node)

    return node 
Example #23
Source File: rigutils.py    From DynRigBuilder with MIT License 5 votes vote down vote up
def duplicateJointChain(rootJoint, replace=None, suffix=None):
    """
    Duplicate the given joint chain.
    :param rootJoint: `PyNode` root joint of the given joint chain
    :param replace: `tuple` or `list` (old string, new string)
                    rename the duplicated joint chain by replacing string in given joint name
    :param suffix: `string` rename the duplicated joint chain by adding suffix to the given joint name
    :return: `list` list of joints in the duplicated joint chain. ordered by hierarchy
    """
    srcJnts = getJointsInChain(rootJoint)
    dupJnts = []
    if not replace and not suffix:
        raise ValueError("Please rename the duplicated joint chain.")
    for i, srcJnt in enumerate(srcJnts):
        newName = srcJnt.name()
        if replace:
            newName = newName.replace(replace[0], replace[1])
        if suffix:
            newName = "{0}_{1}".format(newName, suffix)
        dupJnt = pm.duplicate(srcJnt, n=newName, po=1)[0]
        dupJnts.append(dupJnt)
        for attr in ['t', 'r', 's', 'jointOrient']:
            pm.setAttr("{0}.{1}".format(dupJnt.name(), attr), pm.getAttr("{0}.{1}".format(srcJnt.name(), attr)))
        if i>0:
            dupJnt.setParent(dupJnts[i-1])
    #
    # for i, srcJnt in enumerate(srcJnts):
    #     if i==0: continue
    #     srcPar = pm.listRelatives(srcJnt, p=1)
    #     if srcPar:
    #         dupJnts[i].setParent(srcPar[0].name().replace(replace[0], replace[1]))
    return dupJnts 
Example #24
Source File: dpPoseReader.py    From dpAutoRigSystem with GNU General Public License v2.0 5 votes vote down vote up
def on_action_nameChange(self, iRow, iCol, *args):
        pCell = self.ui.tblData.item(iRow,iCol)
        pData = pCell.data(QtCore.Qt.UserRole)
        sCurPrefix = pData.nChildLoc.name().split("_")[0]
        for sName in pData.__dict__:
            pCurObj = pData.__dict__[sName]
            sNewName = pCurObj.name().replace(sCurPrefix, args[0])
            pymel.rename(pCurObj, sNewName)

    #Change the axis connection of the system to connect in the good axis 
Example #25
Source File: modeling.py    From SIWeightEditor with MIT License 4 votes vote down vote up
def marge_run(self):
        objects = common.search_polygon_mesh(self.objects, serchChildeNode=True, fullPath=True)
        #print 'marge target :', objects
        if len(objects) < 2:
            self.marged_mesh = objects
            return True
        skined_list = []
        no_skin_list = []
        parent_list = [cmds.listRelatives(obj, p=True, f=True) for obj in objects]
        
        for obj in objects:
            skin = cmds.ls(cmds.listHistory(obj), type='skinCluster')
            if skin:
                skined_list.append(obj)
            else:
                no_skin_list.append(obj)
                
        if no_skin_list and skined_list:
            skined_mesh = skined_list[0]
            for no_skin_mesh in no_skin_list:
                weight.transfer_weight(skined_mesh, no_skin_mesh, transferWeight=False, returnInfluences=False, logTransfer=False)
                
        if skined_list:
            marged_mesh = pm.polyUniteSkinned(objects)[0]
            pm.polyMergeVertex(marged_mesh, d=0.001)
            target_mesh = pm.duplicate(marged_mesh)[0]
            weight.transfer_weight(str(marged_mesh), str(target_mesh), transferWeight=True, returnInfluences=False, logTransfer=False)
        else:
            marged_mesh = pm.polyUnite(objects, o=True)[0]
            pm.polyMergeVertex(marged_mesh, d=0.001)
            target_mesh = pm.duplicate(marged_mesh)[0]
            #pm.delete(objects)
        for obj in objects:
            if pm.ls(obj):
                pm.delete(obj)
            
        pm.delete(marged_mesh)
        
        all_attr_list = [['.sx', '.sy', '.sz'], ['.rx', '.ry', '.rz'], ['.tx', '.ty', '.tz']]
        for p_node in parent_list:
            if cmds.ls(p_node, l=True):
                all_lock_list = []
                for attr_list in all_attr_list:
                    lock_list = []
                    for attr in attr_list:
                        lock_list.append(pm.getAttr(target_mesh+attr, lock=True))
                        pm.setAttr(target_mesh+attr, lock=False)
                    all_lock_list.append(lock_list)
                pm.parent(target_mesh, p_node[0])
                for lock_list, attr_list in zip(all_lock_list, all_attr_list):
                    for lock, attr in zip(lock_list, attr_list):
                        #continue
                        #print 'lock attr :', lock, target_mesh, attr
                        pm.setAttr(target_mesh+attr, lock=lock)
                break
        pm.rename(target_mesh, objects[0])
        pm.select(target_mesh)
        self.marged_mesh = str(target_mesh)
        return True 
Example #26
Source File: auxiliary.py    From anima with MIT License 4 votes vote down vote up
def create_shader(shader_tree, name=None):
    """Creates a shader tree from the given shader tree.

    The shader_tree is a Python dictionary showing node types and attribute
    values.

    Each shader_tree can create only one shading network. The format of the
    dictionary should be as follows.

    shader_tree: {
        'type': <- The maya node type of the toppest shader
        'class': <- The type of the shading node, one of
            "asLight", "asPostProcess", "asRendering", "asShader", "asTexture"
             "asUtility"
        'attr': {
            <- A dictionary that contains attribute names and values.
            'attr1': {
                'type': --- type name of the connected node
                'attr': {
                    <- attribute values ->
                }
            }
        }
    }

    :param dict shader_tree: A dictionary showing the shader tree attributes.
    :return:
    """
    shader_type = shader_tree['type']

    if 'class' in shader_tree:
        class_ = shader_tree['class']
    else:
        class_ = 'asShader'

    shader = pm.shadingNode(shader_type, **{class_: 1})

    if name:
        shader.rename(name)

    attributes = shader_tree['attr']

    for key in attributes:
        value = attributes[key]
        if isinstance(value, dict):
            node = create_shader(value)
            output_attr = value['output']
            node.attr(output_attr) >> shader.attr(key)
        else:
            shader.setAttr(key, value)

    return shader 
Example #27
Source File: auxiliary.py    From anima with MIT License 4 votes vote down vote up
def replace_with_bbox(nodes):
    """replaces the given nodes with a bbox object
    """
    node_names = []
    bboxes = []
    processed_nodes = []
    for node in nodes:
        # create a bbox and parent it to the parent of
        # the original node

        # check if it is a transform node
        if not isinstance(node, pm.nt.Transform):
            continue

        # check the shape
        # check if it has at least one shape under it
        if not has_shape(node):
            continue

        bbox = cube_from_bbox(node.boundingBox())
        bbox.setParent(node.getParent())

        # set pivots
        rp = pm.xform(node, q=1, ws=1, rp=1)
        sp = pm.xform(node, q=1, ws=1, sp=1)
        pm.xform(bbox, ws=1, rp=rp)
        pm.xform(bbox, ws=1, sp=sp)

        node_name = node.name()
        node_shape = node.getShape()
        node_shape_name = None
        if node_shape is not None:
            node_shape_name = node_shape.name()

        node_names.append((node_name, node_shape_name))
        bboxes.append(bbox)
        processed_nodes.append(node)

    # delete the nodes
    if len(processed_nodes):
        pm.delete(processed_nodes)

        # rename the bboxes
        for name, bbox in zip(node_names, bboxes):
            bbox.rename(name[0])
            if name[1]:
                bbox.getShape().rename(name[1])

    return bboxes 
Example #28
Source File: applyop.py    From mgear_core with MIT License 4 votes vote down vote up
def splineIK(name, chn, parent=None, cParent=None, curve=None):
    """Apply a splineIK solver to a chain.

    Arguments:
        name (str): Name of the operator node.
        chn (list of joints): List of joints. At less 2 joints should be in
            the list.
        parent (dagNode): Parent for the ikHandle.
        cParent (dagNode): Parent for the curve.
        curve (dagNode): Specifies the curve to be used by the ikSplineHandle.
            This param is optional.

    Returns:
        list: ikHandle node and splinecrv in a list

    Example:
        >>> aop.splineIK(self.getName("rollRef"),
                         self.rollRef,
                         parent=self.root,
                         cParent=self.bone0 )

    """
    data = {}
    data["n"] = name
    data["solver"] = "ikSplineSolver"
    data["ccv"] = True
    data["startJoint"] = chn[0]
    data["endEffector"] = chn[-1]
    if curve is not None:
        data["curve"] = curve

    node, effector, splineCrv = pm.ikHandle(**data)
    # converting to pyNode
    node = pm.PyNode("|" + node)
    effector = pm.PyNode(effector)
    splineCrv = pm.PyNode(splineCrv)

    node.setAttr("visibility", False)
    splineCrv.setAttr("visibility", False)
    pm.rename(splineCrv, name + "_crv")
    pm.rename(effector, name + "_eff")
    if parent is not None:
        parent.addChild(node)
    if cParent is not None:
        cParent.addChild(splineCrv)

    return node, splineCrv 
Example #29
Source File: modeling.py    From SISideBar with MIT License 4 votes vote down vote up
def marge_run(self):
        objects = common.search_polygon_mesh(self.objects, serchChildeNode=True, fullPath=True)
        print objects
        #print objects
        if len(objects) < 2:
            self.marged_mesh = objects
            return True
        skined_list = []
        no_skin_list = []
        parent_list = [cmds.listRelatives(obj, p=True, f=True) for obj in objects]
        
        for obj in objects:
            skin = cmds.ls(cmds.listHistory(obj), type='skinCluster')
            if skin:
                skined_list.append(obj)
            else:
                no_skin_list.append(obj)
                
        if no_skin_list and skined_list:
            skined_mesh = skined_list[0]
            for no_skin_mesh in no_skin_list:
                weight.transfer_weight(skined_mesh, no_skin_mesh, transferWeight=False, returnInfluences=False, logTransfer=False)
                
        if skined_list:
            marged_mesh = pm.polyUniteSkinned(objects)[0]
            pm.polyMergeVertex(marged_mesh, d=0.001)
            target_mesh = pm.duplicate(marged_mesh)[0]
            weight.transfer_weight(str(marged_mesh), str(target_mesh), transferWeight=True, returnInfluences=False, logTransfer=False)
        else:
            marged_mesh = pm.polyUnite(objects, o=True)[0]
            pm.polyMergeVertex(marged_mesh, d=0.001)
            target_mesh = pm.duplicate(marged_mesh)[0]
            #pm.delete(objects)
        for obj in objects:
            if pm.ls(obj):
                pm.delete(obj)
            
        pm.delete(marged_mesh)
        
        all_attr_list = [['.sx', '.sy', '.sz'], ['.rx', '.ry', '.rz'], ['.tx', '.ty', '.tz']]
        for p_node in parent_list:
            if cmds.ls(p_node, l=True):
                all_lock_list = []
                for attr_list in all_attr_list:
                    lock_list = []
                    for attr in attr_list:
                        lock_list.append(pm.getAttr(target_mesh+attr, lock=True))
                        pm.setAttr(target_mesh+attr, lock=False)
                    all_lock_list.append(lock_list)
                pm.parent(target_mesh, p_node[0])
                for lock_list, attr_list in zip(all_lock_list, all_attr_list):
                    for lock, attr in zip(lock_list, attr_list):
                        continue
                        pm.setAttr(target_mesh[0]+attr, lock=lock)
                break
        pm.rename(target_mesh, objects[0])
        pm.select(target_mesh)
        self.marged_mesh = str(target_mesh)
        return True