How to get the selected faces

SMokeyDemonSMokeyDemon Posts: 0
edited December 1969 in Daz SDK Developer Discussion

Hey guys,

Ive been trying to write a small tool here that involves getting a list of the faces selected in the view port.
(To select the faces I am using the Polygon Group Editor Tool)

Ive managed to get to the DzFacetMesh of the object but this only seems to allow me to set the selected faces or clear them etc. The only hack ive found so far is to create a new face group and assigned the selection to that then read the selected faces from that new face group... but this modifies the face groups which I dont want to do.

Is there a proper way of getting the selected faces?

Cheers,

Comments

  • dtammdtamm Posts: 126
    edited November 2015

     

    s0t said:

    Hey guys,

     

    Ive been trying to write a small tool here that involves getting a list of the faces selected in the view port.
    (To select the faces I am using the Polygon Group Editor Tool)

    Ive managed to get to the DzFacetMesh of the object but this only seems to allow me to set the selected faces or clear them etc. The only hack ive found so far is to create a new face group and assigned the selection to that then read the selected faces from that new face group... but this modifies the face groups which I dont want to do.

    Is there a proper way of getting the selected faces?

    Cheers,

     

    This works for me:

     DzObject* obj = node->getObject(); if( !obj )  return; DzShape* shape = obj->getCurrentShape(); if (!shape)  return; DzFacetMesh* facetMesh = qobject_cast( shape->getGeometry() ); if (!facetMesh)  return; const unsigned char* facetFlags = facetMesh->getFacetFlagsPtr(); for(int i = 0; i < facetMesh->getNumFacets(); i++) {  if (facetFlags[ i ]& DZ_SELECTED_FACE_BIT)  {   qDebug() << QString("Facet[%1] is selected").arg(i);  } }

     

    Post edited by Richard Haseltine on
  • SMokeyDemonSMokeyDemon Posts: 0
    edited December 1969

    awesome thanks for that...

    the missing link was the 'getFacetFlagsPtr' function, I spent a few nights digging around and found the DZ_SELECTED_FACE_BIT but couldn't find what to compare it with :-)

Sign In or Register to comment.