// get pane manager
var oPaneMgr = MainWindow.getPaneMgr();
// get the content lib pane
var oPane = oPaneMgr.findPane("DzContentLibraryPane");
// get selected asset
var aAssets = oPane.getSelectedAssets();
// get the path of selected asset
var relPath = aAssets[0].getRelativeFilePath();
// get the categories the selected asset is stored in
var getCats = aAssets[0].userCategories;
// show the categories the selected asset is stored in
print(relPath)
var clearGrp = aAssets[0].clearGroup();
// set the desired category for the selected asset
var setCat = aAssets[0].addToCategories(["MyCat", "MyCat/Hair", "MyCat/Hair/Bob" ]);
I can't set a category for a newly created asset for some reason. I found out that I can do it just in two cases:
1) If I manually categorize it once and then the script works
2) if I set parameters such as "type" or "audience" in content DB editor for this asset. After that the script works fine.
I can't set content type or audience with script afaik. How can I handle it and categorize my new asset without these two steps I mentioned above?
upd: Probably the problem is that I saving my assets with a script from samples and assets saved in that fashion are not equipped with type data, they don't have the colored badge "pose" in the content library panel. How to force this to mark new assets?