I’m writing a tool which re-organizes meshes from one scene into many scenes. I’m able to copy the meshes into the new scenes without issue, but I am losing some Node properties that are being used, and wish to keep intact.
The issue is there is no existing API to get properties from an A3DObject. I currently need to know the list of property names that I wish to copy over, grab them, and assign them to the node in the new scenes that I am creating. Ideally this could be done by querying all properties.
Are there any implications in adding a GetProperties (flags?) for A3DObject, or any alternatives?
This may also be helpful for AssetInfo and Entity
Edit: Additionally I have no way to get the flags of a known Property object. If I were to create a deep clone of a node I would also need to get these flags and set them on the new property instance.
Thanks
Example Code:
public void CopyNodeAndProperties( Scene sourceScene, Node sourceNode, Scene targetScene )
{
// Creates new node instances in targetScene so the hierarchy is the same, but all nodes are new instances in the targt scene
Node targetNode = GetOrCreateTargetNodeAndAnscestors( sourceScene, sourceNode, targetScene );
// Example of API. Maybe parameterless overload as well?
IReadOnlyList<Property> userDefinedProperties = targetNode.GetProperties( PropertyFlags.UserDefined );
foreach( Property userDefinedProperty in userDefinedProperties )
{
// Create property in target node
targetNode.SetProperty( userDefinedProperty.Name, userDefinedProperty.Value );
// Have to set property first, then FindProperty after to get the Property instance
var targetProperty = targetNode.FindProperty( userDefinedProperty.Name );
targetProperty.SetFlags( userDefinedProperty.GetFlags() );
}
}