Deselect all materials

pcicconepciccone Posts: 661
edited December 1969 in Daz SDK Developer Discussion

Hello again.
Thanks again for the previous help, it all worked out very well.

Is there a way to programmatically deselect all the selected materials? This would be equivalent to clicking on an empty area of the viewport.

Thanks in advance.

Comments

  • rbtwhizrbtwhiz Posts: 2,171
    edited December 1969

    Yes... and its pretty straight forward. Using the static functions on DzMaterial, iterate over the material list and check if DzMaterial::isSelected() is true. If it is, call DzMaterial::select( false ) on that material.

    void MyClass::clearMaterialSelection()
    {
     int numMats = DzMaterial::getNumMaterials();
     for( int i = 0; i < numMats; i++ )
     {
      DzMaterial *curMat = DzMaterial::getMaterial( i );
      if( curMat && curMat->isSelected() )
       curMat->select( false );
     }
    }

    -Rob

  • pcicconepciccone Posts: 661
    edited December 1969

    Thanks. I used that but I was wondering if there was a single direct call. I was just afraid about the performance cost.
    Thank you for the confirmation.

    Cheers.

Sign In or Register to comment.