Debian Codegraph @

editor/plugins/editor_plugin_list.cpp

raw symbols SCIP
1 /**************************************************************************/
2 /* editor_plugin_list.cpp */
3 /**************************************************************************/
4 /* This file is part of: */
5 /* GODOT ENGINE */
6 /* https://godotengine.org */
7 /**************************************************************************/
8 /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9 /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10 /* */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the */
13 /* "Software"), to deal in the Software without restriction, including */
14 /* without limitation the rights to use, copy, modify, merge, publish, */
15 /* distribute, sublicense, and/or sell copies of the Software, and to */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions: */
18 /* */
19 /* The above copyright notice and this permission notice shall be */
20 /* included in all copies or substantial portions of the Software. */
21 /* */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29 /**************************************************************************/
30
31 #include "editor_plugin_list.h"
32
33 bool EditorPluginList::forward_gui_input(const Ref<InputEvent> &p_event) const {
34 bool discard = false;
35
36 for (EditorPlugin *plugin : plugins_list) {
37 if (plugin->forward_canvas_gui_input(p_event)) {
38 discard = true;
39 }
40 }
41
42 return discard;
43 }
44
45 EditorPlugin::AfterGUIInput EditorPluginList::forward_3d_gui_input(Camera3D *p_camera, const Ref<InputEvent> &p_event, bool p_serve_when_force_input_enabled) const {
46 EditorPlugin::AfterGUIInput after = EditorPlugin::AFTER_GUI_INPUT_PASS;
47
48 for (EditorPlugin *plugin : plugins_list) {
49 if (!p_serve_when_force_input_enabled && plugin->is_input_event_forwarding_always_enabled()) {
50 continue;
51 }
52
53 EditorPlugin::AfterGUIInput current_after = plugin->forward_3d_gui_input(p_camera, p_event);
54 if (current_after == EditorPlugin::AFTER_GUI_INPUT_STOP) {
55 after = EditorPlugin::AFTER_GUI_INPUT_STOP;
56 }
57 if (after != EditorPlugin::AFTER_GUI_INPUT_STOP && current_after == EditorPlugin::AFTER_GUI_INPUT_CUSTOM) {
58 after = EditorPlugin::AFTER_GUI_INPUT_CUSTOM;
59 }
60 }
61
62 return after;
63 }
64
65 void EditorPluginList::forward_canvas_draw_over_viewport(Control *p_overlay) const {
66 for (EditorPlugin *plugin : plugins_list) {
67 plugin->forward_canvas_draw_over_viewport(p_overlay);
68 }
69 }
70
71 void EditorPluginList::forward_canvas_force_draw_over_viewport(Control *p_overlay) const {
72 for (EditorPlugin *plugin : plugins_list) {
73 plugin->forward_canvas_force_draw_over_viewport(p_overlay);
74 }
75 }
76
77 void EditorPluginList::forward_3d_draw_over_viewport(Control *p_overlay) const {
78 for (EditorPlugin *plugin : plugins_list) {
79 plugin->forward_3d_draw_over_viewport(p_overlay);
80 }
81 }
82
83 void EditorPluginList::forward_3d_force_draw_over_viewport(Control *p_overlay) const {
84 for (EditorPlugin *plugin : plugins_list) {
85 plugin->forward_3d_force_draw_over_viewport(p_overlay);
86 }
87 }
88
89 void EditorPluginList::add_plugin(EditorPlugin *p_plugin) {
90 ERR_FAIL_COND(plugins_list.has(p_plugin));
91 plugins_list.push_back(p_plugin);
92 }
93
94 void EditorPluginList::remove_plugin(EditorPlugin *p_plugin) {
95 plugins_list.erase(p_plugin);
96 }