Find the Right Visual Models Without Guessing at Their State

A molecular scene can contain many visual models, and it is easy to lose track of which ones are visible, hidden, selected, or associated with material. When you need to inspect or narrow down visual models, relying on a remembered name or clicking through the scene can become tedious. SAMSON’s Node Specification Language (NSL) provides a compact way to express queries about visual-model attributes.

The starting point is the visualModel attribute space, abbreviated vm. It matches visual model nodes. This matters: the prefix tells your expression which kind of node you want to describe. The attributes listed here are inherited from the node attribute space, so they are familiar node properties available for visual models too.

Check visibility with a readable expression

To query the visible attribute, use vm.v or its full form, vm.visible. The documented examples include both positive and negative checks:

  • vm.v — visual models whose visible attribute is true.
  • not vm.v — visual models whose visible attribute is false.

The corresponding hidden attribute can be queried as vm.h or vm.hidden. For example, vm.h and not vm.h express positive and negative checks on that attribute.

visible and hidden are separate attributes in the reference. If your question concerns one of them, write that attribute explicitly rather than assuming the two names are interchangeable. Likewise, visibilityFlag is its own attribute, abbreviated vf, with examples such as vm.vf and vm.vf false. The reference lists all three, but does not define them as synonyms.

Separate selection from selection flags

Selection has a similar distinction. The selected attribute is written vm.selected; unlike several other inherited attributes, it has no short name in the visual-model space. Its documented inverse is not vm.selected.

selectionFlag, on the other hand, has the short name sf. You can write vm.sf or explicitly test for false with vm.sf false. Keeping the full attribute names in mind helps prevent a common source of confusion: a query for selected is not the same expression as a query for selectionFlag.

Use names and material attributes as targeted checks

When a visual model has a useful name, the name attribute can be queried with a quoted string. The examples are vm.n "A" and vm.n "L*", where n is the short name for name. Quotation marks are part of the expression: use them around the name value.

Material-related checks are available too. Use vm.hm for hasMaterial and vm.om for ownsMaterial; both attributes also have explicit true-or-false values. These are distinct names, so choose the one that matches the question you are asking rather than treating them as interchangeable.

A practical way to build a query

Start with the node category, then add the attribute that describes the state you want to inspect. For example, vm.v is a direct visibility check, while not vm.selected checks the selection attribute in the opposite direction. If you need to be precise about a flag, use its own attribute, such as vm.vf false. The documentation’s examples are useful starting points; you can adapt the attribute and value to the question at hand.

Being explicit is especially helpful when reviewing a complex scene: it makes clear whether you are asking about visibility, hidden state, selection, a flag, a name, or material. For the complete attribute reference and additional context, see the SAMSON visual model attributes documentation.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.