DzVertexMesh and geografting

Alessandro_AMAlessandro_AM Posts: 1,577
edited December 1969 in Daz SDK Developer Discussion

I'd like to add support to geografted figures but I am unable to understand how to get the DzVertexMesh for the combined figure.
I used to get the vertex mesh for a standard figure like this:

myVertexMesh = qobject_cast(myFigure->getObject()->getCachedGeom());

However, that wouldn't work on a geografted figure because it reads only the base figure geometry.
I've been taking a look also at the dzgraftingfigureshape.h header (BTW, no documentation about this class is available yet), but I couldn't understand if there are some functions that would actually return the combined vertex mesh, facet mesh, selection map etc.

Any chance of getting some help, or maybe a working example? Thanks


  • ketthroveketthrove Posts: 62
    edited October 2012

    The call you are using will give you the current geografted state of the mesh in the general case, it is the call we use to draw/render the graft, but there a couple exceptions. There are a few tools in studio (ie Polygon Selection Tool, Weight Map Tool, etc) that effectively shut grafting off. While these are active nothing is grafted in the scene.

    On DzShape there is also the functions "getAssemblyGeometry()" and "getModifiableAssemblyGeom()". When grafting is on these meshes will give you the grafted "Assembled" mesh, though both are in unmodified state. When dealing with a shape that is grafted remember to use the "Assembly" material functions instead of the plain material functions. These "Assembly" material functions can be used all the time as they will fall back to the standard ones when no grafting is occurring.

    Post edited by ketthrove on
  • Alessandro_AMAlessandro_AM Posts: 1,577
    edited December 1969

    Thanks ketthrove, I tried using:

    myVertexMesh = qobject_cast(figureShape->getModifiableAssemblyGeom(false)));

    , but the result is the same, only Genesis get loaded. I checked also the myVertexMesh->getNumVertices() and infact the number of vertices, regardless it's a geografting, still shows the same number of the Genesis count.

  • ketthroveketthrove Posts: 62
    edited December 1969

    I selected an un-grafted Genesis with the universal transform selection tool root and ran this script:

    var node = Scene.getPrimarySelection();
    var obj = node.getObject();
    var geom = obj.getCachedGeom();
    print( "Vertices:" + geom.getNumVertices() );
    print( "Faces:" +geom.getNumFacets() );

    It prints:


    I then added a graft to Genesis( Cat Tail from Catgirl Genesis on the store) and ran the script and it gives:


    The cache has the graft in it.

  • Alessandro_AMAlessandro_AM Posts: 1,577
    edited December 1969

    Thanks for the example. It turned out that I had a forceCacheUpdate instruction that caused the mesh to reset to the base figure, and so all the geometry information for grafted parts was not accounted.

    Now the vertices and facets count match what is expected when some grafted parts are applied to the figure.

    However, it seems like getSelectionMap() is able only to collect groups for the base figure: grafted parts are not in the list. And obviously the node children for the base figure won't include the grafted parts either.

    So what is the approach to follow? I mean, do I have to collect information for the base figure, and then do the same for each individual grafted part (which are basically figures themselves) ?

    Or there is a way to scan the primary selection and get all the facegroups that belong to it, grafted and not grafted?


  • ketthroveketthrove Posts: 62
    edited December 1969

    If you are just trying to get the face groups they are on the facet mesh. If you need to not what face group goes to which node that's more tricky. I guess it depends what you need the nodes for. If your just trying to find out what's hidden visible I'd recommend that you use the facet flags on the mesh with the DZ_HIDDEN_FACE_BIT flag to see if they are visible.

  • Alessandro_AMAlessandro_AM Posts: 1,577
    edited December 1969

    Thank you very much: I got rid of the DzSelectionMap and worked directly on the facet groups, and now it seems like geograted figures are working with LAMH.

    1317 x 1089 - 155K
Sign In or Register to comment.
Rocket Fuel