Identifying nodes by type and assets
I'm trying to identify the nodes in a scene belonging to specific types, e.g. clothing.
The first thing I'm trying is getting the presentation for a DzNode. The DzPresentation::type has values like Follower/Wardrobe/Dress, which is useful. However, not all clothing items seem to have this set correctly. Some I encountered just have Follower, for example, which isn't specific enough.
My next idea is to get the metadata for the node's underlying asset. Each node has an assetID, but I can't figure out how to convert it to a DzAsset, from which I can get the relevant categories. The DzAssetMgr class doesn't seem to provide anything useful in that regard. How can I go from DzNode to DzAsset?
More generally, is this the right approach to classifying nodes? Or is there a better way?
Comments
Metadata is made by humans, so it's never going to be completely reliable.
Could you use the AssetURI to get the asset from AssetMgr?
Rob says:
I'm afraid this doesn't do the trick.
Take this Aurore product, for example. I have this character in the scene. Attached is an image of the category metadata I'm trying to get (dunno how to insert images inline here).
> /Default/Figures/People/Female/Real World
But the asset URI I'm getting is
> /data/DAZ%203D/Genesis%203/Female/Genesis3Female.dsf#Genesis3Female
And the metadata (attached JSON) has no categories at all.
And that's one of the few nodes for which the asset manager can even find assets for file. Most of them come up empty. I wonder if it has to do with the asset's install directory; the docs say DzAssetMgr::findAssetsForFile takes a relative path which I assume is relative to the default content install dir. Most of my assets are in a different dir that I've added to the Content Directory Manager. I don't see a way to feed that into the asset manager.
Luckily for me, this particular node does have a presentation type of Actor/Character that I can use to identify as a figure. But take another example, which is the handbag from this product (see other image). The category is
> /Default/Accessories/Hands
But when imported into the scene, the presentation type is
> Prop/Arm/Right/Hand
And no assets are found via the URI at all.
/Default/Figures/People/Female/Real World is a category, /data/DAZ%203D/Genesis%203/Female/Genesis3Female.dsf#Genesis3Female is a relative file path (starting from a content directory, the whole point of using relative paths is that they work ragardless of the location of the content directory - including the /data/cloud/1_SKU/ folders in a Connect install). The function returns an array to allow for multiple assets (e.g. if the item you asked for is a shared files isntalled by multiple products, and so having multiple locations if installed through Connect)
Note that you also seem to be confusing categories (e.g. /Default/Accessories/Hands) and content types (Prop/Arm/Right/Hand).