def getGroupCount(self):
     groupCount = self.text_groupCount.text()
     try:
         if int(groupCount) >= 1:
             return int(groupCount)
     except:
         ld.msg('Please input a integer!')
         return 0
Exemple #2
0
 def checkUVBleed(self):
     cmds.undoInfo(ock = 1)
     try:
         minShellBleed = int(self.text_borderBleed.text())
         minBorderBleed = int(self.text_borderBleed.text())
         uvSize = int(self.box_textureSize.currentText())
     except:
         ld.msg("Input value is not valid!")
     LD_CheckUVBleed(uvSize,minShellBleed,minBorderBleed)
     cmds.undoInfo(cck = 1)
 def LDRibbonTools_getMesh(self):
     sel = ld.ls(0, 'mesh')
     if sel == None:
         sel = self.LDRibbonTools_getBaseMesh()
         if sel == None:
             ld.msg("Please Select Something!")
             return
         return sel
     else:
         return sel
 def setTargetFaces(self):
     sel = cmds.ls(sl=1)
     try:
         selType = sel[0].split('.')[1][0]
         if selType == 'f':
             self.btn_selectTargetFaces.setText(str(sel))
         else:
             ld.msg("Please select faces!")
     except:
         self.btn_selectTargetFaces.setText('...')
         ld.msg("Please select faces!")
Exemple #5
0
 def generate(self):
     cmds.undoInfo(ock=1)
     try:
         count = int(self.text_strandsCount.text())
     except:
         ld.msg("Input count is not valid!")
     if self.btn_normalRope.isChecked():
         self.generateNormalRope(count)
     else:
         self.generateHelixRope(count)
     cmds.undoInfo(cck=1)
def deleteAndCopy(sourcePath, targetPath):
    # If exsits, delete in case error
    if os.path.isdir(targetPath):
        try:
            shutil.rmtree(targetPath)
        except:
            ld.msg("Delete failed!")
    # Copy To Target Path
    try:
        shutil.copytree(sourcePath, targetPath)
    except:
        ld.msg("Copy failed!")
 def selectByEdgeCount(self):
     cmds.undoInfo(ock=1)
     count = self.text_nCount.text()
     if self.btn_edgeLoop.isChecked():
         selectType = 'edgeLoopOrBorder'
     else:
         selectType = 'edgeRing'
     try:
         count = int(count)
         mel.eval("polySelectEdgesEveryN " + selectType + " " + str(count))
     except:
         ld.msg("Count should be an integer!")
     cmds.undoInfo(cck=1)
