DzGroupNone behaviours *Solved*

TotteTotte Posts: 14,804

Hi,

I have some issues to get a DzGroupNode created in script to behave similar (give the same results) as a DzGroupNode created using Create->New Group... and enbedding the selected node into the group. See attached image,

I suspect that the DS Action does some behind the scenes tricks (that I very much would like to do myself, to get the same behavoir. I do call invalidateBoundingBoxes() in tghe DzGroupNode after the node has been parented to it.


GroupNode_problem.jpg
1128 x 905 - 85K
Post edited by Totte on

Comments

  • TotteTotte Posts: 14,804

    Thanks to Rob Whiz and also MikeD for brining clairity to this.

     

  • DoctorJellybeanDoctorJellybean Posts: 9,736

    Totte said:

    Hi,

    I have some issues to get a DzGroupNode created in script to behave similar (give the same results) as a DzGroupNode created using Create->New Group... and enbedding the selected node into the group. See attached image,

    I suspect that the DS Action does some behind the scenes tricks (that I very much would like to do myself, to get the same behavoir. I do call invalidateBoundingBoxes() in tghe DzGroupNode after the node has been parented to it.


     In 4.x DzBox3::include() is bugged in script (it is fixed in 6.x), but translation of the C++ code to script is:

    var boxWorld = new DzBox3();

    var aNodes = Scene.getSelectedNodeList();
    for( var i = 0, n = aNodes.length; i < n; i += 1 ){
     boxWorld.include( aNodes[i].getWSBoundingBox() );
    }

    var vecMax = boxWorld.max;
    var vecMin = boxWorld.min;
    var vecMid = vecMax.add( vecMin ).multiply( new DzVec3( 0.5, 0.5, 0.5 ) );

    if( oGroupNode ){
     oGroupNode.setWSPos( new DzVec3( vecMid.x, vecMin.y, vecMid.z ) );
    }

    The C++ is shorter - operator functions on DzVec3

Sign In or Register to comment.