From 3f31925b180dd0bfd2601c20d7200b9b152b12ef Mon Sep 17 00:00:00 2001 From: Pedro J. Estébanez Date: Sun, 29 Oct 2017 20:32:09 +0100 Subject: Universalize draw-over API for EditorPlugins - Now it is usable from both `CanvasItem` and `Spatial` editors. - `EditorPlugin` API changes: - `forward_draw_over_canvas()` becomes `forward_draw_over_viewport()`. - `update_canvas()` becomes `update_overlays()`, which now triggers the update of every overlay on top of any 2D or 3D viewports present. Also now it returns the number of such viewports, which is useful whenever you need to know the number of draw-over calls you'll get. - New: `[set/is]_force_draw_over_forwarding_enabled()` to force overlaying regardless it handles the current object type, in a similar fashion as `[set/is]_input_event_forwarding_always_enabled`. This kind of overlay is also on top of those for regular handled node types. - New: `forward_force_draw_over_canvas()`, which is the callback that gets called for plugins that enable forced overlaying. --- editor/editor_plugin.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'editor/editor_plugin.h') diff --git a/editor/editor_plugin.h b/editor/editor_plugin.h index 1d68eee11..11f437866 100644 --- a/editor/editor_plugin.h +++ b/editor/editor_plugin.h @@ -102,6 +102,7 @@ class EditorPlugin : public Node { UndoRedo *_get_undo_redo() { return undo_redo; } bool input_event_forwarding_always_enabled; + bool force_draw_over_forwarding_enabled; String last_main_screen_name; @@ -151,13 +152,17 @@ public: void set_input_event_forwarding_always_enabled(); bool is_input_event_forwarding_always_enabled() { return input_event_forwarding_always_enabled; } + void set_force_draw_over_forwarding_enabled(); + bool is_force_draw_over_forwarding_enabled() { return force_draw_over_forwarding_enabled; } + void notify_main_screen_changed(const String &screen_name); void notify_scene_changed(const Node *scn_root); void notify_scene_closed(const String &scene_filepath); virtual Ref create_spatial_gizmo(Spatial *p_spatial); virtual bool forward_canvas_gui_input(const Ref &p_event); - virtual void forward_draw_over_canvas(Control *p_canvas); + virtual void forward_draw_over_viewport(Control *p_overlay); + virtual void forward_force_draw_over_viewport(Control *p_overlay); virtual bool forward_spatial_gui_input(Camera *p_camera, const Ref &p_event); virtual String get_name() const; virtual bool has_main_screen() const; @@ -178,7 +183,7 @@ public: EditorInterface *get_editor_interface(); - void update_canvas(); + int update_overlays() const; void queue_save_layout() const; -- cgit v1.2.3-70-g09d2