def dump_data(self, obj, dumper, s): if (not soya._SAVING is obj) and obj._filename: # self is saved in another file, save filename only return cerealizer.Handler.dump_data(self, obj, dumper, s) else: cerealizer.ObjHandler.dump_data(self, obj, dumper, s) def undump_obj(self, dumper, s): filename = dumper.undump_ref(s) if filename: return self.Class._reffed(filename) return cerealizer.ObjHandler.undump_obj(self, dumper, s) def undump_data(self, obj, dumper, s): if not getattr(obj, "_filename", 0): # else, has been get'ed cerealizer.ObjHandler.undump_data(self, obj, dumper, s) cerealizer.register_class(soya.Vertex) cerealizer.register_class(soya.World, SavedInAPathHandler(soya.World)) cerealizer.register_class(soya.NoBackgroundAtmosphere) cerealizer.register_class(soya.FixTraveling) cerealizer.register_class(soya.SimpleModel, SavedInAPathHandler(soya.SimpleModel)) cerealizer.register_class(soya.Material, SavedInAPathHandler(soya.Material)) cerealizer.register_class(soya.CylinderSprite) cerealizer.register_class(soya.Light) cerealizer.register_class(soya.TravelingCamera) cerealizer.register_class(soya.CoordSystState) cerealizer.register_class(soya.CoordSystSpeed) cerealizer.register_class(soya.Vector) cerealizer.register_class(soya.Point) cerealizer.register_class(soya.Image, SavedInAPathHandler(soya.Image)) cerealizer.register_class(soya.CellShadingModel, SavedInAPathHandler(soya.CellShadingModel)) cerealizer.register_class(soya._soya._AnimatedModelData)
# a = random.random()*100000000000000000L # data = str(t)+' '+str(r)+' '+str(a)+' '+str(args) # data = md5.md5(data).hexdigest() # return data class GameLevel(object): def __init__(self): self.splines = [] self.triggers = [] self.obstacles = [] self.enemies = [] self.triggers = [] cerealizer.register_class(GameLevel) def get_mod(modulePath): return __import__(modulePath, globals(), locals(), ["*"]) def get_attr(fullAttrName): """Retrieve a module attribute from a full dotted-package name.""" # Parse out the path, module, and function lastDot = fullAttrName.rfind(u".") attrName = fullAttrName[lastDot + 1 :] modPath = fullAttrName[:lastDot] aMod = get_mod(modPath) aAttr = getattr(aMod, attrName) # Return a reference to the function itself,
# except: # # if we can't get a network address, just imagine one # a = random.random()*100000000000000000L # data = str(t)+' '+str(r)+' '+str(a)+' '+str(args) # data = md5.md5(data).hexdigest() # return data class GameLevel(object): def __init__(self): self.splines = [] self.triggers = [] self.obstacles = [] self.enemies = [] self.triggers = [] cerealizer.register_class(GameLevel) def get_mod(modulePath): return __import__(modulePath, globals(), locals(), ['*']) def get_attr(fullAttrName): """Retrieve a module attribute from a full dotted-package name.""" # Parse out the path, module, and function lastDot = fullAttrName.rfind(u".") attrName = fullAttrName[lastDot + 1:] modPath = fullAttrName[:lastDot] aMod = get_mod(modPath) aAttr = getattr(aMod, attrName) # Return a reference to the function itself, # not the results of the function. return aAttr