nodedge.serializable

Serializable “interface” module. It is an abstract class.

class nodedge.serializable.Serializable

Bases: object

Serializable class

Create data which are common to any serializable object.

It stores the id of the object used in the SceneHistory, the SceneClipboard, and the file structure.

serialize() → collections.OrderedDict

Serialization method to serialize this class data into OrderedDict which can be stored in memory or file easily.

Returns

data serialized in OrderedDict

Return type

OrderedDict

deserialize(data: dict, hashmap: Optional[dict] = None, restoreId: bool = True, *args, **kwargs) → bool

Deserialization method which take data in python dict format 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

  • restoreId (bool) – True if we are creating new sockets. False is useful when loading existing sockets which we want to keep the existing object’s id

Returns

True if deserialization was successful, False otherwise

Return type

bool