Maxscript: Duplicated Members And Functions in Structure Definitions


#1

Using a struct defined like this :

struct controlData (this, data, enabled, visible)

generates an error in Max 2016.

-- Compile error: Duplicate struct member name:  this
--  In line: 			this,

(denisT example from this link Scripting Rollouts for tabs)

While searching official documentation i found an explanation

Starting with 3ds Max 2014 structs with duplicated Member definitions are disallowed and a Compile-time error is generated.

What would be the change that allows the struct above to run in Max 2014+?


#2

in versions 2014+ this is a hidden property of any structure. You try to define duplicated ‘this’ property which is not allowed anymore.
so the solution could be:

struct controlData (_this, data, enabled, visible)

where _this is your property instead of this

PS. i usually use owner now in the same meaning


#3

Thanks, Denis!

Trying to assign a custom struct data back to the rollout.data something like

secA.data = (rolloutData owner:Rollout:secA title:"NEW A" open:true border:true controls:#((controlData owner:RadioControl:rb data:#(#(#state, 1)) enabled:true visible:true), (controlData owner:SpinnerControl:sp data:#(#(#value, 99), #(#range, [0,1e+009,99])) enabled:true visible:true)))

gives a syntax error . It looks like the colon from owner definition raises this error:

-- Syntax error: at keyword parameter, expected <keyword arg>
--  In line: secA.data = (rolloutData owner:Rollout:s

I’m testing this to see if i can save and load the rollout data from file .

What would be the best approach to avoid this syntax error ?