Property — Aspose.3D FOSS for Java
Example
Property reprezentuoja vieną pavadintą, tipizuotą metaduomenų lauką, priskirtą bet kuriam A3DObject (įskaitant Node, Mesh, AnimationClip, kt.). Savybės pasiekiamos per PropertyCollection grąžinamą obj.getProperties(). Galite skaityti, rašyti ir išvardinti savybes, kad saugotumėte vartotojo apibrėžtus duomenis šalia scenos elementų.
Example: com.aspose.threed
import com.aspose.threed.Property;Example
Property objektai paprastai nėra tiesiogiai konstruojami programos kode. Jie kuriami kviečiant A3DObject.getProperty() arba randami per A3DObject.findProperty().
| Example | Example | Example |
|---|---|---|
name | String | Savybės pavadinimas |
value | Object | Pradinė reikšmė (neprivaloma) |
Example
| Example | Example | Example | Example | Example |
|---|---|---|---|---|
name | String | getName() | – | Tik skaitymui skirta savybės pavadinimas |
value | Object | getValue() | setValue(Object) | Dabartinė reikšmė; skaitoma ir rašoma |
valueType | Class<?> | getValueType() | – | Java Class dabartinės reikšmės |
Example
| Example | Grąžinimo tipas | Example |
|---|---|---|
getExtra(String name) | Object | Gauti pavadintą papildomą metaduomenų lauką, saugomą šioje savybėje |
setExtra(String name, Object value) | void | Nustato pavadintą papildomą metaduomenų lauką |
getBindPoint(AnimationNode anim, boolean create) | BindPoint | Grąžina animacijos susiejimo tašką šiai savybei nurodytame AnimationNode; praeiti true sukurti, jei nėra |
getKeyframeSequence(AnimationNode anim, boolean create) | KeyframeSequence | Grąžina raktų kadro seką šiai savybei nurodytame 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"
}