Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show tooltips normally when the scene tree is paused #29365

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions scene/main/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void Node::_notification(int p_notification) {
} break;
case NOTIFICATION_ENTER_TREE: {

if (data.pause_mode == PAUSE_MODE_INHERIT) {
if (data.pause_mode == PAUSE_MODE_INHERIT || data.pause_mode == PAUSE_MODE_SELF_PROCESS) {

if (data.parent)
data.pause_owner = data.parent->data.pause_owner;
Expand Down Expand Up @@ -448,7 +448,7 @@ void Node::set_pause_mode(PauseMode p_mode) {

Node *owner = NULL;

if (data.pause_mode == PAUSE_MODE_INHERIT) {
if (data.pause_mode == PAUSE_MODE_INHERIT || data.pause_mode == PAUSE_MODE_SELF_PROCESS) {

if (data.parent)
owner = data.parent->data.pause_owner;
Expand All @@ -466,7 +466,7 @@ Node::PauseMode Node::get_pause_mode() const {

void Node::_propagate_pause_owner(Node *p_owner) {

if (this != p_owner && data.pause_mode != PAUSE_MODE_INHERIT)
if (this != p_owner && data.pause_mode != PAUSE_MODE_INHERIT && data.pause_mode != PAUSE_MODE_SELF_PROCESS)
return;
data.pause_owner = p_owner;
for (int i = 0; i < data.children.size(); i++) {
Expand Down Expand Up @@ -763,6 +763,8 @@ bool Node::can_process() const {
return false;
if (data.pause_mode == PAUSE_MODE_PROCESS)
return true;
if (data.pause_mode == PAUSE_MODE_SELF_PROCESS)
return true;
if (data.pause_mode == PAUSE_MODE_INHERIT) {

if (!data.pause_owner)
Expand All @@ -773,6 +775,8 @@ bool Node::can_process() const {

if (data.pause_owner->data.pause_mode == PAUSE_MODE_STOP)
return false;

ERR_FAIL_V(false);
}
}

Expand Down Expand Up @@ -2872,6 +2876,7 @@ void Node::_bind_methods() {
BIND_ENUM_CONSTANT(PAUSE_MODE_INHERIT);
BIND_ENUM_CONSTANT(PAUSE_MODE_STOP);
BIND_ENUM_CONSTANT(PAUSE_MODE_PROCESS);
BIND_ENUM_CONSTANT(PAUSE_MODE_SELF_PROCESS);

BIND_ENUM_CONSTANT(DUPLICATE_SIGNALS);
BIND_ENUM_CONSTANT(DUPLICATE_GROUPS);
Expand All @@ -2889,7 +2894,7 @@ void Node::_bind_methods() {
//ADD_PROPERTY( PropertyInfo( Variant::BOOL, "process/input" ), "set_process_input","is_processing_input" ) ;
//ADD_PROPERTY( PropertyInfo( Variant::BOOL, "process/unhandled_input" ), "set_process_unhandled_input","is_processing_unhandled_input" ) ;
ADD_GROUP("Pause", "pause_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "pause_mode", PROPERTY_HINT_ENUM, "Inherit,Stop,Process"), "set_pause_mode", "get_pause_mode");
ADD_PROPERTY(PropertyInfo(Variant::INT, "pause_mode", PROPERTY_HINT_ENUM, "Inherit,Stop,Process,Self Process"), "set_pause_mode", "get_pause_mode");

#ifdef ENABLE_DEPRECATED
//no longer exists, but remains for compatibility (keep previous scenes folded
Expand Down
3 changes: 2 additions & 1 deletion scene/main/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class Node : public Object {

PAUSE_MODE_INHERIT,
PAUSE_MODE_STOP,
PAUSE_MODE_PROCESS
PAUSE_MODE_PROCESS,
PAUSE_MODE_SELF_PROCESS,
};

enum DuplicateFlags {
Expand Down
1 change: 1 addition & 0 deletions scene/main/scene_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1998,6 +1998,7 @@ SceneTree::SceneTree() {
//create with mainloop

root = memnew(Viewport);
root->set_pause_mode(Node::PAUSE_MODE_SELF_PROCESS);
root->set_name("root");
root->set_handle_input_locally(false);
if (!root->get_world().is_valid())
Expand Down
4 changes: 4 additions & 0 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@ void Viewport::_notification(int p_what) {
} break;
case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: {

if (get_tree()->is_paused()) {
break;
}

if (get_tree()->is_debugging_collisions_hint() && contact_2d_debug.is_valid()) {

VisualServer::get_singleton()->canvas_item_clear(contact_2d_debug);
Expand Down