When working on complex molecular models, it’s common to load or import large systems with many hierarchical components. As your scene builds up, things start to disappear from view—or never appear at all. It’s frustrating to realize that parts of your model may be hidden, or not displaying properly, even though they were technically loaded. 🤔
If you’re using SAMSON, and you’re analyzing or preparing models for images, presentations, or simulations, it’s helpful to know what’s being shown and what’s not. The Node Specification Language (NSL) in SAMSON provides an accurate and consistent way to query visibility. But what’s the difference between a node being visible, hidden, or having a visibilityFlag? Here’s a breakdown that will clarify it all.
Understanding Node Visibility in SAMSON
In SAMSON, whether an object is shown on screen depends not only on its own visibility settings, but also those of its parent nodes. Here’s how it works:
node.visibilityFlag(short:n.vf): This refers to whether this specific node is marked as visible. This does not consider the visibility flags of parent nodes.node.visible(short:n.v): This is a compound attribute. It’strueonly when the node and all of its ancestors (e.g., parent folders or groups) are visible. This is what determines if the node is actually rendered in the viewport.node.hidden(short:n.h): This is typically the negation ofvisible, meaning the node or one of its ancestors hasvisibilityFlag = false.
Example:
Say you are working on a protein-ligand complex and want to select everything that’s currently visible. You would use:
|
1 |
n.v |
This ensures you only work with the parts that are actively displayed.
Use Cases: Why This Matters
Let’s imagine you’re creating a publication-ready rendering of a protein structure, and you hide some helper folders containing visual models, labels, or extra representations. You want to export only the visible atoms:
|
1 |
n.t a and n.v |
This matches all atom nodes that are visible — excluding anything you’ve hidden, whether directly or via some parent node.
Need to find things that aren’t showing up?
|
1 |
not n.v |
This finds everything that’s hidden from view — very helpful for cleaning up your scene or checking for missing components.
Common Scenarios
- Scene management: Control layers of a complex molecular system (e.g. ligands, solvents, ions) by hiding/showing parent folders.
- Scripting accuracy: When building NSL-based selection expressions, use
n.vinstead ofn.vfif you care about actual visibility. - Debugging: Something missing from your render? Use
not n.vto look for it.
Final Tip
If you’re ever unsure whether a node is showing up, n.v is the most reliable check. It combines the node’s own visibility settings and the state of its entire ancestral chain. This is particularly useful in multi-level scenes where environments, groups, or visual abstraction layers are involved.
Want to learn more about node attributes and NSL in SAMSON? Visit the official documentation page.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.
