Files
gtav-src/tools_ng/wildwest/script/3dsMax/Characters/Rigging/mrSkeleton/mrSkeleton.ms
T
2025-09-29 00:52:08 +02:00

2328 lines
72 KiB
Plaintext
Executable File

gc()
-- Load the common maxscript functions
boneTagArray =#()
BoneNameArray=#()
filein (RsConfigGetWildWestDir() + "script/3dsMax/_config_files/Wildwest_header.ms")
filein (RsConfigGetWildWestDir() + "script/3dsMax/Characters/Rigging/mrSkeleton_v2/mrSkeleton_2_ui.ms")
-- RsCollectToolUsageData (getThisScriptFilename())
-- --N.B. ENSURE YOU HAVE THE LATEST IN /ART/PEDS/SKELETONS/MRSKELETON/
-- global mrSkelActive = true
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- legArray = undefined
-- spineForwardArray = undefined
-- spineBackArray = undefined
-- transTags = undefined
--
-- ddListArray = undefined
-- boneCreateAlignArray = undefined --populated from the definitions file. An array of nodes and how to align them during creation
-- skelMarkerDefintion = undefined
-- rotationOffsetOffNodes = undefined
--
-- masterMarkerArray = #() --this gets defined during skeleton defnition
--
-- markerParentingArray = #() --dynamically created multi dim array with parent as first node then children as next ones this is different to the reg version as this makes use of ensuring that only centre line nodes are used
-- regularParentingMarkerArray = #() --dynamically created multi dim array with parent as first node then children as next ones
--
-- -- skelType = ddListArray[1]
--
-- defaultbonewidth = 0.05
-- defaultfinsize = 0.01
-- SkelArr = #()
-- skelType = undefined
--
-- debugPrintVal = undefined
-- phParents = undefined
-- rotationOffsetOffNodes = undefined --this gets defined depending upon which skeleton type we choose
-- planarMarkerArray = undefined --this gets populated depending upon which skeleton type we choose
-- connectedMarkerNodes = undefined --this gets defined during skeleton choice. 2d array of master and child markers which get wired otgether
-- transTaggedBones = undefined
-- -- orientNodes = undefined
-- feetNodes = undefined
-- isStretchy = undefined
-- bonePrefix = undefined
-- orderedSkeletonArray = #()--populated during skeleton definition
-- previousBoneZAxis = undefined
-- legArray = #()
-- armArray = #()
-- -- ctrlRigParentingArray = undefined
-- CTRLRIGPelvisArray = #()
-- -- CTRLRIGpelvisAuxChildren = undefined
-- --
-- -- CTRLRIGpelvisChildren = undefined
-- --
-- -- CTRLRIGpelvis1Children = undefined
-- --
-- -- CTRLRIGpelvisRootChildren = undefined
-- wingNodes = undefined
-- -- realignTheseJoints = undefined
-- WingArray = #()
-- customLegOrient = undefined
-- tempMarkerArray = #(#(),#()) --gets used during the unparent and parent marker array functions
-- filein (RsConfigGetWildWestDir() + "script/3dsMax/characters/rigging/mrSkeleton/mrSkeletonDefinitions.ms")
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- fn debugPrint printStr = --this is a little function to replace the debugPrint command. This allows us then to be able to globally turn on and off debugPrint cstatements.
-- (
-- if debugPrintVal == true do
-- (
-- Print printStr
-- )
-- )
-- fn genSpecFile = --generates a spec file for the anim export based off tags on joints then adds to p4
-- (
-- if maxfilename != "" then
-- (
-- --get all of the nodes which are skel nodes
-- skelNodes = #()
-- for o in objects do
-- (
-- if (substring o.name 1 4) == "SKEL" do
-- (
-- append skelNodes o
-- )
-- )
--
-- currentAnimal = (filterstring maxfilename "_")
-- currentAnimal = (filterstring currentAnimal[3] ".")
-- currentAnimal = currentAnimal[1]
-- output_name = ("x:/gta5/tools/etc/config/anim/control_templates/FullBody_"+currentAnimal+"_Spec.xml")
-- existing = doesFileExist output_name
--
-- if existing == true do
-- (
-- gRsPerforce.sync output_name silent:true
-- gRsPerforce.edit output_name silent:true
--
-- --this is a little hacky but we'll now delete the file if it exists
-- deleteFile output_name
-- )
--
-- if output_name != undefined then
-- (
-- output_file = createfile output_name
--
-- --first off we create the header
--
-- hc1 = ("<rage__AnimExportCtrlSpec>"+"\r"+"\t"+"<TrackSpecs>"+"\r\t\t"+"<Item>"+"\r\t\t\t"+"<nameExpr>root</nameExpr>"+"\r\t\t\t"+"<bIncludeChildren value="+"\""+"false"+"\""+"/>")
-- hc2 = ("\r\t\t\t"+"<Tracks>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>translate</inputName>"+"\r\t\t\t\t\t"+"<outputName>trans</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>"+"\r\t\t\t\t\t"+"<compressionTol value="+"\""+"0.0"+"\""+" />")
-- hc3 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>rotate</inputName>"+"\r\t\t\t\t\t"+"<outputName>rot</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>"+"\r\t\t\t\t\t"+"<compressionTol value="+"\""+"0.0"+"\""+" />")
-- hc4 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>cameraFOV</inputName>"+"\r\t\t\t\t\t"+"<outputName>fov</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>"+"\r\t\t\t\t\t"+"<compressionTol value="+"\""+"0.0"+"\""+" />")
-- hc5 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData0</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData0</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc6 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData1</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData1</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc7 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData2</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData2</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc8 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData3</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData3</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc9 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData4</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData4</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc10 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData5</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData5</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc11 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData6</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData6</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc12 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t\t"+"<Item>"+"\r\t\t\t\t\t"+"<inputName>projectData7</inputName>"+"\r\t\t\t\t\t"+"<outputName>projectData7</outputName>"+"\r\t\t\t\t\t"+"<components>X,Y,Z</components>")
-- hc13 = ("\r\t\t\t\t"+"</Item>"+"\r\t\t\t"+"</Tracks>"+"\r\t\t"+"</Item>")
--
--
-- hc = (hc1+hc2+hc3+hc4+hc5+hc6+hc7+hc8+hc9+hc10+hc11+hc12+hc13)
-- -- print hc
--
-- for sN = 1 to skelNodes.count do
-- (
-- --we need to check the bone tag and if export trans == true then we add trans
-- udp = getUserPropBuffer skelNodes[sN]
-- transTrue = findString udp "exportTrans = true"
-- hc1 = "\r\t\t"+"<Item>"
-- hc2 = ("\r\t\t\t"+"<nameExpr>"+skelNodes[sN].name+"</nameExpr>")
-- hc3 = "\r\t\t\t"+"<Tracks>"
--
-- hc = (hc+hc1+hc2+hc3)
--
-- if transTrue != undefined do
-- (
-- hc4 = "\r\t\t\t\t"+"<Item>"
-- hc5 = "\r\t\t\t\t\t"+"<inputName>translate</inputName>"
-- hc6 = "\r\t\t\t\t\t"+"<outputName>trans</outputName>"
-- hc8 = "\r\t\t\t\t\t"+"<components>X,Y,Z</components>"
-- hc9 = "\r\t\t\t\t\t"+"<compressionTol value="+"\""+"0.0"+"\""+" />"
-- hc10 = "\r\t\t\t\t"+"</Item>"
--
-- hc = (hc+hc4+hc5+hc6+hc8+hc9+hc10)
-- )
-- hc4 = "\r\t\t\t\t"+"<Item>"
-- hc5 = "\r\t\t\t\t\t"+"<inputName>rotate</inputName>"
-- hc6 = "\r\t\t\t\t\t"+"<outputName>rot</outputName>"
-- hc8 = "\r\t\t\t\t\t"+"<components>X,Y,Z</components>"
-- hc9 = "\r\t\t\t\t\t"+"<compressionTol value="+"\""+"0.0"+"\""+" />"
-- hc10 = "\r\t\t\t\t"+"</Item>"
-- hc11 = "\r\t\t\t"+"</Tracks>"
-- hc12 = "\r\t\t"+"</Item>"
--
-- hc = (hc+hc4+hc5+hc6+hc8+hc9+hc10+hc11+hc12)
-- )
--
-- hc1 = ("\r\t"+"</TrackSpecs>"+"\r"+"</rage__AnimExportCtrlSpec>")
-- hc = (hc+hc1)
--
-- -- print hc
-- format hc to:output_file
--
--
-- print ("Created "+output_name)
-- )
-- close output_file
--
-- if existing == false do --ok we need to add to p4
-- (
-- gRsPerforce.add #(output_name) silent:true
-- print ("Added "+output_name+" to p4.")
-- )
--
-- )
-- else
-- (
-- messagebox ("This scene has not been saved so we cannot generate spec file.")
-- )
-- )
-- fn addPhNodes =
-- (
-- renameArrayA = #(
-- #("PH_L_Hand", "BONETAG_L_PH_Hand"),
-- #("PH_R_Hand", "BONETAG_R_PH_Hand"),
-- #("IK_L_Hand", "IK_L_Hand"),
-- #("IK_R_Hand", "IK_R_Hand"),
-- #("IK_L_Hand", "IK_L_Hand"),
-- #("PH_L_Foot", "BONETAG_L_PH_Foot"),
-- #("PH_R_Foot", "BONETAG_R_PH_Foot"),
-- #("IK_R_Foot", "IK_R_Foot"),
-- #("IK_L_Foot", "IK_L_Foot")
-- )
--
-- cSel = selection as array
-- for i = 1 to phParents.count do
-- (
-- parNode = getNodeByName phParents[i][1]
-- mkrNode = getNodeByName phParents[i][2]
--
-- if mkrNode == undefined then
-- (
-- print ("Couldn't find "+phParents[i][2])
-- )
-- else
-- (
-- for p = 3 to 4 do
-- (
-- marker = point pos:[0,0,0] name:phParents[i][p] size:0.1 centermarker:off axisTripod:off cross:on constantscreensize:off drawontop:off
-- marker.position = mkrNode.position
-- marker.parent = parNode
-- marker.wirecolor = color 135 59 8
--
-- udp = ("tag = "+marker.name+"\r\n"+"exportTrans = true")
--
-- for item = 1 to renameArrayA.count do
-- (
-- if marker.name == renameArray[item][1] do
-- (
-- udp = ("tag = "+renameArray[item][2]+"\r\n"+"exportTrans = true")
-- )
-- )
-- setUserPropBuffer marker ("tag = "+marker.name+"\r\n"+"exportTrans = true")
--
-- select marker
-- freezeTransform()
-- )
-- )
-- )
-- select cSel
-- )
-- fn addSaddleNode saddleName saddleParent saddlePos =
-- (
-- saddleEndX = saddlePos[1] --+0.1
-- saddleEndY = saddlePos[2] + 0.1
-- saddleEndZ = saddlePos[3]
--
-- saddleEnd = [saddleEndX,saddleEndY,saddleEndZ]
--
-- saddleNode = BoneSys.createBone saddlePos saddleEnd [1,0,0]
-- saddleNode.Width = 0.1
-- saddleNode.Height = 0.1
-- saddleNode.Name = saddleName
-- saddleParentNode = getNodeByName saddleParent
-- saddleNode.parent = saddleParentNode
-- )
-- fn udpTag =
-- (
-- --now we need to tag the bones
-- for o in objects do
-- (
-- boneToTag = o
-- boneName = boneToTag.name
-- if (substring boneName 1 4) == "SKEL" do
-- (
-- udpt = findBoneTag boneName
-- if udpt == "UNKNOWN" do
-- (
-- udpt = boneName
-- )
-- setUserPropBuffer boneToTag ("tag = "+udpt)
--
-- for tB = 1 to transTaggedBones.count do
-- (
-- if boneName == (transTaggedBones[tb]) do
-- (
-- debugprint ("boneName = "+bonename+"\n"+" tb = "+transTaggedBones[tb])
-- udpt1 = findBoneTag bonename
-- debugprint ("udpt1 = "+udpt1)
-- udpt2 = ("exportTrans = true")
-- debugprint ("udpt2 = "+udpt2 )
-- debugprint ("Final udtp = "+(udpt1+"\n"+udpt2))
-- udpt = (udpt1+"\n"+udpt2)
--
-- -- boneToTag = (getNodeByName boneName)
-- setUserPropBuffer boneToTag ("tag = "+udpt1+"\r\n"+udpt2)
-- )
-- )
-- )
-- )
-- print "UDP Tagging complete."
-- )
-- fn buildNewBoneMR bname btag source dest bonewidth bfinsize bcolour parentbone xrot alignto =
-- (
-- sourcePos = source.position
-- destPos = dest.position
-- zAxis = undefined
--
--
-- spineBackNode = undefined
-- spineFrontNode = undefined
--
-- doTest = false
--
-- for i = 1 to spineBackArray.count do
-- (
-- if (bonePrefix+spineBackArray[i]) == bName do (spineBackNode = true)
-- )
-- for i = 1 to spineForwardArray.count do
-- (
-- if (bonePrefix+spineForwardArray[i]) == bName do (spineFrontNode = true)
-- )
--
--
-- if ((substring bName 5 3) != "_L_") then
-- (
-- if ((substring bName 5 3) != "_R_") then
-- (
-- --ok we found a centreline joint
-- zAxis = [0,0,0]
-- )
-- else
-- (
-- --we're a right _R_ joint
-- doTest = true
-- )
-- )
-- else
-- (
-- --we're a left _L_ joint
-- doTest = true
-- )
-- if doTest == true do
-- (
-- --WE'LL DO A TEST HERE ON THE AXES TO SEE IF A JOINT IS MORE VERTICAL AND IF SO WE'LL SET THE ZAXIS TO [0,-1,0]
-- sPos = #()
-- append sPos source.position[1]
-- append sPos source.position[2]
-- append sPos source.position[3]
-- dPos = #()
-- append dPos dest.position[1]
-- append dPos dest.position[2]
-- append dPos dest.position[3]
-- --now we'll make all values positive
-- for s = 1 to sPos.count do
-- (
-- -- if sPos[s] < 1 do (sPos[s] = sPos[s] * -1)
-- if sPos[s] < 0 do (sPos[s] = sPos[s] * -1)
-- )
-- for d = 1 to dPos.count do
-- (
-- -- if dPos[d] < 1 do (dPos[d] = dPos[d] * -1)
-- if dPos[d] < 0 do (dPos[d] = dPos[d] * -1)
-- )
--
-- xDist = undefined
-- yDist = undefined
-- zDist = undefined
--
-- -- now we'll get the distances
-- if sPos[1] < dPos[1] then
-- (
-- xDist = dPos[1] - sPos[1]
-- )
-- else
-- (
-- xDist = sPos[1] - dPos[1]
-- )
-- if sPos[2] < dPos[2] then
-- (
-- yDist = dPos[2] - sPos[2]
-- )
-- else
-- (
-- yDist = sPos[2] - dPos[2]
-- )
-- if sPos[3] < dPos[3] then
-- (
-- zDist = dPos[3] - sPos[3]
-- )
-- else
-- (
-- zDist = sPos[3] - dPos[3]
-- )
--
-- winString = undefined
--
-- --if z wins we need to use [0,-1,0] as its vertical
-- --if Y wins we need to use [0,0,-1]
--
-- if xDist > yDist then --x bigger than y X WINS
-- (
-- if xDist > zDist then --x bigger than y and z X WINS
-- (
-- -- zAxis = [0,0,-1]
-- zAxis = [0,0,1]
-- winString = (bName+" --x bigger than y and z - X WINS")
-- )
-- else --x bigger than y but less than z Z WINS
-- (
-- zAxis = [0,-1,0]
-- winString = (bName+" --x bigger than y but less than z - Z WINS")
-- )
-- )
-- else -- x less than y
-- (
-- if YDist >ZDist then --y bigger than z and X - Y WINS
-- (
-- zAxis = [0,0,1]
--
-- winString = (bName+" --y bigger than z and X - Y WINS")
-- )
-- else --y bigger than x but less than z Z WINS
-- (
-- zAxis = [0,-1,0]
-- winString = (bName+" --y bigger than x but less than z - Z WINS")
-- )
-- )
--
-- if customLegOrient != undefined do
-- (
-- -- *** THIS IS A GIANT HACK TO TRY AND KEEP LEG ORIENTS CORRECT SO THE Z ALWAYS STAYS CONSISTENT
-- -- THIS WASD IMPLEMENTED FOR THE GULL SPECIFICALLY
-- for a = 1 to customLegOrient.count do
-- (
-- if (substring bName 5 -1) == customLegOrient[a] do
-- (
-- zAxis = previousBoneZAxis
--
-- for zi = 1 to 3 do
-- (
-- if zAxis[zi] != 0 do
-- (
-- zAxis[zi] = zAxis[zi] * -1
-- )
-- )
-- )
-- )
-- )
-- )
-- newBone = BoneSys.createBone sourcePos destPos zAxis
-- newBoneScale = newBone.scale as string
-- if newBoneScale != "[1,1,1]" do
-- (
-- print ("*** WARNING! ***** "+"Invalid Scale: " + bname + " Scale " + newBone.scale as string)
--
-- newbone.scale = [1,1,1]
-- print ("*** Resetting to [1,1,1]. "+bName+".scale == "+(newBone.scale as string))
-- print "============================================================================"
-- )
--
-- previousBoneZAxis = zAxis
--
-- --is the boneenable thing here necessary anymore?
-- newBone.boneEnable = false
--
-- newBone.height = bonewidth
-- newbone.width = bonewidth
-- newBone.taper = 90.0
-- newBone.parent = undefined
-- newBone.sidefins = on
-- newBone.sidefinssize = bfinsize
-- newBone.wirecolor = bcolour
-- newBone.name = bname
--
-- select newbone
-- newBone.boxmode = off
--
-- newbone
-- )
-- fn alignMovers = --aligns pivot of imported mover geo to the marker mover
-- (
-- markerMover = getNodeByName "Marker_mover"
-- realMover = getNodeByName "mover"
-- realMover.pivot = markerMover.pivot
-- )
-- --function which queries object positions and changes them from the weird hexy 2.056e74 (scientific notation) numbers to flat zeroes
-- fn rectifyScientificNotationValues obj =
-- (
-- thisPos = in coordsys world obj.position
--
-- theseVals = #()
-- modVals = #()
--
-- tX = (thisPos[1] as string)
-- tY = (thisPos[2] as string)
-- tZ = (thisPos[3] as string)
--
-- append theseVals tX
-- append theseVals tY
-- append theseVals tZ
-- for v = 1 to theseVals.count do
-- (
-- foundE = findString theseVals[v] "e"
-- if foundE == undefined then
-- (
-- append modVals theseVals[v]
-- )
-- else --ok an e was found so we need to convert to a flat 0.0
-- (
-- append modVals "0.0"
-- )
-- )
--
-- tX = (modVals[1] as float)
-- tY = (modVals[2] as float)
-- tZ = (modVals[3] as float)
--
-- in coordsys world obj.position = [tX,tY,tZ]
-- )
-- -- fn mirrorWingRotations wingArray bonePrefix = --mirrors rotations on wing nodes so poses can be pasted
-- -- (
-- -- for i = 1 to WingArray.count do
-- -- (
-- -- L = getNodeByName (bonePrefix+WingArray[i][2])
-- -- LRot1 = in coordsys parent L.rotation as eulerangles
-- -- R = getNodeByName (bonePrefix+WingArray[i][1])
-- -- RRot = in coordsys parent R.rotation as eulerAngles
-- -- rRotX = in coordsys parent R.rotation.X_Rotation
-- -- rRotY = in coordsys parent R.rotation.Y_Rotation
-- -- rRotZ = in coordsys parent R.rotation.Z_Rotation
-- -- in coordsys parent L.rotation.x_rotation = rRotX * -1
-- -- in coordsys parent L.rotation.Y_Rotation = rRotY * -1
-- -- in coordsys parent L.rotation.Z_Rotation = RRotZ * 1
-- -- LRot2 = in coordsys parent L.rotation as eulerangles
-- -- debugprint "------------------------------------------------"
-- -- debugprint ("initial "+R.name+" Rot = "+(RRot as string))
-- -- debugprint ("initial "+L.name+" Rot = "+(LRot1 as string))
-- -- debugprint ("Final "+L.name+" Rot = "+(LRot2 as string))
-- -- debugprint "------------------------------------------------"
-- -- )
-- -- )
-- fn addAntlerRoot = --add root node used during generation of physics bounds
-- (
-- headJoint = getNodeByName "SKEL_Head"
--
-- if headJoint != undefined then
-- (
-- --first get user to pick mesh (so we can get name)
--
-- selectedGeo = selectByName title:"Pick mesh" showHidden:true
--
-- if selectedGeo != undefined then
-- (
-- --then create faceroot node aligned to head joint with name Faceroot_GEONAME
-- --foundExistingRoot = getNodeByName ("AntlerRoot_"+selectedGeo[1].name)
-- foundExistingRoot = getNodeByName ("AntlerRoot")
--
-- if foundExistingRoot == undefined then
-- (
-- marker = BoneSys.createBone [0,0,0] [0,0.1,0] [0,-1,0]
-- --marker.name = ("AntlerRoot_"+selectedGeo[1].name)
-- marker.name = ("AntlerRoot")
-- marker.height = marker.length / 4
-- marker.width = marker.length / 4
--
-- markerNub = BoneSys.createBone [0,0.1,0] [0,0.15,0] [0,-1,0]
-- markerNub.parent = marker
-- --markerNub.name = ("AntlerRoot_"+selectedGeo[1].name+"_NUB")
-- markerNub.name = ("AntlerRoot"+"_NUB")
-- markerNub.height = markerNub.length / 8
-- markerNub.width = markerNub.length / 8
--
-- marker.transform = headJoint.transform
--
--
-- -- marker.size = 0.1
-- -- marker.cross = on
-- -- marker.centermarker = on
-- -- marker.axistripod = on
-- -- marker.box = on
-- -- marker.wirecolor = red
-- -- marker.name = ("FaceRoot_"+selectedGeo[1].name)
-- marker.showLinks = true
-- -- marker.box = on
-- marker.wirecolor = red
--
-- marker.scale = [1,1,1]
-- marker.parent = headJoint
-- select marker
-- freezeTransform()
-- debugprint ("Marker "+marker.name+" made.")
-- --then add tag to faceroot
-- setUserPropBuffer marker ("tag= AntlerRoot"+"\r\n"+"exportTrans = false"+"\r\n"+"exportRot = false"+"\r\n"+"exportScale = false")
--
-- )
-- else
-- (
-- --messagebox ("WARNING! "+("AntlerRoot_"+selectedGeo[1].name)+" already exists.") beep:true
-- messagebox ("WARNING! "+("AntlerRoot")+" already exists.") beep:true
-- )
-- )
-- else
-- (
-- messagebox "WARNING! Please select you skinned mesh." beep:true
-- )
-- )
-- else
-- (
-- messagebox "WARNING! Faceroot cannot be created as no SKEL_Head can be found." beep:true
-- )
-- )
-- fn removeMarkerObjects = --deletes marker objects from scene
-- (
-- max unhide all
-- max select all
-- allObs = selection as array
--
-- for i = allObs.count to 1 by -1 do
-- (
-- if (substring allObs[i].name 1 7) == "Marker_" do
-- (
-- delete allObs[i]
-- )
-- )
--
-- )
-- fn unparentMarkers = --unparents marker nodes for use during mirroring and several other functions
-- (
-- tempMarkerArray = #(#(),#())
--
-- for o in objects do
-- (
-- if (substring o.name 1 6) == "Marker" do
-- (
-- oPar = "undefined"
-- if o.parent != undefined do
-- (
-- oPar = o.parent
-- )
--
-- -- toApp = #(o,oPar)
-- -- append tempMarkerArray toApp
-- append tempMarkerArray[1] o
-- append tempMarkerArray[2] oPar
-- --
-- o.parent = undefined
-- )
-- )
-- print "Markers unparented"
-- )
-- fn addSkeletonLayer layerName objectToAdd freezeLayer = --creates a layer for the skel
-- (
-- foundLayer = layerManager.getLayerFromName layerName
--
-- if foundLayer == undefined do
-- (
-- foundLayer = LayerManager.newLayerFromName layerName
-- )
--
-- foundLayer.addNode objectToAdd
-- objectToAdd.showFrozenInGray = false
--
-- foundLayer.isFrozen = freezeLayer
-- )
-- fn parentMarkerNodes = --parents marker nodes back together where necessary
-- (
-- deleteAllChangeHandlers() --first we have to remove the 'wire' callback which makes the roots move together
-- --print "Change handlers removed."
--
-- --then using string matching we parent the markers once they are all made
-- for skl = 1 to skelArr.count do
-- (
--
-- markerToFind = undefined
-- if skelArr[skl][1] == "Dummy01" then
-- (
-- markerToFind = "Marker_Dummy01"
-- )
-- else
-- (
-- if skelArr[skl][1] == "mover" then
-- (
-- markerToFind = "Marker_mover"
-- )
-- else
-- (
-- markerToFind = ("Marker"+(substring skelArr[skl][1] 5 100))
-- )
-- )
--
-- marker = getNodeByName markerToFind
-- select marker
-- )
--
--
-- for skl = 1 to skelArr.count do
-- (
-- markerToFind = undefined
-- markerParent = undefined
-- if skelArr[skl][1] == "Dummy01" then
-- (
-- markerToFind = "Marker_Dummy01"
-- markerParent = "none"
-- )
-- else
-- (
-- if skelArr[skl][1] == "mover" then
-- (
-- markerToFind = "Marker_mover"
-- markerParent = getNodeByName "Marker_Dummy01"
-- )
-- else
-- (
-- if skelArr[skl][2] == "mover" then
-- (
-- markerToFind = ("Marker"+(substring skelArr[skl][1] 5 100))
-- markerParent = getNodeByName "Marker_mover"
-- )
-- else
-- (
-- markerToFind = ("Marker"+(substring skelArr[skl][1] 5 100))
-- markerParent = getNodeByName ("Marker"+(substring skelArr[skl][2] 5 100))
-- )
-- )
-- )
-- --
-- marker = getNodeByName markerToFind
-- if markerParent != "none" do
-- (
-- marker.parent = markerParent
-- --print ("Parented "+(marker as string)+" to "+(markerParent as string))
-- )
-- )
--
-- --now use the tempAmarkerArray to reconnect the markers via the unparentmarkers fn
-- if tempMarkerArray.count != 0 do
-- (
-- for par = 1 to tempMarkerArray[1].count do
-- (
-- --print ("tempMarkerArray[2]["+(par as string)+"]: "+(tempMarkerArray[2][par] as string))
-- parentOb = tempMarkerArray[2][par]
-- parString = (tempMarkerArray[2][par] as string)
-- --print ("tempMarkerArray[1]["+(par as string)+"]: "+(tempMarkerArray[1][par] as string))
-- childOb = tempMarkerArray[1][par]
--
-- --for some reason i had to convert this to a string otherwise undeifned wasnt working!
-- if parString != "undefined" do
-- (
-- childOb.parent = parentOb
-- )
-- )
-- )
-- debugPrint "Markers parented."
-- )
-- fn alignMarkersToSkel = --this will align default martkers to a skeleton already in the scene
-- (
-- max unhide all
-- max unfreeze all
-- max select all
-- sceneObjects = selection as array
-- clearSelection()
--
-- markerPars = #(
-- #(),
-- #()
-- )
--
-- foundMarkers = false
-- for i = 1 to sceneObjects.count do
-- (
-- if (substring sceneObjects[i].name 1 6) == "Marker" do
-- (
-- foundMarkers = true
-- )
-- )
--
-- if foundMarkers == true then
-- (
-- --first we need to delete the SKEL DUMMY that gets generated and rename the OLD_ shit
-- for i = sceneObjects.count to 1 by -1 do
-- (
-- if (substring sceneObjects[i].name 1 5 ) == "SKEL_" do
-- (
-- delete sceneObjects[i]
-- )
-- )
-- max select all
-- sceneObjects = selection as array
-- clearSelection()
-- for i = sceneObjects.count to 1 by -1 do
-- (
-- if (substring sceneObjects[i].name 1 4) == "OLD_" do
-- (
-- sceneObjects[i].name = (substring sceneObjects[i].name 5 80)
-- )
-- )
--
-- max select all
-- sceneObjects = selection as array
-- clearSelection()
-- for o = 1 to sceneObjects.count do
-- (
-- mkr = sceneObjects[o]
-- markerName = undefined
--
-- if (substring mkr.name 1 6) == "Marker" do
-- (
-- markerName = mkr.name
-- print ("found "+MarkerName)
--
-- boneName = undefined
-- markerBone = undefined
--
-- boneName = ("SKEL"+(substring markerName 7 100))
--
-- print ("Looking for "+("SKEL"+(substring markerName 7 100)))
-- markerBone = getNodeByName boneName
--
-- if markerName == "Marker_Dummy01" then
-- (
-- boneName = "Dummy_01"
-- markerBone = getNodeByName boneName
-- )
-- else
-- (
-- if markerName == "Marker_mover" then
-- (
-- boneName = "Marker_mover"
-- markerBone = getNodeByName boneName
-- )
-- )
--
-- if markerBone == undefined then
-- (
-- print ("Couldnt find "+("SKEL"+(substring markerName 7 100)))
--
-- boneName = ("Stretchy"+(substring markerName 7 100))
-- print ("Looking for "+("Stretchy"+(substring markerName 7 100)))
--
-- markerBone = getNodeByName boneName
-- if markerBone == undefined do
-- (
-- print ("Couldn't find "+("Stretchy"+(substring markerName 7 100)))
-- )
-- )
-- else
-- (
-- print ("Found "+("Stretchy"+(substring markerName 7 100)))
-- )
--
-- if markerBone != undefined then
-- (
-- append markerPars[1] mkr
-- if mkr.parent != undefined then
-- (
-- append markerPars[2] mkr.parent
-- )
-- else
-- (
-- append markerPars[2] "Undefined"
-- )
-- mkr.parent = undefined
-- in coordsys world mkr.position = in coordsys world markerBone.position
-- -- in coordsys parent mkr.position = in coordsys parent markerBone.position
-- )
-- else
-- (
-- print ("Couldn't find bone match for "+markerName)
-- )
-- )
-- )
-- )
-- else
-- (
-- messagebox ("Could not find any marker to align in the scene.") beep:true
-- print ("Could not find any marker to align in the scene.")
-- )
--
-- for i = 1 to markerPars[1].count do
-- (
-- if markerPars[2][i] != "Undefined" do
-- (
-- markerPars[1][i].parent = markerPars[2][i]
-- )
-- )
--
-- )
-- fn pointPlaneProj pA pB pC pD = --used for planar alignment of joints.
-- (
-- local nABC=normalize (cross (pB-pA) (pC-pA))
-- pD+((dot (pA-pD) nABC)*nABC)
-- )
-- -- Align the marker joints along a plane. This will allow us to planarise joint chains
-- fn alignMarkers customPlanarMarkerArray =
-- (
-- -- Print ("Beginning planarisation...."+" with " +(customPlanarMarkerArray as string))
--
-- debugPrint ("customPlanarMarkerArray = "+(customPlanarMarkerArray as string))
-- mA = getNodeByName customPlanarMarkerArray[1]
-- debugPrint ("Looking for "+customPlanarMarkerArray[1]+"mA = "+mA.name)
-- mB = getNodeByName customPlanarMarkerArray[2]
-- debugPrint ("Looking for "+customPlanarMarkerArray[2]+"mB = "+mB.name)
-- mC = getNodeByName customPlanarMarkerArray[3]
-- debugPrint ("Looking for "+customPlanarMarkerArray[3]+"mC = "+mC.name)
-- mD = getNodeByName customPlanarMarkerArray[4]
-- debugPrint ("Looking for "+customPlanarMarkerArray[4]+"mD = "+mD.name)
-- pAX = (in coordsys world ma.pos[1] as double)
-- pAY = (in coordsys world ma.pos[2] as double)
-- pAZ = (in coordsys world ma.pos[3] as double)
-- pointA = [pAX, pAY, pAZ]
--
-- pBX = (in coordsys world mB.pos[1] as double)
-- pBY = (in coordsys world mB.pos[2] as double)
-- pBZ = (in coordsys world mB.pos[3] as double)
-- pointB = [pBX, pBY, pBZ]
-- pCX = (in coordsys world mC.pos[1] as double)
-- pCY = (in coordsys world mC.pos[2] as double)
-- pCZ = (in coordsys world mC.pos[3] as double)
-- pointC = [pCX, pCY, pCZ]
--
-- pDX = (in coordsys world mD.pos[1] as double)
-- pDY = (in coordsys world mD.pos[2] as double)
-- pDZ = (in coordsys world mD.pos[3] as double)
-- pointD = [pDX, pDY, pDZ]
--
-- newpos = pointPlaneProj pointA pointB pointC pointD
--
-- --now remove scientific notation on their vales
-- initVal = (newPos as string)
-- theseVals = #()
-- modVals = #()
--
-- tX = (newpos[1] as string)
-- tY = (newpos[2] as string)
-- tZ = (newpos[3] as string)
--
-- append theseVals tX
-- append theseVals tY
-- append theseVals tZ
-- for v = 1 to theseVals.count do
-- (
-- foundE = findString theseVals[v] "e"
-- if foundE == undefined then
-- (
-- append modVals theseVals[v]
-- )
-- else --ok an e was found so we need to convert to a flat 0.0
-- (
-- append modVals "0.0"
-- )
-- )
--
-- tX = (modVals[1] as float)
-- tY = (modVals[2] as float)
-- tZ = (modVals[3] as float)
--
-- newpos = [tx,tY,tZ]
-- -- messagebox (md.name+"\r\n"+"S:"+(initVal)+"F:"+(newPos as string))
--
-- testNameArray = #("Marker_L_Clavicle", "Marker_L_Finger01_NUB", "Marker_L_Finger01", "Marker_L_Forearm")
-- -- print ("\r\n"+"-------------------------------------------------")
-- -- print (mD.name+"\r\n"+" original Pos:\t"+(mD.pos as string)+"."+"\r\n"+" Adjusted pos:\t"+(newPos as string))
-- -- print ("\r\n"+"-------------------------------------------------")
-- in coordsys world mD.position = newPos
-- )
-- fn wireMarkers connectedMarkerNodes = --creates a callback which makes cnnectedMarkerNodes follow each other liek a wire
-- (
--
-- for w = 1 to connectedMarkerNodes.count do
-- (
-- for i = 2 to connectedMarkerNodes[w].count do
-- (
-- m1 = connectedMarkerNodes[w][1]
-- m1Obj = getNodeByName m1
-- m2 = connectedMarkerNodes[w][i]
-- m2Obj = getNodeByName m2
-- if (m1Obj != undefined ) or (m2Obj != undefined) do
-- (
-- --we're gonna add a wire style callback
-- execStr = ("when transform $'"+m1+"' changes do "+"\r\n"+"("+"\r\n\t"+"$'"+m2+"'.transform = $'"+m1+"'.transform"+"\r\n"+")")
-- execute execStr
--
-- m2Obj = getNodeByName m2
-- hide m2Obj
-- )
-- )
-- )
--
-- debugPrint "Markers wired."
-- )
-- fn removeExistingSkeletonData =
-- (
-- clearSelection()
-- for o in objects do
-- (
-- if (substring o.name 1 4) == "SKEL" do
-- (
-- selectmore o
-- )
-- if o.name == "Dummy01" do
-- (
-- selectmore o
-- )
-- if (o.name == "mover") or (o.name == "Mover") do
-- (
-- selectmore o
-- )
-- )
-- delete selection
-- debugPrint "Skeleton cleanup done."
-- )
--
-- fn createSkeleton bonePrefix isStretchy = --this actually creates the bones
-- (
-- unparentMarkers()
-- --now we ensure the legs are all planar
-- for pln = 1 to planarMarkerArray.count do
-- (
-- customPlanarMarkerArray = planarMarkerArray[pln]
-- alignMarkers customPlanarMarkerArray
-- )
--
-- parentMarkerNodes()
--
-- for i = 1 to markerParentingArray.count do
-- (
-- for m = 2 to markerParentingArray[i].count do --only do from 2 cos 1 is always the parent
-- (
-- parentNode = getNodeByName markerParentingArray[i][1]
-- childNode = getNodeByName markerParentingArray[i][m]
-- -- parentPos =parentNode.position
-- -- childPos = childNode.position
-- parentPos =parentNode
-- childPos = childNode
--
-- thisBoneName = (bonePrefix+(substring parentNode.name 7 100))
-- debugprint ("Creating "+thisBoneName+" between "+parentNode.name+" and "+childNode.name )
-- doesBoneExist = getNodeByName thisBoneName
--
-- if doesBoneExist == undefined do
-- (
-- if parentNode.name == "Marker_Dummy01" then
-- (
-- createdBone = Dummy pos:[0,0,0] isSelected:on
-- createdBone.boxsize = [0.585146,0.585146,0.585146]
-- createdBone.name = thisBoneName
-- -- createdBone.position = parentPos
-- createdBone.position = parentPos.position
-- )
-- else
-- (
-- if parentNode.name == "Marker_mover" then
-- (
-- --need to create mover
-- --cannot dynamically create this as its really fiddly
-- mergeMaxFile (theProjectRoot + "art/peds/Skeletons/mrSkeleton/moverGeo.max") quiet:true
--
-- createdBone = getNodeByName "moverGeo"
-- createdBone.boxmode = on
-- createdBone.name = thisBoneName
-- )
-- else
-- (
-- if thisBoneName == "Stretchy_Spine_Root" do
-- (
-- debugprint ("Creating "+thisBoneName+" from "+((in coordsys world parentPos) as string)+" to "+((in coordsys world childPos) as string))
-- )
--
-- finalBoneWidth = ((distance parentPos childPos) / 4)
-- if finalBoneWidth > defaultBoneWidth do
-- (
-- finalBoneWidth = defaultBoneWidth
-- )
--
-- finalFinSize = ((distance parentPos childPos) / 6)
-- if finalFinSize > defaultFinSize do
-- (
-- finalFinSize = defaultFinSize
-- )
--
-- alignToNode = -1
--
-- alignOffset = 90.0
-- -- alignOffset = 0.0
-- if (substring skelType 1 4) == "Bird" do
-- (
-- if skelType != "Bird - Hen" do
-- (
-- for w = 1 to wingNodes.count do
-- (
-- -- messageBox (substring thisBoneName 5 3)
-- if (substring thisBoneName 7 60) == wingNodes[w] do
-- (
-- alignOffset = 0.0
-- )
-- )
-- )
-- )
--
-- --do a hacky check to ensure we dont get bones orienting at left or right if they are a centreline bone
-- if (substring thisBoneName 5 3) != "_R_" then
-- (
-- if (substring thisBoneName 5 3) != "_L_" do
-- (
-- thisNodesMarker = getNodeByName ("Marker"+(substring thisBoneName 5 60))
-- thisNodesMarkerChildren = thisNodesMarker.children
-- theChildMarker = undefined
-- for tc = 1 to thisNodesMarkerChildren.count do
-- (
-- if (substring thisNodesMarkerChildren[tc].name 7 3) != "_R_" then
-- (
-- if (substring thisNodesMarkerChildren[tc].name 7 3) != "_L_" do
-- (
-- theChildMarker = thisNodesMarkerChildren[tc]
-- )
-- )
-- )
-- if theChildMarker != undefined do
-- (
-- -- childPos = theChildMarker.position
-- childPos = theChildMarker
-- )
-- )
-- )
--
-- alignMarker = undefined
-- if thisBoneName == "SKEL_Spine_Root" do
-- (
--
-- -- forceCompleteRedraw doDisabled:true
-- -- messagebox "Re-aligning Skel_Spine_Root"
--
-- alignToNode = $Marker_ROOT
-- alignMarker = point pos:[0,0,0]
-- alignMarker.transform = alignToNode.transform
-- setTransformLockFlags alignMarker #{7,8,9}
--
-- in coordsys local rotate alignMarker (angleaxis -90 [0,1,0])
--
-- alignToNode = alignMarker
--
-- alignOffset = -90
--
-- )
--
-- -- if thisBoneName == "SKEL_ROOT" do
-- -- (
-- -- print "--------------------------------------------------------------------"
-- -- print ("Marker_Root.position:"+($Marker_Root.position as string))
-- -- print "--------------------------------------------------------------------"
-- -- )
--
-- createdBone = buildNewBoneMR thisBoneName "" parentPos childPos finalbonewidth finalfinsize (color 255 0 0) parentNode alignOffset alignToNode
--
-- -- if thisBoneName == "SKEL_ROOT" do
-- -- (
-- -- print "--------------------------------------------------------------------"
-- -- print ("SKEL_Root.position:"+($SKEL_Root.position as string))
-- -- print "--------------------------------------------------------------------"
-- -- )
--
--
-- if alignMarker != undefined do
-- (
-- delete alignMarker
-- )
--
--
-- )
-- )
-- if ((substring createdBone.name 9 3) == "_L_") then
-- (
-- bCol = Green
-- )
-- else
-- (
-- if ((substring createdBone.name 5 3 ) == "_L_") then
-- (
-- bCol = Green
-- )
-- else
-- (
-- if ((substring createdBone.name 9 3) == "_R_") then
-- (
-- bCol = Red
-- )
-- else
-- (
-- if ((substring createdBone.name 5 3 ) == "_R_") then
-- (
-- bCol = Red
-- )
-- else
-- (
-- if createdBone.name == moverName then
-- (
-- bCol = (color 87 225 87)
-- )
-- else
-- (
-- if createdBone.name == dummyName then
-- (
-- bCol = (color 27 177 27)
-- )
-- else
-- (
-- bCol = Blue
-- )
-- )
-- )
-- )
-- )
-- )
-- createdBone.wirecolor = bCol
-- layerName = (bonePrefix+"_Bones")
-- objectToAdd = createdBone
-- freezeLayer = undefined
--
-- if isStretchy == true then
-- (
-- freezeLayer = true
-- )
-- else
-- (
-- freezeLayer = false
-- )
-- addSkeletonLayer layerName objectToAdd freezeLayer
-- debugPrint ("Created: "+createdBone.name+" between "+parentNode.name+" at pos:"+(in coordsys world parentNode.position as string)+" and "+childNode.name+" at pos:"+(in coordsys world childNode.position as string))
-- )
-- )
-- )
-- output_name = "c:/regularParentingMarkerArray.txt"
-- output_file = createfile output_name
--
-- --now we need to parent the skeleton
-- for i = 1 to regularParentingMarkerArray.count do
-- (
-- for m = 2 to regularParentingMarkerArray[i].count do
-- (
-- parentNode = getNodeByName (bonePrefix+(substring regularParentingMarkerArray[i][1] 7 100))
-- childNode = getNodeByName (bonePrefix+(substring regularParentingMarkerArray[i][m] 7 100))
--
-- debugprint ("parentNode = "+(parentNode as string))
-- debugprint ("childNode = "+(childNode as string))
-- if childNode != undefined do
-- (
-- childNode.parent = parentNode
-- completeRedraw()
-- debugPrint ("Linking "+childNode.name+" to "+parentNode.name)
-- format (("Linking child:"+childNode.name+" to parent:"+parentNode.name)+"\r\n") to:output_file
-- )
-- )
-- )
--
--
-- close output_file
--
--
-- --*****************************************************************************************************************************************
-- --*****************************************************************************************************************************************
-- debugprint ("finding: "+(bonePrefix+"_Dummy01"))
-- debugprint ("finding: "+(bonePrefix+"_mover"))
-- dum = getNodeByName (bonePrefix+"_Dummy01")
-- mov = getNodeByName (bonePrefix+"_mover")
-- dum.name = "Dummy01"
-- mov.name = "mover"
-- -- print "About to realign movers"
-- -- break()
-- --now ensure mover is aligned to markerMover
--
-- alignMovers()
--
-- -- print "Movers aligned"
-- -- break()
--
-- print "UDP Tagging initialising..."
--
-- populateMappingArrays()
--
-- --now we'll apply a tcb controller to reset any odd winding values on joints
-- for o in objects do
-- (
-- if (substring o.name 1 5) == "SKEL_" do
-- (
-- -- if (subsTring o.name 5 3) != "_L_" do
-- -- (
-- -- if (subsTring o.name 5 3) != "_R_" do
-- -- (
-- o.rotation.controller = tcb_rotation ()
-- --now we'll reset back to a euler
-- o.rotation.controller = Euler_XYZ ()
--
-- freezeTransform()
-- -- )
-- -- )
-- )
-- )
--
-- --now we need to tag the bones
-- udpTag()
-- if skelType == "Aqua - Shark" do --hacky thing to parent shark jaw
-- (
-- jawBone = getNodeByName "SKEL_Jaw"
--
-- if jawBone != undefined do
-- (
-- parBone = getNodeByName "SKEL_Spine1"
--
-- jawBone.parent = parBone
-- jawBone.name = "FB_Jaw"
-- )
-- )
-- )
-- fn relinkCtrlRig =
-- (
--
-- AuxNode = getNodeByName "CTRLRIG_Pelvis_Aux"
-- AuxNode.parent = undefined
-- AuxNode = getNodeByName "CTRLRIG_ROOT"
-- AuxNode.parent = undefined
--
-- for i = 1 to CTRLRIGPelvisArray.count do
-- (
-- parentNode = getNodeByName CTRLRIGPelvisArray[i][1][1]
-- print ("Unlinking "+parentNode.name)
-- parentNode.parent = undefined
-- for p = 1 to CTRLRIGPelvisArray[i][2].count do
-- (
-- childNode = getNodeByName CTRLRIGPelvisArray[i][2][p]
-- print ("Linking "+childNode.name+" to "+parentNode.name)
-- try (childNode.parent = undefined) catch (messagebox "Tripped over whilst unparenting "+childNode.name)
-- try (childNode.parent = parentNode) catch (messagebox "Tripped over whilst "+"Linking "+childNode.name+" to "+parentNode.name)
-- )
-- )
-- )
-- fn CtrlRigGen = --create motionobuilder control rig
-- (
-- clearSelection()
-- -- createSkeleton "CTRLRIG" false
--
-- bonePrefixNew = "CTRLRIG"
--
-- oldPrefixCount = bonePrefix.count
--
-- for o in objects do
-- (
-- if (substring o.name 1 (oldPrefixCount)) == bonePrefix do
-- (
-- oldSubstName = (substring o.name (oldPrefixCount +1) 100)
-- o.name = (bonePrefixNew+oldSubstName)
-- )
-- )
--
-- --now we have the nodes made we need ot find the mid point between the hips
--
-- lhip = getNodeByName (bonePrefixNew+"_L_Thigh")
-- rhip = getNodeByName (bonePrefixNew+"_R_Thigh")
-- lHipPos = lhip.position
-- rHipPos = rhip.position
--
-- newHipPos = ((lHipPos + rHipPos) / 2)
--
-- clearSelection()
--
-- --now we clone the CTRL_Pelvis and position it to the newHipPos
--
-- pelvisNode = getNodeByName (bonePrefixNew+"_Pelvis")
-- nodeToClone = pelvisNode
-- pelvisChildren = #()
--
-- for o in objects do
-- (
-- if o.parent == nodeToClone do
-- (
-- append pelvisChildren o
-- )
-- )
--
-- maxOps.cloneNodes nodeToClone cloneType:#copy newNodes:&nnl
-- select nnl
--
-- $.name = (bonePrefixNew+"_Pelvis_AUX")
-- $.position = newHipPos
-- $.parent = pelvisNode
-- clonedNode = getNodeByName (bonePrefixNew+"_Pelvis_AUX")
--
-- for c = 1 to pelvisChildren.count do
-- (
-- pelvisChildren[c].parent = clonedNode
-- )
--
-- oldRoot = getNodeByName "EXISTING_SKEL_ROOT"
-- newRoot = getNodeByName "CTRLRIG_ROOT"
-- if oldRoot != undefined do
-- (
-- oldMover = oldRoot.parent
-- oldDummy = oldMover.parent
--
-- newMover = newRoot.parent
-- newDummy = newMover.parent
--
-- -- newRoot.parent = undefined
--
-- delete newMover
-- delete newDummy
-- )
-- newRoot.parent = undefined
--
-- for o in objects do
-- (
-- if (substring o.name 1 9) == "EXISTING_" do
-- (
-- o.name = (substring o.name 10 100)
-- )
-- )
--
-- --now we need to do some re-parenting for Motionbuilder
-- relinkCtrlRig()
-- )
-- fn createMarkerArrays = --this populates the various arrays used for marker data. The majority of the script is run via these.
-- (
--
-- markerObjects = #()
-- -- forceCompleteRedraw doDisabled:true
-- -- messagebox "Starting createMarkerArrays 1"
--
-- for o in objects do
-- (
-- if (substring o.name 1 6) == "Marker" do
-- (
-- debugPrint ("Found maker "+o.name)
-- append markerObjects o
-- )
-- )
-- -- forceCompleteRedraw doDisabled:true
-- -- messagebox "markerObject array created 2"
-- -- break()
-- debugPrint ((markerObjects.count as string)+" total Markers found in scene.")
--
-- markerParentingArray = #()
-- regularParentingMarkerArray = #()
--
-- for m = 1 to markerObjects.count do
-- (
-- ignoreThis = false
-- for tst = 1 to rotationOffsetOffNodes.count do
-- (
-- --messagebox ("rotationOffsetOffNodes["+(tst as string)+"] = "+rotationOffsetOffNodes[tst]+". MarkerObjects["+(m as string)+"] = "+markerObjects[m].name)
-- if ( substring rotationOffsetOffNodes[tst] 10 100 ) == (substring markerObjects[m].name 8 98) do
-- (
-- ignoreThis = true
-- )
-- )
--
--
-- debugPrint ("current marker = "+markerObjects[m].name)
-- debugPrint ("child count = "+(markerObjects[m].children.count as string))
--
-- --build all the children of the current marker
-- if markerObjects[m].children.count != 0 then
-- (
-- markerChildArray = markerObjects[m].children
-- debugPrint ("markerChildArray = "+(markerChildArray as string))
--
-- thisStr = ("\""+markerObjects[m].name+"\"")
-- for i = 1 to markerChildArray.count do
-- (
-- thisStr = (thisStr+", "+"\""+(markerChildArray[i].name)+"\"")
-- )
-- thisStr = (thisStr)
-- finalStr = ("append regularParentingMarkerArray "+"#("+thisStr+")")
-- debugPrint ("finalStr = "+finalStr)
-- execute finalStr
--
-- )
-- --
-- if ignoreThis != true then
-- (
-- debugPrint ("current marker = "+markerObjects[m].name)
-- debugPrint ("child count = "+(markerObjects[m].children.count as string))
-- if markerObjects[m].children.count != 0 then
-- (
-- markerChildArray = markerObjects[m].children
-- debugPrint ("markerChildArray = "+(markerChildArray as string))
--
-- thisStr = ("\""+markerObjects[m].name+"\"")
-- for i = 1 to markerChildArray.count do
-- (
-- thisStr = (thisStr+", "+"\""+(markerChildArray[i].name)+"\"")
-- )
-- thisStr = (thisStr)
-- finalStr = ("append markerParentingArray "+"#("+"\r\n"+thisStr+")")
-- debugPrint ("finalStr = "+finalStr)
-- execute finalStr
--
-- )
-- )
-- else
-- (--ok se these are nodes which run along the centreline but have multiple children so we need to find which
-- --child is closest to the centreline to know which joint to create so the spine is straight
--
-- --do stuff for children nodes here
-- if markerObjects[m].children.count != 0 do
-- (
-- --we need to look at all the children and find which child is on the same x position
-- markerChildArray = markerObjects[m].children
--
-- childXPos = in coordsys world markerChildArray[1].position[1]
-- smallestChild = markerChildArray[1]
-- for x = 1 to markerChildArray.count do
-- (
-- thisXPos = (in coordsys world markerChildArray[x].position[1])
-- closeToZero = 0
--
-- if thisXPos < 0 then
-- (
-- thisXPos = (0 - thisXpos)
-- )
-- else
-- (
-- thisXPos = (0 + thisXpos)
-- )
--
-- if childXPos < 0 do (childXPos = childXPos * -1) --convert so its a positive sign
-- if thisXpos < 0 do (thisXPos = thisXpos * -1) --convert so its a positive sign
--
-- --messagebox (markerChildArray[x].name+" x pos = "+(thisXPos as string))
-- if thisXPos < childXPos do
-- (
--
-- childXPos = markerChildArray[x].position[1]
-- smallestChild = markerChildArray[x]
-- --messagebox ("\r\n"+"<<<<<<<<<<< USING "+smallestChild.name+" as smallest for "+markerObjects[m].name+"\r\n")
-- )
-- )
--
-- thisStr = ("\""+markerObjects[m].name+"\"")
-- thisStr = (thisStr+", "+"\""+(smallestChild.name)+"\"")
--
-- thisStr = (thisStr)
-- finalStr = ("append markerParentingArray "+"#("+"\r\n"+thisStr+")")
-- debugPrint ("finalStr = "+finalStr)
-- execute finalStr
--
-- )
-- )
-- --messagebox ("regularParentingMarkerArray.count = "+(regularParentingMarkerArray.count as string))
--
-- for o in markerObjects do
-- (
-- o.scale = [1,1,1]
-- )
-- debugPrint "---------"
--
-- -- forceCompleteRedraw doDisabled:true
-- -- messagebox ("itterating m loop ("+(m as string)+")")
-- -- break()
-- )
--
-- debugPrint ("markerParentingArray.count = "+(markerParentingArray.count as string))
-- debugPrint ("markerParentingArray = "+(markerParentingArray as string))
-- )
-- fn lockMarkers selArray = --set the transform locks so only move is active on objects
-- (
-- -- for i = 1 to selArray.count do
-- -- (
-- setTransformLockFlags selArray #{4,5,6,7,8,9}
-- -- )
-- )
-- fn createMarkers usePreset = --create marker nodes
-- (
-- SkelArr = #()
-- markArr = #()
-- if usePreset == true do
-- (
-- --need to rename any old skeleton nodes
-- for o in objects do
-- (
-- -- moverObj = undefined
-- if (substring o.name 1 4) == "SKEL" do
-- (
-- oldName = o.name
-- o.name = ("OLD_"+o.name)
-- debugprint ("Renamed "+oldName+" to "+o.name)
-- if o.parent.name == "mover" do
-- (
-- moverObj = o.parent
-- moverObj.name = "OLD_mover"
-- moverObjPar = moverObj.parent
-- moverObjPar.name = ("OLD_"+moverObjPar.name)
-- )
-- )
-- if o.name == "Dummy01" do
-- (
--
-- )
-- )
--
-- --firstLoad the definition file
-- fileIn skelMarkerDefintion
--
-- --NOW WE NEED TO ENSURE THE MARKER ROOT AND Marker_mover (3RD AND 4TH ELEMENT IN THE ARRAY FROM SKELmARKdEFINITION MATCH POSITIONALLY
-- --OTHERWISE THE MARKERS JUMP DURING SKELEOTN GEN.
--
-- if (masterMarkerArray[3][2] as string) != (masterMarkerArray[4][2] as string) do
-- (
-- print ("[3][2] = "+(masterMarkerArray[3][2] as string))
-- print ("[4][2] = "+(masterMarkerArray[4][2] as string))
--
-- print "WARNING! Marker_mover does not match Marker_ROOT in your .mkr file. This may cause problems - beware!"
-- messagebox "WARNING! Marker_mover does not match Marker_ROOT in your .mkr file. This may cause problems - beware!" beep:true title:"WARNING!"
-- --break()
-- )
--
-- debugPrint ("Loaded skeleton definition. Now generating fake skeleton...")
-- --need to test if there is a skeleton inthe scene already and if so skip this section
-- foundSkelRoot = getNodeByName "SKEL_ROOT"
-- if foundSkelRoot == undefined do
-- (
-- --this creates a fake skeleton based off the markers so the standard marker generation can be used.
-- for m = 1 to masterMarkerArray.count do
-- (
-- marker = Point pos:[0,0,0]
-- marker.transform = masterMarkerArray[m][2]
-- marker.size = 0.1
-- marker.cross = on
-- marker.centermarker = off
-- marker.axistripod = off
-- marker.box = off
-- marker.wirecolor = green
-- marker.name = ("SKEL_"+(substring masterMarkerArray[m][1] 8 100))
-- marker.showLinks = true
-- marker.box = on
-- marker.wirecolor = red
--
-- marker.scale = [1,1,1]
--
-- select marker
-- --**freezeTransform()
-- debugprint ("Marker "+marker.name+" made.")
-- hide marker
-- )
-- for m = 1 to masterMarkerArray.count do
-- (
-- if (masterMarkerArray[m][3] as string) != "undefined" do
-- (
-- thisPar = getNodeByName ("SKEL_"+(substring masterMarkerArray[m][3] 8 100))
-- marker = getNodeByName ("SKEL_"+(substring masterMarkerArray[m][1] 8 100))
-- debugprint ("Parented "+marker.name+" to "+thisPar.name)
-- marker.parent = thisPar
-- )
-- )
-- )
-- debugPrint "Marker definition loading complete..."
--
-- )
-- --first build an array of the skeleton nodes
--
-- objArray = objects as array
--
-- for o = 1 to objArray.count do
-- (
-- if (substring objArray[o].name 1 4) == "SKEL" do
-- (
-- chi = objArray[o]
-- par = objArray[o].parent
--
-- if (par as string) != "undefined" then
-- (
-- skelStr = ("#(("+"\""+chi.name +"\""+"),("+"\""+par.name+"\""+"))")
-- thisArr = execute skelStr
-- appendIfUnique skelArr thisArr
-- debugPrint skelStr
-- )
-- else
-- (
-- par = "undefined"
-- skelStr = ("#(("+"\""+chi.name +"\""+"),("+"\""+par+"\""+"))")
-- thisArr = execute skelStr
-- appendIfUnique skelArr thisArr
-- debugPrint skelStr
-- )
-- )
-- if objArray[o].name == "Dummy01" do
-- (
-- chi = objArray[o]
-- par = objArray[o].parent
--
-- if par == undefined do
-- (
-- par = "undefined"
-- )
-- skelStr = ("#(("+"\""+chi.name +"\""+"),("+"\""+par+"\""+"))")
-- thisArr = execute skelStr
-- appendIfUnique skelArr thisArr
-- debugPrint skelStr
--
-- )
-- if objArray[o].name == "mover" do
-- (
-- chi = objArray[o]
-- par = objArray[o].parent
--
-- if par != undefined do
-- (
-- skelStr = ("#(("+"\""+chi.name +"\""+"),("+"\""+par.name+"\""+"))")
-- thisArr = execute skelStr
-- appendIfUnique skelArr thisArr
-- debugPrint skelStr
-- )
-- )
-- )
-- debugPrint "============================================================================="
-- debugPrint skelArr
-- debugPrint ("skelArr count = "+(skelArr.count as string))
-- debugPrint "============================================================================="
-- cui.commandPanelOpen = false
--
-- if skelArr.count != 0 then
-- (
-- --first we create the markers
-- for skl = 1 to skelArr.count do
-- (
-- thisBone = getNodeByName skelArr[skl][1]
-- if thisBone.name == "Dummy01" then
-- (
-- markerName = ("Marker_"+thisBone.name)
-- )
-- else
-- (
-- if (thisBone.name == "mover") or (thisBone.name == "Mover") then
-- (
-- markerName = ("Marker_"+"mover")
-- )
-- else
-- (
-- markerName = ("Marker"+(substring thisBone.name 5 100))
-- )
-- )
-- doesMarkerExist = getNodeByName markerName
-- if doesMarkerExist != undefined do --remove any existing markers
-- (
-- delete doesMarkerExist
-- )
-- marker = Point pos:[3.36035,3.35986,0]
-- marker.transform = thisBone.transform
-- marker.size = 0.1
-- marker.cross = on
-- marker.centermarker = off
-- marker.axistripod = off
-- marker.box = off
-- marker.wirecolor = green
-- marker.name = markerName
-- debugPrint ("Made "+markerName)
--
-- lockMarkers marker
-- )
-- debugPrint "Markers made..."
-- unparentMarkers()
--
-- --now we ensure the legs are all planar
-- for pln = 1 to planarMarkerArray.count do
-- (
-- customPlanarMarkerArray = planarMarkerArray[pln]
-- alignMarkers customPlanarMarkerArray
-- )
--
-- for obj in objects do
-- (
-- if (substring obj.name 1 6) == "Marker" do
-- (
-- rectifyScientificNotationValues obj
-- )
-- )
--
-- debugPrint ("Markers Planarised")
--
-- parentMarkerNodes()
--
-- )
-- else
-- (
-- Messagebox "WARNING! Couldn't find any SKEL joints with which to generate markers." beep:true
-- )
--
-- debugPrint ("Wiring Markers...")
-- wireMarkers connectedMarkerNodes
--
-- cui.commandPanelOpen = true
-- )
-- fn mirrorMarker selectedMarkers =
-- (
-- undo "Mirror Marker" on
-- (
-- -- if selection.count == 1 then
-- -- (
-- --first off unparent markers
-- -- unparentMarkers()
-- for s = 1 to selectedMarkers.count do
-- (
-- selectedMarker = selectedMarkers[s]
-- if (substring selectedMarker.name 1 6) == "Marker" do
-- (
-- oppositeMarkerName = undefined
-- if (substring selectedMarker.name 8 1) == "L" then
-- (
-- oppositeMarkerName = ((substring selectedMarker.name 1 7)+"R"+(substring selectedMarker.name 9 60))
-- )
-- else
-- (
-- if (substring selectedMarker.name 8 1) == "R" then
-- (
-- oppositeMarkerName = ((substring selectedMarker.name 1 7)+"L"+(substring selectedMarker.name 9 60))
-- )
-- else
-- (
-- messagebox ((selectedMarkers[s] as string)+" cannot be mirrored as no opposite match found.") beep:true
-- )
-- )
--
-- if oppositeMarkerName != undefined do
-- (
-- oppositeMarker = getNodeByName oppositeMarkerName
-- wpx = in coordsys world selectedMarker.position.x
-- wpy = in coordsys world selectedMarker.position.y
-- wpz = in coordsys world selectedMarker.position.z
-- in coordsys world selectedMarker.rotation.x = 0.0
-- in coordsys world selectedMarker.rotation.y = 0.0
-- in coordsys world selectedMarker.rotation.z = 0.0
--
-- in coordsys world selectedMarker.position.x = wpx
-- in coordsys world selectedMarker.position.y = wpy
-- in coordsys world selectedMarker.position.z = wpz
--
-- in coordsys world oppositeMarker.rotation.x = 0.0
-- in coordsys world oppositeMarker.rotation.y = 0.0
-- in coordsys world oppositeMarker.rotation.z = 0.0
-- in coordsys world oppositeMarker.position.x = ((in coordsys world selectedMarker.position.x) * -1)
--
-- in coordsys world oppositeMarker.position.y = ((in coordsys world selectedMarker.position.y))
-- in coordsys world oppositeMarker.position.z = ((in coordsys world selectedMarker.position.z))
--
-- print ("Opposite marker = "+oppositeMarkerName )
-- )
-- format ("Mirrored "+selectedMarker.name+".\n")
-- )
-- )
-- -- parentMarkerNodes()
-- )
-- -- else
-- -- (
-- -- messagebox ("Please mirror with only one Marker")
-- -- )
-- )
-- clearListener()
-- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-- if ((skelGenGUI != undefined) and (skelGenGUI.isDisplayed)) do
-- (destroyDialog skelGenGUI)
-- rollout skelGenGUI "Mr Skeleton"
-- (
-- checkBox chkDebugPrnt "DebugPrint" checked:true tooltip:"Check to enable debug print output."
-- dropDownList ddSkelType "Type" items:ddListArray
--
-- button btnFileMarkers "Default Markers" width:160 tooltip:"Create default Markers for selected skeleton type."
-- button btnFinalSkelGen "Final Skeleton" width:160 tooltip:"Create final Skeleton."
-- button btnCTRLRig "Create Control Rig" width:160 tooltip:"Create MotionBuilder Control rig Skeleton."
--
-- button btnMirrorMkr "Mirror Marker" width:160 tooltip:"Mirror selected Markers."
-- button btnRemoveMarkers "Delete Markers" width:160 tooltip:"Delete all Markers from scene."
-- button btnAddAntlerRoot "Add Antler Root" width:160 tooltip:"Add facial root node."
-- button btnGenSpecFile "Generate SpecFile" width:160 tooltip:"Generate a spec file."
--
-- -- button btnCB_Off "<debug> CB off " width:160 tooltip:"Stretchy bone length callback off."
-- button btnAlignMarkers "<debug> Align Markers to Skel" width:160 tooltip:"Generate Marker objects from current skeleton."
-- button btnCreateMarkers "<debug> Markers From Skel" width:160 tooltip:"Generate Marker objects from current skeleton."
-- button btnGenMarkerFile "<debug> Gen Markers File" width:160 tooltip:"Generate Marker mkr file from current Markers."
-- -- button btnUdpTag "<debug> UDP Tag" width:160
-- button btnApplyAnim "<debug> Test Anim" width:160 tooltip:"Apply 90 degree rotational test animation."
--
-- on skelGenGUI open do
-- (
-- -- populateDropDown()
-- skelType = ddListArray[1]
-- debugPrint ("skelType defaulting to "+ddListArray[1])
-- defaultbonewidth = 0.05
-- defaultfinsize = 0.01
-- chkDebugPrnt.state = false
-- debugPrintVal = chkDebugPrnt.state
--
-- print ("debugPrint = "+(debugprintval as string))
-- )
--
-- on chkDebugPrnt changed theState do
-- (
-- if chkDebugPrnt.state == false then
-- (
-- debugPrintVal = false
-- print "Debug printing disabled."
-- )
-- else
-- (
-- debugPrintVal = true
-- print "Debug printing enabled."
-- )
-- )
--
-- on ddSkelType selected i do
-- (
-- skelType = ddListArray[i]
-- debugPrint ("You picked "+skelType)
-- defineSkeletonSettings skelType
-- )
--
--
-- on btnFileMarkers pressed do --Default Markers
-- (
-- if skelType != ddListArray[1] then
-- (
-- defineSkeletonSettings skelType
--
-- createMarkers true
-- -- buildNewMarkerSet()
-- )
-- else
-- (
-- messagebox "Please make a valid skeleton type selection"
-- print "Please make a valid skeleton type selection"
-- )
-- )
--
-- on btnFinalSkelGen pressed do --Final Skeleton
-- (
-- maxops.affectchildren = true
--
-- if skelType != ddListArray[1] then
-- (
-- for o in objects do
-- (
-- if (substring o.name 1 6) == "Marker" do
-- (
-- o.showLinks = false
-- )
-- )
--
-- bonePrefix = "SKEL"
-- --now we need ot get rid of all existing SKEL nodes
-- removeExistingSkeletonData()
--
-- --messagebox ("SkelType: "+(skelType as string))
--
-- -- clearSkelTypes()
--
-- defineSkeletonSettings skelType
--
-- -- print ("About to create marker arrays")
-- -- break()
-- -- *********************************************
-- --marker shifting occuring here
-- -- *********************************************
-- createMarkerArrays()
--
-- -- removeStretchyRig()
-- print ("Beginning Final skeleton generation...")
-- createSkeleton bonePrefix false
-- -- CtrlRigGen()
--
-- if skelType == ddListArray[5] do --ok its a horse so we need to add saddle node
-- (
-- saddleName = "SKEL_SADDLE"
-- saddleParent = "SKEL_ROOT"
-- saddlePos = [0,0,1.47357]
-- addSaddleNode saddleName saddleParent saddlePos
-- )
--
-- addPhNodes()
--
-- udpTag()
--
-- genSpecFile()
-- )
-- else
-- (
-- messagebox "Please make a valid skeleton type selection"
-- print "Please make a valid skeleton type selection"
-- )
-- )
--
-- on btnGenSpecFile pressed do
-- (
-- genSpecFile()
-- )
--
-- on btnCTRLRig pressed do
-- (
-- if skelType != ddListArray[1] then
-- (
--
-- bonePrefix = "SKEL"
--
-- defineSkeletonSettings skelType
-- existingMarker = getNodeByName "Marker_ROOT"
--
-- if existingMarker == undefined do
-- (
-- createMarkers true
-- alignMarkersToSkel()
-- )
--
-- for o in objects do
-- (
-- if (substring o.name 1 4) == bonePrefix do
-- (
-- o.name = ("EXISTING_"+o.name)
-- )
-- )
--
-- createMarkerArrays()
-- print ("Beginning CTRL Rig generation...")
--
-- createSkeleton bonePrefix false
-- CtrlRigGen()
--
-- )
-- else
-- (
-- messagebox "Please make a valid skeleton type selection"
-- print "Please make a valid skeleton type selection"
-- )
-- )
--
-- on btnMirrorMkr pressed do --Mirror Markers
-- (
-- curMarker = selection as array
-- --mirrorMarker (selection as array)
-- --first off we'll unparent the markers
-- unparentmarkers()
--
-- if queryBox "Click Yes to mirror all or No to mirror selected." beep:true then
-- (
-- --run mirror on EVERYTHING
-- currName = selection[1].name
--
-- isLeft = findString currName "_L_"
--
-- if isLeft != undefined then
-- (
-- isLeft = true
-- )
-- else
-- (
-- isLeft = false
-- )
--
-- markersToMirror = #()
--
-- if isLeft == true then
-- (
-- for o in objects do
-- (
-- if (substring o.name 1 9) == "Marker_L_" do
-- (
-- print ("Mirroring left to right")
-- append markersToMirror o
-- )
-- )
-- )
-- else
-- (
-- for o in objects do
-- (
-- if (substring o.name 1 9) == "Marker_R_" do
-- (
-- print ("Mirroring right to left")
-- append markersToMirror o
-- )
-- )
-- )
--
-- format ("markers to mirror: "+(markersToMirror as string))
-- mirrorMarker markersToMirror
--
-- debugPrint "Mirroring complete."
-- )
-- else --do for no
-- (
-- --run mirror on only opposite of selected.
--
-- selA = selection as array
--
-- markersToMirror = #()
--
-- currName = selA[1].name
--
-- isLeft = findString currName "_L_"
--
-- if isLeft != undefined then
-- (
-- isLeft = true
-- )
-- else
-- (
-- isLeft = false
-- )
-- if isLeft == true then
-- (
-- for o in selA do
-- (
-- if (substring o.name 1 9) == "Marker_L_" do
-- (
-- print ("Mirroring left to right")
-- append markersToMirror o
-- )
-- )
-- )
-- else
-- (
-- for o in selA do
-- (
-- if (substring o.name 1 9) == "Marker_R_" do
-- (
-- print ("Mirroring right to left")
-- append markersToMirror o
-- )
-- )
-- )
--
--
-- -- for a in sela do
-- -- (
-- -- if (substring a.name 1 9) == "Marker_L_" do
-- -- (
-- -- append markersToMirror a
-- -- )
-- --
-- -- if (substring a.name 1 9) == "Marker_R_" do
-- -- (
-- -- append markersToMirror o
-- -- )
-- -- )
--
-- format ("markers to mirror: "+(markersToMirror as string))
-- mirrorMarker markersToMirror
-- )
-- parentMarkerNodes() -- reparent them
--
-- select curMarker
-- )
--
-- -- on btnRemoveMarkers pressed do
-- -- (
-- -- removeMarkerObjects()
-- -- )
-- --
-- on btnAddAntlerRoot pressed do
-- (
-- addAntlerRoot()
-- )
--
-- -- on btnCB_Off pressed do --<debug> CallBack off
-- -- (
-- -- removeStretchyCallBack()
-- -- )
-- on btnAlignMarkers pressed do
-- (
-- alignMarkersToSkel()
-- )
--
-- on btnCreateMarkers pressed do --create markers from existing skeleton
-- (
-- if skelType != ddListArray[1] then
-- (
-- defineSkeletonSettings skelType
-- createMarkers false
-- )
-- else
-- (
-- messagebox "Please make a valid skeleton type selection"
-- print "Please make a valid skeleton type selection"
-- )
-- )
--
-- on btnGenMarkerFile pressed do
-- (
-- filein (RsConfigGetWildWestDir() +"script/3dsMax/Characters/Rigging/mrSkeleton/buildMarkerArrays.ms")
-- )
--
-- on btnUdpTag pressed do
-- (
-- udpTag()
-- )
--
-- on btnApplyAnim pressed do
-- (
-- filein (RsConfigGetWildWestDir() + "script/3dsMax/Characters/Rigging/mrSkeleton/generateNinetyDegreeRotations.ms")
-- )
-- )
-- CreateDialog skelGenGUI width:175 pos:[1400, 100]