Itoo Software Forum

Forest Pack => Forest Pro (*) => Topic started by: Shawn Olson on April 25, 2017, 03:56:55 PM

Title: MAXscript Questions
Post by: Shawn Olson on April 25, 2017, 03:56:55 PM
I need to automate some steps in a Forest pipeline and need to be able to generate a forest and populate it with an array of props.

I've been trying to manually add props by appending array properties but so far there are always issues.

Can you provide a function that would add a model to a forest in this format:

function addNodeToForest forestNode modelNode = ()

Thanks!
Title: Re: MAXscript Questions
Post by: Shawn Olson on April 26, 2017, 12:41:39 AM
NVM, I figured it out.

For anyone else, here was a bare minimum needed to get to work (as I was needing):

Code: [Select]
function wallworm_createForest surfaces mdls:undefined uvMode:false  = (
if ::Forest_Pro != undefined AND surfaces.count > 0 then (
local f = Forest_Pro()
f.surflist = surfaces
if uvMode == true then (
f.pf_aractivelist[1] = off
f.surfmode = 1
) else (
f.pf_aractivelist[1] = on
f.surfmode = 0
)
if mdls.count > 0 then (
f.cobjlist = mdls
local problist = #()
local geomlist = #()
local usemeshdimlist = #()
local namelist = #()
local tempnamelist = #()
for i = 1 to mdls.count do (
append geomlist 2
append usemeshdimlist true
append namelist mdls[i].name
append problist 100
append tempnamelist "One Plane"
)
f.tempnamelist = tempnamelist
f.geomlist =geomlist
f.usemeshdimlist = usemeshdimlist
f.namelist= namelist
f.problist = problist
)
f.units_x = 1024
f.surfanim = on
f
)
)
To print all array params:

Code: [Select]
for p in (getPropNames  $) WHERE (classof (getProperty $ p)==ArrayParameter) do format "% : %\n" p (getProperty $ p)
Title: Re: MAXscript Questions
Post by: Screenscene vfx on April 26, 2017, 11:14:16 AM
That array property print script is lovely Shawn - thanks for posting it!
Title: Re: MAXscript Questions
Post by: Shawn Olson on April 27, 2017, 03:07:00 PM
Thanks.

I had to update the script to use ::Forest_Pro instead of Forest_Pro. This can avoid some variable scope problems I discovered for people who don't have Forest.
Title: Re: MAXscript Questions
Post by: amitgedia on April 30, 2017, 08:51:56 AM
Hi Guys,
I am sorry for such a question but i found this post interesting and understood half of it.
my question is how to use this script and can u provide an example with a max file to understand it more

thanks
Title: Re: MAXscript Questions
Post by: Shawn Olson on May 03, 2017, 03:59:05 PM
I wrote the script to drop into one of my own pipelines. What I'm using it for is to select landscape areas in the scene, the models that should go on them, then pressing a button to automate setting up Forest. There will be a video demonstrating how I'm using them in the near future.