Is a child a geograft?

DraagonStormDraagonStorm Posts: 748

When looping thru the children of a node, is there something I can check to see if that child is geografted to the node?

var gNumChildren = oNode.getNumNodeChildren();		for( var c = 0; c < gNumChildren; c++ ){    var gChild = oNode.getNodeChild( c );    //Check to see if this child is geografted to oNode?????}

 

Post edited by DraagonStorm on

Comments

  • PraxisPraxis Posts: 252
    edited August 2016

    This may help:

    If you select a DzFigure in the Scene and then run the Node Properties sample script, it reports these undocumented functions (among others):

      getNumGraftFigures()
      getGraftFigure(int)
      getNumCullFigures()
      getCullFigure(int)
      isGraftFollowing()

    You can test them e.g. like this:

    var oObj= Scene.getPrimarySelection();if( oObj && oObj.inherits( "DzFigure" ) ) {  // Test some non-documented functions reported by the "Node Properties" sample script:  var nCount;  var j;  var oFig;  print( ' ' );  print( 'Sub-Figures of', oObj.name, oObj.isGraftFollowing() );  nCount = oObj.getNumGraftFigures();  print( ' ' );  print( 'Grafted Sub-Figures', nCount );  if( nCount > 0 ) {    for( j = 0; j < nCount; j++ ) {      oFig = oObj.getGraftFigure( j );      if( oFig ) {        print( oFig.name+': '+oFig.className(), oFig.isGraftFollowing() );      }    }  }  nCount = oObj.getNumCullFigures();  print( ' ' );  print( 'Culled Sub-Figures', nCount );  if( nCount > 0 ) {    for( j = 0; j < nCount; j++ ) {      oFig = oObj.getCullFigure( j );      if( oFig ) {        print( oFig.name+': '+oFig.className(), oFig.isGraftFollowing() );      }    }  }}

    So it looks like MAYBE all you need to do in your example is this?:

      if( gChild && gChild.inherits( "DzFigure" ) && gChild.isGraftFollowing() ) {    // gChild is GeoGrafted to the Parent Figure...  }

    -P

    Post edited by Praxis on
  • Thank You!

    Worked a charm...

    So I hadn't lost my Google Foo, Those were undocumented.

Sign In or Register to comment.