Find the Right Render Preset Without Querying the Wrong Nodes

When a molecular scene contains many kinds of nodes, a query that looks simple can still be difficult to interpret: are you matching a render preset, or some other node with a similar name or selection state? SAMSON’s Node Specification Language (NSL) provides a dedicated attribute space for render presets. Using it helps keep the question focused on the preset nodes themselves.

Start with the render-preset scope

The attribute space is renderPreset, with the short name rp. It matches only render preset nodes. That makes rp a useful prefix when your task is specifically about presets rather than nodes in general.

For example, to refer to a render preset by its name, use the name attribute or its short name, n:

  • rp.n "A"
  • rp.n "L*"

The values are strings in quotes. The examples show that a name can be written as a quoted string; if you are unsure what a particular name expression matches in your scene, test it against the names you intend to find rather than assuming a broader interpretation.

Keep two kinds of selection state distinct

Render presets inherit the selected and selectionFlag attributes from the general node attribute space. These names are easy to conflate, so it helps to treat them as separate query choices.

For the selected state, the render-preset form is rp.selected. You can also negate it with not rp.selected. Notably, the inherited selected attribute does not use the short name s in this attribute space. If you are adapting a query that uses a short name elsewhere, write out selected here to avoid relying on a shorthand that is not listed for render presets.

For the selection flag, use rp.sf or the full attribute name rp.selectionFlag. The reference examples include both rp.sf and rp.sf false. The first tests the flag without an explicit value; the second specifies false. The available values are true and false.

A practical way to build a query

  1. Decide what you are trying to locate. If the target is a render preset, begin with the rp attribute space.
  2. Choose one attribute at a time. Use rp.n for a name, rp.selected for selected state, or rp.sf for the selection flag.
  3. Check the spelling and value form. Names are quoted strings; Boolean values are true or false.
  4. Use the full name when shorthand could be unclear. selectionFlag can be written as sf, while selected has no short name in the render-preset attribute space.

This small distinction can save time when inspecting a scene: a query’s scope tells you which kind of node it addresses, while the attribute tells you what property you are testing. Keeping those choices explicit makes a query easier to read later, especially when you return to a project and need to remember whether you were matching a preset’s name, its selected state, or its selection flag.

For the complete attribute reference, see the render preset NSL documentation.

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

Comments are closed.