...
The script's output is formatted and the name of the searched object is printed in quotes ("Cube03"). To do this, the a so-called escape character is used before the quote mark (\") is used:
Code Block | ||
---|---|---|
| ||
# Define which name you want to look for, create empty list and get the scene's nodes checkForName = "Cube03" nodeNames = [] nodeSelection = [] sceneNodes = scene.getNodes() |
...
# Loop through the nodes and add every node's name to the "nodeNames" list for entry in sceneNodes: nodeNames.append(entry.getName()) |
...
# If the search name is part of "nodeNames" print out a message and select the node if (checkForName in nodeNames): scene.message("Object \""+checkForName+"\" exists.") nodeSelection.append(scene. |
...
getNode(checkForName)) |
...
# Otherwise, print out that the name has not been found else: scene.message("Object \""+checkForName+"\" ist not part of the project.") scene.selectNodes(nodeSelection, True) |