Page MenuHome

Cleanup: Add macro and functions for node storage
ClosedPublic

Authored by Hans Goudey (HooglyBoogly) on Dec 6 2021, 8:17 PM.

Details

Summary

The node_storage functions to retrieve const and mutable structs
from a node are generated by a short macro that can be placed at the top
of each relevant file. I use this in D8286 to make code snippets in the
socket declarations much shorter, but I thought it would be good to
use it consistently everywhere else too.

I also changed some casting to avoid line wrapping, and used storage
consistently for node storage variable names.

Diff Detail

Repository
rB Blender
Branch
cleanup-node-storage-funcs (branched from master)
Build Status
Buildable 19244
Build 19244: arc lint + arc unit

Event Timeline

Hans Goudey (HooglyBoogly) requested review of this revision.Dec 6 2021, 8:17 PM
Hans Goudey (HooglyBoogly) created this revision.

The commit message should also mention that this can avoid copy paste errors (like the one you found for the cylinder node)

source/blender/blenkernel/BKE_node.h
1583

have you tested this on the buildbot just to make sure it works everywhere?

This revision is now accepted and ready to land.Dec 7 2021, 12:06 AM
  • Merge branch 'master' into cleanup-node-storage-funcs

Builds passed here: https://builder.blender.org/admin/#/builders/18/builds/205

(They only didn't because of the revert of the C++ conversions moving the blender::nodes namespace.

source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
24

any reason why you can't put this into the namespace?

source/blender/nodes/shader/nodes/node_shader_tex_noise.cc
24

The rest of the file isn't in the blender::nodes namespace now. That could be changed, I kept this change simpler though.