Find the Light, Not the Noise: A Practical Guide to Light Queries in SAMSON

When a molecular scene gets crowded, it is easy to lose track of the non-molecular elements that help make it readable. Lights are one example: you may want to locate them, check their visibility, or distinguish them by name without accidentally matching other kinds of nodes. SAMSON’s Node Specification Language (NSL) provides a compact way to express those queries.

This guide focuses on a small, useful part of NSL: the light attribute space. Its short name is li, and it matches only light nodes. That first detail is important. Starting a query with li makes your intent explicit: you are looking for lights, rather than relying on a general node query and then sorting out the results afterward.

Start with the question you want to answer

Before writing an expression, translate the task into a simple question. Are you looking for lights that are hidden? Lights that are visible? A light with a particular name? Or lights that are not selected? These are different checks, and the light attribute space provides attributes for each.

For example, the documented expression li.h uses the short name h for hidden. Its negated form, not li.h, expresses the opposite condition. Similarly, li.v checks the visible attribute, while not li.v selects lights for which that condition is false.

Using these as separate checks helps keep the question precise. “Hidden” and “visible” are both available attributes; do not assume that one expression is simply a substitute for the other. If the distinction matters to your task, query the attribute that directly describes what you want to inspect.

Use names when the scene has several lights

When a scene contains multiple lights, a name-based query can make a broad search more specific. The name attribute has the short name n, and the reference gives examples such as li.n "A" and li.n "L*". The quoted text is part of the expression, so keep the quotation marks when writing a name query.

These examples are useful starting points when you need to focus on lights identified by name. If you are unsure what a scene’s lights are called, first inspect or search using the naming conventions in your own model. A readable naming scheme makes later queries easier to understand—and makes it easier for collaborators to recognize what a query is intended to find.

Keep selection checks explicit

NSL also exposes selected and selectionFlag. For lights, the reference shows li.selected and not li.selected, as well as li.sf and li.sf false. One small detail can prevent a frustrating syntax detour: selected does not have the short name s in the light attribute space. Use the full form, such as li.selected, rather than assuming the abbreviation available elsewhere applies here.

The page identifies these attributes as inherited from the general node attribute space. If you need their full definitions, consult the node reference rather than guessing from their names. The same applies to hidden, name, visibilityFlag, and visible: the light page lists them as inherited attributes.

A small checklist for writing a light query

  • Begin with li. This limits the query to light nodes.
  • Choose the attribute that matches your question. For example, use h for hidden or v for visible.
  • Use not when you want the opposite condition. The reference includes examples such as not li.h and not li.v.
  • Keep names in quotes. The documented name examples use quoted strings.
  • Do not assume every attribute has a short form. In particular, selected is shown without the short name s for lights.

The practical benefit is clarity: a query can state both the node type and the property you care about. That makes it easier to revisit your work later, especially when a scene has many objects and you need to check a specific class of elements without manually scanning the whole structure.

For the complete list of light attributes and their documented examples, see the SAMSON light attributes reference.

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

Comments are closed.