How to tell when all smoothing is done...

After calling dzScene->setFrame(), and node->finalize() on all the nodes, I'm having trouble knowing when I can go ahead and call node->getCachedGeom().

I've tried dzScene->stepTime() because it was said to be synchronous, but it isn't.

I've tried DzScene::drawnDataChanged() but that signal gets fired many, many times, to many times instead of once.

The onlt thing that I've tried that works is something that my self-respect won't let me do:

dzScene->setFrame( frameNo );for ( auto const &node : nodes ) {    node->finalize(true);}Sleep( 2000 ); // <---- I am going to hellQApplication::processEvents();

Has anyone found the proper technique to synchronously wait for the scene to settle? Any help would be greatly appreciated.

Comments

  • So, the view counter doesn't seem to be working anymore, so I don't know how many people actually care :) but I found something that works. It was buried in with something that someone did actually suggest, but it wasn't clear that it is the simple, single thing one needs to do.

    Whether the smoothing is done synchronously or not is a property of the modifier, not the scene nor the geometry. Setting "Interactive Updates" under Smoothing to "On" causes DzNode->finalize()

    I'm not sure yet whether it is DzScene::setFrame(), DzNode::update(), or DzNode::finalize() that blocks, or whether you even have to call QApplication::processEvents(), but by the time all four of these return, DzFacetMesh::getCachedGeom() returns the smoothed mesh with no arbitrary Sleep() calls that would put in peril anyone's immortal soul.

    So I think the solution is to find that property, set then all to "On", and then set them all back to their original values after exporting is done. Should be easy enough.

    I'm so used to utterly failing to figure out even the simplest things with the SDK that this tastes like the sweetest success.

  • I usually only work with base mesh so getCachedGeom gets me what I want.

    If I want to work with subdivided mesh then I call update and finalize. https://www.daz3d.com/forums/discussion/150426/obtaining-subdivided-dzfacetmesh-for-a-node

    Sleep won't send you to hell nor is it a guaranteed solution laugh

  • Hi again, surreal.

    Yes, what you said above is what ultimately worked. I don't know what actaully triggers smoothing to start, setFrame(), update(), or finalize(), and I suppose it's not really that important. It was important to just know that unless interactive updates in on, smoothing is done in another thread (or via a slot that hasn't been processedEvents()'d yet), and you can end up calling getCachedGeom() too early. With it on, things happen synchronously and more simply.

     

Sign In or Register to comment.