PDA

View Full Version : As the Array can be CustAttribute parameters??


easyfrog
04-11-2012, 10:23 AM
As the Array can be CustAttribute parameters ??

theCA= attributes theDATA
(
parameters main rollout:rol
(
myArray type:#array ----- ???
)

rollout rol "aaa"
(

)
)

Obviously the above code will ERROR. so how to achieve it ??

Pjanssen
04-11-2012, 10:29 AM
Arrays in parameter blocks are called Tabs. They are statically typed though, so you'll have to specify something like #IntTab, #StringTab, and so on.

TheGrak
04-12-2012, 08:59 PM
Or:


(
--based on code by denis Trofimov
fn applyObjectData node theArray:#() = if isvalidnode node do
(
str = "attributes objectData
(
rollout paramsRollout \"Parameters\"
(
dropdownlist nodesDd items:% pos:[0,0]
)
)
"
ss = stringstream ""
format str(with printallelements on theArray as string) to:ss
objectData = execute (ss as string)
free ss
custAttributes.add node objectData baseobject:on
select node --return the node as $
max modify mode -- now the rollout was created the first time
)
local myBox = box(); myBox.name = "theBox"
local myArray = #("test1","test2",(3.14 as string),myBox.name)
applyObjectData myBox theArray:myArray
)


Everything you store in the array will have to be a string, but you can cast the strings back to their original data types, if that information is available.

CGTalk Moderation
04-12-2012, 08:59 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.