Find the Light in a Crowded Molecular Scene

A molecular scene can accumulate lights as you build, compare, and present models. When several are present, it may be difficult to tell which one is hidden, which is visible, or which has the name you remember. Selecting lights by eye can turn a quick cleanup into a hunt.

SAMSON’s Node Specification Language (NSL) offers a more deliberate approach: query the light nodes using the light attribute space, abbreviated li. The key detail is that li matches only light nodes. That gives you a focused way to inspect light-related attributes without mixing your search with other kinds of nodes.

Start with the light namespace

Use the namespace prefix with an attribute to make your intent explicit. For example, li.h is an expression for lights whose hidden attribute is true, while not li.h expresses the opposite. Similarly, li.v and not li.v let you query the visible attribute in either direction.

This is useful when you are trying to answer a specific question rather than scanning every object in the scene: “Which lights are hidden?” or “Which lights are not visible?” The NSL expression names the attribute you want to check, and the light namespace keeps the query scoped to lights.

Use names to narrow the search

If you have given a light a recognizable name, query the name attribute with a quoted string. The reference page shows examples such as li.n "A" and li.n "L*". This can be a practical first step when a scene contains several lights and you are looking for one by its label. Keep the string in quotes, as shown in the examples.

Names are particularly useful alongside visibility checks: first identify the light you mean, then query the state that matters. This keeps the process easier to reason about than relying on an object’s appearance in a busy viewport.

Don’t confuse state attributes

The light reference includes hidden, visible, selected, selectionFlag, and visibilityFlag. These are not all interchangeable query names. For instance, the page lists selected as a boolean attribute, but notes that for lights it does not have the short name s. If you want to test selection state, use li.selected or not li.selected, rather than assuming a shorthand is available.

The selection and visibility flags have their own short names: sf and vf. The reference gives examples such as li.sf false, li.sf, and li.vf false. When writing a query, choose the attribute that matches the state you want to inspect instead of treating “hidden,” “visible,” and “visibility flag” as synonyms. The documentation identifies these as separate attributes, so being precise makes your expressions clearer.

A small troubleshooting routine

  1. Limit the query to lights with the li namespace.

  2. If you know a name, check it with li.n "your name", keeping the name in quotes.

  3. Check the relevant state directly: for example, li.h for hidden lights or not li.v for lights whose visible attribute is false.

  4. If you are investigating selection or flags, use their listed attributes explicitly, such as li.selected or li.vf.

This approach is most helpful when a scene’s appearance alone does not make the state of a light obvious. Instead of guessing, you can formulate a focused expression around the attribute you need. The light attribute space inherits these properties from the general node attribute space, while keeping the li prefix specific to light nodes.

For the full attribute table and examples, see the SAMSON light attributes reference.

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

Comments are closed.