A3DObject / SceneObject / CustomObject

A3DObject, SceneObject, CustomObject — Aspose.3D FOSS for Java

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

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


A3DObject

すべての Aspose.3D 管理オブジェクトのルート基底クラスです。ライブラリ内のすべての名前付きオブジェクトは – Node, Mesh, AnimationClip, Material, など – 継承元 A3DObject.

import com.aspose.threed.A3DObject;

Example

ExampleExampleExampleExampleExample
nameStringgetName()setName(String)オブジェクトの人間が読みやすい名前。デフォルトは空文字列です。.
propertiesPropertyCollectiongetProperties()このオブジェクトに付随する動的プロパティコレクション。反復処理するか、使用してください findProperty() 名前付きルックアップ用。.

Example

findProperty(String propertyName)

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

ExampleExampleExample
propertyNameString検索対象の名前。.

戻り値: Property または null

import com.aspose.threed.Scene;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("origin");
Property prop = node.findProperty("name");
if (prop != null) {
    System.out.println(prop.getValue());   // "origin"
}

getProperty(String property)

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

ExampleExampleExample
propertyStringプロパティ名。.

戻り値: Object

Object val = node.getProperty("name");
System.out.println(val);   // "origin"

setProperty(String property, Object value)

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

ExampleExampleExample
propertyStringプロパティ名。.
valueObject新しい値。.

戻り値: void

node.setProperty("layer", 3);
System.out.println(node.getProperty("layer"));   // 3

removeProperty(String property)

コレクションから指定された名前のプロパティを削除します。.

ExampleExampleExample
propertyString または Propertyプロパティ名または Property 削除するインスタンス。.

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


Example

import com.aspose.threed.Scene;
import com.aspose.threed.Node;
import com.aspose.threed.Property;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("my_node");

// Set and retrieve a custom property
node.setProperty("export_lod", 2);
System.out.println(node.getProperty("export_lod"));   // 2

// Enumerate all properties
for (Property prop : node.getProperties()) {
    System.out.println("  " + prop.getName() + " = " + prop.getValue());
}

// Find and inspect a specific property
Property p = node.findProperty("name");
if (p != null) {
    System.out.println(p.getValueType());   // java.lang.String
}

SceneObject

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

import com.aspose.threed.SceneObject;

Example

A3DObject -> SceneObject

追加プロパティ

ExampleExampleExampleExampleExample
sceneScenegetScene()setScene(Scene)Example Scene このオブジェクトが属する、または null まだアタッチされていない場合。.
import com.aspose.threed.Scene;

Scene scene = new Scene();
Node node = scene.getRootNode().createChildNode("child");
System.out.println(node.getScene() == scene);   // true

CustomObject

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

import com.aspose.threed.CustomObject;

Example

A3DObject -> CustomObject

Example

CustomObject()
CustomObject(String name)

Example

import com.aspose.threed.CustomObject;
import com.aspose.threed.Scene;

// Attach pipeline metadata to a scene as a custom object
CustomObject meta = new CustomObject("render_settings");
meta.setProperty("max_bounces", 8);
meta.setProperty("use_denoiser", true);

Scene scene = new Scene();
scene.getRootNode().setProperty("render_meta", meta.getName());
System.out.println(meta.getProperty("max_bounces"));   // 8

参照

 日本語