diff options
author | kobewi <kobewi4e@gmail.com> | 2022-10-14 00:22:46 +0200 |
---|---|---|
committer | kobewi <kobewi4e@gmail.com> | 2022-10-14 00:22:46 +0200 |
commit | bee0b7e583b5472e6f5ee628ecb95793302a9349 (patch) | |
tree | f069a919bae9c868f8f97e9936efa17c5f2ac590 /editor | |
parent | 926429392a73a0c2261bc4ed4503c99025842d7c (diff) |
Redraw 2D viewport when scene changes
Diffstat (limited to 'editor')
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 9 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.h | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index c59781390a..fe33a91a41 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -5455,6 +5455,15 @@ void CanvasItemEditorPlugin::set_state(const Dictionary &p_state) { canvas_item_editor->set_state(p_state); } +void CanvasItemEditorPlugin::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + connect("scene_changed", callable_mp((CanvasItem *)canvas_item_editor->get_viewport_control(), &CanvasItem::queue_redraw).unbind(1)); + connect("scene_closed", callable_mp((CanvasItem *)canvas_item_editor->get_viewport_control(), &CanvasItem::queue_redraw).unbind(1)); + } break; + } +} + CanvasItemEditorPlugin::CanvasItemEditorPlugin() { canvas_item_editor = memnew(CanvasItemEditor); canvas_item_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index b731d3cc7d..3ade048e4b 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -563,6 +563,9 @@ class CanvasItemEditorPlugin : public EditorPlugin { CanvasItemEditor *canvas_item_editor = nullptr; +protected: + void _notification(int p_what); + public: virtual String get_name() const override { return "2D"; } bool has_main_screen() const override { return true; } |