Page MenuHome

Shader Nodes: Declare nodes in their own namespace
ClosedPublic

Authored by Aaron Carlisle (Blendify) on Dec 5 2021, 10:26 PM.

Details

Summary

Follow up on rB1df8abff257030ba79bc23dc321f35494f4d91c5

This puts all static functions in geometry node files into a new
namespace. This allows using unity build which can improve
compile times significantly

  • The namespace name is derived from the file name. That makes it possible to write some tooling that checks the names later on. The filename extension (cc) is added to the namespace name as well. This also possibly simplifies tooling but also makes it more obvious that this namespace is specific to a file.
  • In the register function of every node, I added a namespace alias namespace file_ns = blender::nodes::node_shader_*_cc;. This avoids some duplication of the file name and may also simplify tooling, because this line is easy to detect. The name file_ns stands for "file namespace" and also indicates that this namespace corresponds to the current file.

In the future some nodes will be split up to separate files and given their own namespace
This will allow function names to be simplified similar to rBfab39440e94

Diff Detail

Repository
rB Blender

Event Timeline

Aaron Carlisle (Blendify) requested review of this revision.Dec 5 2021, 10:26 PM
Aaron Carlisle (Blendify) created this revision.
  • Merge branch 'master' into nodes-shader-namespace

This looks like a straightforward change with the file names as the namespace names, so I think this is good to go, assume you're watching out for compile errors on all platforms.

Thanks for your work here.

This revision is now accepted and ready to land.Dec 5 2021, 10:43 PM
  • Match file name, do not give namespace to each node when in the same file
  • Cleanup: Make format
Aaron Carlisle (Blendify) edited the summary of this revision. (Show Details)
  • Shader Nodes: Split each node into own file