Property — Aspose.3D FOSS for Python API Reference
Overview
Property represents a single named, typed metadata field attached to any A3DObject (including Node, Mesh, AnimationClip, etc.). Properties are accessed through the PropertyCollection returned by obj.properties. You can read, write, and enumerate properties to store user-defined data alongside scene elements.
Package: aspose.threed
from aspose.threed import PropertyConstructor
Property objects are not normally constructed directly by application code. They are created by calling A3DObject.get_property() or found via A3DObject.find_property().
| Parameter | Type | Description |
|---|---|---|
name | str | Property name |
value | Any | Initial value (optional) |
Properties
| Name | Type | Description |
|---|---|---|
name | str | Read-only name of the property |
value | Any | Current value; readable and writable |
value_type | type | Python type of the current value; returns type(None) when value is None |
Methods
| Method | Return Type | Description |
|---|---|---|
get_extra(name) | Any | Gets a named extra metadata field stored on this property |
set_extra(name, value) | None | Sets a named extra metadata field |
get_bind_point(anim, create) | BindPoint | None | Returns the animation bind point for this property in the given AnimationNode; pass create=True to create one if absent |
get_keyframe_sequence(anim, create) | KeyframeSequence | None | Returns the keyframe sequence for this property in the given AnimationNode |
Example
from aspose.threed import Scene
scene = Scene()
node = scene.root_node.create_child_node("tagged_node")
# Access the property collection
props = node.properties
# Get a property by name (read raw value)
val = node.get_property("name")
print(val) # "tagged_node"
# Find a property object
prop = node.find_property("name")
if prop is not None:
print(prop.name) # "name"
print(prop.value) # "tagged_node"
print(prop.value_type) # <class 'str'>
# Enumerate all properties
for p in props:
print(f" {p.name} = {p.value!r}")
# Store a custom value on a property (extra metadata)
if prop:
prop.set_extra("ui_label", "Scene Origin Node")
label = prop.get_extra("ui_label")
print(label) # "Scene Origin Node"