When a node looks selected, check its ancestors

A molecular scene can be confusing in a familiar way: an atom appears selected, hidden, or locked, even though its own setting does not seem to explain why. In SAMSON, that can happen because some node states are inherited through the data graph. A parent node’s flag may affect its descendants, so checking only the atom’s local flag can give an incomplete picture.

Node Specification Language (NSL) helps you ask two different questions: “What is this node’s effective state?” and “What flag is set directly on this node?” That distinction is useful when inspecting a complex hierarchy or narrowing a query to the nodes that matter.

Effective state versus local flag

For selection, node.selected (short form n.s) matches nodes that are selected because their own selection flag is true or because an ancestor’s selection flag is true. By contrast, node.selectionFlag (short form n.sf) checks the flag on the node itself.

For example, n.s finds effectively selected nodes, while n.sf true finds nodes whose own selection flag is set. If you are investigating why a descendant is selected, comparing these queries can help separate inherited selection from a flag set locally. To find nodes whose own selection flag is false, use n.sf false; that does not necessarily mean they are effectively unselected, since an ancestor may still be selected.

The same distinction matters for visibility

node.visible (short form n.v) describes effective visibility: a node is visible when its visibility flag is true and its ancestors are visible. node.visibilityFlag (short form n.vf) checks the node’s own flag. A node can therefore have a true visibility flag and still be hidden because an ancestor’s flag is false.

Use n.v when the practical question is “Which nodes are currently visible?” Use n.vf false when you are looking for nodes with visibility explicitly turned off at their own level. The related query n.h matches nodes that are hidden either because their own visibility flag is false or because an ancestor’s is false. In short, n.vf is about a local setting; n.v and n.h reflect the hierarchy.

Locked nodes can also inherit state

The same pattern applies to locking. node.locked (short form n.l) matches nodes that are locked because their own locked flag is true or because an ancestor’s is true. node.lockedFlag (short form n.lf) checks the local flag. If a node seems locked unexpectedly, compare n.l with n.lf true to distinguish an effective lock from a flag set directly on that node.

A practical way to investigate

  1. Start with the effective-state query that matches what you see: n.s, n.h, or n.l.

  2. Check the corresponding local flag: n.sf, n.vf, or n.lf.

  3. If the effective state and local flag do not seem to agree, inspect the node’s ancestors in the hierarchy. An ancestor’s flag may explain the result.

This mental model can prevent a common detour: changing an atom’s local flag when the state you see is actually inherited from a containing group. It also helps make queries more precise. Ask for effective state when you want the scene’s current behavior; ask for a flag when you want to inspect what is set directly on each matching node.

For the full list of node attributes, categories, node types, and examples, see the SAMSON NSL node attributes reference.

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

Comments are closed.