PDA

View Full Version : How does max script handle instances?


stuh505
10-13-2005, 05:15 PM
If you instantiate a struct, and then change the struct and re-evaluate it, this does not change the definition of the instanced struct.

There are two possible explanations for this that I see

1) Every single struct instance stores the struct definition

2) Re-defining a struct does not override the previous definition but makes a new definition, and instances simply store a pointer to the definition that was used to create them

It is very important for me to know which method max script uses, because if it uses the first method, then the object oriented approach should be abandoned and instead there should be "data structs" and "function structs" to allow many instances of a struct to be created without wasting memory by duplicating identical function definitions.

Bobo
10-13-2005, 08:48 PM
If you instantiate a struct, and then change the struct and re-evaluate it, this does not change the definition of the instanced struct.

There are two possible explanations for this that I see

1) Every single struct instance stores the struct definition

2) Re-defining a struct does not override the previous definition but makes a new definition, and instances simply store a pointer to the definition that was used to create them

It is very important for me to know which method max script uses, because if it uses the first method, then the object oriented approach should be abandoned and instead there should be "data structs" and "function structs" to allow many instances of a struct to be created without wasting memory by duplicating identical function definitions.

When it comes to functions in structs, it looks to be case 2. But I might be wrong.

stuh505
10-13-2005, 08:52 PM
Looks like I'm going to have to do a stress test then!

stuh505
10-13-2005, 10:50 PM
Good news, the speed test confirms that method 2 is used :)

CGTalk Moderation
10-13-2005, 10:50 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.