Property — Aspose.3D FOSS for Java

Example

Property 어떤 객체에든 부착되는 단일 명명된, 타입이 지정된 메타데이터 필드를 나타냅니다 A3DObject (포함 Node, Mesh, AnimationClip, 등). 속성은 다음을 통해 접근합니다 PropertyCollection 에 의해 반환된 obj.getProperties(). 속성을 읽고, 쓰고, 열거하여 사용자 정의 데이터를 씬 요소와 함께 저장할 수 있습니다.

Example: com.aspose.threed

import com.aspose.threed.Property;

Example

Property 객체는 일반적으로 애플리케이션 코드에서 직접 생성되지 않습니다. 호출하여 생성됩니다. A3DObject.getProperty() 또는 통해 찾을 수 있습니다 A3DObject.findProperty().

ExampleExampleExample
nameString속성 이름
valueObject초기값 (선택 사항)

Example

ExampleExampleExampleExampleExample
nameStringgetName()속성의 읽기 전용 이름
valueObjectgetValue()setValue(Object)현재 값; 읽고 쓸 수 있음
valueTypeClass<?>getValueType()Java Class 현재 값의

Example

Example반환 타입Example
getExtra(String name)Object이 속성에 저장된 명명된 추가 메타데이터 필드를 가져옵니다
setExtra(String name, Object value)void명명된 추가 메타데이터 필드를 설정합니다
getBindPoint(AnimationNode anim, boolean create)BindPoint주어진 상황에서 이 속성의 애니메이션 바인드 포인트를 반환합니다 AnimationNode; pass true 없을 경우 하나를 생성합니다
getKeyframeSequence(AnimationNode anim, boolean create)KeyframeSequence주어진 …에서 이 속성에 대한 keyframe 시퀀스를 반환합니다 AnimationNode

Example

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

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

// Access the property collection
PropertyCollection props = node.getProperties();

// Get a property by name (read raw value)
Object val = node.getProperty("name");
System.out.println(val);   // "tagged_node"

// Find a property object
Property prop = node.findProperty("name");
if (prop != null) {
    System.out.println(prop.getName());         // "name"
    System.out.println(prop.getValue());        // "tagged_node"
    System.out.println(prop.getValueType());    // class java.lang.String
}

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

// Store a custom value on a property (extra metadata)
if (prop != null) {
    prop.setExtra("ui_label", "Scene Origin Node");
    Object label = prop.getExtra("ui_label");
    System.out.println(label);   // "Scene Origin Node"
}

참고

 한국어