Node
Example
Example Node klasse vertegenwoordigt een benoemd element in de Aspose.3D-scènegrafiek. Elke knoop kan er één bevatten Entity (zoals een Mesh, Camera, of Light), onderhoudt ouder‑kindrelaties met andere knopen, en draagt een lokale transformatie. Knooppunten zijn de primaire manier om 3D‑objecten in een scènehiërarchie te organiseren.
using Aspose.ThreeD;
var scene = new Scene();
// Access the root node
Node root = scene.RootNode;
// Create a child node
Node child = root.CreateChildNode("my_node");
// Iterate child nodes
foreach (var node in root.ChildNodes)
{
Console.WriteLine(node.Name);
}Example
| Name | Type | Access | Description |
|---|---|---|---|
AssetInfo | AssetInfo? | Read/Write | Gets or sets the asset info. |
Visible | bool | Read/Write | Gets or sets the visible. |
ChildNodes | IList<Node> | Read | Gets the child nodes. |
Entity | Entity? | Read/Write | Gets or sets the entity. |
Excluded | bool | Read/Write | Gets or sets the excluded. |
Entities | IList<Entity> | Read | Gets the entities. |
MetaDatas | IList<CustomObject> | Read | Gets the meta datas. |
Materials | IList<Shading.Material> | Read | Gets the materials. |
Material | Shading.Material? | Read/Write | Gets or sets the material. |
ParentNode | Node? | Read/Write | Gets or sets the parent node. |
Transform | Transform | Read | Gets the transform. |
GlobalTransform | GlobalTransform | Read | Gets the global transform. |
Scene | Scene | Read | Gets the scene. |
Name | string | Read/Write | Gets or sets the name. |
Properties | PropertyCollection | Read | Gets the properties. |
Example
| Signature | Description |
|---|---|
Node() | Creates a node with name and attaches the given entity |
Node(name: string) | |
Node(name: string, entity: Entity) | |
CreateChildNode() | Creates a child node |
CreateChildNode(nodeName: string) | Creates a child node |
CreateChildNode(entity: Entity) | Creates a child node |
CreateChildNode(nodeName: string, entity: Entity) | Creates a child node |
CreateChildNode(nodeName: string, entity: Entity, material: Shading.Material) | Creates a child node |
AddChildNode(node: Node) | Add a child node to this node |
AddEntity(entity: Entity) | Add an entity to the node. |
Merge(node: Node) | Detach everything under the node and attach them to current node. |
EvaluateGlobalTransform(withGeometricTransform: bool) | Evaluate the global transform, include the geometric transform or not. |
GetChild(index: int) | Gets the child node at specified index. |
GetChild(nodeName: string) | Gets the child node at specified index. |
Accept(visitor: NodeVisitor) | Walks through all descendant nodes(including the current node) and call the visitor with the node. Visitor can break the walk-through by returning false |
GetBoundingBox() | Calculate the bounding box of the node |
SelectSingleObject(path: string) | Select single object under current node using XPath-like query syntax. |
SelectObjects(path: string) | Select multiple objects under current node using XPath-like query syntax. |
ToString() | Gets the string representation of this node. |
SceneObject(name: string) | |
A3DObject() | |
RemoveProperty(property: Property) | Removes a dynamic property. |
GetProperty(property: string) | Get the value of specified property |
SetProperty(property: string, value: object?) | Sets the value of specified property |
FindProperty(propertyName: string) | Finds the property. It can be a dynamic property (Created by CreateDynamicProperty/SetProperty) or native property(Identified by its name) |
Example
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
var scene = new Scene();
// Build a hierarchy with entities
var parent = scene.RootNode.CreateChildNode("Parent");
parent.Transform.Translation = new FVector3(10, 0, 0);
var box = new Box(2, 2, 2);
var child = parent.CreateChildNode("BoxChild", box);
child.Transform.Translation = new FVector3(5, 0, 0);
scene.Save("hierarchy.gltf");