Structs In an Array or an Array of Structs

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 06 June 2011   #1
Structs In an Array or an Array of Structs

I'm using Structs for the first time and not sure what the best method to use is.

So I think I need a struct like this.....

Struct Task (OptionA, OptionB, OptionC)

Now if I want to have multiple tasks should I have....

An Array of Structs

TaskArray = #(TaskA OptionA:ValA OptionB:ValB OptionC:ValC,TaskB OptionA:ValA OptionB:ValB OptionC:ValC,TaskC OptionA:ValA OptionB:ValB OptionC:ValC)


An Array of Structs

Tasks = Task (OptionA:#(ValA,ValA,ValA), OptionB:#(ValB,ValB,ValB), OptionC:#(ValC,ValC,ValC))

Any good examples or documentation?


Maxscript Made Easy...
Old 06 June 2011   #2
hi Dave, the first option would be my approach (IMHO), compiling an array of the instantiated structs, rather than multiple arrays of struct parameters.

An example can be found here -

I use an array of structs to retrieve morpher key data from XML. The struct in my example is called keydata. I found that easier to iterate and restore the keys this way. It seems to be a more OO based approach to me!

Read my technical blog -

Last edited by LoneRobot : 06 June 2011 at 09:53 AM.
Old 06 June 2011   #3
Definitely the first option, a bit pointless to use a struct otherwise.
Old 06 June 2011   #4
Yep cheers guys, After a few mins of playing around it seems completely obvious now, option 1 is the way.
Maxscript Made Easy...
Old 06 June 2011   #5
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 08:30 PM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.