When working with complex molecular systems in SAMSON, it’s common to accumulate multiple camera nodes—some for animations, others for specific views, and a few that are just temporary tests. But how do you quickly find the right camera node when your project contains dozens?
This blog post explains a practical and often overlooked solution: how to filter and select camera nodes using the Node Specification Language (NSL) in SAMSON. If you’ve ever found yourself scrolling endlessly through the Node Editor trying to locate that one camera view called “Top View” or trying to find which cameras aren’t selected, this post is for you.
What is a camera node in SAMSON?
In SAMSON, camera nodes are used to define viewpoints. Each camera node can have associated attributes like name, selected, and selectionFlag. These help you manage and automate camera-related tasks.
Quick Intro to NSL for Cameras
NSL (Node Specification Language) lets you write concise expressions to filter nodes in your document. For camera nodes, you operate within the camera attribute space, which has the short name ca. That’s your entry point.
Filter Cameras by Name
You can filter camera nodes by their name attribute using:
|
1 |
ca.n "Top View" |
This will match only the camera node named “Top View”. You can also use wildcards to match multiple cameras dynamically:
|
1 |
ca.n "View-*" |
This will match any camera whose name starts with “View-” (e.g., “View-Front”, “View-Back”).
Select Only What You Need
If you want to filter for camera nodes that are currently selected, just use:
|
1 |
ca.selected |
And if you want the opposite—i.e., cameras that are not selected:
|
1 |
not ca.selected |
Using Selection Flags
Selection flags are a bit more subtle. They represent prior selection states or more persistent selections in scripting contexts.
To find camera nodes that do not have their selectionFlag set:
|
1 |
ca.sf false |
Or to select only those that do:
|
1 |
ca.sf |
This feature is especially useful when scripting the visualization of structures — for instance, to automatically render from only the flagged viewpoints.
Practical Use Case: Cleanup Before Export
Before exporting a presentation or sharing a SAMSON file with collaborators, it’s helpful to clean up unused or unflagged cameras to avoid confusion. You can quickly get a list of all unflagged ones with:
|
1 |
not ca.sf |
Select them, delete in bulk, and avoid clutter.
Learn More
This post only covers the camera attribute space of NSL, one part of a powerful querying language in SAMSON. You can explore the full documentation of camera attributes here:
https://documentation.samson-connect.net/users/latest/nsl/camera/
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
