How to get the asset type?

For assets who aren't loaded but selected is there a way to get the asset type?
I have the DzAsset object via getSelectedAssets() but most of the fields are empty. "contentType", "userCategories", "compatibilities", "categories", "compatabilityBase" are all empty. It's the same with the asset manager and getTypeForContentFile.
The information is there as it is displayed when hovering over the asset ("Type: wearable", "Type: preset_material" and such). Any way to access that type information in code?

Comments

  • DafaDafa Posts: 97

    This was as far as I got to getting the "type: wearable". Note that if the vendor or whoever didn't add metadata to the asset, it doesn't work.

    The reason why you see those properties being empty is because it's actually empty. If you try it out on  the base Genesis 8 Male, it will work. 

    //...var someAssetILoaded = getAssetFromNode();var oMetadata = someAssetILoaded.getMetadata(); print(oMetadata.type); // returns number

     

  • mikekmikek Posts: 195
    edited August 2021

    Dafa said:

    If you try it out on  the base Genesis 8 Male, it will work. 

     

    I'm assuming this is after loading the figure?
    What I try to do is get the information before loading anything into the scene. Currently it looks like this but returns always 0 (an asset has be be selected in the Content Library pane before running it):
     

    var oPaneMgr = MainWindow.getPaneMgr();var oPane = oPaneMgr.findPane("DzContentLibraryPane");var aAssets = oPane.getSelectedAssets();var oMetadata = aAssets[0].getMetadata(); print(oMetadata.type); // returns number 

    imageimage

     

    Post edited by mikek on
Sign In or Register to comment.