Find the Lights, Not the Noise: A Practical NSL Guide

In a complex molecular scene, small scene elements can be easy to overlook. Lights are a good example: when you need to inspect or manage them, searching through unrelated nodes can add friction to an otherwise simple task. SAMSON’s Node Specification Language (NSL) provides a focused way to describe light nodes and filter them by attributes such as name, visibility, hidden state, and selection state.

The key is to start with the right attribute space. The light space, abbreviated li, matches only light nodes. That gives you a clear starting point for a query: instead of asking about nodes generally, you can express that you are interested in lights specifically.

Start with the light-only scope

Use li as the prefix for light attributes. For example, li.v refers to the visible attribute of light nodes, while li.n "A" refers to their names. The prefix makes expressions easier to read: it tells you both what kind of node you are targeting and which property you want to examine.

This can be useful when a scene contains many different kinds of nodes. Rather than mentally scanning a mixed scene for the lights you care about, you can build a query around the light category first, then add an attribute that narrows the target.

Use visibility and hidden state deliberately

Two inherited attributes are especially useful when you are trying to understand what is present in a scene: visible (short name v) and hidden (short name h). The documented examples are li.v, not li.v, li.h, and not li.h.

These expressions give you a compact way to describe lights by either state. For example, not li.v expresses the inverse of the visible-light condition. The separate hidden attribute is also available, so use the property that matches the question you are asking rather than assuming the two names are interchangeable.

Find lights by name

When a scene uses meaningful light names, the name attribute can make a query more specific. The light reference shows examples such as li.n "A" and li.n "L*". The short form n is available, and the name value is written in quotes.

This is helpful when you have named lights and want your expression to reflect that naming convention. A readable query is also easier to revisit later: a teammate can see that the expression is targeting lights by name, rather than trying to infer its purpose from a long sequence of scene operations.

Keep selection-related attributes distinct

The light attribute space also includes selected and selectionFlag. For lights, selected has no short name; the reference gives li.selected and not li.selected as examples. selectionFlag has the short name sf, with examples li.sf and li.sf false.

Similarly, visibilityFlag is abbreviated vf, with examples li.vf and li.vf false. These are distinct attributes in the reference, so it is worth using their precise names when you want a query to communicate the property you mean.

A small query checklist

  • Begin with li to target light nodes.
  • Use v or h when your question concerns visibility or hidden state.
  • Use n with a quoted value when you want to refer to a light by name.
  • Use selected, sf, or vf when the selection-related or visibility-flag attribute is the property you need.

The benefit is not just shorter typing. Explicit attributes make your intent easier to check, reduce ambiguity when revisiting a scene, and give you a repeatable starting point for finding the lights you need.

For the complete attribute reference and additional NSL examples, learn more in the SAMSON light attributes documentation.

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

Comments are closed.