version of Genesis character

How can I distinguish which version of Genesis character is selected using script? I mean mainly, G3, G8, G9.

Comments

  • Richard HaseltineRichard Haseltine Posts: 101,805

    Look at the name (rather than the label) or, better, the asset details (e.g look at the methods used in http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/metadata/list_products_used/start )

  • Michal P.Michal P. Posts: 88

    Richard Haseltine said:

    Look at the name (rather than the label) or, better, the asset details (e.g look at the methods used in http://docs.daz3d.com/doku.php/public/software/dazstudio/4/referenceguide/scripting/api_reference/samples/metadata/list_products_used/start )

    Thank you for the suggestion. I know that in some cases could be the name used but it doesn't work in genral. I like the idea with the asset detail, but I don't know which information should be used. Any suggestion?

  • Seven193Seven193 Posts: 1,096

    Names work for me:

     var sourceNode = Scene.getPrimarySelection();
     if (!sourceNode) {
        MessageBox.critical( qsTr("Nothing selected."), qsTr("Warning"), qsTr("&OK") );
        return;
     }

     if(sourceNode.inherits("DzBone")) sourceNode = sourceNode.getSkeleton();
     if( !sourceNode.inherits("DzSkeleton")) {
        MessageBox.critical( qsTr("Selection is not a figure."), qsTr("Warning"), qsTr("&OK") );
        return;
     }

     var validNames = ['Genesis2Female','Genesis3Female','Genesis8Female','Genesis8_1Female',
                       'Genesis2Male','Genesis3Male','Genesis8Male','Genesis8_1Male',
                       'Genesis9' ];

     var bValidFlag=0;

     for(var i=0; i < validNames.length; i++) {
        if(sourceNode.name == validNames[i] ) {
           bValidFlag = true;
           break;
        }
     }

     if(!bValidFlag) {
        MessageBox.critical( qsTr("Selection must be a Genesis character."), qsTr("Warning"), qsTr("&OK") );
        return;
     }

Sign In or Register to comment.