示例#1
0
def create_facial_rig():
    errmsg = []
    msg = ft.create_ctl()
    errmsg.append(msg)
    pm.refresh()
    if not pm.confirmBox(title='Facial Rig Status',message = "Face Control Created\nError:\n%s"%msg, yes='Continue?', no='Stop?'):
        return
    msg = ft.create_eye_rig()
    errmsg.append(msg)
    pm.refresh()
    if not pm.confirmBox(title='Facial Rig Status',message = "Eyeballs Rig Created\nError:\n%s"%msg, yes='Continue?', no='Stop?'):
        return
    msg = ft.connect_mouth_ctl()
    errmsg.append(msg)
    pm.refresh()
    if not pm.confirmBox(title='Facial Rig Status',message = "Mouth Control to Bone Connected\nError:\n%s"%msg, yes='Continue?', no='Stop?'):
        return
    msg = ft.create_facial_bs_ctl()
    errmsg.append(msg)
    pm.refresh()
    if not pm.confirmBox(title='Facial Rig Status',message = "Create BlendShape control and setup BlendShape \nError:\n%s"%msg, yes='Continue?', no='Stop?'):
        return
    # ft.parent_ctl_to_head()
    # pm.refresh()
    # if not pm.confirmBox(title='Facial Rig Status',message = "Parent Root Group to Head OK", yes='Continue?', no='Stop?'):
    #     return
    msg = ft.copy_facialskin()
    pm.refresh()
    if not pm.confirmBox(title='Facial Rig Status',message = "Facial Copy \nError:\n%s"%msg, yes='Continue?', no='Stop?'):
        return
    pm.informBox(title='Riggin Status', message = "Face Rig Complete")
示例#2
0
 def assertTrue(value, msg):
     try:
         assert value
     except AssertionError as why:
         pm.informBox('Error:', msg)
         log.error(msg)
         raise RuntimeError(msg)
示例#3
0
def cam_projection(selected):
    if not selected:
        pm.informBox(title="ERROR", message="Please Select a shot Camera to continue", ok="OK")
        return None
    else:
        newCamera = pm.duplicate(ic=False, name="proj_cam_fr" + frame_name)
        return newCamera
示例#4
0
 def onGetNameClick(self):
     if not pm.selected():
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     if not hasattr(pm.selected()[0], 'name'):
         return
     self.resetTextField()
     name = pm.selected()[0].name().split('|')[-1]
     splitName = name.split(self.separator)
     prefix = ''
     suffix = ''
     if len(splitName) > 2:
         prefix = splitName[0]
         name = self.separator.join(splitName[1:-1])
         suffix = splitName[-1]
     elif len(splitName) == 2:
         if len(splitName[1]) > len(splitName[0]):
             name = splitName[1]
             prefix = splitName[0]
         else:
             name = splitName[0]
             suffix = splitName[1]
     self.prefix_combobox.setCurrentText(prefix)
     self.name_text.setText(name)
     self.suffix_combobox.setCurrentText(suffix)
 def _action_show_parent_help(self):
     """
     Show a small help window about the use direct parent option
     """
     sHelpMsg = "If checked, the direct parent of the driven node will be" \
                " use as the recept of the parent constraint. Else, a new parent will be created. \n" \
                "WARNING : New parent cannot be used on referenced node"
     pymel.informBox("Space Switcher", sHelpMsg)
 def _action_show_parent_help(self):
     """
     Show a small help window about the use direct parent option
     """
     sHelpMsg = "If checked, the direct parent of the driven node will be" \
                " use as the recept of the parent constraint. Else, a new parent will be created. \n" \
                "WARNING : New parent cannot be used on referenced node"
     pymel.informBox("Space Switcher", sHelpMsg)
示例#7
0
def DisplayInfoBox(message, title=None):
    """
    Displays dismissable info box to user.
    
    :param message: box Title.
    :param title: box body text. 
    """
    pm.informBox(title, message)
示例#8
0
 def onGetNameClick(self):
     if not pm.selected():
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     if not hasattr(pm.selected()[0], 'name'):
         return
     name = pm.selected()[0].name().split('|')[-1]
     self.name_text.setText(name)
示例#9
0
 def getOblist(self):
     ob_list = pm.selected(
     ) if not self.renameAll_radialbutton.isChecked() else pm.ls(
         type='transform')
     if not ob_list:
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     return ob_list
示例#10
0
 def onDeleteNameAfterClick(self):
     if not pm.selected():
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     for ob in pm.selected():
         if not hasattr(ob, 'rename'):
             continue
         newName = ob.name().split('|')[-1][:-1]
         ob.rename(newName)
