Property — Aspose.3D FOSS for Java
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 atgriezts no obj.getProperties(). Jūs varat lasīt, rakstīt un uzskaitīt īpašības, lai saglabātu lietotāja definētus datus kopā ar ainas elementiem.
Methods: com.aspose.threed
import com.aspose.threed.Property;Methods
Property objekti parasti netiek tieši konstruēti ar lietojumprogrammas kodu. Tie tiek izveidoti, izsaucot A3DObject.getProperty() vai atrasti caur A3DObject.findProperty().
| Methods | Methods | Methods |
|---|---|---|
name | String | Īpašības nosaukums |
value | Object | Sākotnējā vērtība (pēc izvēles) |
Methods
| Methods | Methods | Methods | Methods | Methods |
|---|---|---|---|---|
name | String | getName() | – | Tikai lasāms īpašības nosaukums |
value | Object | getValue() | setValue(Object) | Pašreizējā vērtība; lasāma un rakstāma |
valueType | Class<?> | getValueType() | – | Java Class no pašreizējās vērtības |
Methods
| Methods | Atgriešanas tips | Methods |
|---|---|---|
getExtra(String name) | Object | Iegūst nosauktu papildu metadatu lauku, kas saglabāts šajā īpašībā |
setExtra(String name, Object value) | void | Iestata nosauktu papildu metadatu lauku |
getBindPoint(AnimationNode anim, boolean create) | BindPoint | Atgriež animācijas saistīšanas punktu šim īpašumam dotajā AnimationNode; pass true lai izveidotu to, ja tas trūkst |
getKeyframeSequence(AnimationNode anim, boolean create) | KeyframeSequence | Atgriež atslēgkadru secību šim īpašumam dotajā AnimationNode |
Methods
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"
}