[Closed] Help with data storage
Hi all,
i have a doubt about data storage and i hope someone could open my eyes.
The question is how does a modifier to store data when a scene is closed and retrieve it once is open?
For example, i suppose the edit_Poly modifier stores, among other things, the position of each vertex. But how does the modifier to store all that info?
If i wanted to store this info in a struct like this
struct dataInfo
(
numVertex,
posVertex,
…
…
)
where could i store it without loosing it when the 3dsMax is closed?
I need to do this but i have no idea how to store data without loosing it. I would appreciate any help anyone could give me.
Thanks in advance.
What sort of data are you trying to store?
Modifiers and objects store editable data in in parameterblocks, these expose the data to max. Most but not all data is stored in parameter blocks. If you animate a editable poly a masterpoint controller is created where per vertex a bezier controller is made, that stores the animation.
So depending on what you need to make, you can extend a existing modifier or object by creating a scripted plugin, where you can define your own paramters / routines for editing/creating objects.
Or you could make a custom attribute on basicly any maxobject that stores certain data for you, it really depends on what you are trying to do.
-Johan
Hi, thanks for the reply.
What i would like to do is to use, for example, an attribute holder and store there an struct to store each vertex of a mesh with its position.
Something like this
struct dataInfo(
numVertex,
posVertex,
…
…)
I am trying to do something similar to a morpher.
I am not very familiar with the parameterblocks, can i store there structs or only arrays?
Can i retrieve the information of the vertices in a parameterblock? I do not know beforehand the number of vertices i need to store so if i can not use structs is quite difficult to manage with that.
Any idea of how can i store that info?
Thanks.
You can’t directly store structs in a parameter block, you can convert a struct to a string and store that in a stringArray parameter, but I think it’s not a very good approach.
You could make a parameter block with multiple “linked” parameters.
parameters main
(
vertexIndex type:#intTab
vertexPos type:#point3Tab
)
-- or cheat and use
parameters main
(
vertexInfo type:#point4Tab
)
For the “linking” you need logic that works on both arrays at the same time.
the point4tab is a cheat where you could store the vertnum in the 1st point4 value and the position in the next 3. You could even use a matrixTab if you need to store more values (no string values though!)
Definitly take a look at the “Scripted Plug-in Clauses” chapter in the mxs help.
-Johan
Ok, i will try that
One last question, due to i have to store a lot of vertex info, there is any way of knowing the amount of memory usage the arrays (or the modifier where the arrays are located) are using?
Thanks.