Skip to content

Node Design Guidelines

John Haddon edited this page Nov 26, 2019 · 2 revisions

Node Names

  • Where sensible, prefer "nouny" names. Example : Sphere, not CreateSphere.
  • Avoid "contrived nouniness". Example : not AttributeDeleter.
  • Where a name contains a verb, use VerbSubject order. Example : DeleteAttributes, not AttributesDelete.
  • Prefer shorter names. Where several modules have a claim on a name, use the short name for the predominant claim. Example : Transform and ImageTransform.

ArrayPlugs vs individual inputs

Both SceneProcessor and ImageProcessor nodes can be constructed with either a single in plug, or an array of in[0], in[1] etc.

  • Use ArrayPlugs where multiple inputs are required, and they all serve a similar purpose. Examples : Merge, Mix, Group.
  • Avoid arrays when each input serves different purposes. In this case, add additional children with a descriptive name instead. Examples : the source plug of a CopyAttributes node, the prototypes plug of an Instancer node.

Ordering of ComputeNode methods

  • Declare methods in this order : affects(), hash() and then compute(). This matches the order they will be called in during operation.
  • In cpp files, place the corresponding compute*() method immediately underneath the appropriate hash*() method. This makes it easier to verify that the hash has the appropriate content for the compute.