Notifications
Clear all
[Closed] Functions with Out Parameters
Sep 17, 2013 10:47 am
Is it possible to write your own maxscript function with a set of Out Parameters?
5 Replies
Sep 17, 2013 10:47 am
Ah yes, makes sense now…
(
fn testFunction ¶m ¶m2 =
(
param = 4
param2 = 8
true
)
testFunction &testVal &testVal2
print testVal
print testVal2
)
Sep 17, 2013 10:47 am
I find this style not very intuitive, I try to avoid it whenever possible.
1 Reply
Me neither, I don’t like using with things like the layermanager…One of our guys was asking me how it worked and I was trying to find a way to explain what was going on under the hood. I generally prefer to pre-declare the variables so it reads a bit easier.
(
fn testFunction ¶m ¶m2 =
(
param = 4
param2 = 8
true
)
testVal = 0
testVal2 = 0
testFunction &testVal &testVal2
print testVal
print testVal2
)
Sep 17, 2013 10:47 am
there some value types in the MXS which are ‘pointers’… they can be used as out arguments with no using the &
samples:
a = #("b","a")
fn sortArray arr = (sort a)
sortArray a
format "%
" a
a = point3 1 2 3
fn incrementPoint3 p =
(
for k=1 to 3 do p[k] += 1
)
incrementPoint3 a
format "%
" a
struct range (start = 0.0, end = 1.0)
a = range 100 200
fn doubleRange d =
(
d.start *= 2
d.end *= 2
ok
)
doubleRange a
format "%
" a
a = orange
fn swapRB c =
(
swap c.r c.b
)
swapRB a
format "%
" a