Property
Methods
Property pārstāv vienu nosauktu, tipizētu metadatu lauku, kas pievienots jebkuram A3DObject (iekļaujot Node, Mesh, AnimationClip, utt.). Īpašības tiek piekļūtas caur PropertyCollection atgriežot obj.properties. Jūs varat lasīt, rakstīt un uzskaitīt īpašības, lai saglabātu lietotāja definētus datus blakus ainas elementiem.
Methods: aspose.threed
from aspose.threed import PropertyMethods
Property objekti parasti netiek tieši konstruēti lietojumprogrammas kodā. Tie tiek izveidoti, izsaucot A3DObject.get_property() vai atrasti, izmantojot A3DObject.find_property().
| Methods | Methods | Methods |
|---|---|---|
name | str | Īpašības nosaukums |
value | Any | Sākotnējā vērtība (pēc izvēles) |
Methods
| Methods | Methods | Methods |
|---|---|---|
name | str | Tikai lasāms īpašības nosaukums |
value | Any | Pašreizējā vērtība; lasāma un rakstāma |
value_type | type | Python type no pašreizējās vērtības; atgriež type(None) kad value ir None |
Methods
| Methods | Atgriešanas tips | Methods |
|---|---|---|
get_extra(name) | Any | Iegūst nosauktu papildu metadatu lauku, kas saglabāts šajā īpašībā |
set_extra(name, value) | None | Iestata nosauktu papildu metadatu lauku |
get_bind_point(anim, create) | `BindPoint | None` |
get_keyframe_sequence(anim, create) | `KeyframeSequence | None` |
Methods
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"