summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/editor/editor_node.cpp47
-rw-r--r--tools/editor/editor_node.h3
-rw-r--r--tools/editor/editor_plugin.cpp22
-rw-r--r--tools/editor/editor_plugin.h4
-rw-r--r--tools/editor/plugins/canvas_item_editor_plugin.cpp14
-rw-r--r--tools/editor/plugins/collision_polygon_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/collision_shape_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/light_occluder_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/navigation_polygon_editor_plugin.h2
-rw-r--r--tools/editor/plugins/path_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/polygon_2d_editor_plugin.h2
-rw-r--r--tools/editor/plugins/spatial_editor_plugin.cpp3
-rw-r--r--tools/editor/plugins/tile_map_editor_plugin.h2
13 files changed, 74 insertions, 33 deletions
diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp
index 56170e1489..9a81d287b2 100644
--- a/tools/editor/editor_node.cpp
+++ b/tools/editor/editor_node.cpp
@@ -6681,45 +6681,54 @@ EditorNode::~EditorNode() {
void EditorPluginList::make_visible(bool p_visible) {
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->make_visible(p_visible);
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->make_visible(p_visible);
}
+
}
void EditorPluginList::edit(Object* p_object) {
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- plugins_list[i]->edit(p_object);
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->edit(p_object);
}
+
}
-bool EditorPluginList::forward_input_event(const InputEvent& p_event) {
+bool EditorPluginList::forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) {
+
bool discard = false;
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- if (plugins_list[i]->forward_input_event(p_event)) {
- discard = true;
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ if (plugins_list[i]->forward_canvas_input_event(p_canvas_xform,p_event)) {
+ discard = true;
}
}
+
return discard;
}
bool EditorPluginList::forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event) {
bool discard = false;
- if (!plugins_list.empty()) {
- for (int i = 0; i < plugins_list.size(); i++) {
- if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) {
- discard = true;
- }
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ if (plugins_list[i]->forward_spatial_input_event(p_camera, p_event)) {
+ discard = true;
}
}
+
return discard;
}
+void EditorPluginList::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas) {
+
+ for (int i = 0; i < plugins_list.size(); i++) {
+ plugins_list[i]->forward_draw_over_canvas(p_canvas_xform,p_canvas);
+ }
+
+}
+
bool EditorPluginList::empty() {
return plugins_list.empty();
}
diff --git a/tools/editor/editor_node.h b/tools/editor/editor_node.h
index e6119cf577..147a0fd6ed 100644
--- a/tools/editor/editor_node.h
+++ b/tools/editor/editor_node.h
@@ -780,8 +780,9 @@ public:
void make_visible(bool p_visible);
void edit(Object *p_object);
- bool forward_input_event(const InputEvent& p_event);
+ bool forward_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event);
bool forward_spatial_input_event(Camera* p_camera, const InputEvent& p_event);
+ void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control* p_canvas);
void clear();
bool empty();
diff --git a/tools/editor/editor_plugin.cpp b/tools/editor/editor_plugin.cpp
index 752e961c87..0cfb9c083c 100644
--- a/tools/editor/editor_plugin.cpp
+++ b/tools/editor/editor_plugin.cpp
@@ -131,13 +131,25 @@ Ref<SpatialEditorGizmo> EditorPlugin::create_spatial_gizmo(Spatial* p_spatial) {
return Ref<SpatialEditorGizmo>();
}
-bool EditorPlugin::forward_input_event(const InputEvent& p_event) {
+bool EditorPlugin::forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) {
- if (get_script_instance() && get_script_instance()->has_method("forward_input_event")) {
- return get_script_instance()->call("forward_input_event",p_event);
+ if (get_script_instance() && get_script_instance()->has_method("forward_canvas_input_event")) {
+ return get_script_instance()->call("forward_canvas_input_event",p_canvas_xform,p_event);
}
return false;
}
+
+void EditorPlugin::forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas) {
+
+ if (get_script_instance() && get_script_instance()->has_method("forward_draw_over_canvas")) {
+ get_script_instance()->call("forward_draw_over_canvas",p_canvas_xform,p_canvas);
+ }
+}
+
+void EditorPlugin::update_canvas() {
+ CanvasItemEditor::get_singleton()->get_viewport_control()->update();
+}
+
bool EditorPlugin::forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event) {
if (get_script_instance() && get_script_instance()->has_method("forward_spatial_input_event")) {
@@ -327,6 +339,7 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_resource_previewer:EditorResourcePreview"),&EditorPlugin::get_resource_previewer);
ObjectTypeDB::bind_method(_MD("inspect_object","object","for_property"),&EditorPlugin::inspect_object,DEFVAL(String()));
+ ObjectTypeDB::bind_method(_MD("update_canvas"),&EditorPlugin::update_canvas);
ObjectTypeDB::bind_method(_MD("get_base_control:Control"),&EditorPlugin::get_base_control);
ObjectTypeDB::bind_method(_MD("get_undo_redo:UndoRedo"),&EditorPlugin::_get_undo_redo);
@@ -334,7 +347,8 @@ void EditorPlugin::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_editor_settings:EditorSettings"),&EditorPlugin::get_editor_settings);
ObjectTypeDB::bind_method(_MD("queue_save_layout"),&EditorPlugin::queue_save_layout);
- ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_input_event",PropertyInfo(Variant::INPUT_EVENT,"event")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_canvas_input_event",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::INPUT_EVENT,"event")));
+ ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo("forward_draw_over_canvas",PropertyInfo(Variant::MATRIX32,"canvas_xform"),PropertyInfo(Variant::OBJECT,"canvas:Control")));
ObjectTypeDB::add_virtual_method(get_type_static(),MethodInfo(Variant::BOOL,"forward_spatial_input_event",PropertyInfo(Variant::OBJECT,"camera",PROPERTY_HINT_RESOURCE_TYPE,"Camera"),PropertyInfo(Variant::INPUT_EVENT,"event")));
MethodInfo gizmo = MethodInfo(Variant::OBJECT,"create_spatial_gizmo",PropertyInfo(Variant::OBJECT,"for_spatial:Spatial"));
gizmo.return_val.hint=PROPERTY_HINT_RESOURCE_TYPE;
diff --git a/tools/editor/editor_plugin.h b/tools/editor/editor_plugin.h
index ed949c74f6..f73fb47cc8 100644
--- a/tools/editor/editor_plugin.h
+++ b/tools/editor/editor_plugin.h
@@ -101,7 +101,8 @@ public:
void remove_control_from_bottom_panel(Control *p_control);
virtual Ref<SpatialEditorGizmo> create_spatial_gizmo(Spatial* p_spatial);
- virtual bool forward_input_event(const InputEvent& p_event);
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform, const InputEvent& p_event);
+ virtual void forward_draw_over_canvas(const Matrix32& p_canvas_xform,Control *p_canvas);
virtual bool forward_spatial_input_event(Camera* p_camera,const InputEvent& p_event);
virtual String get_name() const;
virtual bool has_main_screen() const;
@@ -120,6 +121,7 @@ public:
virtual void get_window_layout(Ref<ConfigFile> p_layout);
virtual void edited_scene_changed(){} // if changes are pending in editor, apply them
+ void update_canvas();
virtual void inspect_object(Object *p_obj,const String& p_for_property=String());
diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp
index 3468f42a6c..b0e002ba44 100644
--- a/tools/editor/plugins/canvas_item_editor_plugin.cpp
+++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp
@@ -1058,7 +1058,7 @@ void CanvasItemEditor::_viewport_input_event(const InputEvent& p_event) {
EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
if (!over_plugin_list->empty()) {
- bool discard = over_plugin_list->forward_input_event(p_event);
+ bool discard = over_plugin_list->forward_input_event(transform,p_event);
if (discard) {
accept_event();
return;
@@ -2090,6 +2090,18 @@ void CanvasItemEditor::_viewport_draw() {
}
+ {
+
+ EditorNode *en = editor;
+ EditorPluginList *over_plugin_list = en->get_editor_plugins_over();
+
+ if (!over_plugin_list->empty()) {
+
+ over_plugin_list->forward_draw_over_canvas(transform,viewport);
+
+ }
+ }
+
if (skeleton_show_bones) {
int bone_width = EditorSettings::get_singleton()->get("2d_editor/bone_width");
Color bone_color1 = EditorSettings::get_singleton()->get("2d_editor/bone_color1");
diff --git a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
index 982ba35fe8..431d3651c1 100644
--- a/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
+++ b/tools/editor/plugins/collision_polygon_2d_editor_plugin.h
@@ -95,7 +95,7 @@ class CollisionPolygon2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "CollisionPolygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/collision_shape_2d_editor_plugin.h b/tools/editor/plugins/collision_shape_2d_editor_plugin.h
index 1ee81eda43..a8930dc0f2 100644
--- a/tools/editor/plugins/collision_shape_2d_editor_plugin.h
+++ b/tools/editor/plugins/collision_shape_2d_editor_plugin.h
@@ -86,7 +86,7 @@ class CollisionShape2DEditorPlugin : public EditorPlugin {
EditorNode* editor;
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_shape_2d_editor->forward_input_event(p_event); }
virtual String get_name() const { return "CollisionShape2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/light_occluder_2d_editor_plugin.h b/tools/editor/plugins/light_occluder_2d_editor_plugin.h
index b570fff506..0176eb87dd 100644
--- a/tools/editor/plugins/light_occluder_2d_editor_plugin.h
+++ b/tools/editor/plugins/light_occluder_2d_editor_plugin.h
@@ -99,7 +99,7 @@ class LightOccluder2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "LightOccluder2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/navigation_polygon_editor_plugin.h b/tools/editor/plugins/navigation_polygon_editor_plugin.h
index 503b4c2662..defdebbec2 100644
--- a/tools/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/tools/editor/plugins/navigation_polygon_editor_plugin.h
@@ -101,7 +101,7 @@ class NavigationPolygonEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "NavigationPolygonInstance"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/path_2d_editor_plugin.h b/tools/editor/plugins/path_2d_editor_plugin.h
index 973c17464e..acbc481e09 100644
--- a/tools/editor/plugins/path_2d_editor_plugin.h
+++ b/tools/editor/plugins/path_2d_editor_plugin.h
@@ -108,7 +108,7 @@ class Path2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return path2d_editor->forward_input_event(p_event); }
virtual String get_name() const { return "Path2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/polygon_2d_editor_plugin.h b/tools/editor/plugins/polygon_2d_editor_plugin.h
index d8b951ec44..33bae94340 100644
--- a/tools/editor/plugins/polygon_2d_editor_plugin.h
+++ b/tools/editor/plugins/polygon_2d_editor_plugin.h
@@ -151,7 +151,7 @@ class Polygon2DEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return collision_polygon_editor->forward_input_event(p_event); }
virtual String get_name() const { return "Polygon2D"; }
bool has_main_screen() const { return false; }
diff --git a/tools/editor/plugins/spatial_editor_plugin.cpp b/tools/editor/plugins/spatial_editor_plugin.cpp
index 41956747e1..8076a91a32 100644
--- a/tools/editor/plugins/spatial_editor_plugin.cpp
+++ b/tools/editor/plugins/spatial_editor_plugin.cpp
@@ -3469,6 +3469,8 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
if (!is_visible() || get_viewport()->gui_has_modal_stack())
return;
+#if 0
+//i don't remember this being used
{
EditorNode *en = editor;
@@ -3480,6 +3482,7 @@ void SpatialEditor::_unhandled_key_input(InputEvent p_event) {
}
}
+#endif
switch(p_event.type) {
diff --git a/tools/editor/plugins/tile_map_editor_plugin.h b/tools/editor/plugins/tile_map_editor_plugin.h
index 4b47dccd15..2f24002770 100644
--- a/tools/editor/plugins/tile_map_editor_plugin.h
+++ b/tools/editor/plugins/tile_map_editor_plugin.h
@@ -181,7 +181,7 @@ class TileMapEditorPlugin : public EditorPlugin {
public:
- virtual bool forward_input_event(const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); }
+ virtual bool forward_canvas_input_event(const Matrix32& p_canvas_xform,const InputEvent& p_event) { return tile_map_editor->forward_input_event(p_event); }
virtual String get_name() const { return "TileMap"; }
bool has_main_screen() const { return false; }