Godot-cpp: How to trigger `_redraw` of `EditorNode3DGizmoPlugin`

Godot Version

4.2

Question

I’ve made an EditorNode3DGizmoPlugin in GDScript by following the tutorial in the official docs. This gizmo seems to be working great, but I don’t know how to trigger it to redraw using GDExtension and godot-cpp.

This gizmo operates on a Node3D type that I created using godot-cpp and GDExtension. This custom C++ node has internal data that changes from time to time. Whenever this data changes, a _redraw should be triggered on the gizmo that’s attached to it.

How do I go about triggering this redraw in C++ with godot-cpp?

1 Like

For anyone having this problem:
In a node 3D, there’s a method to call the gizmo redraw called update_gizmos. Simply call it at the end of a property setter method in order to update the gizmo when changing the values. Same thing for handles: set the value of your property via the property setter in the gizmos set_handle method and it will trigger the redraw after the value update.

I was stuck at that for a few days but going through Godot source code helped me a lot for that. Specifically the camera3d node, gizmo, and plugin classes. It’s the one that use the most features of gizmos, so they’re great references!