Find the Lights You Mean: A Practical Guide to SAMSON’s Light Queries

When a molecular scene gets busy, small display elements can be surprisingly hard to keep track of. You may need to identify lights that are hidden, check which ones are visible, or find a light by name—without confusing those objects with atoms or other nodes. SAMSON’s Node Specification Language (NSL) gives light nodes their own attribute space, so you can describe what you are looking for with a compact expression.

The key starting point is li, the short name for the light attribute space. It limits a query to light nodes. From there, attributes let you specify a property to match. This is useful when you want to inspect one kind of scene element at a time rather than relying on a broad selection.

Start with the state you need to check

If your immediate question is whether a light is visible, try li.v. The v is the short name for visible, and the expression matches visible lights. To look for lights that are not visible, use not li.v. Similarly, li.h matches lights whose hidden attribute is true, while not li.h matches lights whose hidden attribute is false.

These attributes are related to display state, but they are separate queryable properties. If you are troubleshooting an unexpected scene, check the precise property relevant to your question rather than assuming that “hidden” and “not visible” are interchangeable. A useful habit is to run the corresponding queries separately and compare what each one finds.

Use the full name when a short form is easy to forget

Most of the listed light attributes have concise forms: hidden is h, name is n, selectionFlag is sf, visibilityFlag is vf, and visible is v. For example, the documented expression li.vf false checks the visibility flag when it is false.

One detail worth remembering: selected does not have a short name in the light attribute space. Use li.selected to match selected lights, or not li.selected to match lights that are not selected. The inherited node attribute would otherwise have the short name s, but the light reference specifically says it is not available here. Using the full attribute name avoids guessing and makes saved queries easier for collaborators to read.

Find a light by its name

Names are written as quoted strings. The reference gives li.n "A" and li.n "L*" as examples. This can be handy when a scene contains several lights and you need to focus on a particular name or naming pattern. Keep the quotes around the name expression, and use the li prefix so the query is scoped to lights.

A small troubleshooting routine

  1. Begin with li-scoped expressions so you are checking light nodes specifically.

  2. Check visibility with li.v and not li.v; check hidden state with li.h and not li.h.

  3. If selection is the issue, use li.selected rather than assuming the node short name s applies.

  4. If several lights are present, use the name attribute, such as li.n "A", to narrow your search.

This approach turns a vague question—“Where did that light go?”—into a set of specific checks. The expressions above are drawn from the light attribute reference; they do not require you to infer an undocumented meaning for a flag or combine conditions using syntax not shown there.

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.