示例#11
0
 def generate_thumbnail(cls):
     """generates thumbnail for current scene
     """
     from anima.env.mayaEnv import auxiliary
     # reload(auxiliary)
     result = auxiliary.generate_thumbnail()
     if result:
         pm.informBox('Done!', 'Thumbnail generated successfully!')
     else:
         pm.informBox('Fail!', 'Thumbnail generation was unsuccessful!')
示例#12
0
 def onRenameClick(self):
     if not pm.selected():
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     for ob in pm.selected():
         if not hasattr(ob, 'rename'):
             continue
         name = pm.selected()[0].name().split('|')[-1]
         newName = name.replace(self.nameSearch_text.text(),
                                self.nameReplace_text.text())
         ob.rename(newName)
示例#13
0
 def onDeleteSuffixClick(self):
     if not pm.selected():
         pm.informBox('Error', 'No Object Selected')
         raise RuntimeError('No Object Selected')
     for ob in pm.selected():
         if not hasattr(ob, 'rename'):
             continue
         splitName = ob.name().split('|')[-1].split(self.separator)
         if len(splitName) > 1:
             newName = self.separator.join([c for c in splitName[:-1] if c])
             ob.rename(newName)
def RotPro(menu1, menu2, rotationDict, *args):
    print 'ran'
    buttons = pm.radioCollection(menu2, q=True, sl=True)
    rtype = pm.radioButton(buttons, q=True, label=True)
    type = menu1.getValue()
    axis = rotationDict[rtype][0]
    mod = rotationDict[rtype][1]
    print type, axis, mod
    modx = 0
    mody = 0
    modz = 0
    faces = ''
    rotationamount = mod
    if axis == 'x':
        modx = rotationamount
        print 'modx', modx
    if axis == 'y':
        mody = rotationamount
    if axis == 'z':
        modz = rotationamount
    selected = pm.ls(sl=True)

    if (len(selected) < 1):
        pm.informBox(title='Object Selection Error',
                     message='Please Select a Single Object',
                     ok='Ok')
        return
    try:
        shape = selected[0].getChildren()
        faces = shape[0].f[0:]
    except:
        try:
            faces = selected
        except:
            pm.informBox(title='Object Selection Error',
                         message='Please Select a valid Object',
                         ok='Ok')
            return

    projection = pm.polyProjection(faces,
                                   rx=modx,
                                   ry=mody,
                                   rz=modz,
                                   type=type,
                                   ibd=True,
                                   sf=True)[0]
    print projection
    pm.select(d=True)
    pm.select(projection, r=True)
    pm.setToolTo('ShowManips')
    pm.showManipCtx()
    pm.ShowManipulators()
示例#15
0
 def fix_student_license_on_selected_file(cls):
     """fixes the student license error on selected file
     """
     texture_path = \
     file_path = pm.fileDialog2(
         cap="Choose Maya Scene", okc="Choose", fm=1
     )[0]
     result = cls.fix_student_license(file_path)
     if result:
         pm.informBox('Done!', 'Fixed:\n\n%s' % file_path)
     else:
         pm.informBox('Fail!',
                      'No Student License Found on\n\n%s' % file_path)
示例#16
0
def load_lba2_folder(*args):
    global lba_path
    global palette
    global resources
    global import_menu

    def find(name, path):
        for root, dirs, files in os.walk(path):
            if name in files:
                return os.path.join(root, name)

    directory = pm.fileDialog2(caption="Select LBA2 Installation Folder",
                               fileMode=2,
                               okCaption="Select")
    if directory is None:
        return
    # Look for essential files before accepting:
    if find("BODY.HQR", directory[0]) is None:
        pm.informBox("Incorrect Folder", "File BODY.HQR not found.")
        return
    if find("RESS.HQR", directory[0]) is None:
        pm.informBox("Incorrect Folder", "File RESS.HQR not found.")
        return
    if find("ANIM.HQR", directory[0]) is None:
        pm.informBox("Incorrect Folder", "File ANIM.HQR not found.")
        return

    lba_path = directory[0]
    # Read RESS.HQR relevant entries
    loading_box = pm.progressWindow(title="LBA2 Model Generator",
                                    status="Opening Folder...",
                                    isInterruptable=False,
                                    progress=0)
    ress_file = HQRReader(lba_path + "/RESS.HQR")
    pm.progressWindow(loading_box,
                      edit=True,
                      status="Loading Palette...",
                      progress=10)
    palette = load_palette(ress_file[0])
    pm.progressWindow(loading_box,
                      edit=True,
                      status="Loading Resources...",
                      progress=20)
    resources = load_information(ress_file[44], loading_box)
    import_menu.setEnable(val=True)
    pm.progressWindow(loading_box, endProgress=1)
