DzShaderSupportAssetFilter updating assetURI inconsistently?

I'm having an issue with DzShaderSupportAssetFilter not consistently updating the assetURI on the material it is saving.

Setting ApplyToLikeSurfaces false makes the issue much worse, but it occurs either way.

If I save just a shader support asset, then it's not really a problem, however if I save a shader support asset and then save a shader asset or a scene, then sometimes the shader asset or scene reference the shader support asset but other times the brick data is saved in the shader asset or scene DSON instead.

 

Attached is a simple script (no bricks) to reproduce the issue. Can anyone point out something obvious I am missing before I assume it is a bug?

dsa
dsa
ShaderSaveTest.dsa
2K

Comments

  • jag11jag11 Posts: 885

    "assetUri.filePath" is failing when two or more surfaces are selected, which I believe is a bug and should be reported.

    In order to keep the script running

    Add this line -> oShape.findMaterial("Stand").select(false);

    Before this line -> oShape.findMaterial("OuterSphere").select(true);

    Reason is, Material Ball Scene starts with both "OuterSphere" and "Stand" surfaces selected by default.

  • jag11 said:

    "assetUri.filePath" is failing when two or more surfaces are selected, which I believe is a bug and should be reported.

    In order to keep the script running

    Add this line -> oShape.findMaterial("Stand").select(false);

    Before this line -> oShape.findMaterial("OuterSphere").select(true);

    Reason is, Material Ball Scene starts with both "OuterSphere" and "Stand" surfaces selected by default.

    Does the documentation say it should work with multiple surfaces selected? if not then it isn't a bug, just a need to check for valid input.

  • OmnifluxOmniflux Posts: 377
    edited January 2023

    @jag11 Thanks for narrowing this issue down, I stumbled upon it a few years ago in my MDL script but only now put together a simple case to reproduce. I'm traveling for the next two weeks, but will check it resolves all cases when I get back and submit a ticket for either the method or documentation as seems appropriate (fairly sure this is an actual issue, as saving a reference to a dsf vs saving everything in the duf should not depend on how many surfaces you happen to have selected in the UI)

    Post edited by Omniflux on
  • OmnifluxOmniflux Posts: 377

    If multiple surfaces are selected when DzAssetMgr::doSaveWithOptions is used with DzShaderSupportAssetFilter, then one and only one of the surfaces assetUri.filePath fields are updated. This makes some sense, as only one shader is saved and the materials ARE different, even if identical. The problem is which material is updated is unpredictable. It should be first selected, last selected, or documented that it is unpredictable when more than one material is selected.

  • OmnifluxOmniflux Posts: 377

    Submitted as Request #430179

Sign In or Register to comment.