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 CLOSED
 
Thread Tools Search this Thread 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)

or

An Array of Structs

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



Any good examples or documentation?

Cheers


D
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
  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 -

http://www.scriptspot.com/3ds-max/scripts/speechbot

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!
__________________
Regards,
Pete

Read my technical blog - lonerobot.net

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...
http://davewortley.wordpress.com/
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 07:18 AM.


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