示例#17
0
def send_current_file(scene=True,
                      suffix='_vn',
                      lastest=True,
                      render=False,
                      tex=True,
                      extras=['psd', 'uv', 'zbr', 'pattern'],
                      version=1,
                      verbose=True):
    src = pm.sceneName()
    scene_src = src.dirname()
    path_root = ''
    status = []
    todayFolder = pm.date(f='YYMMDD')
    if version > 1:
        todayFolder = "{}_{:02d}".format(todayFolder, int(version))
    status.append('Send File to {}'.format(todayFolder))
    scene_dest = pm.util.path(
        scene_src.replace('Works',
                          'to/{}/Works'.format(todayFolder))).truepath()
    files = scene_src.files('*.mb')
    files.extend(scene_src.files('*.ma'))
    #print files
    files.sort(key=lambda f: f.getmtime())
    lastestfile = files[-1]
    try:
        status.append('Scene Sending status:')
        if lastest:
            src = lastestfile
            status.append('send latest file')
        dest = scene_dest.__div__(src.basename().replace(
            src.ext, '{}{}'.format(suffix, src.ext)))
        if scene:
            check_dir(dest)
            pm.sysFile(src, copy=dest)
            status.append("%s copy to %s" % (src, dest))
        if render:
            render_str = ['rend', 'Render', 'render', 'Rend']
            rend_src = []
            print src.dirname().dirs()
            for test_str in render_str:
                for dir in src.dirname().dirs():
                    if test_str in dir.basename():
                        print dir.basename()
                        rend_src = dir
                        break
                break
            if rend_src:
                rend_dest = dest.dirname().__div__(test_str)
                status.append(sys_cop(rend_src, rend_dest))
    except (IOError, OSError, shutil.Error) as why:
        msg = "Scene Copy Error\n{}".format(','.join(why))
        status.append(msg)
    if tex or extras:
        if all([src.dirname().dirname().dirname().basename() != d for d in ['CH','BG','CP']]) and \
                src.dirname().dirname().basename()!='CP':
            scene_src = scene_src.dirname()
            scene_dest = scene_dest.dirname()
            print scene_src
        tex_src = pm.util.path(scene_src.replace('scenes',
                                                 'sourceimages')).truepath()
        tex_files = tex_src.files('*.jpg')
        tex_extra = {}
        for extra in extras:
            tex_extra[extra] = tex_src.__div__(extra)
        tex_dest = pm.util.path(scene_dest.replace('scenes', 'sourceimages'))
        status.append('Texture Sending status:')
        try:
            if tex:
                for tex_file in tex_files:
                    src = tex_file
                    dest = tex_dest.__div__(tex_file.basename())
                    check_dir(dest)
                    pm.sysFile(src, copy=dest)
                    status.append("%s copy to %s" % (src, dest))
            if extras:
                for name, path in tex_extra.items():
                    status.append('%s Sending status:' % name)
                    dest = tex_dest.__div__(name)
                    status.append(sys_cop(path, dest))
        except (IOError, OSError, shutil.Error) as why:
            msg = "Tex Copy Error:\n{}".format(','.join(why))
            status.append(msg)
    pm.informBox(title='Send File Status', message='\n'.join(status))
