diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/canvas_item.cpp | 5 | ||||
-rw-r--r-- | scene/2d/canvas_item.h | 2 | ||||
-rw-r--r-- | scene/gui/dialogs.cpp | 12 | ||||
-rw-r--r-- | scene/gui/dialogs.h | 5 |
4 files changed, 20 insertions, 4 deletions
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp index 29a0cd5ba0..fa23e3fd39 100644 --- a/scene/2d/canvas_item.cpp +++ b/scene/2d/canvas_item.cpp @@ -360,6 +360,10 @@ bool CanvasItem::_edit_is_selected_on_click(const Point2 &p_point, double p_tole } } +Transform2D CanvasItem::_edit_get_transform() const { + return Transform2D(_edit_get_rotation(), _edit_get_position() + _edit_get_pivot()); +} + bool CanvasItem::is_visible_in_tree() const { if (!is_inside_tree()) @@ -1133,6 +1137,7 @@ void CanvasItem::_bind_methods() { ClassDB::bind_method(D_METHOD("_edit_set_pivot", "pivot"), &CanvasItem::_edit_set_pivot); ClassDB::bind_method(D_METHOD("_edit_get_pivot"), &CanvasItem::_edit_get_pivot); ClassDB::bind_method(D_METHOD("_edit_use_pivot"), &CanvasItem::_edit_use_pivot); + ClassDB::bind_method(D_METHOD("_edit_get_transform"), &CanvasItem::_edit_get_transform); ClassDB::bind_method(D_METHOD("get_canvas_item"), &CanvasItem::get_canvas_item); diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h index 581adf1396..e51ee601e2 100644 --- a/scene/2d/canvas_item.h +++ b/scene/2d/canvas_item.h @@ -281,6 +281,8 @@ public: virtual void _edit_set_pivot(const Point2 &p_pivot){}; virtual Point2 _edit_get_pivot() const { return Point2(); }; + virtual Transform2D _edit_get_transform() const; + /* VISIBILITY */ void set_visible(bool p_visible); diff --git a/scene/gui/dialogs.cpp b/scene/gui/dialogs.cpp index 062089d80b..19bac5e5ac 100644 --- a/scene/gui/dialogs.cpp +++ b/scene/gui/dialogs.cpp @@ -239,13 +239,15 @@ void WindowDialog::_notification(int p_what) { #ifdef TOOLS_ENABLED case NOTIFICATION_POST_POPUP: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) { + was_editor_dimmed = EditorNode::get_singleton()->is_editor_dimmed(); EditorNode::get_singleton()->dim_editor(true); + } } break; case NOTIFICATION_POPUP_HIDE: { - if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton() && !get_viewport()->gui_has_modal_stack()) - EditorNode::get_singleton()->dim_editor(false); + if (get_tree() && Engine::get_singleton()->is_editor_hint() && EditorNode::get_singleton()) + EditorNode::get_singleton()->dim_editor(was_editor_dimmed); } break; #endif } @@ -345,6 +347,10 @@ WindowDialog::WindowDialog() { close_button = memnew(TextureButton); add_child(close_button); close_button->connect("pressed", this, "_closed"); + +#ifdef TOOLS_ENABLED + was_editor_dimmed = false; +#endif } WindowDialog::~WindowDialog() { diff --git a/scene/gui/dialogs.h b/scene/gui/dialogs.h index afd1173f28..2eb0978e9b 100644 --- a/scene/gui/dialogs.h +++ b/scene/gui/dialogs.h @@ -59,6 +59,10 @@ class WindowDialog : public Popup { Point2 drag_offset_far; bool resizable; +#ifdef TOOLS_ENABLED + bool was_editor_dimmed; +#endif + void _gui_input(const Ref<InputEvent> &p_event); void _closed(); int _drag_hit_test(const Point2 &pos) const; @@ -106,7 +110,6 @@ class AcceptDialog : public WindowDialog { HBoxContainer *hbc; Label *label; Button *ok; - //Button *cancel; no more cancel (there is X on that titlebar) bool hide_on_ok; void _custom_action(const String &p_action); |