How to set properties

I'm having trouble setting properties of a model in the scene.

What I would like to do is learn how to move any selected nodes to a translation x of 100.

I've got this all working in Daz Script, but can't figure out how to do it in C++.

This is what I am trying now, but Daz crashes.


DzNodeListIterator	nodeIt(dzScene->selectedNodeListIterator());	while (nodeIt.hasNext()) {		DzNode *myNode =;		DzFloatProperty *myX = myNode->getXPosControl();		myX->setValue(100);	}


Thanks for any help.


  • hphoenixhphoenix Posts: 1,335
    edited December 2015

    Just from a C++ perspective, that looks like an infinite loop (assuming nodeIt.hasNext() is not null).

    It's infinite, because nothing in the body changes what nodeIt points to.  Maybe try adding in the body of the loop a;


    ...unless of course, that the method automatically updates the object.  Not sure how the iterator class is structured in the Daz libraries.

    (I'm an old hand at C/C++, but I'm new to DAZ coding....)


    The other possible problem is if dzScene->selectedNodeListIterator() returns an empty or null node.  Then an attempt to call nodeIt.hasNext() would cause an exception (attempting to dereference a null.)  Might want to put in a test to make sure.



    Post edited by hphoenix on
  • I think the NodeIt does the iterations, I'm not getting any errors from the loop itself.

    I think the moves the pointer. ie this line :


    DzNode *myNode =;


    I used it from an example and that's the way it was done.

    I'll try it without anything in the loop just to make sure.


  • Got it...


        DzNodeListIterator	nodeIt(dzScene->selectedNodeListIterator());	while (nodeIt.hasNext()) {			DzNode *nd =;		DzFloatProperty *fp = nd->getXPosControl();		fp->setValue(10.0);			}


Sign In or Register to comment.