How to put an asset into scene

I am learning Daz script and have read some samples from daz documentation center. But I cannot find an example for putting an asset into scene such as loading a figure into scene and the dress up a cloth?

Can anybody give me any suggestion?

Thanks~

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,888

    Assuming you know the path to the asset you just need to get the Content Manager (App.getContentMgr()) and tell it to load the native file (contentMgr.openNativeAsset( name )) - or you could use assets as such, via Asset Manager to get ana sset fiel and then contentMgr.loadAsset(asset ). http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz

  • Assuming you know the path to the asset you just need to get the Content Manager (App.getContentMgr()) and tell it to load the native file (contentMgr.openNativeAsset( name )) - or you could use assets as such, via Asset Manager to get ana sset fiel and then contentMgr.loadAsset(asset ). http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz

    Thank you so much to point this out to me! Thanke  you~

  • Assuming you know the path to the asset you just need to get the Content Manager (App.getContentMgr()) and tell it to load the native file (contentMgr.openNativeAsset( name )) - or you could use assets as such, via Asset Manager to get ana sset fiel and then contentMgr.loadAsset(asset ). http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/object_index/contentmgr_dz

    Hi~ Richard Haseltine, I've been able to load asset into scene as you tald me. But I got a new problem. I wanna know the asset type as the picture as the picture shows:

    How can I get the file type via script? I tried to find it in the documentation center but still not find out. If you know, whould you please tell me? Thank you ~

    1.jpg
    452 x 372 - 30K
  • TotteTotte Posts: 13,965

    Hi,
     

    the best way to find a loaded asset is to grab the sceneobjects Array, add the object, and then grab it again and see which item was loaded. The pitfall here is of you have a blank scene with auto added camera, when you add the first object, the auto added camera is removed and a new is added, so if you're not adding cameras, do not add the to your list of saved objects as you will die on a "accessing a deleted object" if you try to read it from the list after the new item was added.

  • Richard HaseltineRichard Haseltine Posts: 100,888
    edited April 2018
    Totte said:

    Hi,
     

    the best way to find a loaded asset is to grab the sceneobjects Array, add the object, and then grab it again and see which item was loaded. The pitfall here is of you have a blank scene with auto added camera, when you add the first object, the auto added camera is removed and a new is added, so if you're not adding cameras, do not add the to your list of saved objects as you will die on a "accessing a deleted object" if you try to read it from the list after the new item was added.

    isInScene() can perhaps be used there https://www.daz3d.com/forums/discussion/237461/nodeinstance-targets-not-null-for-deleted-nodes#latest

    Post edited by Richard Haseltine on
  • Totte said:

    Hi,
     

    the best way to find a loaded asset is to grab the sceneobjects Array, add the object, and then grab it again and see which item was loaded. The pitfall here is of you have a blank scene with auto added camera, when you add the first object, the auto added camera is removed and a new is added, so if you're not adding cameras, do not add the to your list of saved objects as you will die on a "accessing a deleted object" if you try to read it from the list after the new item was added.

    isInScene() can perhaps be used there https://www.daz3d.com/forums/discussion/237461/nodeinstance-targets-not-null-for-deleted-nodes#latest

    Hi,

    sorry for my mistake that I may not descript it clear. 

    First of all, what I wanna to do is to load a figure into scene and the dress a cloth up for this figure. All this should be done via script. And now I know how to get all assets in my daz studio and load an asset into scene under the help of Richard, thank you again~. But the problem I am facing now is how to know if an asset is cloth or not? I find that when I focus my cursor on an asset, Daz will pop up an dialog that descripts this asset, and it has an "Type" descripton that cloth is "wearable". I wanna know how to get this "Type" description so that I can know this asset is a "Cloth".

Sign In or Register to comment.