When the View Gets Crowded: Finding Camera Nodes with NSL

In a molecular scene, it can be easy to lose track of a camera among the many other nodes. When you need to identify camera nodes rather than atoms or other scene elements, the key is to start your Node Specification Language (NSL) expression with the camera attribute space.

The camera attribute space has the short name ca and matches only camera nodes. That scope is useful: it makes the intent of an expression clear and avoids treating a camera name as though it were the name of a molecular object. The camera space also inherits several attributes from the general node space, so you can describe cameras by name or by their selection state.

Find a camera by name

Use ca.n as the short form of the inherited name attribute. Names are written as strings in quotation marks. For example, ca.n "A" specifies a camera named “A.” The reference also gives ca.n "L*" as an example expression. Keeping the ca prefix is a simple way to make clear that you are looking for a camera node.

If an expression does not return what you expect, check the basics first: confirm that you are using the camera prefix, that the name is quoted, and that the name or pattern you entered corresponds to the camera you intend to find. This quick check can save time when the scene contains several kinds of nodes with similar-looking names.

Check selection state

Camera nodes also inherit the selected attribute. The examples show both ca.selected and not ca.selected, which let you express the two sides of a selection check: cameras that are selected, and cameras that are not selected.

There is a small naming detail worth remembering: although the general node attribute has the short name s, the camera reference specifies selected without that short name. So, for camera expressions, use ca.selected rather than assuming ca.s is available.

Use the selection flag explicitly

The inherited selectionFlag attribute has the short name sf. Its documented examples are ca.sf false and ca.sf. The attribute accepts Boolean values, true or false.

selected and selectionFlag are listed as separate attributes. If your task specifically concerns the selection flag, write that attribute explicitly with ca.sf; if it concerns whether a node is selected, use ca.selected. Keeping the two names distinct makes expressions easier to read and helps prevent a query from expressing a different condition than the one you intended.

A compact reference

  • ca.n "A" — camera name attribute, using its short form.
  • ca.selected — selected camera nodes.
  • not ca.selected — camera nodes that are not selected.
  • ca.sf false — camera nodes whose selection flag is false.

These examples are a practical starting point when a scene contains many nodes and you need your expression to focus specifically on cameras. For the complete attribute reference, see the SAMSON camera attributes documentation.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.