How to find a Named  DOF/DCS Node from a vgPart

 

Vega Code Example

 

 

 

 

 

 
 

This example function illustrates how to fined a named Performer  Dynamic Coordinate System (DCS) pfDCS node that is part of the given vgPart.

 

Note that the pfFindNode function is case sensitive.

 

Also you should be aware that if the vgPart is from an OpenFlight file and the node uses the default name; such as dof1  and has not had its position  altered, then the node might get removed during the flatten and clean process done by default after the file is loaded.

 

It is good practice to name all Dof/Lod/Switch nodes or any  node of importance, this practice will save you time when debugging

 

 
   
 

 

 
 
 
 

 

#include "vg.h"          // Required for the standard Vega classes
#include "vgperf.h"      // Required for the vgGetXXXPfNode functions
#include "pf.h"          // Required for the standard Performer classes
#include "vgutil.h"
#include "pfutil.h"      // Required for pfFindNode


pfDCS*
findNamedDCSNodeInVgPart( vgPart  *part, const  char  *dcsName ) {
// #################################################################
// # Public Function
// #
// # Attempts to find the named Performer pfDCS Node (DOF Bead)
// # within the passed vgPart
// #
// # return a pointer to the performer pfDCS node if founD
// #
// # return NULL otherwise
// #
// #################################################################

pfDCS  *dcsNode = NULL;
pfNode *node    = NULL;

    //
    // Sanity check we need an part
    //

   
 if( part == NULL )
       
 return NULL;

    //
    // Retrieve the Parts root pfNode
    //
    node = vgGetPartPfNode( part );
   
 if( node == NULL )
      
 return NULL;

    //
    // Find the Named DCS/DOF node in the performer tree
    // Note the name search is case sensitive
    //


   dcsNode = (
pfDCS *)pfFindNode( node, dcsName, pfGetDCSClassType());

return dcsNode;

}
// findNamedDCSNodeInVgPart

 

 
 

 

 

© Copyright 2004 Gordon Tomlinson  All Rights Reserved.

All logos, trademarks and copyrights in this site are property of their respective owner.