This leads to much simpler error checking. Add casts so the inlined code can be called from the editor's C++ code.