970 lines
34 KiB
Plaintext
Executable File
970 lines
34 KiB
Plaintext
Executable File
-- expressionCreator.ms
|
|
-- Rockstar North
|
|
-- Matt Rennie Nov 2010
|
|
-- Tool to simplify creation of expressions in a more visual fashion rather than code wise.
|
|
|
|
filein "rockstar/export/settings.ms" -- This is fast
|
|
|
|
-- Figure out the project
|
|
theProjectRoot = RsConfigGetProjRootDir()
|
|
theProject = RSConfigGetProjectName()
|
|
theWildWest = RsConfigGetWildWestDir()
|
|
|
|
theProjectConfig = RsConfigGetProjBinConfigDir()
|
|
|
|
filein (theWildWest+"script/3dsMax/Characters/Rigging/mrSkeleton_v2/expressionExport/expressionCreate_UI.ms")
|
|
|
|
-- filein (RsConfigGetWildWestDir() + "script/max/Rockstar_North/character/includes/FN_oldWWTU.ms")
|
|
|
|
-- filein (theWildWest + "script/3dsMax/_common_functions/FN_RSTA_Rigging.ms")
|
|
-- OldWWCollectToolUsageData (getThisScriptFilename())
|
|
|
|
-- filein (theWildWest + "script/3dsMax/_common_functions/FN_RSTA_Rigging.ms")
|
|
-- -- filein (theWildWest + "script/3dsMax/Characters/Rigging/mrSkeleton_v2/expressionExport/mrExpression_Export.ms")
|
|
--
|
|
-- filein (theWildWest + "script/3dsMax/Characters/Rigging/usefulScripts/removeEmptyScalarTargets.ms")
|
|
-- filein (theWildWest + "script/3dsMax/Characters/Rigging/usefulScripts/RSTA_convertOldJoystickToNew.ms")
|
|
--
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
-- -- clearListener()
|
|
-- global expressionRoll
|
|
-- global driver = undefined
|
|
-- global driverAxis = undefined
|
|
-- global driverName = undefined
|
|
-- global driverP1 = "undefined"
|
|
-- global driverP2 = "undefined"
|
|
|
|
-- global receiver = undefined
|
|
-- global receiverAxis = undefined
|
|
-- global receiverName = undefined
|
|
|
|
-- global expSelection = undefined
|
|
-- global expType = ""
|
|
-- global multiplierVal = undefined
|
|
|
|
-- global expressionText = undefined
|
|
-- global txtExpressionText = undefined
|
|
-- global preserveContVal = undefined
|
|
|
|
-- fn RSTA_addLookAt driver receiver preserveContVal=
|
|
-- (
|
|
-- print ("Tring to add lookat to "+receiver.name+" with "+driver.name+"as target")
|
|
--
|
|
-- if preserveContVal != true then
|
|
-- (
|
|
-- format "Not preserving controllers\n"
|
|
--
|
|
-- if toLower(receiverTransType) == toLower("Rotation.controller") do
|
|
-- (
|
|
-- for i = receiver.Rotation.controller.count to 2 by -1 do
|
|
-- (
|
|
-- receiver.Rotation.controller.delete i
|
|
-- )
|
|
-- receiver.Rotation.controller.available.controller = Euler_XYZ()
|
|
-- receiver.Rotation.controller.setName 2 "Zero Euler XYZ"
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- format "Preserving controllers\n"
|
|
-- )
|
|
--
|
|
-- newLookat = receiver.rotation.controller.Available.controller = LookAt_Constraint ()
|
|
-- newLookAt.appendTarget driver 50
|
|
--
|
|
-- -- theCtrl = LookAt_Constraint relative:true --create a lookAt Constraint with Keep Initial Offset on
|
|
-- -- theCtrl.appendTarget theTarget 100 --append the picked target to it with Weight of 100
|
|
-- -- selection.rotation.controller = theCtrl --and instance the controller to all selected objects
|
|
-- )
|
|
|
|
-- fn RSTA_addExpression driver driverAxis receiver receiverAxis expressionText preserveContVal =
|
|
-- (
|
|
--
|
|
-- print ("receiver.name = "+(receiver.name as string))
|
|
-- print ("receiverAxis = "+receiverAxis)
|
|
-- print ("driver.Name = "+driver.Name)
|
|
|
|
-- print "==================================================="
|
|
|
|
|
|
--
|
|
-- newfcStr = undefined
|
|
-- driverTrans = undefined
|
|
-- driverAxisValue = undefined
|
|
-- receiverTrans = undefined
|
|
-- receiverTransValue = undefined
|
|
-- SVN = undefined
|
|
-- fjString = undefined
|
|
-- fjStr = undefined
|
|
--
|
|
-- print ("*** driverAxis = "+driverAxis+" ****")
|
|
--
|
|
-- if (substring driverAxis 3 5) == "Trans" then
|
|
-- (
|
|
-- --driverTrans = ("position."+driver.name+".Zero_Pos_XYZ")
|
|
-- driverTransType = "position.controller"
|
|
-- -- driverTrans = ("position."+"controller"+".Zero_Pos_XYZ")
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- -- if (substring driverAxis 3 5) == "Rotat" then
|
|
-- if (substring driverAxis 3 3) == "Rot" then
|
|
-- (
|
|
-- -- messagebox "FOUNDROT"
|
|
-- driverTransType = "rotation.controller"
|
|
-- -- driverTrans = ("rotation."+"controller"+".Euler_XYZ")
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- -- print ("(substring "+driverAxis+" 3 5) = "+(substring driverAxis 3 5) )
|
|
-- driverTransType = "scale.controller"
|
|
-- )
|
|
-- )
|
|
--
|
|
-- if (substring receiverAxis 3 3) == "Rot" then
|
|
-- (
|
|
-- receiverTransType = "rotation.controller"
|
|
-- print ("set receiverTransType to rotation.controller")
|
|
-- -- receiverTrans = ("rotation."+"controller"+".Zero_Pos_XYZ")
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- if (substring receiverAxis 3 3) == "Tra" then
|
|
-- (
|
|
-- receiverTransType = "position.controller"
|
|
-- print ("set receiverTransType to position.controller")
|
|
-- -- receiverTrans = ("rotation."+"controller"+".Zero_Pos_XYZ")
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- receiverTransType = "scale.controller"
|
|
-- print ("set receiverTransType to scale.controller")
|
|
-- )
|
|
-- )
|
|
--
|
|
-- if preserveContVal != true then
|
|
-- (
|
|
-- format "Not preserving controllers\n"
|
|
--
|
|
-- format ("receiverTransType: "+receiverTransType+"\n")
|
|
--
|
|
-- if toLower(receiverTransType) == toLower("Position.controller") do
|
|
-- (
|
|
-- for i = receiver.position.controller.count to 2 by -1 do
|
|
-- (
|
|
-- receiver.position.controller.delete i
|
|
-- )
|
|
-- receiver.position.controller.available.controller = Position_XYZ()
|
|
-- receiver.position.controller.setName 2 "Zero Pos XYZ"
|
|
-- )
|
|
-- if toLower(receiverTransType) == toLower("Rotation.controller") do
|
|
-- (
|
|
-- for i = receiver.Rotation.controller.count to 2 by -1 do
|
|
-- (
|
|
-- receiver.Rotation.controller.delete i
|
|
-- format ("Removing "+receiverTransType+" controller "+(i as string)+"\n")
|
|
-- )
|
|
--
|
|
-- receiver.Rotation.controller.available.controller = Euler_XYZ()
|
|
-- receiver.Rotation.controller.setName 2 "Zero Euler XYZ"
|
|
-- )
|
|
-- if toLower(receiverTransType) == toLower("Scale.controller") do
|
|
-- (
|
|
-- for i = receiver.Scale.controller.count to 2 by -1 do
|
|
-- (
|
|
-- receiver.Scale.controller.delete i
|
|
-- )
|
|
-- receiver.Scale.controller.available.controller = ScaleXYZ()
|
|
-- receiver.Scale.controller.setName 2 "Zero Scale XYZ"
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- format "Preserving controllers\n"
|
|
-- )
|
|
--
|
|
-- driverTransValue = (substring driverAxis 1 1)
|
|
-- receiverTransValue = (substring receiverAxis 1 1)
|
|
-- ---------------------------------------------------------------------------------------------
|
|
-- -- if driverTransType == "rotation.controller" then
|
|
-- if driverTransType == "rotation.controller" do
|
|
-- (
|
|
-- if (driver.rotation.controller as string) != "Controller:Euler_XYZ" then
|
|
-- (
|
|
-- controllerNumberdriver = driver.rotation.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberdriver = "notList"
|
|
-- )
|
|
-- )
|
|
-- -- else
|
|
-- if driverTransType == "position.controller" do
|
|
-- (
|
|
-- if (driver.position.controller as string) != "Controller:Position_XYZ" then
|
|
-- (
|
|
-- controllerNumberdriver = driver.position.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberdriver = "notList"
|
|
-- )
|
|
-- )
|
|
-- if driverTransType == "scale.controller" do
|
|
-- (
|
|
-- if (driver.scale.controller as string) != "Controller:ScaleXYZ" then
|
|
-- (
|
|
-- controllerNumberdriver = driver.scale.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberdriver = "notList"
|
|
-- )
|
|
-- )
|
|
--
|
|
-- -- if receiverTransType == "rotation.controller" then
|
|
-- if receiverTransType == "rotation.controller" do
|
|
-- (
|
|
-- if (receiver.rotation.controller as string) != "Controller:Euler_XYZ" then
|
|
-- (
|
|
-- receiver.rotation.controller.Available.controller = Euler_XYZ () --add a new euler controller onto the object so we can add a float expression
|
|
-- controllerNumberReceiver = receiver.rotation.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberReceiver = "notList"
|
|
-- )
|
|
-- )
|
|
-- -- else
|
|
-- if receiverTransType == "position.controller" do
|
|
-- (
|
|
-- if (receiver.position.controller as string) != "Controller:Position_XYZ" then
|
|
-- (
|
|
-- receiver.position.controller.Available.controller = Position_XYZ () --add a new pos controller onto the object so we can add a float expression
|
|
-- controllerNumberReceiver = receiver.position.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberReceiver = "notList"
|
|
-- )
|
|
-- )
|
|
-- if receiverTransType == "scale.controller" do
|
|
-- (
|
|
-- if (receiver.scale.controller as string) != "Controller:ScaleXYZ" then
|
|
-- (
|
|
-- receiver.scale.controller.Available.controller = ScaleXYZ () --add a new pos controller onto the object so we can add a float expression
|
|
-- controllerNumberReceiver = receiver.scale.controller.count
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- controllerNumberReceiver = "notList"
|
|
-- )
|
|
-- )
|
|
|
|
|
|
--
|
|
-- print "**************************************************"
|
|
-- print ("receiver.name = "+receiver.name)
|
|
-- print ("receiverTransType = "+receiverTransType)
|
|
-- print ("controllerNumberReceiver = "+(controllerNumberReceiver as string))
|
|
-- print ("receiverTransValue = "+receiverTransValue)
|
|
-- print "**************************************************"
|
|
|
|
|
|
--
|
|
-- if controllerNumberReceiver != "notList" then
|
|
-- (
|
|
-- fcStr = ("$"+receiver.name+"."+receiverTransType+"["+(controllerNumberReceiver as string)+"].controller."+receiverTransValue+"_"+receiverTransType+" = Float_Expression ()")
|
|
-- print ("_______SETTING "+fcStr+"_________________")
|
|
-- execute fcStr
|
|
-- fcStr = ("$"+receiver.name+"."+receiverTransType+"["+(controllerNumberReceiver as string)+"].controller."+receiverTransValue+"_"+receiverTransType)
|
|
-- newfcStr = execute fcStr
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- fcStr = ("$"+receiver.name+"."+receiverTransType+"."+receiverTransValue+"_"+receiverTransType+" = Float_Expression ()")
|
|
-- print ("_______SETTING "+fcStr+"_________________")
|
|
-- execute fcStr
|
|
-- fcStr = ("$"+receiver.name+"."+receiverTransType+"."+receiverTransValue+"_"+receiverTransType)
|
|
-- newfcStr = execute fcStr
|
|
-- )
|
|
--
|
|
-- print "---------------------------------------------"
|
|
-- print ("driver.name = "+driver.name)
|
|
-- print ("driverTransType = "+driverTransType )
|
|
-- print ("controllerNumberDriver = "+(controllerNumberDriver as string))
|
|
-- print ("driverTransValue = "+driverTransValue)
|
|
-- print "---------------------------------------------"
|
|
--
|
|
--
|
|
--
|
|
-- if controllerNumberDriver != "notList" then
|
|
-- (
|
|
-- driverString = ("$"+driver.name+"."+driverTransType+"["+(controllerNumberDriver as string)+"].controller."+driverTransValue+"_"+driverTransType)
|
|
-- driverStr = execute driverString
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverString = ("$"+driver.name+"."+driverTransType+"."+driverTransValue+"_"+driverTransType)
|
|
-- driverStr = execute driverString
|
|
-- )
|
|
|
|
|
|
-- SVN = (driver.name+ "_"+driverTransValue)
|
|
--
|
|
--
|
|
-- newfcStr.AddScalarTarget SVN driverStr --add scalar pointing to the translation of the joystick object
|
|
|
|
-- -- foundDriverInExpression = (findString expressionText "Driver")
|
|
-- -- foundDriverInExpression = (findString expressionText SVN)
|
|
|
|
-- -- if foundDriverInExpression != undefined then
|
|
-- -- (
|
|
-- -- preStr = (substring expressionText 1 (foundDriverInExpression - 1))
|
|
-- -- print ("preStr = "+preStr)
|
|
-- -- postStr = (substring expressionText (foundDriverInExpression +6) (expressionText.count ))
|
|
-- -- print ("postStr = "+postStr)
|
|
-- --
|
|
-- -- expressionTextFinal = (preStr+SVN+postStr)
|
|
-- -- print ("Found a Driver in text")
|
|
-- -- print ("expressionTextFinal = "+expressionTextFinal)
|
|
-- -- )
|
|
-- -- else
|
|
-- -- (
|
|
-- -- expressionTextFinal = (SVN+" "+expressionText)
|
|
-- -- print ("Didn't find a Driver in text")
|
|
-- -- print ("expressionTextFinal = "+expressionTextFinal)
|
|
-- -- )
|
|
--
|
|
-- -- newfcStr.SetExpression (ExpressionTextFinal)
|
|
-- newfcStr.SetExpression (ExpressionText)
|
|
|
|
-- print ("Expression Created on "+receiver.name+"'s "+receiverTransValue+receiverTransType+" driven by "+driver.name+"'s "+driverTransValue+driverTransType)
|
|
-- )
|
|
|
|
|
|
-- fn RSTA_expressionCreatorUI =
|
|
-- (
|
|
-- preserveContVal = undefined
|
|
--
|
|
-- if ((expressionRoll != undefined) and (expressionRoll.isDisplayed)) do
|
|
-- (destroyDialog expressionRoll)
|
|
|
|
-- driver = undefined
|
|
-- driverAxis = undefined
|
|
-- driverName = "None"
|
|
--
|
|
-- receiver = undefined
|
|
-- receiverAxis = undefined
|
|
-- receiverName = "None"
|
|
--
|
|
-- expressionText = ""
|
|
--
|
|
-- try (cui.UnRegisterDialogBar ExpressionCreator)catch()
|
|
-- try (destroyDialog ExpressionCreator)catch()
|
|
|
|
-- --The rollout
|
|
-- rollout expressionRoll "Expression Creator"
|
|
-- (
|
|
-- groupbox grpDriver "Driver" pos:[5,5] width:165 height:145
|
|
-- button btnDriverPickByName "Pick Driver by Name" pos:[10,23] width:150 height:25
|
|
-- --****************************************************************
|
|
-- --add a pickbutton to select by hit
|
|
-- pickbutton btnDriverPickByHit "Pick Driver by Hit" pos:[10,53] width:150 height:25
|
|
-- --****************************************************************
|
|
-- editText txtDriverName "" pos:[10,81] width:150 height:20 readOnly:true bold:false
|
|
-- -- label labelDriverName driverName pos:[10,55] width:150 height:25
|
|
-- dropDownList btnDriverAxis "Driver Axis" items:#("None", "X Trans", "Y Trans", "Z Trans", "X Rot", "Y Rot", "Z Rot", "X Scale", "Y Scale", "Z Scale") pos:[10,105] width:150 height:25
|
|
--
|
|
-- groupbox grpReceiver "Receiver" pos:[175,5] width:165 height:145
|
|
-- button btnReceiverPickByName "Pick Receiver" pos:[180,23] width:150 height:25
|
|
-- --****************************************************************
|
|
-- --add a pickbutton to select by hit
|
|
-- pickbutton btnReceiverPickByHit "Pick Receiver by Hit" pos:[180,53] width:150 height:25
|
|
-- --****************************************************************
|
|
-- editText txtReceiverName "" pos:[180,81] width:150 height:20 readOnly:true bold:false
|
|
-- dropDownList btnReceiverAxis "Receiver Axis" items:#("None", "X Trans", "Y Trans", "Z Trans", "X Rot", "Y Rot", "Z Rot", "X Scale", "Y Scale", "Z Scale") pos:[180,105] width:150 height:25
|
|
--
|
|
-- groupbox grpExpType "Expression Type" pos:[6,150] width:334 height:135
|
|
-- dropDownList btnExpType "" pos:[10,165] width:150 height:25 items:#("None", "Clamp", "Mult", "degToRad", "degToRad Clamp", "LookAt")
|
|
-- spinner spinMult "Multiplier" pos:[45,190] width:80 value:1 range:[-1000,1000,1]
|
|
--
|
|
-- spinner spinClampUpr "Upper Clamp" pos:[60,190] width:80 value:1 range:[-1000,1000,1]
|
|
-- spinner spinClampLwr "Lower Clamp" pos:[60,210] width:80 value:1 range:[-1000,1000,1]
|
|
-- spinner spinClampMult " Multiplier" pos:[60,230] width:80 value:1 range:[-1000,1000,1]
|
|
--
|
|
-- spinner spind2rClampUpr "Upper Clamp" pos:[60,190] width:80 value:1 range:[-1000,1000,1]
|
|
-- spinner spind2rClampLwr "Lower Clamp" pos:[60,210] width:80 value:1 range:[-1000,1000,1]
|
|
-- spinner spind2rClampMult " Multiplier" pos:[60,230] width:80 value:1 range:[-1000,1000,1]
|
|
--
|
|
-- -- radiobuttons addClampMult labels:#("No","Yes")
|
|
--
|
|
-- label labelExpressionName "Expression:" pos:[5,290]
|
|
-- editText txtExpressionText "" text:"Driver" pos:[5,305] width: 340 height: 200
|
|
--
|
|
-- checkBox chkPreserveCont "Preserve Existing Expressions" pos:[5,510] tooltip:"Check to keep existing expressions" checked:true
|
|
--
|
|
-- button btnCreateExpression "Create Expression" pos:[5,530] width: 330 height:45
|
|
--
|
|
-- button btnRemoveExpressions "Remove Expressions From Selection" pos:[5,580] width: 330 height:45 tooltip:"Remove all expression controllers from selection."
|
|
--
|
|
-- button btnCreateJoystick "Create New Joystick" pos:[5,630] width:160 height:45 tooltip:"Create new joystick object."
|
|
--
|
|
-- button btnConvertJoysticksToNewStyle "Convert Joysticks" pos:[185,630] width:150 height:45 tooltip:"Convert selected joystick to R* standard."
|
|
--
|
|
-- on expressionRoll open do
|
|
-- (
|
|
-- spinMult.enabled = false
|
|
-- spinMult.visible = false
|
|
--
|
|
-- spinClampUpr.enabled = false
|
|
-- spinClampUpr.visible = false
|
|
-- spinClampLwr.enabled = false
|
|
-- spinClampLwr.visible = false
|
|
-- spinClampMult.enabled = false
|
|
-- spinClampMult.visible = false
|
|
--
|
|
-- spind2rClampUpr.enabled = false
|
|
-- spind2rClampUpr.visible = false
|
|
-- spind2rClampLwr.enabled = false
|
|
-- spind2rClampLwr.visible = false
|
|
-- spind2rClampMult.enabled = false
|
|
-- spind2rClampMult.visible = false
|
|
--
|
|
-- --labelDriverName = driverName
|
|
-- if driver == undefined then
|
|
-- (
|
|
-- driverP1 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP1 = driver.name
|
|
-- )
|
|
-- if driverAxis == undefined then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- if driverAxis == "None" then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP2 = (substring driverAxis 1 1)
|
|
-- )
|
|
-- )
|
|
-- txtExpressionText.text = (driverP1+"_"+driverP2)
|
|
-- )
|
|
--
|
|
-- on chkPreserveCont changed theState do
|
|
-- (
|
|
-- preserveContVal = theState
|
|
--
|
|
-- format ("preserveContVal set to "+(theState as string)+"\n")
|
|
-- )
|
|
|
|
-- on btnDriverPickByName pressed do
|
|
-- (
|
|
-- selectedDriver = selectByName title:"Pick Driver object" showHidden:true
|
|
-- -- selectedDriver = pickObject message:"Pick Driver" count:1 pickFrozen:false select:true
|
|
-- driver = selectedDriver[1]
|
|
-- format "You selected '%'!\n" driver
|
|
-- if driver == undefined then
|
|
-- (
|
|
-- driverP1 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP1 = driver.name
|
|
-- )
|
|
-- if driverAxis == undefined then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP2 = (substring driverAxis 1 1)
|
|
-- )
|
|
-- txtExpressionText.text = (driverP1+"_"+driverP2)
|
|
-- txtDriverName.text = driverP1
|
|
--
|
|
-- --now test if send / receiver are scale and if so ensure the controller is not a bezier scale
|
|
-- if driverAxis != undefined do
|
|
-- (
|
|
-- if (substring driverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if driver != undefined do
|
|
-- (
|
|
-- if (driver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+driver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on btnDriverPickByHit picked obj do
|
|
-- (
|
|
-- --see if the user did not cancel the picking...
|
|
|
|
-- if obj != undefined do
|
|
-- (
|
|
-- driver = obj
|
|
-- format "You selected '%'!\n" driver
|
|
-- if driver == undefined then
|
|
-- (
|
|
-- driverP1 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP1 = driver.name
|
|
-- )
|
|
-- if driverAxis == undefined then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP2 = (substring driverAxis 1 1)
|
|
-- )
|
|
-- txtExpressionText.text = (driverP1+"_"+driverP2)
|
|
-- txtDriverName.text = driverP1
|
|
--
|
|
-- --now test if send / receiver are scale and if so ensure the controller is not a bezier scale
|
|
-- if driverAxis != undefined do
|
|
-- (
|
|
-- if (substring driverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if driver != undefined do
|
|
-- (
|
|
-- if (driver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+driver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on btnDriverAxis selected i do
|
|
-- (
|
|
-- driverAxis = btnDriverAxis.items[i]
|
|
-- format "You selected '%'!\n" btnDriverAxis.items[i]
|
|
-- if driver == undefined then
|
|
-- (
|
|
-- driverP1 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP1 = driver.name
|
|
-- )
|
|
-- if driverAxis == undefined then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- if driverAxis == "None" then
|
|
-- (
|
|
-- driverP2 = "undefined"
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- driverP2 = (substring driverAxis 1 1)
|
|
-- )
|
|
-- )
|
|
-- txtExpressionText.text = (driverP1+"_"+driverP2)
|
|
--
|
|
-- --now test if send / receiver are scale and if so ensure the controller is not a bezier scale
|
|
-- if (substring driverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if driver != undefined do
|
|
-- (
|
|
-- if (driver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+driver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
|
|
-- on btnReceiverPickByName pressed do
|
|
-- (
|
|
-- selectedReceiver = selectByName title:"Pick Receiver object" showHidden:true
|
|
-- -- selectedReceiver = pickObject message:"Pick Receiver" count:1 pickFrozen:false select:true
|
|
-- receiver = selectedReceiver[1]
|
|
-- format "You selected '%'!\n" receiver
|
|
--
|
|
-- txtReceiverName.text = receiver.name
|
|
--
|
|
-- --now test if send / receiver are scale and if so ensure the controller is not a bezier scale
|
|
-- if receiverAxis != undefined do
|
|
-- (
|
|
-- if (substring receiverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if receiver != undefined do
|
|
-- (
|
|
-- if (receiver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+receiver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on btnReceiverPickByHit picked obj do
|
|
-- (
|
|
-- --see if the user did not cancel the picking...
|
|
|
|
-- if obj != undefined do
|
|
-- (
|
|
-- receiver = obj
|
|
-- format "You selected '%'!\n" receiver
|
|
--
|
|
-- txtReceiverName.text = receiver.name
|
|
--
|
|
-- --now test if send / receiver are scale and if so ensure the controller is not a bezier scale
|
|
-- if receiverAxis != undefined do
|
|
-- (
|
|
-- if (substring receiverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if receiver != undefined do
|
|
-- (
|
|
-- if (receiver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+receiver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
-- )
|
|
|
|
-- on btnReceiverAxis selected i do
|
|
-- (
|
|
-- format "You selected '%'!\n" btnReceiverAxis.items[i]
|
|
-- receiverAxis = btnReceiverAxis.items[i]
|
|
--
|
|
-- if (substring receiverAxis 3 5) == "Scale" do
|
|
-- (
|
|
-- if receiver != undefined do
|
|
-- (
|
|
-- if (receiver.scale.controller as string) == "Controller:Bezier_Scale" then
|
|
-- (
|
|
-- messageBox ("Warning please ensure "+receiver.name+" has a frozen scale list.") beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
--
|
|
-- )
|
|
--
|
|
-- on btnExpType selected i do
|
|
-- (
|
|
-- format "You selected '%'!\n" btnExpType.items[i]
|
|
-- expSelection = btnExpType.items[i]
|
|
--
|
|
-- if expSelection == "LookAt" do
|
|
-- (
|
|
-- -- RSTA_addLookAt driver receiver
|
|
-- spinMult.enabled = false
|
|
-- spinMult.visible = false
|
|
--
|
|
-- spinClampUpr.enabled = false
|
|
-- spinClampUpr.visible = false
|
|
-- spinClampLwr.enabled = false
|
|
-- spinClampLwr.visible = false
|
|
-- spinClampMult.enabled = false
|
|
-- spinClampMult.visible = false
|
|
|
|
-- spind2rClampUpr.enabled = false
|
|
-- spind2rClampUpr.visible = false
|
|
-- spind2rClampLwr.enabled = false
|
|
-- spind2rClampLwr.visible = false
|
|
-- spind2rClampMult.enabled = false
|
|
-- spind2rClampMult.visible = false
|
|
--
|
|
-- txtExpressionText.text = ("LookAt on "+receiver.name+" with "+driver.name+"as target")
|
|
-- )
|
|
--
|
|
-- if expSelection == "degToRad" do
|
|
-- (
|
|
-- spinMult.enabled = false
|
|
-- spinMult.visible = false
|
|
--
|
|
-- spinClampUpr.enabled = false
|
|
-- spinClampUpr.visible = false
|
|
-- spinClampLwr.enabled = false
|
|
-- spinClampLwr.visible = false
|
|
-- spinClampMult.enabled = false
|
|
-- spinClampMult.visible = false
|
|
|
|
-- spind2rClampUpr.enabled = false
|
|
-- spind2rClampUpr.visible = false
|
|
-- spind2rClampLwr.enabled = false
|
|
-- spind2rClampLwr.visible = false
|
|
-- spind2rClampMult.enabled = false
|
|
-- spind2rClampMult.visible = false
|
|
--
|
|
--
|
|
-- expType = expSelection
|
|
-- -- txtExpressionText.text = (expType+" ("+txtExpressionText.text+")")
|
|
-- txtExpressionText.text = (expType+" ( "+(driverP1+"_"+driverP2)+" )")
|
|
-- )
|
|
--
|
|
|
|
-- if expSelection == "degToRad Clamp" do
|
|
-- (
|
|
-- spinMult.enabled = false
|
|
-- spinMult.visible = false
|
|
--
|
|
-- spinClampUpr.enabled = false
|
|
-- spinClampUpr.visible = false
|
|
-- spinClampLwr.enabled = false
|
|
-- spinClampLwr.visible = false
|
|
-- spinClampMult.enabled = false
|
|
-- spinClampMult.visible = false
|
|
|
|
-- spind2rClampUpr.enabled = true
|
|
-- spind2rClampUpr.visible = true
|
|
-- spind2rClampLwr.enabled = true
|
|
-- spind2rClampLwr.visible = true
|
|
-- spind2rClampMult.enabled = true
|
|
-- spind2rClampMult.visible = true
|
|
--
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
--
|
|
-- finalString = ("( min ( "+(spind2rClampUpr.value as string)+", ( max ( "+(spind2rClampLwr.value as string)+", ( degToRad ( "+driverString+" * "+(spind2rClampMult.value as string)+" ))))))")
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
--
|
|
-- if expSelection == "Mult" do
|
|
-- (
|
|
-- spinMult.enabled = true
|
|
-- spinMult.visible = true
|
|
--
|
|
-- spinClampUpr.enabled = false
|
|
-- spinClampUpr.visible = false
|
|
-- spinClampLwr.enabled = false
|
|
-- spinClampLwr.visible = false
|
|
-- spinClampMult.enabled = false
|
|
-- spinClampMult.visible = false
|
|
|
|
-- spind2rClampUpr.enabled = false
|
|
-- spind2rClampUpr.visible = false
|
|
-- spind2rClampLwr.enabled = false
|
|
-- spind2rClampLwr.visible = false
|
|
-- spind2rClampMult.enabled = false
|
|
-- spind2rClampMult.visible = false
|
|
--
|
|
-- -- txtExpressionText.text = (txtExpressionText.text+" * "+(spinMult.value as string))
|
|
-- txtExpressionText.text = ((driverP1+"_"+driverP2)+" * "+(spinMult.value as string))
|
|
-- )
|
|
--
|
|
-- if expSelection == "Clamp" do
|
|
-- (
|
|
-- spinMult.enabled = false
|
|
-- spinMult.visible = false
|
|
--
|
|
-- spinClampUpr.enabled = true
|
|
-- spinClampUpr.visible = true
|
|
-- spinClampLwr.enabled = true
|
|
-- spinClampLwr.visible = true
|
|
-- spinClampMult.enabled = true
|
|
-- spinClampMult.visible = true
|
|
--
|
|
-- spind2rClampUpr.enabled = false
|
|
-- spind2rClampUpr.visible = false
|
|
-- spind2rClampLwr.enabled = false
|
|
-- spind2rClampLwr.visible = false
|
|
-- spind2rClampMult.enabled = false
|
|
-- spind2rClampMult.visible = false
|
|
--
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
--
|
|
-- finalString = ("( min ( "+(spinClampUpr.value as string)+", ( max ( "+(spinClampLwr.value as string)+", ( "+driverString+" * "+(spinClampMult.value as string)+" )))))")
|
|
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on spinClampUpr changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
|
|
-- finalString = ("( min ( "+(spinClampUpr.value as string)+", ( max ( "+(spinClampLwr.value as string)+", ( "+driverString+" * "+(spinClampMult.value as string)+" )))))")
|
|
--
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
--
|
|
-- on spinClampLwr changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
|
|
-- finalString = ("( min ( "+(spinClampUpr.value as string)+", ( max ( "+(spinClampLwr.value as string)+", ( "+driverString+" * "+(spinClampMult.value as string)+" )))))")
|
|
--
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
|
|
-- on spinClampMult changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
-- finalString = ("( min ( "+(spinClampUpr.value as string)+", ( max ( "+(spinClampLwr.value as string)+", ( "+driverString+" * "+(spinClampMult.value as string)+" )))))")
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
--
|
|
-- on spind2rClampUpr changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
|
|
-- finalString = ("( min ( "+(spind2rClampUpr.value as string)+", ( max ( "+(spind2rClampLwr.value as string)+", ( degToRad ( "+driverString+" * "+(spind2rClampMult.value as string)+" ))))))")
|
|
--
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
--
|
|
-- on spind2rClampLwr changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
|
|
-- finalString = ("( min ( "+(spind2rClampUpr.value as string)+", ( max ( "+(spind2rClampLwr.value as string)+", ( degToRad ( "+driverString+" * "+(spind2rClampMult.value as string)+" ))))))")
|
|
--
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
|
|
-- on spind2rClampMult changed val do
|
|
-- (
|
|
-- driverString = (driverP1+"_"+driverP2)
|
|
-- finalString = ("( min ( "+(spind2rClampUpr.value as string)+", ( max ( "+(spind2rClampLwr.value as string)+", ( degToRad ( "+driverString+" * "+(spind2rClampMult.value as string)+" ))))))")
|
|
-- txtExpressionText.text = finalString
|
|
-- )
|
|
--
|
|
-- on spinMult changed val do
|
|
-- (
|
|
-- originalExpr = (txtExpressionText.text )
|
|
-- findStarIndex = (findString originalExpr " " )
|
|
-- if findStarIndex == undefined do
|
|
-- (
|
|
-- findStarIndex = 100
|
|
-- )
|
|
-- --exprString = (substring originalExpr 1 (findStarIndex - 1))
|
|
-- exprString = (driverP1+"_"+driverP2)
|
|
|
|
-- txtExpressionText.text = (exprString+" * "+(spinMult.value as string))
|
|
-- )
|
|
--
|
|
-- on txtExpressionText changed txt do
|
|
-- (
|
|
-- expressionText = txt
|
|
-- )
|
|
--
|
|
-- on btnCreateExpression pressed do
|
|
-- (
|
|
-- if expSelection == "LookAt" then
|
|
-- (
|
|
-- if (driver != undefined) then
|
|
-- (
|
|
-- if (receiver != undefined) then
|
|
-- (
|
|
-- RSTA_addLookAt driver receiver
|
|
-- RSTA_expressionCreatorUI()
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messagebox "Please ensure Receiver is picked" beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messagebox "Please ensure Driver is picked" beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- if driver != undefined then
|
|
-- (
|
|
-- if driverAxis != undefined then
|
|
-- (
|
|
-- if receiver != undefined then
|
|
-- (
|
|
-- if receiverAxis != undefined then
|
|
-- (
|
|
-- if driver != receiver then
|
|
-- (
|
|
-- expressionText = txtExpressionText.text
|
|
-- print ("driver = "+driver.name)
|
|
-- print ("driver Axis= "+driverAxis)
|
|
-- print ("receiver = "+receiver.name)
|
|
-- print ("receiver Axis= "+receiverAxis)
|
|
-- print ("expressionText = "+expressionText)
|
|
|
|
-- RSTA_addExpression driver driverAxis receiver receiverAxis expressionText preserveContVal
|
|
-- RSTA_expressionCreatorUI()
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messageBox "WARNING! Cannot set driver to same as receiver..." beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messageBox "WARNING! Please pick a receiver Axis..." beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messageBox "WARNING! Please pick a receiver..." beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messageBox "WARNING! Please pick a driver Axis..." beep:true
|
|
-- )
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messageBox "WARNING! Please pick a driver..." beep:true
|
|
-- )
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on btnRemoveExpressions pressed do
|
|
-- (
|
|
-- if selection.count > 0 then
|
|
-- (
|
|
-- RSTA_FreezeTransform()
|
|
-- )
|
|
-- else
|
|
-- (
|
|
-- messagebox ("Please pick your objects!") beep:true title:"WARNING!"
|
|
-- )
|
|
-- )
|
|
--
|
|
-- on btnCreateJoystick pressed do
|
|
-- (
|
|
-- filein (theWildWest + "script/3dsMax/Characters/Rigging/Slider_Toolkit.ms")
|
|
-- )
|
|
--
|
|
-- on btnConvertJoysticksToNewStyle pressed do
|
|
-- (
|
|
-- RSTA_convertOldJoystickToNew obj
|
|
-- )
|
|
--
|
|
-- )--end expressionRoll
|
|
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
-- -------------------------------------------------------------------------------------------------------------------------
|
|
-- -- createDialog expressionRoll 400 800 pos:[1150, 100] --main window size
|
|
-- createDialog expressionRoll 350 700 pos:[1150, 100] --main window size
|
|
--
|
|
-- --cui.RegisterDialogBar expressionRoll minSize:[180,350] style:#(#cui_dock_all, #cui_floatable)
|
|
-- )
|
|
|
|
-- RSTA_expressionCreatorUI() |