/
Working with metadatas with Python

Working with metadatas with Python

Metadatas are one of the basic entities in Atoms. They wrap basic data types and inherit the basic object AtomsCore.Metadata.

The basic Metadata class has functions to clone, copy, serialize etc.

These are the basic metadata type that can be used inside Atoms:

  • BoolMetadata

  • BoolArrayMetadata

  • IntMetadata

  • IntArrayMetadata

  • DoubleMetadata

  • DoubleArrayMetadata

  • Vector3Metadata

  • Vector3ArrayMetadata

  • EulerMetadata

  • EulerArrayMetadata

  • QuaternionMetadata

  • QuaternionArrayMetadata

  • MatrixMetadata

  • MatrixArrayMetadata

  • CurveMetadata

  • CurveArrayetadata

  • MeshMetadata

  • MeshArrayMetadata

  • ImageMetadata

  • PoseMetadata

  • SkeletonMetadata

These are container metadata types:

  • MapMetadata

  • ArrayMetadata


Creating metadatas

You can create metadatas using the constructor of each type or you can use the metadata factory. Every metadata type has a unique typeId, it's used to register the metadata inside the metadata factory. Since the serialization code relies on this factory.

import AtomsCore intMeta = AtomsCore.IntMetadata(5) doubleMeta = AtomsCore.DoubleMetadata(654.4) factory = AtomsCore.MetadataFactory.instance() data = factory.createMetadata(AtomsCore.Vector3Metadata.staticTypeId())



MapMetada

The MapMetadata is a map container for metadata similar to a python dictionary. It can store different metadata types at the same time. It uses strings as keys.

To insert data inside a MapMetadata:

import AtomsCore mapMeta = AtomsCore.MapMetadata() #Insert element cloning the data mapMeta["myKey1"] = AtomsCore.IntMetadata(4)


To get an entry from the map:

vecData = mapMeta["myKey3"] intData = mapMeta["myKey1"]


List all the entries:

ArrayMetadata

The array metadata is similar to the MapMetadata, but it stores metadata in a vector rather than a map.

Serialization

All the metadata types and other Atoms objects can be serialized/deserialized to and from the disk.

To serialize an object, you must create an archive object and use the serialize functions.

 

To deserialize, use the deserialise functions.



Related content

Working with metadatas
Working with metadatas
More like this
Defining a variation filter
Defining a variation filter
Read with this
Working with metadata (AtomsUnreal)
Working with metadata (AtomsUnreal)
More like this
Serialization
More like this
Atoms geometry file format
Atoms geometry file format
More like this
Metadata
More like this

Copyright © 2017, Toolchefs LTD.