Saves and loads the properties of objects in active scenes.
The new version also saves the position and orientation of the objects.
Note:Objects must have a property named “save”.
Only works for objects in active scene such as overlay scenes.
The end result is a Dictionary of every objects name,
under each name is the stuff saved for that object.
The Dictionary is then saved to a file called saveLoadProperties.dat.
saveLoadProperties.dat <-- GameLogic.globalDict <-- Object.name <-- Object’s stuff
# saveLoad.dat # | # GameLogic.globalDict # _____________|_______________ # | | # Suzanne Cube # _____|_____ _____|_______ # | | | | # propList position propList position
s - to save the properties.
L - to load globalDict and replace properties.
space - to move the Cube and increment variables.
Saves the properties of objects in all active scenes.
I believe this requires 2.49a. because its using "if “save” in object:"saveLoadProperties_2.49a_1Script.blend (180 KB) 180kb
saveLoadProperties_2.49a_2Scripts.blend (181 KB) 181kb
28-Jun-09: This version also saves the position and orientation of the objects
There’s some good info on using globalDict here
08-Aug-09: cPickle The Dictionary is now saved to a file using cPickle (mentioned by Sim88) instead of using the Logic bricks.
(pickling aka serialization or marshaling)
please let me now if it works for you.saveLoadProperties_pickle_Aug08-09.blend (188 KB) 188kb
12-Sep-09: cPicklesaveLoadProperties_pickle_Sept12-09.blend 187kb
Just an improvement to avoid errors.
You really don’t need to save the global dictionary to a file when switching scenes,
because whatever is in globalDict remains the same while switching scenes.
You are free to use the files posted by me in this thread in any way that you would like.
But a little credit would be nice.
I hope someone will find it useful.