Home Technical Talk

MAXScript Help

polycounter lvl 10
Offline / Send Message
pthomas1172 polycounter lvl 10
I know zip about Maxscript, but Im having to import about a thousand and one models to do the exact same process over and over. I tried to macro record my actions but its too specific to each model..is there some super easy way to repeat a long series of actions that im just missing?





HALP!

Replies

  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    could you perhaps illustrate what you want to do, we might be able to guide you then through the process of creating a script for that very specific task.

    Yes you can macro record commands, but most likely your task will include some specific things like only do this to object with this name or this property... in that case you would have to apply some context sensitive script.

    But its kind of tricky to help you at this stage without much concrete input ;)
  • pthomas1172
    Options
    Offline / Send Message
    pthomas1172 polycounter lvl 10
    Sure, thank you!

    This is for making collision models :

    clone model
    apply specific material to clone
    apply vertex weld modifier
    apply push modifier at 0.5
    apply Pro-Optimise at 50% while preserving textures cords
    apply Pro-Optimise again at 75% while preserving textures cords
    done

    thats it... thoughts?
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    things you can do (have soon lunch, can take it further then), hit F11 (will open the maxscript listener), somewhere in the menu there should be a turn macro recording 'on' switch. Witch will start recording your steps you do in the max interface (well most of them).
    Just do the described steps you just wrote and have it record the steps to the maxscript listener. Once you are done turn off the maxscript macro recording and copy the generated code and paste it here in this thread.

    I will look at it, try to reproduce it at my PC and explain you step by step which parts of that macro recording are useful and how they should be copied to your script.

    Deal?
  • pthomas1172
    Options
    Offline / Send Message
    pthomas1172 polycounter lvl 10
    Most awesome!

    I will do it in the morning.. now its time to go home and drink

    And id / Doom 4 salutes you for TExTOOLs... dear lord thank you for that tool!
  • RobotGilardi
    Options
    Offline / Send Message
    something like this?
    see maxscript help for options on any of the commands, you might want to put an offset in for cloneNodes, or add a step to move your object
    myObject = [COLOR="Red"]$[/color] -- Object is selection, change to something else if necessary
    numCopies = [COLOR="Red"]100[/color] -- Pick your number
    
    for i= 0 to numCopies do(
            --create clone
    	objArry = #{}
    	maxOps.cloneNodes myObject cloneType:#copy newNodes:&objArry
    
    
    
    	-- add material
    -- Change this to be your sepcific material instead of [COLOR="Red"]meditmaterials[1][/color]
    	objArry[1].material = [COLOR="Red"]meditmaterials[1][/color]
    
            --Weld
    	addModifier objArry[1] (Vertex_Weld ()) before:1
    
            --Push
    	addModifier objArry[1] (Push ()) before:1
    	objArry[1].modifiers[#Push].Push_Value = 0.5
    
            -- Optimize 50
    	addModifier objArry[1] (ProOptimizer ())
    	mod1 = objArry[1].modifiers[1] -- Last modifier
    	mod1.KeepUV = on
    	mod1.Calculate = on
    	mod1.VertexPercent = 0.5
    
            -- Optimize 75
    	addModifier objArry[1] (ProOptimizer ())
    	mod1 = objArry[1].modifiers[1] -- Last modifier
    	mod1.KeepUV = on
    	mod1.Calculate = on
    	mod1.VertexPercent = 0.75
    )
    
  • pthomas1172
    Options
    Offline / Send Message
    pthomas1172 polycounter lvl 10
    Holy crap thanks!

    the number or copies portion was giving me problems so I removed it. other than that I'm grateful on the help
  • RobotGilardi
    Options
    Offline / Send Message
    You can change numCopies to whatever number you need and it should work instead of using the var

    if anything else doesn't work just let me know
Sign In or Register to comment.