diff options
-rw-r--r-- | .mailmap | 3 | ||||
-rw-r--r-- | SConstruct | 7 | ||||
-rw-r--r-- | methods.py | 30 | ||||
-rw-r--r-- | scene/gui/viewport_container.cpp | 28 | ||||
-rw-r--r-- | scene/gui/viewport_container.h | 1 |
5 files changed, 57 insertions, 12 deletions
@@ -8,6 +8,9 @@ Bastiaan Olij <mux213@gmail.com> Bernhard Liebl <poke1024@gmx.de> Bernhard Liebl <poke1024@gmx.org> Geequlim <geequlim@gmail.com> +Hugo Locurcio <hugo.locurcio@hugo.pro> +Hugo Locurcio <hugo.locurcio@hugo.pro> <hugo.l@openmailbox.org> +Hugo Locurcio <hugo.locurcio@hugo.pro> <Calinou@users.noreply.github.com> Ignacio Etcheverry <ignalfonsore@gmail.com> Indah Sylvia <ISylvox@yahoo.com> Jakub Grzesik <kubecz3k@gmail.com> diff --git a/SConstruct b/SConstruct index 7e82e582d0..dcf8134c93 100644 --- a/SConstruct +++ b/SConstruct @@ -498,7 +498,12 @@ node_count_interval = 1 node_pruning = 8 # Number of nodes to process before prunning the cache if ('env' in locals()): node_count_fname = str(env.Dir('#')) + '/.scons_node_count' -show_progress = env['progress'] +# Progress reporting is not available in non-TTY environments since it +# messes with the output (for example, when writing to a file) +if sys.stdout.isatty(): + show_progress = env['progress'] +else: + show_progress = False import time, math diff --git a/methods.py b/methods.py index fbdac8a966..3ffe8cb310 100644 --- a/methods.py +++ b/methods.py @@ -1549,18 +1549,26 @@ def save_active_platforms(apnames, ap): def no_verbose(sys, env): - # If the output is not a terminal, do nothing - if not sys.stdout.isatty(): - return - colors = {} - colors['cyan'] = '\033[96m' - colors['purple'] = '\033[95m' - colors['blue'] = '\033[94m' - colors['green'] = '\033[92m' - colors['yellow'] = '\033[93m' - colors['red'] = '\033[91m' - colors['end'] = '\033[0m' + + # Colors are disabled in non-TTY environments such as pipes. This means + # that if output is redirected to a file, it will not contain color codes + if sys.stdout.isatty(): + colors['cyan'] = '\033[96m' + colors['purple'] = '\033[95m' + colors['blue'] = '\033[94m' + colors['green'] = '\033[92m' + colors['yellow'] = '\033[93m' + colors['red'] = '\033[91m' + colors['end'] = '\033[0m' + else: + colors['cyan'] = '' + colors['purple'] = '' + colors['blue'] = '' + colors['green'] = '' + colors['yellow'] = '' + colors['red'] = '' + colors['end'] = '' compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) java_compile_source_message = '%sCompiling %s==> %s$SOURCE%s' % (colors['blue'], colors['purple'], colors['yellow'], colors['end']) diff --git a/scene/gui/viewport_container.cpp b/scene/gui/viewport_container.cpp index af849589cf..ac5e6020eb 100644 --- a/scene/gui/viewport_container.cpp +++ b/scene/gui/viewport_container.cpp @@ -30,6 +30,7 @@ #include "viewport_container.h" +#include "core/engine.h" #include "scene/main/viewport.h" Size2 ViewportContainer::get_minimum_size() const { @@ -139,8 +140,34 @@ void ViewportContainer::_notification(int p_what) { } } +void ViewportContainer::_input(const Ref<InputEvent> &p_event) { + + if (Engine::get_singleton()->is_editor_hint()) + return; + + Transform2D xform = get_global_transform(); + + if (stretch) { + Transform2D scale_xf; + scale_xf.scale(Vector2(shrink, shrink)); + xform *= scale_xf; + } + + Ref<InputEvent> ev = p_event->xformed_by(xform.affine_inverse()); + + for (int i = 0; i < get_child_count(); i++) { + + Viewport *c = Object::cast_to<Viewport>(get_child(i)); + if (!c || c->is_input_disabled()) + continue; + + c->input(ev); + } +} + void ViewportContainer::_bind_methods() { + ClassDB::bind_method(D_METHOD("_input", "event"), &ViewportContainer::_input); ClassDB::bind_method(D_METHOD("set_stretch", "enable"), &ViewportContainer::set_stretch); ClassDB::bind_method(D_METHOD("is_stretch_enabled"), &ViewportContainer::is_stretch_enabled); @@ -155,4 +182,5 @@ ViewportContainer::ViewportContainer() { stretch = false; shrink = 1; + set_process_input(true); } diff --git a/scene/gui/viewport_container.h b/scene/gui/viewport_container.h index cd8b4dd5c1..45c4cd03a1 100644 --- a/scene/gui/viewport_container.h +++ b/scene/gui/viewport_container.h @@ -48,6 +48,7 @@ public: void set_stretch(bool p_enable); bool is_stretch_enabled() const; + void _input(const Ref<InputEvent> &p_event); void set_stretch_shrink(int p_shrink); int get_stretch_shrink() const; |