node_serializable Module¶
A module containing Serializable “Interface”. We pretend its an abstract class
-
class
nodeeditor.node_serializable.Serializable¶ Bases:
objectDefault constructor automatically creates data which are common to any serializable object. In our case we create
self.idwhich we use in every object in NodeEditor.-
id¶ We set this property in the constructor because all of NodeEditor’s serializable objects use this attribute to unique object identification. It is handy for referencing objects.
-
serialize() → collections.OrderedDict¶ Serialization method to serialize this class data into
OrderedDictwhich can be easily stored in memory or file.Returns: data serialized in OrderedDictReturn type: OrderedDict
-
deserialize(data: dict, hashmap: dict = {}, restore_id: bool = True) → bool¶ Deserialization method which take data in python
dictformat with helping hashmap containing references to existing entities.Parameters: - data (
dict) – Dictionary containing serialized data - hashmap (
dict) – Helper dictionary containing references (by id == key) to existing objects - restore_id (bool) – True if we are creating new Sockets. False is useful when loading existing Sockets of which we want to keep the existing object’s id.
Returns: Trueif deserialization was successful, otherwiseFalseReturn type: bool- data (
-