When a molecular scene contains several animations, finding the right one can be a small but persistent source of friction. A broad search may also match other kinds of nodes, while a name-based search alone may not help if you are trying to distinguish animations by their visibility or selection state. SAMSON’s Node Specification Language (NSL) provides an animation attribute space for writing criteria that match animation nodes specifically.
Start with the animation namespace
The full attribute-space name is animation; its short name is an. The examples below use the short form, which keeps expressions compact:
an.n "A"uses the animation’snameattribute.an.vchecks thevisibleattribute.an.hchecks thehiddenattribute.
The namespace matters: an expression beginning with an is scoped to animation nodes, rather than being a general search over every node in the molecular scene. That makes it a useful starting point when the task is specifically about animations.
Use names and states for different questions
A name criterion is useful when you know what an animation is called. For example, an.n "A" is the documented form for matching a quoted name. The reference also shows an.n "L*"; consult the NSL examples if you need to understand the matching behavior of a particular name expression rather than assume it works like a particular programming language’s pattern syntax.
State attributes answer a different question. The documented expressions an.v and not an.v let you express the positive and negative forms of the visibility test. Similarly, an.h and not an.h express the two forms of the hidden test. These expressions are criteria to use in NSL; they should not be mistaken for instructions that change an animation’s state.
One practical habit is to begin with the narrowest criterion you know. If the animation has a recognizable name, start with its name attribute. If you are investigating visibility, use the visibility attribute explicitly. This keeps the question clear: are you trying to identify an animation by its name, or check a particular property?
Keep similar attributes distinct
The animation reference lists visible and hidden as separate attributes, and also lists selected, selectionFlag, and visibilityFlag. They are not interchangeable names in the reference. For example, an.selected tests selected, while an.sf refers to selectionFlag, and an.vf refers to visibilityFlag. If you are building a query, use the attribute that matches the question you actually mean to ask.
There is also a small shorthand detail worth remembering: the animation reference gives hidden the short name h, name the short name n, selectionFlag the short name sf, visibilityFlag the short name vf, and visible the short name v. Although selected is available as an.selected, this attribute has no short name in the animation attribute space. Using the full name avoids guessing.
A quick check before using a query
- Does the expression start with
anoranimation? - Are you checking a name, visibility, hidden state, selection, or a flag?
- For a negative test, have you used the documented
notform, such asnot an.v? - Are quoted strings used for name criteria?
These checks help make an expression easier to read and reduce confusion between similarly named attributes. For the complete attribute table and inherited attribute details, learn more in the animation attributes reference.
Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.
