Hello everybody
Do not tell me what is the problem with this script?
from bge import logic as G
G.loadGlobalDict()
def save():
sce = G.getCurrentScene()
for obj in sce.objects:
if "ObjToSave" in obj:
pos = obj.worldPosition
orient = obj.worldOrientation
props = {p:obj[p] for p in obj.getPropertyNames() if p != "PropToSave"}
G.globalDict[obj.name] = pos, orient, props
G.saveGlobalDict()
def load():
sce = G.getCurrentScene()
for obj in sce.objects:
if obj.name in G.globalDict:
sav = G.globalDict[obj.name]
obj.worldPosition = sav[0]
obj.orientation = sav[1]
if sav[2]:
for p in sav[2]:
obj[p] = sav[2][p]
In theory, this script can save a position, orientation, and all properties of objects with properties - ObjToSave, but neither of which does not work.
save_load_TEST.blend (494 KB)
Thank you for attention
When repairing the car, the masters threw out the old car, and made a new one.:yes: