• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Helpfile Maxscript Example Corrections
#1
I noticed two examples from the help file which were not working when used. Here are my fixed recommendations..

EXAMPLE: FumeFX MAXScript Functions for Accessing the Simulation
Code:
fn PostObjects = (
for i in 0 to (nx - 1) do
for j in 0 to (ny - 1) do
for k in 0 to (nz - 1) do
SetSmoke i j k k/nz
)
Variables k and nz are integers, so dividing k/nz will always result in 0 in maxscript. A fix would be is to convert one of them to a float type, or just multiply one of them to 1.0.

FIX:
Code:
fn PostObjects =
(
    for i in 0 to (nx - 1) do
    (
        for j in 0 to (ny - 1) do
        (
            for k in 0 to (nz - 1) do
            (
                val = k/(nz as float) -- fix
                SetSmoke i j k val
            )
        )
    )
)

--------------------------------------------------------------------------------------


EXAMPLE: More Channel Functions
Code:
fn PostLoad = (
sm = 1.0 -- desired minimum smoke value
for i in 0 to (voxels-1) do
(
s = GetSmokeByIndex
if (s < sm) then ( SetSmokeByIndex sm )
)
)
The index input required by the functions GetSmokeByIndex and SetSmokeByIndex was not set.

FIX:
Code:
fn PostLoad =
(
    sm = 1.0 -- desired minimum smoke value
    for i in 0 to (voxels-1) do
    (
        s = GetSmokeByIndex i
        if (s < sm) then ( SetSmokeByIndex i sm )
    )
)

I also changed the recommended code format as it is more maxscript-centric. Big Grin
Jeff Lim
  Reply
#2
Hello !

Thank you for your corrections. I will added them to the help file right away.
Feel free to post if you find anything else.

Kresimir
  Reply
#3
thanks Kresmir Big Grin

I also noticed that the built in global variables are not documented in the helpfile:

Code:
node    ffx         - current FumeFX node
int    ffxSimStep    - simulation frame
int    ffxSimSubStep    - simulation substep (if there are more than 1)
int    nx, ny, nz    - dimensions of the adaptive area (in voxels)
int     nyz        - +-nyz means next voxel over x axis, +-nz over y axis, +-1 over z axis
int    voxels        - total number of voxels
Jeff Lim
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)