Itoo Software Forum

Author Topic: MAXscript Questions  (Read 1963 times)

Shawn Olson

  • Jr. Member
  • **
  • Posts: 92
  • Wall Worm
    • Wall Worm
MAXscript Questions
« 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!
Shawn Olson
Product Management Team @ Autodesk for 3ds Max
Developer of Wall Worm Tools

Shawn Olson

  • Jr. Member
  • **
  • Posts: 92
  • Wall Worm
    • Wall Worm
Re: MAXscript Questions
« Reply #1 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)
« Last Edit: April 27, 2017, 03:06:02 PM by Shawn Olson »
Shawn Olson
Product Management Team @ Autodesk for 3ds Max
Developer of Wall Worm Tools

Screenscene vfx

  • Newbie
  • *
  • Posts: 36
Re: MAXscript Questions
« Reply #2 on: April 26, 2017, 11:14:16 AM »
That array property print script is lovely Shawn - thanks for posting it!

Shawn Olson

  • Jr. Member
  • **
  • Posts: 92
  • Wall Worm
    • Wall Worm
Re: MAXscript Questions
« Reply #3 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.
Shawn Olson
Product Management Team @ Autodesk for 3ds Max
Developer of Wall Worm Tools

amitgedia

  • Full Member
  • ***
  • Posts: 153
Re: MAXscript Questions
« Reply #4 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

Shawn Olson

  • Jr. Member
  • **
  • Posts: 92
  • Wall Worm
    • Wall Worm
Re: MAXscript Questions
« Reply #5 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.
Shawn Olson
Product Management Team @ Autodesk for 3ds Max
Developer of Wall Worm Tools