Display world-space transform of an object?

cwichuracwichura Posts: 1,042
edited May 2013 in Daz Studio Discussion

I use LuxRender as my rendering engine. I also frequently hack the scene files exported from Studio to add stuff that the exporters don't support. There have been times when I wanted to place a native Lux shape to a scene, but this requires knowing the world-space transform of a reference object in the Studio scene to place correctly. If you are trying to place something relative to a figure or other object in the scene, it's easiest to parent the reference object to said figure. But then there is no easy way to find out what the world space transform (location, rotation and scale) is, since the values shown in the property tab become relative to the parent object. You could parent the item and then unparent it, but that has the problem of it won't follow the parent item around when repositioned, and it also loses the inheritance of scale changes made to the parent.

Is there some easy way to find out what the world space transform is? Perhaps a script that takes a selected object and throws up a message dialog with the world space info? Or is there some hidden info pane that displays this?

Thanks

Post edited by cwichura on

Comments

  • BlackFeather1973BlackFeather1973 Posts: 739
    edited December 1969

    This should do the trick :

    // DAZ Studio version 4.5.1.56 filetype DAZ Script
    // What's my World Space ?
    
    var oNode = Scene.getPrimarySelection();
    var sMessage = "";
    
    if(oNode)
    {
     sMessage += oNode.getLabel() + "\n\n";
     sMessage += "xTranslate = " + round2dec(oNode.getWSPos().x) + "\n";
     sMessage += "yTranslate = " + round2dec(oNode.getWSPos().y) + "\n";
     sMessage += "zTranslate = " + round2dec(oNode.getWSPos().z) + "\n";
     sMessage += "xScale = " + round3dec(oNode.getWSScale().m11) + "\n";
     sMessage += "yScale = " + round3dec(oNode.getWSScale().m22) + "\n";
     sMessage += "zScale = " + round3dec(oNode.getWSScale().m33) + "\n";
     sMessage += "xRot = " + round2dec(rad2degree(oNode.getWSRot().getValue(0,1,2).x)) + "\n";
     sMessage += "yRot = " + round2dec(rad2degree(oNode.getWSRot().getValue(0,1,2).y)) + "\n";
     sMessage += "zRot = " + round2dec(rad2degree(oNode.getWSRot().getValue(0,1,2).z)) + "\n";
    
     MessageBox.information(sMessage, "What's my World Space ?", "&OK;");
     print(sMessage);
    }
    
    function round2dec(value)
    {
     return Math.round(value*100)/100;
    }
    
    function round3dec(value)
    {
     return Math.round(value*1000)/1000;
    }
    
    function rad2degree(value)
    {
     return value*180/Math.PI;
    }
  • cwichuracwichura Posts: 1,042
    edited December 1969

    Many thanks for that. Seems to work a treat.

Sign In or Register to comment.