During the OpenFlight User Group Meeting at I/ITSEC on 11/30/2011, tips and tricks were presented for using OpenFlight Script and Creator Script.
Here is a script presented that shows how to use the Creator Script command Select From ID. It shows how to set the “ID” parameter of the command when your node names contain special characters.
Note that during the presentation, a user asked how to search for a node whose name contains the “*” (wildcard) character. The script presented below is a modified version of that presented during the meeting in order to address this specific question.
We hope you find this instructional.
# this script executes the Creator tool: Select From ID
# to demonstrate how to use this tool for different kinds of names
# consider a simgle scene containing the following hierarchy
#
# db
# |
# +---------------+--------------+
# | | |
# shadow group collision group shadow*
#
# get a parameter block that can be used for the Select From ID tool
paramBlock = mgGetParamBlock ("Select from ID")
# set up the tool parameters
# select only this node
mgParamSet (paramBlock, "Add to Select List", MG_FALSE)
mgParamSet (paramBlock, "Case Sensitive", MG_TRUE)
# if the node name contains one or more spaces you must "quote" the name
# use the special character sequence \" to include a " in the ID string
mgParamSet (paramBlock, "ID", "\"shadow group\"")
# the following will select the node named "shadow group"
mgExecute ("Select from ID", paramBlock)
# if the node name contains one or more spaces you must "quote" the name
mgParamSet (paramBlock, "ID", "\"collision group\"")
# the following will select the node named "collision group"
mgExecute ("Select from ID", paramBlock)
# use the "*" wildcard to select any node ending in "group"
mgParamSet (paramBlock, "ID", "*group")
# the following will select both nodes "shadow group" and
# "collision group"
mgExecute ("Select from ID", paramBlock)
# if the node name contains the "*" wildcard, you have to quote
# the entire name
mgParamSet (paramBlock, "ID", "\"shadow*\"")
# the following will select just the node named shadow*
mgExecute ("Select from ID", paramBlock)