save script help

hi.

I have working “save and load” script. It simply get position and orientation of an object in list and save it to the text file. But if I added another object that I wanted to save I had to add it manualy to the script. All I want is get the list of objects that have the property saveable = true and save or print it somewhere to work with them later.

thanks for your help…

Have a look at the SaveLoader. It does what you want plus more.
It saves as a dict.

Hey, if you’re coding your own script, you’ll want to iterate through a list of objects and pick out the ones with the property you want,


saveable = [] #start with an empty list
for entry in scene.getObjectList():
    if entry.has_key("property_you_want"):
        saveable.append(entry)