A3DObject / SceneObject / CustomObject

A3DObject, SceneObject, CustomObject — Aspose.3D Python API Reference

パッケージ: aspose.threed (aspose-3d-foss 26.1.0)

これら3つのクラスは Aspose.3D クラス階層の基礎を構成します。ライブラリ内のすべての公開オブジェクトは以下から継承します A3DObject, 名前と動的プロパティコレクションを提供します。. SceneObject 拡張 A3DObject , シーンメンバーシップの追跡を行います。. CustomObject , 任意のユーザーメタデータを格納するための軽量な具体サブクラスです。.


A3DObject

Aspose.3D 管理オブジェクトすべてのルート基底クラスです。ライブラリ内のすべての名前付きオブジェクトは — Node, Mesh, AnimationClip, Material, その他 — から継承します A3DObject.

from aspose.threed import A3DObject

Example

ExampleExampleExampleExample
namestr読み取り/書き込みオブジェクトの人間が読める名前です。デフォルトは空文字列です。.
propertiesPropertyCollection読み取りこのオブジェクトに添付された動的プロパティコレクションです。反復処理するか、使用してください find_property() 名前付きルックアップ用に.

Example

find_property(property_name)

このオブジェクトの名前付きプロパティを検索し PropertyCollection そして返します Property インスタンス、または None 見つからない場合は.

ExampleExampleExample
property_namestr検索する名前。.

戻り値: Property | None

from aspose.threed import Scene

scene = Scene()
node = scene.root_node.create_child_node("origin")
prop = node.find_property("name")
if prop is not None:
    print(prop.value)   # "origin"

get_property(property)

名前付きプロパティの現在の値を返します、または None プロパティが存在しない場合。.

ExampleExampleExample
propertystrプロパティ名。.

戻り値: Any

val = node.get_property("name")
print(val)   # "origin"

set_property(property, value)

名前付きプロパティの値を設定します。プロパティが存在しない場合は新たに作成します。.

ExampleExampleExample
propertystrプロパティ名。.
valueAny新しい値。.

戻り値: None

node.set_property("layer", 3)
print(node.get_property("layer"))   # 3

remove_property(property)

コレクションから名前付きプロパティを削除します。.

ExampleExampleExample
property`strProperty`

戻り値: boolTrue プロパティが見つかり、削除された場合。.


Example

from aspose.threed import Scene

scene = Scene()
node = scene.root_node.create_child_node("my_node")

# Set and retrieve a custom property
node.set_property("export_lod", 2)
print(node.get_property("export_lod"))   # 2

# Enumerate all properties
for prop in node.properties:
    print(f"  {prop.name} = {prop.value!r}")

# Find and inspect a specific property
p = node.find_property("name")
if p:
    print(p.value_type)   # <class 'str'>

SceneObject

Example A3DObject 所有者への参照とともに Scene. Node, Entity,、そして関連クラスは継承します SceneObject.

from aspose.threed import SceneObject

Example

A3DObjectSceneObject

追加プロパティ

ExampleExampleExampleExample
scene`SceneNone`読み取り/書き込み
from aspose.threed import Scene

scene = Scene()
node = scene.root_node.create_child_node("child")
print(node.scene is scene)   # True (Node inherits SceneObject)

CustomObject

軽量な具体的サブクラス A3DObject 名前と任意の PropertyCollection.。 任意のエンティティタイプをサブクラス化せずに、シーンにフリーフォームメタデータを添付するために使用してください。.

from aspose.threed import CustomObject

Example

A3DObjectCustomObject

Example

CustomObject(name: str = None)

Example

from aspose.threed import CustomObject, Scene

# Attach pipeline metadata to a node as a custom object
meta = CustomObject("render_settings")
meta.set_property("max_bounces", 8)
meta.set_property("use_denoiser", True)

scene = Scene()
# Store as a user property on the root node
scene.root_node.set_property("render_meta", meta.name)
print(meta.get_property("max_bounces"))   # 8

参照

 日本語