When working on complex molecular systems, clarity is essential. A major pain point for molecular modelers is managing the visibility of objects within a scene—especially when you’re juggling dozens (or hundreds) of nodes, each with specific visual properties. Why is one object showing up when it shouldn’t? Why is another invisible, even though it looks like it should be active?
In SAMSON’s Node Specification Language (NSL), the visualModel attribute space helps you control visual elements precisely. If you’re wondering about the differences between visible, hidden, visibilityFlag, and how to effectively use them, this article breaks it down.
Understanding Visual Model Visibility
There are four main attributes in NSL that affect visibility of visual models:
- visible (
v): Specifies whether the node is currently rendered in the scene or not. - hidden (
h): Represents whether the node has been manually hidden. - visibilityFlag (
vf): A more granular toggle that contributes to the final visibility state. - selectionFlag (
sf): While related more to selection than visibility, confusion often arises due to visual feedback from selections.
All of these attributes operate within the vm (short for visualModel) namespace. For example:
|
1 2 3 |
vm.v # Object is visible not vm.h # Object is not hidden vm.vf false # Visibility flag is off |
How They Combine
The object’s actual visibility is influenced by a combination of these attributes. For example:
- If
vm.histrue, the object is manually hidden. - If
vm.vfisfalse, the visibility flag disables rendering even ifvm.hisfalse. - The
vm.vattribute will reflect the actual state—whether it’s currently shown.
So, manually hiding an object sets vm.h to true, which impacts vm.v. Similarly, toggling vm.vf impairs rendering regardless of other states.
Typical Use Cases
Imagine you’re preparing a molecular animation and want to fade out objects frame by frame. You could sequentially disable vm.vf flags to control visibility without altering the hidden status (which a user might have set manually).
Alternatively, if you are diagnosing a scene where some data seems to be missing, checking vm.v and cross-referencing with vm.h and vm.vf can help you identify hidden model components quickly.
Query Examples
Some useful NSL expressions:
|
1 2 3 4 |
vm.v # Selects all visible visual models not vm.h # Selects visual models that are not manually hidden vm.vf false # Selects visual models with disabled visibility flag |
Combining conditions can be powerful:
|
1 2 |
vm.v and not vm.h and vm.vf |
This selects all nodes that are clearly visible and not being blocked by any flag or manual setting.
Bottom Line
Understanding these visibility attributes helps avoid frustration when debugging your molecular scenes, preparing renderings, or scripting animations. By using vm.v, vm.h, and vm.vf thoughtfully, you can better control what appears—and what doesn’t—in your visual models.
To learn more, visit the official SAMSON NSL documentation for visual models.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
