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
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)

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/
 
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 -

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.
 
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...
http://davewortley.wordpress.com/
 
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.
 
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 03:06 AM.


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