summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/node.cpp14
-rw-r--r--scene/main/node.h3
-rw-r--r--scene/main/viewport.cpp33
-rw-r--r--scene/main/viewport.h1
4 files changed, 38 insertions, 13 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 11b400d4a9..bea6e75aef 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2085,6 +2085,15 @@ bool Node::is_owned_by_parent() const {
return data.parent_owned;
}
+void Node::set_display_folded(bool p_folded) {
+ data.display_folded=p_folded;
+}
+
+bool Node::is_displayed_folded() const {
+
+ return data.display_folded;
+}
+
void Node::_bind_methods() {
ObjectTypeDB::bind_method(_MD("_add_child_below_node","node:Node","child_node:Node","legible_unique_name"),&Node::add_child_below_node,DEFVAL(false));
@@ -2140,6 +2149,8 @@ void Node::_bind_methods() {
ObjectTypeDB::bind_method(_MD("can_process"),&Node::can_process);
ObjectTypeDB::bind_method(_MD("print_stray_nodes"),&Node::_print_stray_nodes);
ObjectTypeDB::bind_method(_MD("get_position_in_parent"),&Node::get_position_in_parent);
+ ObjectTypeDB::bind_method(_MD("set_display_folded","fold"),&Node::set_display_folded);
+ ObjectTypeDB::bind_method(_MD("is_displayed_folded"),&Node::is_displayed_folded);
ObjectTypeDB::bind_method(_MD("get_tree:SceneTree"),&Node::get_tree);
@@ -2194,6 +2205,7 @@ void Node::_bind_methods() {
//ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/input" ), _SCS("set_process_input"),_SCS("is_processing_input" ) );
//ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), _SCS("set_process_unhandled_input"),_SCS("is_processing_unhandled_input" ) );
ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "process/pause_mode",PROPERTY_HINT_ENUM,"Inherit,Stop,Process" ), _SCS("set_pause_mode"),_SCS("get_pause_mode" ) );
+ ADD_PROPERTYNZ( PropertyInfo( Variant::BOOL, "editor/display_folded",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR ), _SCS("set_display_folded"),_SCS("is_displayed_folded" ) );
BIND_VMETHOD( MethodInfo("_process",PropertyInfo(Variant::REAL,"delta")) );
BIND_VMETHOD( MethodInfo("_fixed_process",PropertyInfo(Variant::REAL,"delta")) );
@@ -2231,6 +2243,7 @@ Node::Node() {
data.in_constructor=true;
data.viewport=NULL;
data.use_placeholder=false;
+ data.display_folded=false;
}
Node::~Node() {
@@ -2240,6 +2253,7 @@ Node::~Node() {
data.owned.clear();
data.children.clear();
+
ERR_FAIL_COND(data.parent);
ERR_FAIL_COND(data.children.size());
diff --git a/scene/main/node.h b/scene/main/node.h
index 88334f32f0..dcc3829d15 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -111,6 +111,7 @@ private:
bool in_constructor;
bool use_placeholder;
+ bool display_folded;
} data;
@@ -325,6 +326,8 @@ public:
void update_configuration_warning();
+ void set_display_folded(bool p_folded);
+ bool is_displayed_folded() const;
/* CANVAS */
Node();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 3c52af1c1e..68f5a252e5 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -1331,11 +1331,11 @@ Matrix32 Viewport::_get_input_pre_xform() const {
Matrix32 pre_xf;
if (render_target) {
- ERR_FAIL_COND_V(to_screen_rect.size.x==0,pre_xf);
- ERR_FAIL_COND_V(to_screen_rect.size.y==0,pre_xf);
+ if (to_screen_rect!=Rect2()) {
- pre_xf.elements[2]=-to_screen_rect.pos;
- pre_xf.scale(rect.size/to_screen_rect.size);
+ pre_xf.elements[2]=-to_screen_rect.pos;
+ pre_xf.scale(rect.size/to_screen_rect.size);
+ }
} else {
pre_xf.elements[2]=-rect.pos;
@@ -1575,35 +1575,38 @@ void Viewport::_gui_call_input(Control *p_control,const InputEvent& p_input) {
// _block();
+ InputEvent ev = p_input;
+
//mouse wheel events can't be stopped
- bool cant_stop_me_now = (p_input.type==InputEvent::MOUSE_BUTTON &&
- (p_input.mouse_button.button_index==BUTTON_WHEEL_DOWN ||
- p_input.mouse_button.button_index==BUTTON_WHEEL_UP ||
- p_input.mouse_button.button_index==BUTTON_WHEEL_LEFT ||
- p_input.mouse_button.button_index==BUTTON_WHEEL_RIGHT ) );
+ bool cant_stop_me_now = (ev.type==InputEvent::MOUSE_BUTTON &&
+ (ev.mouse_button.button_index==BUTTON_WHEEL_DOWN ||
+ ev.mouse_button.button_index==BUTTON_WHEEL_UP ||
+ ev.mouse_button.button_index==BUTTON_WHEEL_LEFT ||
+ ev.mouse_button.button_index==BUTTON_WHEEL_RIGHT ) );
CanvasItem *ci=p_control;
while(ci) {
Control *control = ci->cast_to<Control>();
if (control) {
- control->call_multilevel(SceneStringNames::get_singleton()->_input_event,p_input);
+ control->call_multilevel(SceneStringNames::get_singleton()->_input_event,ev);
if (gui.key_event_accepted)
break;
if (!control->is_inside_tree())
break;
- control->emit_signal(SceneStringNames::get_singleton()->input_event,p_input);
+ control->emit_signal(SceneStringNames::get_singleton()->input_event,ev);
if (!control->is_inside_tree() || control->is_set_as_toplevel())
break;
if (gui.key_event_accepted)
break;
- if (!cant_stop_me_now && control->data.stop_mouse && (p_input.type==InputEvent::MOUSE_BUTTON || p_input.type==InputEvent::MOUSE_MOTION))
+ if (!cant_stop_me_now && control->data.stop_mouse && (ev.type==InputEvent::MOUSE_BUTTON || ev.type==InputEvent::MOUSE_MOTION))
break;
}
if (ci->is_set_as_toplevel())
break;
+ ev=ev.xform_by(ci->get_transform()); //transform event upwards
ci=ci->get_parent_item();
}
@@ -1749,8 +1752,9 @@ void Viewport::_gui_input_event(InputEvent p_event) {
Vector2 pos = top->get_global_transform_with_canvas().affine_inverse().xform(mpos);
if (!top->has_point(pos)) {
- if (top->data.modal_exclusive) {
+ if (top->data.modal_exclusive || top->data.modal_frame==OS::get_singleton()->get_frames_drawn()) {
//cancel event, sorry, modal exclusive EATS UP ALL
+ //alternative, you can't pop out a window the same frame it was made modal (fixes many issues)
//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
@@ -2498,6 +2502,9 @@ Variant Viewport::gui_get_drag_data() const {
return gui.drag_data;
}
+Control *Viewport::get_modal_stack_top() const {
+ return gui.modal_stack.size()?gui.modal_stack.back()->get():NULL;
+}
String Viewport::get_configuration_warning() const {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 545020dfc7..aaa640e0e6 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -374,6 +374,7 @@ public:
bool gui_has_modal_stack() const;
Variant gui_get_drag_data() const;
+ Control *get_modal_stack_top() const;
virtual String get_configuration_warning() const;