Nils Norgren Posted August 19, 2010 Share Posted August 19, 2010 (edited) During the vray class down at siggraph I presented a Max Tips and Tricks demo I had developed for the Autodesk Booth on the show floor during the CGSchool lunch break. I presented a work flow for using the point cache for animated builds, which used a few maxscript snippets (partial scripts). Jeff had a request to send the maxscripts that I used during the presentation. The scripts are partial, and the context and selection will make them useless, so I thought I would post them here with some explanation as to what they do. I have also included a max file that was my starting point for the demo. I had to delete some of the chairs (they are all copies) to get the file small enough to upload. if you want to recreate the large amount of chairs just copy around the group that are included. here is the Description: The first thing I did was to add a Point Cache modifier to the main animated chair, this one uses point animation on the layer called "3_Animated Chair". After saving the point cache file to disk with all the settings (read about point cache if you are unsure how to use it). A general maxscript note, these are meant to live in the listener, and the double dash comments out text. -----------------------------with the main animated chair selected I ran this script to run, myPC = $.modifiers[1] -- put the cursor at the end of the script and hit "Enter" ---------------------------- this snippet grabs the point cache modifier into a variable ---------------------------- called "myPC (for my point cache) --------- turn off the layer "3_AnimatedChair" ----------------------------------- now select all the chairs that make up the stadium seating, for i in selection do (addmodifier i myPC) --and run this script, it will put an instance of --------------------------------------------------the modifier on each seat ---------- after this last step, select all the chairs again and click the ---------- "Make Unique" button in the modifier panel for i in selection do (i.modifiers[1].playbacktype = 1) -- with the stadium seats still selected, ------------- run this, it will set the playback type from "origional" to "Custom Start" for each seat --------------------- With the chairs still selected, run this script, it will offset each seat's start time by 1/3 for i in 1 to selection.count do (selection.modifiers[1].playbackStart = (i/3.0)) -------------------- Select the dummy for this next build test, --------------------- run this script to grab the dummy into a variable myDumm = $ ----------------- Select the chairs again, run this script to make ----------------- the chairs build in order based on their ----------------- distance to the dummy for i in selection do (i.modifiers[1].playbackStart = ((distance myDumm i) * .5)) ----------------- select the chairs again and run this, ----------------- it will have each chair start it's build ----------------- based on a random number ----------------- between 0 and 140 for i in selection do (i.modifiers[1].playbackStart = (random 0 140)) --------------- this last script will combine the last 2 scripts and --------------- add some randomness to the distance build for i in selection do (i.modifiers[1].playbackStart = ((distance myDumm i) * .25) + (random -6.0 6.0)) ---------- these are some extra script snippets that I saved, -----------for various housecleaning, by reading through them ---------- it should be obvious what they were for, remember -----------that $ is used to point to the selection, used often with ---------- one object selected $.modifiers[1].enabled = false for i in selection do i.modifiers[1].enabled = false for i in selection do deleteModifier i 1 Let me know if anyone has any questions about how things work, I apologize that this is not a more cohesive tutorial, my presentation was captured in the booth at siggraph, you can find it at the Area, under the 20th anniversary section, it was part 1 of the "Tips and Tricks" screen capture. enjoy! -Nils Norgren Edited August 19, 2010 by NilsN Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now