What Does It Really Mean for a Node to Be Hidden in SAMSON?

When working with complex molecular systems in SAMSON, controlling what you see—and what you don’t—is essential for clarity and focus. If you’ve ever found yourself wondering why some nodes appear invisible, seemingly at random, you’re not alone. In this post, we dig into what it actually means for a node to be hidden and how you can take back control using the NSL.

What are Hidden Nodes?

A node in SAMSON is considered hidden not only when its own visibility flag is set to false, but also when any of its ancestor nodes has a visibility flag set to false.

This behavior can cause confusion. For instance, if you hide a molecule, all the atoms and bonds it contains will also become hidden—even if their individual visibility flags are true.

Matching Hidden Nodes with NSL

NSL makes it easy to find and work with hidden or visible nodes through the node.hidden or n.h attribute.

Examples:

  • node.hidden (or n.h): matches all hidden nodes
  • not node.hidden (or not n.h): matches all visible nodes

This gives you powerful filtering tools. For example, you can quickly isolate only the hidden atoms in a molecule, or find out which visual models are not currently shown.

Hidden vs. Visibility Flags: Subtle but Important

It’s important to distinguish between node.hidden and node.visibilityFlag.

node.visibilityFlag (short: n.vf) tells you whether a node explicitly has its visibility flag set to true or false. This does not take into account **ancestor** visibility.

By contrast, node.hidden checks the actual render state, affected by both the node and all of its ancestors.

Tip: If a node is hidden but its visibility flag is set to true, one of its ancestors may be the culprit.

Use Case: Diagnosing Why Items Aren’t Displayed 🔍

Imagine you’ve applied a style or a material to a node but it’s not showing in the viewport. Before diving into redoing your visuals, it might help to verify its visibility by executing:

Followed by:

This lets you understand whether the node is hidden because of its own flag or because of an ancestor node.

Node Visibility and Materials

Another related attribute is node.hasMaterial (n.hm). Sometimes a node may be hidden, or simply not visible due to material inheritance from hidden parents.

Combining these attributes strategically can help you debug visualization issues much faster:

This retrieves all nodes that have materials and are visible—an efficient way to verify which styled elements are currently part of your scene.

Conclusion

The node.hidden attribute in NSL is an essential tool for molecular modelers managing complex systems in SAMSON. It factors in the entire node hierarchy, letting you fully understand and control what gets rendered. Whether you’re troubleshooting a rendering issue or selectively hiding document parts for clarity, knowing the difference between n.h and n.vf gives you a real advantage.

Learn more in the full NSL Node documentation.

SAMSON and all SAMSON Extensions are free for non-commercial use. You can get SAMSON at https://www.samson-connect.net.

Comments are closed.