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 Display Modes
  06 June 2011
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...
  06 June 2011
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.
  06 June 2011
Definitely the first option, a bit pointless to use a struct otherwise.
  06 June 2011
Yep cheers guys, After a few mins of playing around it seems completely obvious now, option 1 is the way.
Maxscript Made Easy...
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 04:41 PM.

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