Notifications
Clear all

[Closed] Ifdef equivalent in maxscript

Just put your code inside the ‘if’ block and set the global inside.

So if worcks in this case exactly like ifdesf? I was thinking about such solution, but you completlly right, my imagination stoped me from doing that, as in programming languages, I normally using like C++, something like this would never worck. Many thanks.

Nah it wasn´t as easy, I tried firs this:

if myVar==undefined then
(
 global myVar=OK

MyAttribute = attributes "my attribute"
(
...
)

)

It didn´t worck, as MyAttribute was seen as a local whatever and not avaible after exiting if statement, at the end have to change my code to:

  if  MyAttribute==undefined then
    (

    global MyAttribute = attributes "my attribute"
    (
    ...
    )

    )

Which seems to worck.

It is a great discovery and completely undoes the previous logic. Congratulations!

Page 2 / 2