Scripts

Free memory MAX

Copy these lines of code into your maxscript editor to help clean up memory if Max starts chugging.

  • gc() Garbage Collection.
  • freescenebitmaps() Cleans up in texture memory.
  • clearUndoBuffer() Removes your Undo’s

From <http://www.characterink.com/2010/10/25/quick-tip-1-free-up-memory-in-3ds-max/>

Control Dynamic text with box height

(copy & paste this script into the MAXscript editor and run or use as reference)

  1. –Create a box and a text shape
  2. b=box name: “ControlBox” wirecolor:blue
  3. t=text name: “ControlledText” wirecolor:red
  4. select $ControlledText
  5. modPanel.addModToSelection (Poly_Select ()) ui:on
  6. theCtrl = float_script() –create a float script controller
  7. theCtrl.addNode “TheText” t –add a variable, connect to theText node
  8. theCtrl.addNode “TheBox” b –add a variable, connect to the Box node –Set the expression to assign the height of the box as string to the –.text property of the text shape, then return 0 on the next line:
  9. theCtrl.SetExpression “TheText.text = TheBox.height as string\n0”
  10. t.kerning.controller=theCtrl –assign the controller to the kerning
  11. animate on at time 100 b.height*=2 –animate the height of the box
  12. max tool zoomextents all –zoom into the two objects

Dynamic text from Distance between 2 objects

— Dynamic text from Distance between 2 objects

–Creates a box and a text shape

  1. b_A=box name: “ControlBox_A” wirecolor:blue
  2. $ControlBox_A.pos = [-82,0,0]
  3. b_B=box name: “ControlBox_B” wirecolor:yellow
  4. $ControlBox_B.pos = [82,0,0]
  5. ExpTM=ExposeTm name: “ExposeDIST” wirecolor:green
  6. t=text name: “ControlledText” wirecolor:white
  7. $ControlledText.size = 30
  8. select $ControlledText
  9. modPanel.addModToSelection (Poly_Select ()) ui:on
  10. theCtrl = float_script() –create a float script controller
  11. theCtrl.addNode “TheText” t –add a variable, connect to theText node
  12. theCtrl.addNode “TheDISTANCE” ExpTM –add a variable, connect to the Expose TM the next line:
  13. $ExposeDIST.exposeNode = $ControlBox_A
  14. $ExposeDIST.useParent = off
  15. $ExposeDIST.localReferenceNode = $ControlBox_B
  16. theCtrl.SetExpression “TheText.text = ExpTM.distance as string\n0” –Set the expression to select $ControlledText
  17. t.kerning.controller=theCtrl –assign the controller to the kerning
  18. set animate on
  19. sliderTime = 100f
  20. $ControlBox_B.pos = [180,0,0]
  21. sliderTime = 0f
  22. $ControlBox_B.pos = [66,0,0]
  23. set animate off

MAXScript – Mouse Tools for Vertex Weighting during Skinning: 

— (copy & paste this script into the MAXscript editor and run

— then assign a hotkey to “Quick Vertex Weight Tool” in category:”Custom Skin Tools”)

  1. macroScript QuickSkinVertexWeight category:”Custom Skin Tools”
  2. tooltip:”Quick Vertex Weight Tool”
  3. (
  4.     tool AssignSkinVertexWeightTool
  5.     (
  6.         local original
  7.         fn setweight wt = (
  8.             if (wt < 0) then wt = 0
  9.             if (wt > 1.0) then wt = 1.0
  10.             skinOps.setWeight $.modifiers[#Skin] wt
  11.             $.modifiers[#Skin].effect = wt
  12.         )
  13.         on mousePoint clickno do (
  14.             if clickno > 1 then return #stop
  15.             original = $.modifiers[#Skin].effect
  16.         )
  17.         on mouseAbort clickno do (
  18.             setweight original
  19.         )
  20.         on mouseMove clickno do (
  21.             newval = (original + (gridDist.x  * 0.01))
  22.             setweight newval
  23.         )
  24.     )
  25.     startTool AssignSkinVertexWeightTool prompt:”Set Vertex Weight”
  26. )

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s