Attributes (Python)
Attribute Base Class
- class FnAttribute.Attribute
Bases:
pybind11_object
GEOLIB3 Attribute
- __init__() None
- getBinary() bytes
Returns a binary representation of this attribute.
- getHash() str
Returns the hash of this attribute as a string.
- getHash64() int
Returns the high 64 bits of this attribute’s hash.
- getSize() int
Returns the total memory in bytes that is allocated for this attribute.
- getXML() str
Returns an XML representation of this attribute.
- static parseBinary(binary: object) PyFnAttribute.Attribute
Returns the attribute described by the given binary representation, or an invalid attribute if parsing fails.
- static parseXML(xml: str) PyFnAttribute.Attribute
Returns the attribute described by the given XML representation, or an invalid attribute if parsing fails.
- writePython(stream: object) object
Writes the Python code required to reproduce this attribute to the given stream object, which is expected to provide a callable
write
attribute that accepts astr
as an argument.
Null Attributes
- class FnAttribute.NullAttribute
Bases:
Attribute
GEOLIB3 NullAttribute
- __init__() None
- writePython(stream: object) object
Writes the Python code required to reproduce this attribute to the given stream object, which is expected to provide a callable
write
attribute that accepts astr
as an argument.
Data Attributes
- class FnAttribute.DataAttribute
Bases:
Attribute
GEOLIB3 DataAttribute
- __init__() None
- getBoundingSampleTimes(time: float) tuple
Returns a tuple of two sample times for this attribute which bound the given time. If time falls exactly on a sample value, both values will be equal. If an error occurs, both values will be None.
- getNumberOfTimeSamples() int
Returns the number of time samples at which data is recorded in this attribute.
- getNumberOfTuples() int
Returns the number of tuples in this attribute.
- getNumberOfValues() int
Returns the total number of data values for this attribute. This will equal getNumberOfTuples() * getTupleSize().
- getSampleTime(index: int) float
Returns the sample time at the given index, or 0.0 if index is out of range.
- getSampleTimes() tuple
Returns a tuple containing all sample times for this attribute.
- getTupleSize() int
Returns the number of data values per tuple for this attribute.
- class FnAttribute.IntAttribute
Bases:
DataAttribute
GEOLIB3 IntAttribute
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: PyFnAttribute.IntAttribute, value: float, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.IntAttribute, data: dict, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.IntAttribute, data: sequence, tupleSize: int = 1) -> None
- getData() PyFnAttribute.ConstVector
Equivalent to IntAttribute.getNearestSample(0.0).
- getNearestSample(sampleTime: float) PyFnAttribute.ConstVector
Returns a ConstVector containing samples for the sample time closest to the given sampleTime for this attribute. If sampleTime falls exactly between two sample values, the lower sample time is chosen.
- getSamples() Dict[float, PyFnAttribute.ConstVector]
Returns a dict from sample time to ConstVector, containing all samples at all sample times for this attribute.
- getValue(defaultValue: int = 0, throwOnError: bool = True) int
Returns the first value from the time sample nearest to 0.0. If no value is present, if throwOnError is True then a RuntimeError is raised; otherwise defaultValue is returned.
- class FnAttribute.FloatAttribute
Bases:
DataAttribute
GEOLIB3 FloatAttribute
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: PyFnAttribute.FloatAttribute, value: float, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.FloatAttribute, data: dict, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.FloatAttribute, data: sequence, tupleSize: int = 1) -> None
- getData() PyFnAttribute.ConstVector
Equivalent to FloatAttribute.getNearestSample(0.0).
- getNearestSample(sampleTime: float) PyFnAttribute.ConstVector
Returns a ConstVector containing samples for the sample time closest to the given sampleTime for this attribute. If sampleTime falls exactly between two sample values, the lower sample time is chosen.
- getSamples() Dict[float, PyFnAttribute.ConstVector]
Returns a dict from sample time to ConstVector, containing all samples at all sample times for this attribute.
- getValue(defaultValue: float = 0.0, throwOnError: bool = True) float
Returns the first value from the time sample nearest to 0.0. If no value is present, if throwOnError is True then a RuntimeError is raised; otherwise defaultValue is returned.
- class FnAttribute.DoubleAttribute
Bases:
DataAttribute
GEOLIB3 DoubleAttribute
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: PyFnAttribute.DoubleAttribute, value: float, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.DoubleAttribute, data: dict, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.DoubleAttribute, data: sequence, tupleSize: int = 1) -> None
- getData() PyFnAttribute.ConstVector
Equivalent to DoubleAttribute.getNearestSample(0.0).
- getNearestSample(sampleTime: float) PyFnAttribute.ConstVector
Returns a ConstVector containing samples for the sample time closest to the given sampleTime for this attribute. If sampleTime falls exactly between two sample values, the lower sample time is chosen.
- getSamples() Dict[float, PyFnAttribute.ConstVector]
Returns a dict from sample time to ConstVector, containing all samples at all sample times for this attribute.
- getValue(defaultValue: float = 0.0, throwOnError: bool = True) float
Returns the first value from the time sample nearest to 0.0. If no value is present, if throwOnError is True then a RuntimeError is raised; otherwise defaultValue is returned.
- class FnAttribute.StringAttribute
Bases:
DataAttribute
GEOLIB3 StringAttribute
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: PyFnAttribute.StringAttribute, value: str, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.StringAttribute, data: dict, tupleSize: int = 1) -> None
__init__(self: PyFnAttribute.StringAttribute, data: sequence, tupleSize: int = 1) -> None
- getData() PyFnAttribute.ConstVector
Equivalent to StringAttribute.getNearestSample(0.0).
- getNearestSample(sampleTime: float) PyFnAttribute.ConstVector
Returns a ConstVector containing samples for the sample time closest to the given sampleTime for this attribute. If sampleTime falls exactly between two sample values, the lower sample time is chosen.
- getSamples() Dict[float, PyFnAttribute.ConstVector]
Returns a dict from sample time to ConstVector, containing all samples at all sample times for this attribute.
- getValue(defaultValue: str = '', throwOnError: bool = True) str
Returns the first value from the time sample nearest to 0.0. If no value is present, if throwOnError is True then a RuntimeError is raised; otherwise defaultValue is returned.
Group Attributes
- class FnAttribute.GroupAttribute
Bases:
Attribute
GEOLIB3 GroupAttribute
- __init__(*args, **kwargs)
Overloaded function.
__init__(self: PyFnAttribute.GroupAttribute, groupInherit: bool = True) -> None
__init__(self: PyFnAttribute.GroupAttribute, children: sequence, groupInherit: bool = True) -> None
__init__(self: PyFnAttribute.GroupAttribute, children: dict, groupInherit: bool = True) -> None
- childList() list
Returns a list containing all child attributes in this group.
- getChildByIndex(index: int) PyFnAttribute.Attribute
Returns the child attribute at the given index in this group, or None if index is out of range.
- getChildByName(name: str) PyFnAttribute.Attribute
Returns the child attribute with the given name in this group, or None if there is no child with that name.
- getChildName(index: int) str
Returns the name of the child at the given index, or an empty string if index is out of range.
- getGroupInherit() bool
Returns whether this group has the groupInherit flag set.
- getNumberOfChildren() int
Returns the number of children contained in the group.
- writePython(stream: object) object
Writes the Python code required to reproduce this attribute to the given stream object, which is expected to provide a callable
write
attribute that accepts astr
as an argument.
GroupBuilder
- class FnAttribute.GroupBuilder
Bases:
pybind11_object
GEOLIB3 GroupBuilder
- __init__(builderMode: int = 0) None
Initializes a GroupBuilder with the given builderMode, which must be one of GroupBuilderModeNormal or GroupBuilderModeStrict.
- build(builderMode: int = 0) PyFnAttribute.GroupAttribute
Returns a new GroupAttribute with the contents of this builder. If builderMode is GroupBuilderBuildAndFlush, this builder is empty after this call.
- deepUpdate(attr: PyFnAttribute.GroupAttribute) PyFnAttribute.GroupBuilder
Recursively updates the contents of the group builder with the attributes held within the given GroupAttribute. Groups are traversed until set operations can be applied at the leaves with are not GroupAttribute objects themselves.
- delete(pathStr: str) PyFnAttribute.GroupBuilder
Deletes the attribute with the given path. This has no effect if the path does not exist within the builder, or if the builder was created with GroupBuilderModeStrict.
- reserve(count: int) PyFnAttribute.GroupBuilder
Reserves space for count attributes within this GroupBuilder.
- set(*args, **kwargs)
Overloaded function.
set(self: PyFnAttribute.GroupBuilder, pathStr: str, attr: PyFnAttribute.Attribute, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr.
set(self: PyFnAttribute.GroupBuilder, pathStr: str, value: int, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr.
set(self: PyFnAttribute.GroupBuilder, pathStr: str, value: float, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr.
set(self: PyFnAttribute.GroupBuilder, pathStr: str, value: float, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr.
set(self: PyFnAttribute.GroupBuilder, pathStr: str, value: str, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr.
- setGroupInherit(groupInherit: bool) PyFnAttribute.GroupBuilder
Sets the groupInherit flag for GroupAttributes produced by calling build() on this builder.
- setWithUniqueName(*args, **kwargs)
Overloaded function.
setWithUniqueName(self: PyFnAttribute.GroupBuilder, pathStr: str, attr: PyFnAttribute.Attribute, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr. If an attribute already exists at this path, a unique name is chosen by adding an integer suffix.
setWithUniqueName(self: PyFnAttribute.GroupBuilder, pathStr: str, value: int, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr. If an attribute already exists at this path, a unique name is chosen by adding an integer suffix.
setWithUniqueName(self: PyFnAttribute.GroupBuilder, pathStr: str, value: float, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr. If an attribute already exists at this path, a unique name is chosen by adding an integer suffix.
setWithUniqueName(self: PyFnAttribute.GroupBuilder, pathStr: str, value: float, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr. If an attribute already exists at this path, a unique name is chosen by adding an integer suffix.
setWithUniqueName(self: PyFnAttribute.GroupBuilder, pathStr: str, value: str, groupInherit: bool = True) -> PyFnAttribute.GroupBuilder
Sets the value for the attribute identified by pathStr. If an attribute already exists at this path, a unique name is chosen by adding an integer suffix.
- sort() PyFnAttribute.GroupBuilder
Sorts the top-level attributes of the builder by name.
- update(attr: PyFnAttribute.GroupAttribute) PyFnAttribute.GroupBuilder
Updates the contents of the builder with the attributes from the given GroupAttribute. Any new attributes with the same name as existing attributes replace the old ones. Existing attributes without matching new attributes are left intact.
Utility Functions
- FnAttribute.DelimiterEncode(nameOrLocationPath: str) str
Encodes the given name or scene graph location path for use as an attribute name.
- FnAttribute.DelimiterDecode(encodedNameOrLocationPath: str) str
Decodes the given encoded name or scene graph location path that might have been used as an attribute name.
- FnAttribute.GetTotalSize() int
Returns the total memory currently allocated by the FnAttribute library.
- FnAttribute.Util.RemoveTimeSamplesIfAllSame(arg0: PyFnAttribute.Attribute) PyFnAttribute.Attribute
- FnAttribute.Util.RemoveTimeSamplesUnneededForShutter(arg0: PyFnAttribute.Attribute, arg1: float, arg2: float) PyFnAttribute.Attribute
- FnAttribute.Util.ResampleAttrWithInterp(arg0: PyFnAttribute.Attribute, arg1: PyFnAttribute.DataAttribute) PyFnAttribute.Attribute
ScenegraphAttr
In Katana 4.5, the deprecated ScenegraphAttr
type was removed. The
ScenegraphAttr Porting Guide details how to switch over to using
FnAttribute
.