PDA

View Full Version : saving and loading alot of information to a external file, the proper way??


luigi
06-10-2008, 02:27 PM
ok hear is the case:

i got and 3d array with the information for each object. each 3d array wil contation nfo for controllers and keys included on them)

I use to do a posetool that relay in saving information in ini files but having problem with saving somtimes , people had told me saving to ini is a bit bugy so i was thinking to save to my own external file and i will like two know advice of people on that ,because i ben using inifiles all this time.

in my precvious tool i was loading all in loop , so i was looping for object and later inside each loop, i was looping again for controller making the loading process quite slow.so for this new tool i was thinking instead of "for i -1 to array,count do ".... reading the controller in a collection wat as" for a in array do"

My question is the next i could do a 4d array with all the object s and .. and read al at once , but i worried if a got to many object the maxscript memory get full and crash.

so the idea is saving and array3d array for each object and read only one object at a time, but read the controller and the keys as a collection to gain speed.

Is this a good idea or should be develope in other way.

marktsang
06-10-2008, 04:11 PM
hi,
i would format the array as it is with printallelements and execute the resultant string when the line (whole array) is read in

e.g
with printAllElements on format "saveParams = %\n" myArray

you can then readin that line and execute to create an array

i have done with thousands of elements and never had a problem...

mark

Kramsurfer
06-10-2008, 10:36 PM
I agree that is a good option. I store my scene, presets, Elements, shot data, ect.. in a large scene structure, then PrintAllElements out to a file. Just filein to have a valid data structure again... really easy and I've not had an issue.

luigi
06-11-2008, 10:58 AM
ok i always use with print all elements.

but i still worried having all in one array.

just because each object wil got all his controller and array with keys for each controller , with and array of properties of keys so this can be a huge array if is a 4d array.
so probably a line for each object will be safiest, imagine 1000 objects with 9 controllers with 300 keys with * properties each I think in this can of cases maxscript memory can get full if you wan to get al in one array. tol as rpm amanger increase the maxsciot memeory size to avoid this can of issues but i dont know how to do that.

i always use setINISetting getINISetting .

so what is the procedure when you use your own format file.

thnaks in advance

eek
06-11-2008, 06:44 PM
Im actually thinking going via the route of a BVH structure without the hierachal structure: store all the controllers and parameters at the header.

OBJECT test
PARAMETERS xPos yPos zPos xRot yRot zRot length radius color
OBJECT test2
PARAMETERS xPos yPos zPos xRot yRot zRot length radius color

the if theres animation just format for each frame the values.

10 20 30 24 35 54 5.4 2.2 [255,255,0]
10 20 30 24 35 54 5.4 2.2 [255,255,0]

but thats just an idea.

RobGalanakis
06-13-2008, 03:22 AM
ok i always use with print all elements.

but i still worried having all in one array.

just because each object wil got all his controller and array with keys for each controller , with and array of properties of keys so this can be a huge array if is a 4d array.
so probably a line for each object will be safiest, imagine 1000 objects with 9 controllers with 300 keys with * properties each I think in this can of cases maxscript memory can get full if you wan to get al in one array. tol as rpm amanger increase the maxsciot memeory size to avoid this can of issues but i dont know how to do that.

i always use setINISetting getINISetting .

so what is the procedure when you use your own format file.

thnaks in advance
First, I would see if there are maxscript memory issues. If there are, you could just break apart the array into separate arrays and write them each to a line, for example. Then you could just format() them to the external file, and fileIn() the readline() when you are reading back the file. This may keep things more manageable memory-wise (but first I'd test if memory is a problem at all).

Edit: should have read your post more closely, you just suggested that. I endorse trying it :)

luigi
06-13-2008, 10:39 AM
hi eek i will have a look on your idea. you can make your brain stop creatign new ideas :).

ok got the script running and going. i endup with a line for each object , probably to get me a stable version and piece of mind.

i wil try to save al in one superarray all the objects in one line , to make test of speed and just because i can run the hole array in one go with for a in animationarray....

i quite happy wih the result thanks guys for the help, know i got my on format of animation call .ard animation replace data. and i can update the animation in a few clicks , no more saving animation recheck the mapping(always the ca where misssing) and selecting the proper opbject to load the animation. and i did a batch loading so i can load or update the information saved in a folder , so that allows me to load a bunch of rig, characters .. all in once.

when I been wirting the external file i only have creat lines as ...

53 --Objects Count
#("Generic_Man_R_IK arm control__SA", #(#.....
#("Generic_Man_L_IK arm control__SA", #(#("[3][1][2][1]",..


so i was having the first line as amount of object load load and for the progress bar update and later a line for each object.

i dint use the format.

OBJECT test2
PARAMETERS xPos yPos zPos xRot yRot zRot length radius color
OBJECT test2
PARAMETERS xPos yPos zPos xRot yRot zRot length radius color

what wil be this format useful for???

how you read the line when you load it

eek
06-13-2008, 03:12 PM
Essentially im thinking very simple animation loader, if the control exists load the animation. Im thinking of using the bvh method so you have a head with all the names and parameters of those object.

Then essentially a motion part, with the values of those parameters for each line i.e each frame. Each line holds the parameters of every object. For e.g. if a had 10 parameters and b has 20 on the motion section, the first 10 items of that line are for object a, then the next 20 are for object b.

I'm thinking of simple animation,rigging, modular formats that basically just contain values of controllers nothing else - if the controller exists it loads it if it doesnt it skips. Thinking about lots of file type methods atm, things like having an ini of a custom attributes values: buttons,sliders

ELEMENT slider "my slider" [10,20,5]

for example, so you can update things very simply - ive done this idea with dynamic rollouts based on the 'simple viewer' flash tool - it just loads buttons atm but its a start.

CGTalk Moderation
06-13-2008, 03:12 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.