def LDRibbonToolsUI_show():
    if not ld.existsCmd('createCurveWarp'):
        try:
            cmds.loadPlugin('curveWarp')
        except:
            ld.msg("Please Update to 2017!")
    if cmds.window(ldmt_window_name, ex=1):
        if cmds.window(ldmt_window_name, q=1, vis=1):
            cmds.window(ldmt_window_name, e=1, vis=0)
        else:
            cmds.window(ldmt_window_name, e=1, vis=1)
    else:
        ui = LDRibbonToolsUI_cls()
        ui.show()
 def ribbonMaster_random(self, ribbonAttr_msg):
     sel = cmds.ls(sl=1, o=1)
     randomPercentage = self.text_randomIntensity.text()
     try:
         randomPercentage = int(randomPercentage)
     except:
         ld.msg("Input is not valid!")
     for each in sel:
         if cmds.attributeQuery("twistRotation", node=each, ex=1):
             if ribbonAttr_msg == "width":
                 ribbonAttr = "widthScale"
             elif ribbonAttr_msg == "taper":
                 ribbonAttr = "scaleTip"
             elif ribbonAttr_msg == "curvature":
                 ribbonAttr = "curvature"
             elif ribbonAttr_msg == "rotation":
                 ribbonAttr = "rotation"
             elif ribbonAttr_msg == "twist":
                 ribbonAttr = "twistRotation"
         if not cmds.attributeQuery("twistRotation", node=each, ex=1):
             if ribbonAttr_msg == "width":
                 ribbonAttr = "width"
             elif ribbonAttr_msg == "taper":
                 ribbonAttr = "taper"
             elif ribbonAttr_msg == "curvature":
                 ribbonAttr = "curvature"
             elif ribbonAttr_msg == "rotation":
                 ribbonAttr = "orientation"
             elif ribbonAttr_msg == "twist":
                 ribbonAttr = "twist"
         ribbonAttrName = each + '.' + ribbonAttr
         ribbonAttrCurrentValue = cmds.getAttr(ribbonAttrName)
         baseValue = ribbonAttrCurrentValue
         if ribbonAttr == "rotation":
             constValue = 180
             if random.random() > 0.5:
                 targetValue = baseValue + constValue * randomPercentage / 100.0 * random.random(
                 )
             else:
                 targetValue = baseValue - constValue * randomPercentage / 100.0 * random.random(
                 )
         else:
             if random.random() > 0.5:
                 targetValue = baseValue * (
                     1 - randomPercentage / 100.0 * random.random())
             else:
                 targetValue = baseValue * (
                     1 + 2 * randomPercentage / 100.0 * random.random())
         ribbonAttrCurrentValue = cmds.getAttr(ribbonAttrName)
         cmds.setAttr(ribbonAttrName, targetValue)
 def remesh(self):
     targetCount = self.text_targetCount.toPlainText()
     try:
         if targetCount.endswith('%'):
             sel = cmds.ls(sl=1, o=1)
             sel = sel[0]
             currentFaceCount = int(cmds.polyEvaluate(sel, f=True))
             targetCount = 2 * int(
                 currentFaceCount * float(targetCount[:-1]) / 100)
         else:
             targetCount = int(targetCount)
     except:
         ld.msg('Please input a number or ratio!')
         return
     self.instantMeshes_remesh(targetCount)
def spiralGen():
    ldmt_plugin_path = ld.getPath('LDMT') + '/ldmt_plugin'
    pluginPath = ldmt_plugin_path + "/curve2spiral.py"
    if cmds.pluginInfo("curve2spiral", q=1, l=1) != 1:
        cmds.loadPlugin(pluginPath)
    sel = cmds.ls(sl=1)
    sel = cmds.filterExpand(sel, sm=9)
    if len(sel) > 0:
        for i in sel:
            shapes = cmds.listRelatives(i, children=1)
            shape = shapes[0]
            node = cmds.createNode("curveSpiral")
            cmds.connectAttr(shape + ".worldSpace", node + '.ic')
            outputNode = cmds.createNode("nurbsCurve")
            cmds.connectAttr(node + '.oc', outputNode + '.create')
            cmds.select([outputNode, node], r=1)
    else:
        ld.msg("No Curve Selected!")
 def selectSetObjects(self, sel):
     if sel != '...':
         sel = ast.literal_eval(sel)
         cmds.select(sel, r=1)
     else:
         ld.msg('Nothing selected')
