Property, PropertyCollection, AssetInfo — Aspose.3D TypeScript API Reference
Package: @aspose/3d (v24.12.0)
These three classes form the property and metadata system shared by all A3DObject instances.
import { Property, PropertyCollection, AssetInfo } from '@aspose/3d';Property
A single named, typed key/value pair that can be attached to any A3DObject. Property objects are created internally by A3DObject.setProperty() and retrieved via A3DObject.findProperty().
export class PropertyConstructor
new Property(name: string, value: any = null)Property is normally not instantiated directly in application code. Use A3DObject.setProperty() to create properties.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
name | string | read | The property name. Immutable after construction. |
value | any | read/write | The current value. |
valueType | string | read | The JavaScript typeof of the current value, or 'null' when value is null. |
Methods
getExtra(name)
Retrieve a named extra metadata field stored on this property.
getExtra(name: string): anysetExtra(name, value)
Store an additional named metadata field on this property.
setExtra(name: string, value: any): voidtoString()
Returns "Property(name, value)".
Example
import { Scene } from '@aspose/3d';
const scene = new Scene();
const node = scene.rootNode.createChildNode('tagged_node');
node.setProperty('lodBias', 2);
const prop = node.findProperty('lodBias');
if (prop) {
console.log(prop.name); // lodBias
console.log(prop.value); // 2
console.log(prop.valueType); // number
prop.setExtra('ui_label', 'LOD Bias');
console.log(prop.getExtra('ui_label')); // LOD Bias
}PropertyCollection
An ordered, iterable container of Property objects attached to an A3DObject. Accessed via obj.properties.
export class PropertyCollectionProperties
| Property | Type | Access | Description |
|---|---|---|---|
count | number | read | Number of properties in the collection. Alias: length. |
length | number | read | Same as count. |
Methods
findProperty(propertyName)
Return the Property with the given name, or null if not found.
findProperty(propertyName: string): Property | nullget(property)
Return the value of a named property, or null if the property does not exist.
get(property: string): anyremoveProperty(property)
Remove a property by name or by reference.
removeProperty(property: string | Property): booleangetItem(key)
Return the property at index key.
getItem(key: number): Property[Symbol.iterator]()
Iterate over all properties with for...of.
Example
import { Scene } from '@aspose/3d';
const scene = new Scene();
const node = scene.rootNode.createChildNode('settings_node');
node.setProperty('alpha', 0.8);
node.setProperty('visible', true);
const props = node.properties;
console.log(props.count); // 2
for (const p of props) {
console.log(`${p.name} = ${p.value}`);
}
const found = props.findProperty('alpha');
console.log(found?.value); // 0.8
props.removeProperty('alpha');
console.log(props.count); // 1 (only 'name' and 'visible' remain)
AssetInfo
Carries scene-level metadata loaded from the source file, such as creator name, application, creation date, and coordinate system information. Accessed as scene.assetInfo.
export class AssetInfo extends A3DObjectInheritance
A3DObject → AssetInfo
Constructor
new AssetInfo()AssetInfo instances are created automatically when a scene is loaded. You can also create one manually and assign it to scene.assetInfo.
AssetInfo inherits the full property system from A3DObject. Format importers (FBX, COLLADA, glTF) populate standard named properties such as "ApplicationName", "ApplicationVersion", "CreationTime", "UnitName", and "UnitScaleFactor" during loading; the exact properties present depend on what the source file encodes.
Example
import { Scene } from '@aspose/3d';
const scene = new Scene();
scene.open('model.fbx');
const info = scene.assetInfo;
console.log(info.name); // 'AssetInfo'
// Read standard metadata properties when present
const appName = info.getProperty('ApplicationName');
if (appName) {
console.log(`Created by: ${appName}`);
}
// Enumerate all available metadata
for (const prop of info.properties) {
console.log(`${prop.name}: ${prop.value}`);
}