diff options
Diffstat (limited to 'scene/2d/visibility_notifier_2d.cpp')
-rw-r--r-- | scene/2d/visibility_notifier_2d.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/scene/2d/visibility_notifier_2d.cpp b/scene/2d/visibility_notifier_2d.cpp index abaaf3262a..dc72c9a267 100644 --- a/scene/2d/visibility_notifier_2d.cpp +++ b/scene/2d/visibility_notifier_2d.cpp @@ -5,7 +5,7 @@ /* GODOT ENGINE */ /* http://www.godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -155,6 +155,11 @@ void VisibilityEnabler2D::_screen_enter() { _change_node_state(E->key(),true); } + if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) + get_parent()->set_fixed_process(true); + if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) + get_parent()->set_process(true); + visible=true; } @@ -165,6 +170,11 @@ void VisibilityEnabler2D::_screen_exit(){ _change_node_state(E->key(),false); } + if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) + get_parent()->set_fixed_process(false); + if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) + get_parent()->set_process(false); + visible=false; } @@ -235,6 +245,12 @@ void VisibilityEnabler2D::_notification(int p_what){ _find_nodes(from); + if (enabler[ENABLER_PARENT_FIXED_PROCESS] && get_parent()) + get_parent()->set_fixed_process(false); + if (enabler[ENABLER_PARENT_PROCESS] && get_parent()) + get_parent()->set_process(false); + + } if (p_what==NOTIFICATION_EXIT_TREE) { @@ -317,10 +333,14 @@ void VisibilityEnabler2D::_bind_methods(){ ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_animations"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_ANIMATIONS ); ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/freeze_bodies"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_FREEZE_BODIES); ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/pause_particles"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PAUSE_PARTICLES); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_PROCESS); + ADD_PROPERTYI( PropertyInfo(Variant::BOOL,"enabler/fixed_process_parent"),_SCS("set_enabler"),_SCS("is_enabler_enabled"), ENABLER_PARENT_FIXED_PROCESS); BIND_CONSTANT( ENABLER_FREEZE_BODIES ); BIND_CONSTANT( ENABLER_PAUSE_ANIMATIONS ); BIND_CONSTANT( ENABLER_PAUSE_PARTICLES ); + BIND_CONSTANT( ENABLER_PARENT_PROCESS ); + BIND_CONSTANT( ENABLER_PARENT_FIXED_PROCESS ); BIND_CONSTANT( ENABLER_MAX); } @@ -341,6 +361,8 @@ VisibilityEnabler2D::VisibilityEnabler2D() { for(int i=0;i<ENABLER_MAX;i++) enabler[i]=true; + enabler[ENABLER_PARENT_PROCESS]=false; + enabler[ENABLER_PARENT_FIXED_PROCESS]=false; visible=false; |