示例#18
0
    def setup_space_switch(self, nDriven=None, aDrivers=None, bCreateWolrdNode=False, bCreateParent=True):
            """
            Setup a new space switch system on the node
            """
            aCurSel = pymel.selected()
            if aDrivers == None:
                aParent = aCurSel[0:-1]
            else:
                aParent = aDrivers

            bContinue = False
            #Create the worldNode
            if (not self.worldNode and bCreateWolrdNode):
                self.worldNode = pymel.createNode("transform", n="dp_sp_worldNode")
                ctrlUtil.setLockHide([self.worldNode.__melobject__()], ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

            if (self.worldNode):
                self.aDrivers.append(self.worldNode)
                self.aDriversSubName.append("World")

            if (not nDriven):
                if (len(aCurSel) == 0):
                    pymel.informBox("Space Switcher", "You need to choose at least the node to constraint")
                #The user only selected the driven node, so create a space switch between it's parent and the world
                elif (len(aCurSel) == 1):
                    self.nDriven = aCurSel[0]
                    bContinue = True
                else:
                    self.nDriven = aCurSel[-1]
                    bContinue = True
            else:
                self.nDriven = nDriven
                bContinue = True

            if bContinue:
                #Setup the intermediate node to manage the spaceSwitch
                if bCreateParent:
                    self.nSwConstRecept = pymel.PyNode(utils.zeroOut(transformList=[self.nDriven.__melobject__()])[0])
                    self.nSwConstRecept.rename(self.nDriven.name() + "_SW_Const")
                else:
                    self.nSwConstRecept = self.nDriven.getParent()
                m4Driven = self.nDriven.getMatrix(worldSpace=True)
                self.nSwConstRecept.setMatrix(m4Driven, worldSpace=True)
                self.nDriven.setParent(self.nSwConstRecept)

                #Create the parent constraint for the first node, but add the other target manually
                if (bCreateWolrdNode):
                    self.nSwConst = pymel.parentConstraint(self.worldNode, self.nSwConstRecept, n=self.nDriven.name() + "_SpaceSwitch_Const", mo=True)
                else:
                    self.nSwConst = pymel.parentConstraint(aParent[0], self.nSwConstRecept, n=self.nDriven.name() + "_SpaceSwitch_Const", mo=True)
                    self.aDrivers.append(aParent[0])
                    self.aDriversSubName.append(aParent[0].name())
                    aParent = aParent[1:]

                self.nSwConst.getWeightAliasList()[0].set(0.0)

                #Setup the first key for the current activate constraint, targets offset and rest position
                pymel.setKeyframe(self.nSwConst.getWeightAliasList()[0], t=0, ott="step")
                pymel.setKeyframe(self.nSwConst.target[0].targetOffsetTranslate, t=0, ott="step")
                pymel.setKeyframe(self.nSwConst.target[0].targetOffsetRotate, t=0, ott="step")
                pymel.setKeyframe(self.nSwConst.restTranslate, t=0, ott="step")
                pymel.setKeyframe(self.nSwConst.restRotate, t=0, ott="step")

                self.add_target(aParent, firstSetup=True)

                pymel.select(nDriven)
示例#19
0
    def onApplyClick(self):
        # Base Name Variable
        separator = self.separator
        prefix = self.prefix_text.text()
        name = self.name_text.text()
        suffix = self.suffix_text.text()
        # Optional Name Variable Toggle State
        numBool = self.numberEnable_checkbox.checkState()
        numAddSepBool = self.numberAddSeparator_checkbox.checkState()
        letterBool = self.letterEnable_checkbox.checkState()
        letterAddSepBool = self.letterAddSeparator_checkbox.checkState()
        directionBool = self.directionEnable_checkbox.checkState()
        dirAddSepBool = self.directionAddSeparator_checkbox.checkState()
        # Optional Name Variable Position
        numPos = self.numberPosition_comboBox.currentText()
        letterPos = self.letterPosition_comboBox.currentText()
        dirPos = self.directionPosition_comboBox.currentText()
        # Optional Name Variable Value
        startNum = self.startNumber_spinBox.value()
        numPadding = self.padding_spinBox.value()
        startLetter = self.startletter_comboBox.currentIndex()
        direction = self.direction_comboBox.currentText()

        # Name List generate
        def getIndex(postext):
            if 'prefix' in postext.lower():
                if prefix:
                    if postext.lower().startswith('before'):
                        return baseName_list.index(prefix)
                    else:
                        return baseName_list.index(prefix) + 1
                else:
                    return 0
            if 'name' in postext.lower():
                if postext.lower().startswith('before'):
                    return baseName_list.index(name)
                else:
                    return baseName_list.index(name) + 1
            if 'suffix' in postext.lower():
                if suffix:
                    if postext.lower().startswith('before'):
                        return baseName_list.index(suffix)
                    else:
                        return baseName_list.index(suffix) + 1
                else:
                    return (len(baseName_list) - 1)

        if not pm.selected():
            pm.informBox('Error', 'No Object Selected')
            raise RuntimeError('No Object Selected')
        if not name:
            pm.informBox('Error', 'Name is empty, input Name String')
            raise RuntimeError('Name is empty, input Name String')
        result = []
        for obid, ob in enumerate(pm.selected()):
            if hasattr(ob, 'rename'):
                baseName_list = [prefix, name, suffix]
                if numBool:
                    baseName_list.insert(getIndex(numPos),
                                         ("{:0" + str(numPadding) +
                                          "d}").format(startNum + obid))
                    if numAddSepBool:
                        baseName_list.insert(getIndex(numPos), separator)
                if letterBool:
                    baseName_list.insert(getIndex(letterPos),
                                         self.letterList[(startLetter + obid)])
                    if letterAddSepBool:
                        baseName_list.insert(getIndex(letterPos), separator)
                if directionBool:
                    baseName_list.insert(getIndex(dirPos), direction)
                    if dirAddSepBool:
                        if prefix and suffix:
                            baseName_list.insert(getIndex(dirPos), separator)
                        elif dirPos != 'After Suffix':
                            baseName_list.insert(getIndex(dirPos), separator)
                if prefix:
                    baseName_list.insert(1, separator)
                if suffix:
                    baseName_list.insert(getIndex('before suffix'), separator)
                newName = ''.join(baseName_list)
                ob.rename(newName)
                result.append(ob)
        return result
示例#20
0
    def onApplyClick(self):
        # Base Name Variable
        separator = self.separator
        prefix = self.prefix_combobox.currentText()
        name = self.name_text.text()
        suffix = self.suffix_combobox.currentText()
        # Optional Name Variable Toggle State
        numBool = self.numberEnable_checkbox.checkState()
        numAddSepBool = self.numberAddSeparator_checkbox.checkState()
        letterBool = self.letterEnable_checkbox.checkState()
        letterIterBool = self.letterIterate_comboBox.currentIndex()
        letterAddSepBool = self.letterAddSeparator_checkbox.checkState()
        directionBool = self.directionEnable_checkbox.checkState()
        dirAddSepBool = self.directionAddSeparator_checkbox.checkState()
        renameChildBool = self.renameChild_radialbutton.isChecked()
        renameAllBool = self.renameAll_radialbutton.isChecked()
        # Optional Name Variable Position
        numPos = self.numberPosition_comboBox.currentText()
        letterPos = self.letterPosition_comboBox.currentText()
        dirPos = self.directionPosition_comboBox.currentText()
        # Optional Name Variable Value
        startNum = self.startNumber_spinBox.value()
        numPadding = self.numPadding_spinBox.value()
        startLetter = self.startletter_comboBox.currentIndex()
        direction = self.direction_comboBox.currentText()

        # Name List generate
        def getIndex(postext):
            if 'prefix' in postext.lower():
                if prefix:
                    if postext.lower().startswith('before'):
                        return baseName_list.index(prefix)
                    else:
                        return baseName_list.index(prefix) + 1
                else:
                    return 0
            if 'name' in postext.lower():
                if postext.lower().startswith('before'):
                    return baseName_list.index(name)
                else:
                    return baseName_list.index(name) + 1
            if 'suffix' in postext.lower():
                if suffix:
                    if postext.lower().startswith('before'):
                        return baseName_list.index(suffix)
                    else:
                        return baseName_list.index(suffix) + 1
                else:
                    return (len(baseName_list) - 1)

        ob_list = self.getOblist()
        if not name:
            msg = 'Name is empty, input Name String'
            pm.informBox('Error', msg)
            log.error(msg)
            return
        for obid, ob in enumerate(ob_list):
            if hasattr(ob, 'rename'):
                baseName_list = [prefix, name, suffix]
                letterIndex = (startLetter +
                               obid) if letterIterBool else startLetter
                if numBool:
                    baseName_list.insert(getIndex(numPos),
                                         ("{:0" + str(numPadding) +
                                          "d}").format(startNum + obid))
                    if numAddSepBool:
                        baseName_list.insert(getIndex(numPos), separator)
                if letterBool:
                    baseName_list.insert(getIndex(letterPos),
                                         self.letterList[letterIndex])
                    if letterAddSepBool:
                        baseName_list.insert(getIndex(letterPos), separator)
                if directionBool:
                    baseName_list.insert(getIndex(dirPos), direction)
                    if dirAddSepBool:
                        if prefix and suffix:
                            baseName_list.insert(getIndex(dirPos), separator)
                        elif dirPos != 'After Suffix':
                            baseName_list.insert(getIndex(dirPos), separator)
                if prefix:
                    baseName_list.insert(1, separator)
                if suffix:
                    baseName_list.insert(getIndex('before suffix'), separator)
                newName = ''.join(baseName_list)
                ob.rename(newName)
                if renameChildBool:
                    if suffix:
                        obname = ob.name().replace(self.separator + suffix, '')
                    else:
                        obname = ob.name()
                    # if len(ob.getChildren()) > 1:
                    childCount = len(ob.getChildren(type='transform'))
                    # print childCount, ob.getChildren(type='transform')
                    childs = iter_hierachy(ob)
                    i = 1
                    l = -1
                    for child in iter(childs):
                        if child == ob:
                            continue
                        if hasattr(child, 'getParent'):
                            if child.getParent() == ob:
                                i = 1
                                l += 1
                        if hasattr(child, 'rename'):
                            if childCount > 1:
                                childName = '{}_{}{:02d}{}'.format(
                                    obname, self.letterList[l], i,
                                    '_%s' % suffix if suffix else '')
                            else:
                                childName = '{}_{:02d}{}'.format(
                                    obname, i,
                                    '_%s' % suffix if suffix else '')
                            child.rename(childName)
                            i += 1
示例#21
0
    def setup_space_switch(self,
                           nDriven=None,
                           aDrivers=None,
                           bCreateWolrdNode=False,
                           bCreateParent=True):
        """
            Setup a new space switch system on the node
            """
        aCurSel = pymel.selected()
        if aDrivers == None:
            aParent = aCurSel[0:-1]
        else:
            aParent = aDrivers

        bContinue = False
        #Create the worldNode
        if (not self.worldNode and bCreateWolrdNode):
            self.worldNode = pymel.createNode("transform", n="dp_sp_worldNode")
            ctrlUtil.setLockHide(
                [self.worldNode.__melobject__()],
                ['tx', 'ty', 'tz', 'rx', 'ry', 'rz', 'sx', 'sy', 'sz'])

        if (self.worldNode):
            self.aDrivers.append(self.worldNode)
            self.aDriversSubName.append("World")

        if (not nDriven):
            if (len(aCurSel) == 0):
                pymel.informBox(
                    "Space Switcher",
                    "You need to choose at least the node to constraint")
            #The user only selected the driven node, so create a space switch between it's parent and the world
            elif (len(aCurSel) == 1):
                self.nDriven = aCurSel[0]
                bContinue = True
            else:
                self.nDriven = aCurSel[-1]
                bContinue = True
        else:
            self.nDriven = nDriven
            bContinue = True

        if bContinue:
            #Setup the intermediate node to manage the spaceSwitch
            if bCreateParent:
                self.nSwConstRecept = pymel.PyNode(
                    utils.zeroOut(
                        transformList=[self.nDriven.__melobject__()])[0])
                self.nSwConstRecept.rename(self.nDriven.name() + "_SW_Const")
            else:
                self.nSwConstRecept = self.nDriven.getParent()
            m4Driven = self.nDriven.getMatrix(worldSpace=True)
            self.nSwConstRecept.setMatrix(m4Driven, worldSpace=True)
            self.nDriven.setParent(self.nSwConstRecept)

            #Create the parent constraint for the first node, but add the other target manually
            if (bCreateWolrdNode):
                self.nSwConst = pymel.parentConstraint(self.worldNode,
                                                       self.nSwConstRecept,
                                                       n=self.nDriven.name() +
                                                       "_SpaceSwitch_Const",
                                                       mo=True)
            else:
                self.nSwConst = pymel.parentConstraint(aParent[0],
                                                       self.nSwConstRecept,
                                                       n=self.nDriven.name() +
                                                       "_SpaceSwitch_Const",
                                                       mo=True)
                self.aDrivers.append(aParent[0])
                self.aDriversSubName.append(aParent[0].name())
                aParent = aParent[1:]

            self.nSwConst.getWeightAliasList()[0].set(0.0)

            #Setup the first key for the current activate constraint, targets offset and rest position
            pymel.setKeyframe(self.nSwConst.getWeightAliasList()[0],
                              t=0,
                              ott="step")
            pymel.setKeyframe(self.nSwConst.target[0].targetOffsetTranslate,
                              t=0,
                              ott="step")
            pymel.setKeyframe(self.nSwConst.target[0].targetOffsetRotate,
                              t=0,
                              ott="step")
            pymel.setKeyframe(self.nSwConst.restTranslate, t=0, ott="step")
            pymel.setKeyframe(self.nSwConst.restRotate, t=0, ott="step")

            self.add_target(aParent, firstSetup=True)

            pymel.select(nDriven)