DzCustomMDLBrick creation

In 4.8.0.3, the shader mixer got support for auto creating a custom MDL brick. Is this functionality accesible via scripting?

getAutoAddParameter() works great to connect parameters between bricks, but I've got to get the parameters in the first brick first. I can use loadMDLModule() to read a module in and get a DzIrayMDLModule containing the DzMDLDefinition(s), but I cannot find a way to autopopulate DzCustomMDLBrick.

Do I have to manually create the parameters at this point?

Comments

  • OmnifluxOmniflux Posts: 360
    edited October 2020

    What I have so far is

    var sTestMDLFile = "/nvidia/vMaterials/AEC/Drywall/Textured.mdl";// Create Custom MDL Brickvar oCustomMDLBrick = new DzCustomMDLBrick();// Load MDL modulevar oIrayMDLModule = oCustomMDLBrick.loadMDLModule ("${shader}" + sTestMDLFile); // Get first material defined in modulevar aMDLDefinitions = oIrayMDLModule.getMDLDefinitions (oIrayMDLModule.getModuleMaterialsList());var oMDLDefinition = aMDLDefinitions[0];// What do I do with oMDLDefinition now?// Create a materialvar oBrickMat = new DzBrickMaterial();oBrickMat.addBrick (oCustomMDLBrick);// Apply it!oBrickMat.applyToScene();

    If I drop an MDL file in the Shader Mixer, I get this

    but from the code so far, I can only get this

    What is the missing step here?

    DragNDrop_sm.png
    1046 x 834 - 17K
    Created_sm.png
    1046 x 834 - 14K
    Post edited by Omniflux on
  • PraxisPraxis Posts: 240

    Short answer: I don't have a clue.

    But...

    var oBrick = new DzCustomMDLBrick();print( Object.keys( oBrick ).join( '\n' ) );//// This lists useful-looking things like://  getNumParameters()//  getParameter(int)//  beginEdit()//  finishEdit()//  addIntParameter(QString,QString,QString,QString,int)//  addCustomIntParameter(DzPropertyParam*,QString,QString,QString,QString,int)//  addOutParameter(int,QString,QString,bool)//  addCustomOutParameter(DzOutParam*,int,QString,QString,bool)//  ...etc. (about 200 functions that appear to be Brick-related)// At present this oBrick has just the default DzOutParam, as per your screen dump:print( ' ' );print( '---Parameters---' );print( oBrick.getNumParameters() );             // 1var oParam = oBrick.getParameter(0);print( oParam.className() );                    // DzOutParamprint( Object.keys( oParam ).join( '\n' ) );

    Hope this helps.

    P.

     

  • OmnifluxOmniflux Posts: 360

    Unfortunately, I think the shader area is undocumented because it is incomplete. I've found several instances of

    TypeError: ambiguous call of overloaded function setType(); candidates were setType(ParamType) setType(int)

    or 

    TypeError: cannot call type(): unknown return type `DzBrickSet::ShaderType' (register the type with qScriptRegisterMetaType())

  • PraxisPraxis Posts: 240
    edited October 2020
    Omniflux said:

    Unfortunately, I think the shader area is undocumented because it is incomplete...

    Yeah... Scripting in DAZ Studio reminds me often of playing Zork in the 1980s smiley

    Post edited by Praxis on
  • OmnifluxOmniflux Posts: 360

    So.... I opened a support ticket and then quickly figured it out.

    On the DzCustomMDLBrick you just need to set the value on getMDLCallableControl()

  • PraxisPraxis Posts: 240
    Omniflux said:

    On the DzCustomMDLBrick you just need to set the value on getMDLCallableControl()

    Good to know - Thanks.

Sign In or Register to comment.