Exemple #13
0
    def ldmt_function(self, message):
        cmds.undoInfo(ock=1)
        # Basic Panels
        if message == "UV":
            ldmt_toggleUI.toggleUI('UV')
        elif message == "Shader":
            ldmt_toggleUI.toggleUI('hypershade')
        elif message == "Outliner":
            ldmt_toggleUI.toggleUI('outliner')
        # Transform Tools
        elif message == "Mirror Tool":
            from ldmt_function import ldmt_mirrorTool
            reload(ldmt_mirrorTool)
            ldmt_mirrorTool.ldmt_show()
        elif message == "Reset Pivot":
            from ldmt_function import ldmt_resetPivot
            ldmt_resetPivot.resetPivot()
        elif message == "Flatten Tool":
            from ldmt_function import ldmt_flattenTool
            reload(ldmt_flattenTool)
            ldmt_flattenTool.ldmt_show()
        elif message == "Delete History":
            from ldmt_function import ldmt_deleteHistory
            reload(ldmt_deleteHistory)
            ldmt_deleteHistory.deleteHistory()
        elif message == "Morph To UV":
            from ldmt_function import ldmt_morphToUV
            ldmt_morphToUV.runMorph2UV()
        elif message == "Turbo Smooth":
            from ldmt_function import ldmt_turboSmooth
            ldmt_turboSmooth.ldmt_turboSmooth()
        elif message == "Circularize":
            if ld.MAYA_version_float <= 2017:
                if mel.eval('exists "CircularizeVtxCmd"'):
                    mel.eval("CircularizeVtxCmd")
                else:
                    pluginFile = ldmt_function_path + '/CircularizeVtxCmd.py'
                    cmds.loadPlugin(pluginFile)
                    mel.eval("CircularizeVtxCmd")
            else:
                cmds.polyCircularize()
        elif message == "Rebuild Subdiv":
            from ldmt_function import ldmt_rebuildSubdiv
            ldmt_rebuildSubdiv.ldmt_rebuildSubdiv()
        elif message == "Nanomesh":
            from ldmt_function import ldmt_nanomesh
            reload(ldmt_nanomesh)
            ldmt_nanomesh.ldmt_show()
        elif message == "Insert Mesh":
            mods = cmds.getModifiers()
            pluginPath = ldmt_function_path + '/duplicateOverSurface.mll'
            if cmds.pluginInfo(pluginPath, q=1, l=1) != 1:
                cmds.loadPlugin(pluginPath)
            if mods == 0:
                cmds.duplicateOverSurface(cmds.ls(sl=True, long=True)[0])
            elif mods == 4:
                cmds.duplicateOverSurface(cmds.ls(sl=True, long=True)[0],
                                          rotation=False)
        elif message == "Instant Meshes":
            from ldmt_function import ldmt_instantMeshes
            reload(ldmt_instantMeshes)
            ldmt_instantMeshes.ldmt_show()
        elif message == "Topo Blendshape":
            import geometryWalker.QT.pickWalker_UI as pickWalker_UI
            pickWalker_UI.pickWalkerUI()
        elif message == "Face Transfer":
            import faceTransfer.ui
            faceTransfer.ui.show()
        elif message == "Cloth Transfer":
            from ldmt_function import ldmt_clothTransfer
            reload(ldmt_clothTransfer)
            ldmt_clothTransfer.ldmt_show()
        elif message == "Marvelous Tool":
            from ldmt_function import ldmt_marvelousTool
            ldmt_marvelousTool.ldmt_show()

        # Select Tools
        elif message == "Select Hard Edges":
            from ldmt_function import ldmt_hardEdges
            ldmt_hardEdges.selectHardEdges()
        elif message == "Select UV Borders":
            from ldmt_function import ldmt_UVBorders
            ldmt_UVBorders.selectUVEdgeBorders()
        elif message == "Random Selector":
            from ldmt_function import ldmt_randomSelector
            reload(ldmt_randomSelector)
            ldmt_randomSelector.ldmt_show()
        elif message == "Custom Grouper":
            from ldmt_function import ldmt_customGrouper
            reload(ldmt_customGrouper)
            ldmt_customGrouper.ldmt_show()
        elif message == "N Edge Selector":
            from ldmt_function import ldmt_nEdgeSelector
            reload(ldmt_nEdgeSelector)
            ldmt_nEdgeSelector.ldmt_show()
        elif message == "Toggle Camera Selection":
            if self.ui.btn_toggleCamSel.text() == "Turn Cam Sel On":
                cmds.selectPref(useDepth=1)
                self.ui.btn_toggleCamSel.setText("Turn Cam Sel Off")
            else:
                cmds.selectPref(useDepth=0)
                self.ui.btn_toggleCamSel.setText("Turn Cam Sel On")
        # Generate Tools
        elif message == "Spiral":
            from ldmt_function import ldmt_spiralGen
            reload(ldmt_spiralGen)
            ldmt_spiralGen.spiralGen()
        elif message == "Instance":
            from ldmt_function import ldmt_instanceGen
            reload(ldmt_instanceGen)
            ldmt_instanceGen.instanceGen()
        elif message == "Ribbon":
            from ldmt_function import ldmt_ribbonGen
            from ldmt_function import ldmt_fixReverse
            ldmt_ribbonGen.ribbonGen()
            ldmt_fixReverse.fixReverse()
            ld.showChannelBox()
        elif message == "Tube":
            from ldmt_function import ldmt_tubeGen
            from ldmt_function import ldmt_fixReverse
            sel = cmds.ls(sl=1)
            ldmt_tubeGen.tubeGen(sel[0])
            ldmt_fixReverse.fixReverse()
            ld.showChannelBox()
        elif message == "Seams":
            cmds.undoInfo(swf=False)
            maya_version = cmds.about(version=1)
            if maya_version == '2016':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2016.mll"
            elif maya_version == '2016.5':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2016.5.mll"
            elif maya_version == '2017':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2017.mll"
            elif maya_version == '2018':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2018.mll"
            if cmds.pluginInfo(pluginPath, q=1, l=1) != 1:
                cmds.loadPlugin(pluginPath)
            cmds.undoInfo(swf=True)
            mel.eval("seamsEasy")
        elif message == "Stitches":
            cmds.undoInfo(swf=False)
            maya_version = cmds.about(version=1)
            if maya_version == '2016':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2016.mll"
            elif maya_version == '2016.5':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2016.5.mll"
            elif maya_version == '2017':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2017.mll"
            elif maya_version == '2018':
                pluginPath = ldmt_plugin_path + "/seamsEasy_x64_2018.mll"
            if cmds.pluginInfo(pluginPath, q=1, l=1) != 1:
                cmds.loadPlugin(pluginPath)
            cmds.undoInfo(swf=True)
            mel.eval("stitchEasy")
        elif message == "Rope":
            from ldmt_function import ldmt_rope
            reload(ldmt_rope)
            ldmt_rope.ldmt_show()
        elif message == "Braid":
            from ldmt_function import ldmt_braidGen
            ldmt_braidGen.braidGen()
        elif message == "Edge To Curve":
            from ldmt_function import ldmt_edgeToCurve
            ldmt_edgeToCurve.edgeToCurve()
        elif message == "Ribbon Tools":
            LDRibbonToolsUI_show()
        elif message == "Curve On Mesh":
            startDraw()
        elif message == "Clean Procedure":
            from ldmt_function import ldmt_cleanProcedure
            ldmt_cleanProcedure.cleanProcedure()
        elif message == "Find Description":
            from ldmt_function import ldmt_findXgenDescription
            reload(ldmt_findXgenDescription)
            description = ldmt_findXgenDescription.findXgenDescription()
        elif message == "Align Ribbon UV":
            from ldmt_function import ldmt_alignRibbonUV
            ldmt_alignRibbonUV.xgenRibbonAlignUV()
        # UV Tools
        elif message == "UV Deluxe":
            from ldmt_function.UVDeluxe import uvdeluxe
            uvdeluxe.createUI()
        elif message == "Overlap UV Out":
            from ldmt_function import ldmt_moveOverlapUVOut
            ldmt_moveOverlapUVOut.LD_moveOverlapUVOut()
        elif message == "Overlap UV In":
            from ldmt_function import ldmt_move2rdUVIn
            ldmt_move2rdUVIn.LD_move2rdUVIn()
        elif message == "Quick UV":
            pluginPath = 'Unfold3D'
            if cmds.pluginInfo(pluginPath, q=1, l=1) != 1:
                cmds.loadPlugin(pluginPath)
            quickUVMel = ldmt_function_path + '/quickUV.mel'
            message = 'source "' + quickUVMel + '"'
            mel.eval(message)
        elif message == "Check UV Bleed":
            from ldmt_function import ldmt_checkUVBleed
            reload(ldmt_checkUVBleed)
            ldmt_checkUVBleed.ldmt_show()
        elif message == "Switch UV Set":
            sel = ld.ls(0, 'mesh')
            ld.switchUVSet(sel)
        elif message == "Unfold Seam":
            from ldmt_function import ldmt_unfoldSeam
            ldmt_unfoldSeam.main()
        elif message == "Unwrap Ribbon":
            from ldmt_function import ldmt_unwrapRibbon
            ldmt_unwrapRibbon.unwrapRibbon()
        # Debug Tools
        elif message == "Scene Optimize":
            mel.eval("OptimizeSceneOptions")
        elif message == "Clean Mesh":
            from ldmt_function import ldmt_cleanMesh
            ldmt_cleanMesh.ldmt_show()
        elif message == "Normal Facet":
            from ldmt_function import ldmt_normalFacet
            reload(ldmt_normalFacet)
            ldmt_normalFacet.normalFacet()
        elif message == "Delete Namespace":
            from ldmt_function import ldmt_deleteNamespace
            ldmt_deleteNamespace.deleteNamespace()
        elif message == "Rename":
            melPath = ldmt_function_path + '/patternRename.mel'
            message = 'source "' + melPath + '"'
            mel.eval(message)
            mel.eval('patternRename')
        elif message == "Ungroup":
            sel = cmds.ls(sl=1)
            for i in sel:
                try:
                    cmds.ungroup(i)
                except:
                    pass
        elif message == "Reverse By View":
            from ldmt_function import ldmt_fixReverse
            reload(ldmt_fixReverse)
            ldmt_fixReverse.fixReverse()
        elif message == "Display":
            from ldmt_function import ldmt_display
            reload(ldmt_display)
            ldmt_display.ldmt_show()
        elif message == "Plugin Clean":
            from ldmt_function import ldmt_pluginClean
            ldmt_pluginClean.pluginClean()
        elif message == "Reset Pref":
            from ldmt_function import ldmt_resetPref
            ldmt_resetPref.resetPref()
        # Common Panels
        elif message == "Plugin":
            ldmt_toggleUI.toggleUI('plugin')
        elif message == "Preference":
            ldmt_toggleUI.toggleUI('preference')
        elif message == "HyperGraph":
            ldmt_toggleUI.toggleUI('hypergraph')
            print('hahahah')
        elif message == "Node":
            ldmt_toggleUI.toggleUI('node')
        elif message == "Namespace":
            ldmt_toggleUI.toggleUI('namespace')
        elif message == "Hotkey":
            ldmt_toggleUI.toggleUI('hotkey')
        # File
        elif message == "Quick Export":
            from ldmt_function import ldmt_quickExport
            reload(ldmt_quickExport)
            ldmt_quickExport.ldmt_show()
        elif message == "Open Current Folder":
            from ldmt_function import ldmt_openFolder
            ldmt_openFolder.openFolder()
        # Info
        elif message == "Add Button To Shelf":
            from ldmt_function import addToShelf
            reload(addToShelf)
            addToShelf.addToShelf()
        elif message == "Search Command":
            from ldmt_function import vt_quicklauncher
            vt_quicklauncher.show()
        elif message == "Links":
            os.startfile('https://github.com/xgits/LD_MayaToolbox2')
        elif message == "Help Manual":
            os.startfile('https://github.com/xgits/LD_MayaToolbox2')
        elif message == "Update":
            os.startfile('https://github.com/xgits/LD_MayaToolbox2')
        #Texture Tools
        elif message == "Texture Render":
            from ldmt_function import ldmt_textureRender
            reload(ldmt_textureRender)
            ldmt_textureRender.ldmt_show()
        elif message == "Haircap To UV":
            from ldmt_function import ldmt_haircapToUV
            ldmt_haircapToUV.haircapToUV()
        cmds.undoInfo(cck=1)
        toolMessage = ["Mirror Tool", "Flatten Tool", "Nanomesh", "Instant Meshes", "Cloth Transfer", "Random Selector","Custom Grouper",\
                        "N Edge Selector","Rope","Ribbon Tools","Check UV Bleed","Scene","Clean Mesh","Display","Quick Export",\
                        "Texture Render","Marvelous Tool"]
        if message in toolMessage:
            self.toggleToolBtnByMsg(message)

        ld.msg(message)
        postUsername = userName.replace(' ', '_', 10)
        postCommand = message.replace(' ', '_', 10)
        ldmt_postInfo(postUsername, postCommand)
 def selectSetObjects(self, sel):
     if sel != '...':
         cmds.select(sel, r=1)
     else:
         ld.msg('Nothing selected')
