diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-11-05 21:20:42 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-11-05 21:20:42 -0300 |
commit | 0dbedd18fc62f700e92a4cf581e505d849bc47ad (patch) | |
tree | 8f2c85b4d9227e441fd35ab4873009faa656bcba /scene/gui/control.cpp | |
parent | d14baf6e41bcdbe4968e0513beccc09dfb160ecd (diff) |
SceneMainLoop -> SceneTree
-=-=-=-=-=-=-=-=-=-=-=-=-=-
*YOUR SOURCE MIGHT NOT WORK*
For mor information on fix:
https://github.com/okamstudio/godot/wiki/devel_scene_tree
Other stuff:
-Shower of bullets demo
-Fixes all around
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r-- | scene/gui/control.cpp | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index fc24294a70..aea0aacf42 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -183,7 +183,7 @@ bool Control::_set(const StringName& p_name, const Variant& p_value) { void Control::_update_minimum_size() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; data.pending_min_size_update=false; @@ -341,7 +341,7 @@ void Control::_notification(int p_notification) { switch(p_notification) { - case NOTIFICATION_ENTER_SCENE: { + case NOTIFICATION_ENTER_TREE: { if (data.window==this) { @@ -365,7 +365,7 @@ void Control::_notification(int p_notification) { window->drag_attempted=false; window->drag_preview=NULL; - if (get_scene()->is_editor_hint()) { + if (get_tree()->is_editor_hint()) { Node *n = this; while(n) { @@ -385,7 +385,7 @@ void Control::_notification(int p_notification) { _size_changed(); } break; - case NOTIFICATION_EXIT_SCENE: { + case NOTIFICATION_EXIT_TREE: { if (data.window) { @@ -630,7 +630,7 @@ void Control::_notification(int p_notification) { } } break; - case SceneMainLoop::NOTIFICATION_WM_UNFOCUS_REQUEST: { + case SceneTree::NOTIFICATION_WM_UNFOCUS_REQUEST: { if (!window) return; @@ -710,7 +710,7 @@ void Control::drop_data(const Point2& p_point,const Variant& p_data){ void Control::force_drag(const Variant& p_data,Control *p_control) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); ERR_FAIL_COND(p_data.get_type()==Variant::NIL); @@ -728,8 +728,8 @@ void Control::set_drag_preview(Control *p_control) { ERR_FAIL_NULL(p_control); ERR_FAIL_COND( !((Object*)p_control)->cast_to<Control>()); - ERR_FAIL_COND(!is_inside_scene() || !data.window); - ERR_FAIL_COND(p_control->is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree() || !data.window); + ERR_FAIL_COND(p_control->is_inside_tree()); ERR_FAIL_COND(p_control->get_parent()!=NULL); if (data.window->window->drag_preview) { @@ -963,8 +963,8 @@ void Control::_window_input_event(InputEvent p_event) { if (top->data.modal_exclusive) { //cancel event, sorry, modal exclusive EATS UP ALL - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); return; // no one gets the event if exclusive NO ONE } @@ -1034,8 +1034,8 @@ void Control::_window_input_event(InputEvent p_event) { _window_call_input(window->mouse_focus,p_event); } - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); } else { @@ -1079,8 +1079,8 @@ void Control::_window_input_event(InputEvent p_event) { } - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); } } break; @@ -1147,7 +1147,7 @@ void Control::_window_input_event(InputEvent p_event) { window->mouse_over=over; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_tooltip"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_tooltip"); if (window->drag_preview) { window->drag_preview->set_pos(pos); @@ -1203,8 +1203,8 @@ void Control::_window_input_event(InputEvent p_event) { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); - get_scene()->set_input_as_handled(); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->set_input_as_handled(); if (window->drag_data.get_type()!=Variant::NIL && p_event.mouse_motion.button_mask&BUTTON_MASK_LEFT) { @@ -1230,7 +1230,7 @@ void Control::_window_input_event(InputEvent p_event) { if (window->key_event_accepted) { - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); break; } } @@ -1290,7 +1290,7 @@ void Control::_window_input_event(InputEvent p_event) { if (next) { next->grab_focus(); - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_cancel_input_ID",p_event.ID); } } @@ -1305,7 +1305,7 @@ Control *Control::get_window() const { bool Control::is_window() const { - return (is_inside_scene() && window); + return (is_inside_tree() && window); } @@ -1607,7 +1607,7 @@ bool Control::has_constant(const StringName& p_name,const StringName& p_type) co Size2 Control::get_parent_area_size() const { - ERR_FAIL_COND_V(!is_inside_scene(),Size2()); + ERR_FAIL_COND_V(!is_inside_tree(),Size2()); Size2 parent_size; @@ -1624,7 +1624,7 @@ Size2 Control::get_parent_area_size() const { void Control::_size_changed() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; Size2 parent_size = get_parent_area_size(); @@ -1677,7 +1677,7 @@ void Control::_size_changed() { float Control::_get_parent_range(int p_idx) const { - if (!is_inside_scene()) { + if (!is_inside_tree()) { return 1.0; @@ -1748,7 +1748,7 @@ float Control::_a2s(float p_val, AnchorType p_anchor,float p_range) const { void Control::set_anchor(Margin p_margin,AnchorType p_anchor) { - if (!is_inside_scene()) { + if (!is_inside_tree()) { data.anchor[p_margin]=p_anchor; } else { @@ -1980,7 +1980,7 @@ void Control::add_constant_override(const StringName& p_name, int p_constant) { void Control::set_focus_mode(FocusMode p_focus_mode) { - if (is_inside_scene() && p_focus_mode == FOCUS_NONE && data.focus_mode!=FOCUS_NONE && has_focus()) + if (is_inside_tree() && p_focus_mode == FOCUS_NONE && data.focus_mode!=FOCUS_NONE && has_focus()) release_focus(); data.focus_mode=p_focus_mode; @@ -2178,7 +2178,7 @@ bool Control::has_focus() const { void Control::grab_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); if (data.focus_mode==FOCUS_NONE) @@ -2188,7 +2188,7 @@ void Control::grab_focus() { if (data.window->window->key_focus && data.window->window->key_focus==this) return; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); data.window->window->key_focus=this; notification(NOTIFICATION_FOCUS_ENTER); #ifdef DEBUG_ENABLED @@ -2202,13 +2202,13 @@ void Control::grab_focus() { void Control::release_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.window); if (!has_focus()) return; - get_scene()->call_group(SceneMainLoop::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); + get_tree()->call_group(SceneTree::GROUP_CALL_REALTIME,"windows","_window_remove_focus"); //data.window->window->key_focus=this; //notification(NOTIFICATION_FOCUS_ENTER); update(); @@ -2217,12 +2217,12 @@ void Control::release_focus() { bool Control::is_toplevel_control() const { - return is_inside_scene() && (!data.parent_canvas_item && !window && is_set_as_toplevel()); + return is_inside_tree() && (!data.parent_canvas_item && !window && is_set_as_toplevel()); } void Control::show_modal(bool p_exclusive) { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); ERR_FAIL_COND(!data.SI && data.window!=this); ERR_FAIL_COND(!data.window); @@ -2282,7 +2282,7 @@ void Control::_modal_stack_remove() { if (!pfoc) return; - if (!pfoc->is_inside_scene() || !pfoc->is_visible()) + if (!pfoc->is_inside_tree() || !pfoc->is_visible()) return; pfoc->grab_focus(); } else { @@ -2332,13 +2332,13 @@ void Control::set_theme(const Ref<Theme>& p_theme) { void Control::_window_accept_event() { window->key_event_accepted=true; - if (is_inside_scene()) - get_scene()->set_input_as_handled(); + if (is_inside_tree()) + get_tree()->set_input_as_handled(); } void Control::accept_event() { - if (is_inside_scene() && get_window()) + if (is_inside_tree() && get_window()) get_window()->_window_accept_event(); } @@ -2585,7 +2585,7 @@ float Control::get_stretch_ratio() const { void Control::grab_click_focus() { - ERR_FAIL_COND(!is_inside_scene()); + ERR_FAIL_COND(!is_inside_tree()); if (data.window && data.window->window->mouse_focus) { @@ -2620,7 +2620,7 @@ void Control::grab_click_focus() { void Control::minimum_size_changed() { - if (!is_inside_scene()) + if (!is_inside_tree()) return; if (data.pending_min_size_update) @@ -2663,7 +2663,7 @@ bool Control::is_stopping_mouse() const { Control *Control::get_focus_owner() const { - ERR_FAIL_COND_V(!is_inside_scene(),NULL); + ERR_FAIL_COND_V(!is_inside_tree(),NULL); ERR_FAIL_COND_V(!window,NULL); return window->key_focus; } |