When working on complex molecular modeling projects, it’s often easy to lose track of elements in the document—especially when multiple cameras, lights, and visual nodes are involved. If you’ve ever found yourself trying to manually sift through camera nodes just to find the one you named “TopView” or to check which ones are currently selected, there’s a faster, more structured way: using SAMSON’s Node Specification Language (NSL) for camera attributes.
Why filter cameras with NSL?
In large systems with multiple viewpoints or during animation setups, managing cameras can become tedious. Quickly retrieving, selecting, or even hiding certain cameras based on properties like their name or whether they are selected can save time and reduce errors.
The NSL query system allows you to specify exactly what you’re looking for. More importantly, in SAMSON, the camera attribute space (called camera or ca) gives you access to attributes that apply specifically to camera nodes.
Key camera attributes you can query
The following attributes are available in the ca space:
name(n): The name of the camera, useful for queries with wildcards. For example,ca.n "Top*"will match all camera nodes whose name starts with “Top”.selected: Tells you whether the camera is currently selected. Useca.selectedornot ca.selectedto filter accordingly.selectionFlag(sf): This is another way to handle temporary marking of nodes without deselecting others.
Practical examples
Let’s say you have 10 different cameras in your project and you want to:
- Find the camera named exactly “Perspective”:
ca.n "Perspective" - Find all cameras that are currently selected:
ca.selected - Exclude cameras that are flagged for selection without being currently selected:
ca.sfANDnot ca.selected
A few things to remember
These camera attributes are inherited from the more general node attribute space. However, for the selected attribute, note that the short name s is not available in the camera space. You need to write out selected completely here.
Why this matters
Efficient node filtering allows you to script and automate how you interact with camera objects in the visual workspace. Whether you’re organizing multiple viewpoints for publication-quality renderings or managing dynamic views for presentation or simulation purposes, being able to query specific camera nodes is a powerful time-saver.
This functionality is especially handy in multi-step NSL queries and scripting, where precise queries significantly simplify workflows.
To explore this further, visit the official documentation page on Camera attributes in NSL.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
