How do I get the Content Type for a DzNode?
I've been looking at the SDK and the script examples. Some of the functions used in the script examples don't seem to exist in the SDK and some of the functions in the SDK don't seem to do what I think they do. How do I get the Content Type shown in the Node pane in Daz Studio from the SDK (for instance "Follower/Hair"? I've got the absolute and relative path to the asset for the DzNode, but can't find a way to convert it. All the functions that work on the path or the node seem to return and empty string. I'm going to paste some code in to give some examples of things I've been trying. I know the values are stomping each other, I've just been trying different things. I always get an empty string for type. Thanks in advance.
QString Type = dzApp->getAssetMgr()->getTypeForNode(Node);
QString assetURIString = dzApp->getAssetMgr()->getAssetUriForNode(Node);
DzUri assetURI = DzUri(assetURIString);
QString assetPath = assetURI.toLocalFilename();
QString sRelPath = dzApp->getContentMgr()->getRelativePath(assetPath, true);
//dzApp->getAssetMgr()->find
DzAssetMgr::getTypeForContentFile(sRelPath, Type);
//Type = dzApp->getAssetMgr()->getTypeForContentFile(sRelPath);
Comments
You'll want to make sure you're dealing with the correct node.
Internally, the call above first looks for type on the presentation of the node.
If the presentation doesn't define a type, an attempt is made to find the content type (in the database) using the path of the content file specified in a data item on the node.
If the content type isn't defined for the source file, or the data item is missing/empty, an attempt is made to find the content type (in the database) using the content file path of the node.
If the CMS is not running, or metadata for the assets does not exist in the database for some reason, the last two attempts will yeild empty strings.
-Rob
Thank you for all the extra info, that helped a lot. I've got it working now. It turns out I didn't need to get the skeleton node in my case. For some reason
is always giving me an emptry string, but getting the type from the presentation is working for me.
The same was true even when grabbing the skeleton node.