Redacted

cridgitcridgit Posts: 1,757

​Redacted

Post edited by cridgit on

Comments

  • Richard HaseltineRichard Haseltine Posts: 100,886

    On the C++ side, DzTime is a typedef for int. On the script side, DzTime is an object that holds an int and the type is registered so that it can can be used in script (so the script engine knows how to deal with it). Script API documentation for DzTime states "Methods throughout the DAZ Studio API that take a DzTime as an argument can also take a Number in its place." Also documented is the existence of a method named "valueOf" that returns the int (Number) it contains.

    So just use time.valueOf() in your sample, which works (I also added a line to get the selected object as a target)

    print("key\ttime\tvalue");

     

     

    var oNode = Scene.getPrimarySelection();

     

    var property = oNode.findProperty("ZRotate");

     

    for (var i=0; i < property.getNumKeys(); i++) {

    var time = property.getKeyTime(i);

    var val = property.getValue(time.valueOf());

    print("%1\t%2\t%3".arg(i).arg(time.valueOf()).arg(val));

    }

  • Richard HaseltineRichard Haseltine Posts: 100,886

    Meant to add this earlier but the forums were playing silly blighters: that isn't to say you haven't identified an issue, and a future version of Daz Studio will add an override for the Qt handling of such objects so that the behaviour will match the documentation.

Sign In or Register to comment.