def LDRibbonTools_ribbonFromMesh(sel):
    #prepare inputs
    curves = ld.ls('curve')
    material = LDRibbonTools_getMaterial(sel)
    cornerVtx_uv = LDRibbonTools_getRibbonUV(sel)
    ribbonCurrentSubdiv = LDRibbonTools_getRibbonSubdiv(sel)
    currentSubdiv_width = ribbonCurrentSubdiv[1]
    currentSubdiv_length = ribbonCurrentSubdiv[0]

    #if no inputs
    if curves == None:
        ld.msg("Select some curves first!")
        return
    elif sel == None:
        ld.msg("Select some mesh first!")
        return
    elif cornerVtx_uv == None or len(cornerVtx_uv) != 4:
        ld.msg("Select ribbon mesh first!")
        return
    #prepare groups
    bendGroupName = cmds.group(n="bendHandle#", em=1)
    groupName = cmds.group(n="ribbonMeshGroup#", em=1)
    cmds.hide(bendGroupName)
    createdMesh = []

    for i in curves:
        polyCreateName = cmds.polyPlane(sx=currentSubdiv_width,
                                        sy=currentSubdiv_length)
        cmds.hyperShade(assign=material)
        polyName = polyCreateName[0]
        polyPlaneName = polyCreateName[1]
        cmds.setAttr(polyName + '.rz', -90)
        ld.freeze(polyName)
        bendCreateName = cmds.nonLinear(polyName,
                                        type='bend',
                                        lowBound=-1,
                                        highBound=1,
                                        curvature=0)
        bendName = bendCreateName[0]
        bendHandleName = bendCreateName[1]
        curveLength = cmds.arclen(i)
        curveWarpName = cmds.createCurveWarp(polyName, i)
        # default value for polyPlane
        cmds.setAttr(curveWarpName + '.alignmentMode', 4)  #align z
        cmds.setAttr(polyPlaneName + '.height', curveLength)  #max length

        sliderList = LDRibbonTools_getSliderList()
        attrAddList = sliderList['attrName']
        minValue = sliderList['minValue']
        maxValue = sliderList['maxValue']
        softMinValue = sliderList['softMinValue']
        softMaxValue = sliderList['softMaxValue']
        precision = sliderList['precision']
        defaultValue = sliderList['value']

        for index in range(len(sliderList['attrName'])):
            attributeType = 'long' if precision[index] == 0 else 'double'
            cmds.addAttr(polyName,
                         ln=attrAddList[index],
                         min=minValue[index],
                         smn=softMinValue[index],
                         max=maxValue[index],
                         smx=softMaxValue[index],
                         at=attributeType,
                         dv=defaultValue[index],
                         k=1)

        cmds.addAttr(polyName,
                     ln="twistReverse",
                     min=0,
                     max=1,
                     at="long",
                     dv=0,
                     k=1)
        cmds.addAttr(polyName,
                     ln="curvature",
                     min=-180,
                     max=180,
                     at="long",
                     dv=0,
                     k=1)

        polyTwistReverse = polyName + '.twistReverse'
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistReverse,
                           'LDRibbonTools_ribbon_updateTwistReverse("' +
                           polyName + '","' + curveWarpName + '")'
                       ])
        LDRibbonTools_scriptJob_twistReverse = 'cmds.scriptJob(ro=0, ac=["' + polyTwistReverse + '", \'LDRibbonTools_ribbon_updateTwistReverse("' + polyName + '","' + curveWarpName + '")\'])'
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistReverse,
                        n="ldCurveWarpScriptNode#",
                        stp="python")

        cmds.connectAttr(polyName + '.flip', curveWarpName + '.flipAxis')
        cmds.expression(s=curveWarpName + ".maxScale" + '=' + polyName +
                        ".widthScale*2")
        cmds.expression(s=curveWarpName + ".lengthScale" + '=' + polyName +
                        ".lengthScale/100")
        cmds.expression(s=curveWarpName + ".offset" + '=' + polyName +
                        ".offset/100")
        cmds.connectAttr(polyName + '.rotation', curveWarpName + '.rotation')
        cmds.connectAttr(polyName + '.curvature', bendName + '.curvature')

        polyTwistRotation = polyName + '.twistRotation'
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistRotation,
                           'LDRibbonTools_ribbon_updateTwistRotation("' +
                           polyName + '","' + curveWarpName + '")'
                       ])
        LDRibbonTools_scriptJob_twistRotation = 'cmds.scriptJob(ro=0, ac=["' + polyTwistRotation + '", \'LDRibbonTools_ribbon_updateTwistRotation("' + polyName + '","' + curveWarpName + '")\'])'
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistRotation,
                        n="ldCurveWarpScriptNode#",
                        stp="python")

        cmds.setAttr(curveWarpName + '.twistCurve[0].twistCurve_Value', 0.001)
        cmds.setAttr(curveWarpName + '.twistCurve[3].twistCurve_Value', 0.999)

        polySubdivLength = polyName + '.subdivLength'
        polySubdivWidth = polyName + '.subdivWidth'
        polyPlaneSubdivLength = polyPlaneName + '.subdivisionsHeight'
        polyPlaneSubdivWidth = polyPlaneName + '.subdivisionsWidth'
        cmds.scriptJob(ro=0,
                       ac=[
                           polySubdivLength,
                           'LDRibbonTools_ribbon_updateSubdiv("' + polyName +
                           '","' + polyPlaneName + '")'
                       ])
        cmds.scriptJob(ro=0,
                       ac=[
                           polySubdivWidth,
                           'LDRibbonTools_ribbon_updateSubdiv("' + polyName +
                           '","' + polyPlaneName + '")'
                       ])
        LDRibbonTools_scriptJob_subdivLength = 'cmds.scriptJob(ro=0, ac=["' + polySubdivLength + '", \'LDRibbonTools_ribbon_updateSubdiv("' + polyName + '","' + polyPlaneName + '")\'])'
        LDRibbonTools_scriptJob_subdivWidth = 'cmds.scriptJob(ro=0, ac=["' + polySubdivWidth + '",  \'LDRibbonTools_ribbon_updateSubdiv("' + polyName + '","' + polyPlaneName + '")\'])'
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_subdivLength,
                        n="ldCurveWarpScriptNode#",
                        stp="python")
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_subdivWidth,
                        n="ldCurveWarpScriptNode#",
                        stp="python")

        polyTwistStartPos = polyName + '.twistStartPos'
        polyTwistStartValue = polyName + '.twistStartValue'
        curveTwistStartPos1 = curveWarpName + '.twistCurve[1].twistCurve_Position'
        curveTwistStartPos2 = curveWarpName + '.twistCurve[2].twistCurve_Position'
        curveTwistStartValue1 = curveWarpName + '.twistCurve[1].twistCurve_Value'
        curveTwistStartValue2 = curveWarpName + '.twistCurve[2].twistCurve_Value'
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistStartPos,
                           'LDRibbonTools_setAttr("' + curveTwistStartPos1 +
                           '","' + polyTwistStartPos + '",0.01)'
                       ])
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistStartPos,
                           'LDRibbonTools_setAttr("' + curveTwistStartPos2 +
                           '","' + polyTwistStartPos + '",0.01)'
                       ])
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistStartValue,
                           'LDRibbonTools_setAttr("' + curveTwistStartValue1 +
                           '","' + polyTwistStartValue + '",0.01)'
                       ])
        cmds.scriptJob(ro=0,
                       ac=[
                           polyTwistStartValue,
                           'LDRibbonTools_setAttr("' + curveTwistStartValue2 +
                           '","' + polyTwistStartValue + '",0.01)'
                       ])
        LDRibbonTools_scriptJob_twistStartPos1 = 'cmds.scriptJob(ro=0, ac=["' + polyTwistStartPos + '", \'LDRibbonTools_setAttr("' + curveTwistStartPos1 + '","' + polyTwistStartPos + '",0.01)\'])'
        LDRibbonTools_scriptJob_twistStartPos2 = 'cmds.scriptJob(ro=0, ac=["' + polyTwistStartPos + '", \'LDRibbonTools_setAttr("' + curveTwistStartPos2 + '","' + polyTwistStartPos + '",0.01)\'])'
        LDRibbonTools_scriptJob_twistStartValue1 = 'cmds.scriptJob(ro=0, ac=["' + polyTwistStartValue + '", \'LDRibbonTools_setAttr("' + curveTwistStartValue1 + '","' + polyTwistStartValue + '",0.01)\'])'
        LDRibbonTools_scriptJob_twistStartValue2 = 'cmds.scriptJob(ro=0, ac=["' + polyTwistStartValue + '", \'LDRibbonTools_setAttr("' + curveTwistStartValue2 + '","' + polyTwistStartValue + '",0.01)\'])'
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistStartPos1,
                        n="ldCurveWarpScriptNode#",
                        stp="python")
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistStartPos2,
                        n="ldCurveWarpScriptNode#",
                        stp="python")
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistStartValue1,
                        n="ldCurveWarpScriptNode#",
                        stp="python")
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_twistStartValue2,
                        n="ldCurveWarpScriptNode#",
                        stp="python")

        polyScaleRoot = polyName + '.scaleRoot'
        polyScaleTip = polyName + '.scaleTip'
        curveScaleRoot = curveWarpName + '.scaleCurve[0].scaleCurve_Value'
        curveScaleTip = curveWarpName + '.scaleCurve[3].scaleCurve_Value'
        cmds.scriptJob(ro=0,
                       ac=[
                           polyScaleRoot, 'LDRibbonTools_setAttr("' +
                           curveScaleRoot + '","' + polyScaleRoot + '",0.01)'
                       ])
        cmds.scriptJob(ro=0,
                       ac=[
                           polyScaleTip, 'LDRibbonTools_setAttr("' +
                           curveScaleTip + '","' + polyScaleTip + '",0.01)'
                       ])
        LDRibbonTools_scriptJob_scaleRoot = 'cmds.scriptJob(ro=0, ac=["' + polyScaleRoot + '", \'LDRibbonTools_setAttr("' + curveScaleRoot + '","' + polyScaleRoot + '",0.01)\'])'
        LDRibbonTools_scriptJob_scaleTip = 'cmds.scriptJob(ro=0, ac=["' + polyScaleTip + '", \'LDRibbonTools_setAttr("' + curveScaleTip + '","' + polyScaleTip + '",0.01)\'])'
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_scaleRoot,
                        n="ldCurveWarpScriptNode#",
                        stp="python")
        cmds.scriptNode(st=2,
                        bs=LDRibbonTools_scriptJob_scaleTip,
                        n="ldCurveWarpScriptNode#",
                        stp="python")

        # edit uv
        LDRibbonTools_ribbon_recoverUV(polyName, cornerVtx_uv,
                                       currentSubdiv_width,
                                       currentSubdiv_length)
        # group closure
        LDRibbonTools_movePivotToCurve0()
        cmds.parent(polyName, groupName)
        cmds.parent(bendHandleName, bendGroupName)
        createdMesh.append(polyName)
    cmds.select(createdMesh, r=1)