Finding the Right Light: A Practical Guide to SAMSON’s Light Queries

When a molecular scene contains several lights, a small selection mistake can interrupt an otherwise careful workflow. You may want to identify a light by its name, check which lights are marked visible, or find lights that are not selected—without confusing them with other kinds of scene nodes.

SAMSON’s Node Specification Language (NSL) provides a focused way to describe these targets. The key is to start with the light attribute space: its short name is li, and it matches only light nodes. That prefix makes a query’s intent easier to read: you are asking about lights, not making a general statement about every node.

Start with the target, then the property

A light query follows a simple mental pattern: identify the node type, then specify the attribute that matters. For example, li.n "A" refers to lights by the name attribute, while li.h refers to the hidden attribute. The documentation lists name and hidden as inherited node attributes, so these are familiar node properties used within the light-specific space.

This structure is useful when reviewing a query later. A short expression such as li.v still tells you that the query concerns lights and the visible attribute. If you prefer readability over brevity, the full attribute names—such as visible or selectionFlag—make the intent explicit. The short names are optional conveniences, not a reason to make a query harder for a teammate to interpret.

Keep similar-looking attributes distinct

The reference lists several boolean attributes: hidden, selected, selectionFlag, visibilityFlag, and visible. Their names are similar enough that it is worth choosing deliberately rather than guessing. Use the attribute that matches the question you are asking. For example, the documented expression li.selected checks the selected attribute; li.sf addresses the selection flag; and li.vf addresses the visibility flag.

One useful detail: selected is inherited from the node attribute space, but the light space does not provide its short name s. For lights, write li.selected rather than assuming that li.s is available. The other listed short forms include h for hidden, n for name, sf for selectionFlag, vf for visibilityFlag, and v for visible.

Use negation to express the opposite

For boolean attributes, the reference shows both positive and negated forms. For instance, li.v and not li.v express opposite conditions on the visible attribute. The same pattern appears for hidden and selected: li.h versus not li.h, and li.selected versus not li.selected. This makes the query easier to align with the task: decide whether you want lights matching the attribute or lights that do not match it.

For names, the examples use quoted strings, as in li.n "A" and li.n "L*". Keep the value inside quotation marks when following this form. If you are unsure what a particular name expression matches, test it in your own scene rather than inferring behavior from the example alone.

A quick query-planning checklist

  • Target: Start with li to limit the attribute space to light nodes.
  • Intent: Choose the exact property—such as name, visible, or selectionFlag.
  • Value: Use a boolean value where appropriate, or a quoted string for a name.
  • Opposite condition: The documented examples use not to express the opposite of a boolean condition.
  • Clarity: Use short names for compact queries and full names when readability matters.

These habits help prevent a common source of friction: writing a query that looks plausible but uses the wrong attribute or an unavailable abbreviation. For the complete attribute table and the inherited-property references, see the SAMSON light attributes documentation.

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

Comments are closed.