How about adding this as function to the scene class or scene_utils.cpp? I can see this being useful outside of this constraint.
Originally posted by @sjahr in #147 (comment)
It would be good to have these utilities, given they are used in several places in the code base, and could even have tests!