diff options
122 files changed, 413 insertions, 137 deletions
diff --git a/SConstruct b/SConstruct index 14aba28818..72de2e2004 100644 --- a/SConstruct +++ b/SConstruct @@ -1,3 +1,5 @@ +#!/usr/bin/env python + EnsureSConsVersion(0,14); @@ -63,6 +65,8 @@ elif (os.name=="nt"): custom_tools=['mingw'] env_base=Environment(tools=custom_tools); +if 'TERM' in os.environ: + env_base['ENV']['TERM'] = os.environ['TERM'] env_base.AppendENVPath('PATH', os.getenv('PATH')) env_base.AppendENVPath('PKG_CONFIG_PATH', os.getenv('PKG_CONFIG_PATH')) env_base.global_defaults=global_defaults @@ -132,15 +136,16 @@ opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builti opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin') opts.Add('enet','ENet library (system/builtin)','builtin') opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin') +opts.Add('xaudio2','XAudio2 audio driver (yes/no)','no') opts.Add("CXX", "C++ Compiler") opts.Add("CC", "C Compiler") -opts.Add("CCFLAGS", "Custom flags for the C++ compiler"); +opts.Add("CCFLAGS", "Custom flags for the C/C++ compiler"); opts.Add("CFLAGS", "Custom flags for the C compiler"); opts.Add("LINKFLAGS", "Custom flags for the linker"); opts.Add('unix_global_settings_path', 'unix-specific path to system-wide settings. Currently only used by templates.','') opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") -opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') +opts.Add('verbose', 'Enable verbose output for the compilation (yes/no)', 'yes') opts.Add('deprecated','Enable deprecated features (yes/no)','yes') opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '') opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no') @@ -259,6 +264,8 @@ if selected_platform in platform_list: sys.exit(255) suffix+=".opt" + env.Append(CCFLAGS=['-DNDEBUG']); + elif (env["target"]=="release_debug"): if (env["tools"]=="yes"): suffix+=".opt.tools" @@ -327,8 +334,8 @@ if selected_platform in platform_list: if (env['xml']=='yes'): env.Append(CPPFLAGS=['-DXML_ENABLED']) - if (env['colored']=='yes'): - methods.colored(sys,env) + if (env['verbose']=='no'): + methods.no_verbose(sys,env) Export('env') @@ -376,9 +383,9 @@ if selected_platform in platform_list: release_variants = ['release|Win32']+['release|x64'] release_debug_variants = ['release_debug|Win32']+['release_debug|x64'] variants = debug_variants + release_variants + release_debug_variants - debug_targets = ['Debug']+['Debug'] - release_targets = ['Release']+['Release'] - release_debug_targets = ['ReleaseDebug']+['ReleaseDebug'] + debug_targets = ['bin\\godot.windows.tools.32.exe']+['bin\\godot.windows.tools.64.exe'] + release_targets = ['bin\\godot.windows.opt.32.exe']+['bin\\godot.windows.opt.64.exe'] + release_debug_targets = ['bin\\godot.windows.opt.tools.32.exe']+['bin\\godot.windows.opt.tools.64.exe'] targets = debug_targets + release_targets + release_debug_targets msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ], incs = env.vs_incs, @@ -1,3 +1,5 @@ +#!/usr/bin/python + Import('env') Export('env') diff --git a/bin/tests/SCsub b/bin/tests/SCsub index 57c9bc63b2..26687599e1 100644 --- a/bin/tests/SCsub +++ b/bin/tests/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/python + Import('env') env.tests_sources=[] diff --git a/core/SCsub b/core/SCsub index 4ce91c794f..cbed2e4f35 100644 --- a/core/SCsub +++ b/core/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.core_sources=[] diff --git a/core/bind/SCsub b/core/bind/SCsub index 7b4a6acbc0..c2731d60e6 100644 --- a/core/bind/SCsub +++ b/core/bind/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.core_sources,"*.cpp") diff --git a/core/io/SCsub b/core/io/SCsub index 3ff9b355a4..48cc9a5275 100644 --- a/core/io/SCsub +++ b/core/io/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.core_sources,"*.cpp") diff --git a/core/math/SCsub b/core/math/SCsub index 7b4a6acbc0..c2731d60e6 100644 --- a/core/math/SCsub +++ b/core/math/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.core_sources,"*.cpp") diff --git a/core/os/SCsub b/core/os/SCsub index 7b4a6acbc0..c2731d60e6 100644 --- a/core/os/SCsub +++ b/core/os/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.core_sources,"*.cpp") diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 4e0ba53f48..5eb021f6c0 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -31871,6 +31871,8 @@ RayCast can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks. Only enabled raycasts will be able to query the space and report collisions! + + RayCast calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. </description> <methods> <method name="add_exception"> @@ -31891,6 +31893,11 @@ Removes all collision exception for this ray. </description> </method> + <method name="force_raycast_update"> + <description> + Updates the collision information in case if this object's properties changed during the current frame (for example position, rotation or the cast_point). Note, [code]set_enabled[/code] is not required for this to work. + </description> + </method> <method name="get_cast_to" qualifiers="const"> <return type="Vector3"> </return> @@ -32009,6 +32016,8 @@ RayCast2D can ignore some objects by adding them to the exception list via [code]add_exception[/code], setting proper filtering with layers, or by filtering object types with type masks. Only enabled raycasts will be able to query the space and report collisions! + + RayCast2D calculates intersection every fixed frame (see [Node]), and the result is cached so it can be used later until the next frame. If multiple queries are required between fixed frames (or during the same frame) use [method force_raycast_update] after adjusting the raycast. </description> <methods> <method name="add_exception"> @@ -32029,6 +32038,11 @@ Removes all collision exception for this ray. </description> </method> + <method name="force_raycast_update"> + <description> + Updates the collision information in case if this object's properties changed during the current frame (for example position, rotation or the cast_point). Note, [code]set_enabled[/code] is not required for this to work. + </description> + </method> <method name="get_cast_to" qualifiers="const"> <return type="Vector2"> </return> diff --git a/doc/tools/doc_merge.py b/doc/tools/doc_merge.py index b55902ce4f..536770bee4 100644 --- a/doc/tools/doc_merge.py +++ b/doc/tools/doc_merge.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- import sys diff --git a/doc/tools/doc_status.py b/doc/tools/doc_status.py index 35a6bc8bc4..f0ede405ce 100755 --- a/doc/tools/doc_status.py +++ b/doc/tools/doc_status.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 import sys import re diff --git a/doc/tools/makedocs.py b/doc/tools/makedocs.py index 063ee29002..731e04f6fc 100644 --- a/doc/tools/makedocs.py +++ b/doc/tools/makedocs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- # diff --git a/doc/tools/makedoku.py b/doc/tools/makedoku.py index 97819d7da3..7c3ca29af8 100644 --- a/doc/tools/makedoku.py +++ b/doc/tools/makedoku.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- import sys diff --git a/doc/tools/makehtml.py b/doc/tools/makehtml.py index 26edda0935..b0a8cbda88 100644 --- a/doc/tools/makehtml.py +++ b/doc/tools/makehtml.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- import sys diff --git a/doc/tools/makemd.py b/doc/tools/makemd.py index 38b493b0bf..e0fbe9af03 100644 --- a/doc/tools/makemd.py +++ b/doc/tools/makemd.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- import sys diff --git a/doc/tools/makerst.py b/doc/tools/makerst.py index 45e690cb65..718cf4a275 100644 --- a/doc/tools/makerst.py +++ b/doc/tools/makerst.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # -*- coding: utf-8 -*- import codecs diff --git a/drivers/SCsub b/drivers/SCsub index c496f46a1f..1f1509efa8 100644 --- a/drivers/SCsub +++ b/drivers/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.drivers_sources=[] @@ -14,6 +16,8 @@ SConscript('alsa/SCsub'); SConscript('pulseaudio/SCsub'); if (env["platform"] == "windows"): SConscript("rtaudio/SCsub"); +if (env["xaudio2"] == "yes"): + SConscript("xaudio2/SCsub"); # Graphics drivers SConscript('gles2/SCsub'); diff --git a/drivers/alsa/SCsub b/drivers/alsa/SCsub index 0582e01978..ee39fd2631 100644 --- a/drivers/alsa/SCsub +++ b/drivers/alsa/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/convex_decomp/SCsub b/drivers/convex_decomp/SCsub index 0582e01978..ee39fd2631 100644 --- a/drivers/convex_decomp/SCsub +++ b/drivers/convex_decomp/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index b05a96cb99..cf37e9fe36 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') if (env["platform"] in ["haiku","osx","windows","x11"]): diff --git a/drivers/gles2/SCsub b/drivers/gles2/SCsub index 89d7d86360..dedd794dba 100644 --- a/drivers/gles2/SCsub +++ b/drivers/gles2/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/gles2/shaders/SCsub b/drivers/gles2/shaders/SCsub index 88445f34c1..1de5604321 100644 --- a/drivers/gles2/shaders/SCsub +++ b/drivers/gles2/shaders/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') if env['BUILDERS'].has_key('GLSL120GLES'): diff --git a/drivers/nrex/SCsub b/drivers/nrex/SCsub index 0582e01978..ee39fd2631 100644 --- a/drivers/nrex/SCsub +++ b/drivers/nrex/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/png/SCsub b/drivers/png/SCsub index 1e3f54a9ca..04cb70e1c1 100644 --- a/drivers/png/SCsub +++ b/drivers/png/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env_png = env.Clone() diff --git a/drivers/pulseaudio/SCsub b/drivers/pulseaudio/SCsub index 0582e01978..ee39fd2631 100644 --- a/drivers/pulseaudio/SCsub +++ b/drivers/pulseaudio/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/rtaudio/SCsub b/drivers/rtaudio/SCsub index 836c84c43c..f0273dd421 100644 --- a/drivers/rtaudio/SCsub +++ b/drivers/rtaudio/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') # Not cloning the env, the includes need to be accessible for platform/ diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index 36a172025d..fe427e747f 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') g_set_p='#ifdef UNIX_ENABLED\n' diff --git a/drivers/windows/SCsub b/drivers/windows/SCsub index 0582e01978..ee39fd2631 100644 --- a/drivers/windows/SCsub +++ b/drivers/windows/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.drivers_sources, "*.cpp") diff --git a/drivers/xaudio2/SCsub b/drivers/xaudio2/SCsub new file mode 100644 index 0000000000..cb780a893b --- /dev/null +++ b/drivers/xaudio2/SCsub @@ -0,0 +1,9 @@ +#!/usr/bin/env python + +Import('env') + +env.add_source_files(env.drivers_sources, "*.cpp") +env.Append(CXXFLAGS=['-DXAUDIO2_ENABLED']) +env.Append(LINKFLAGS=['xaudio2_8.lib']) + +Export('env') diff --git a/platform/winrt/audio_driver_winrt.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp index ff46244ac3..c7a8962102 100644 --- a/platform/winrt/audio_driver_winrt.cpp +++ b/drivers/xaudio2/audio_driver_xaudio2.cpp @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_winrt.cpp */ +/* audio_driver_xaudio2.cpp */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,23 +26,17 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "audio_driver_winrt.h" +#include "audio_driver_xaudio2.h" #include "globals.h" #include "os/os.h" -using namespace Windows::Media; -using namespace Windows::Media::Core; -using namespace Windows::Media::MediaProperties; -using namespace Windows::Media::Editing; -using namespace Windows::Foundation; - -const char * AudioDriverWinRT::get_name() const +const char * AudioDriverXAudio2::get_name() const { - return "WinRT"; + return "XAudio2"; } -Error AudioDriverWinRT::init() { +Error AudioDriverXAudio2::init() { active = false; thread_exited = false; @@ -86,23 +80,21 @@ Error AudioDriverWinRT::init() { wave_format.nBlockAlign = channels * wave_format.wBitsPerSample >> 3; wave_format.nAvgBytesPerSec = mix_rate * wave_format.nBlockAlign; - voice_callback = memnew(XAudio2DriverVoiceCallback); - - hr = xaudio->CreateSourceVoice(&source_voice, &wave_format, 0, XAUDIO2_MAX_FREQ_RATIO, voice_callback); + hr = xaudio->CreateSourceVoice(&source_voice, &wave_format, 0, XAUDIO2_MAX_FREQ_RATIO, &voice_callback); if (hr != S_OK) { ERR_EXPLAIN("Error creating XAudio2 source voice. " + itos(hr)); ERR_FAIL_V(ERR_UNAVAILABLE); } mutex = Mutex::create(); - thread = Thread::create(AudioDriverWinRT::thread_func, this); + thread = Thread::create(AudioDriverXAudio2::thread_func, this); return OK; }; -void AudioDriverWinRT::thread_func(void* p_udata) { +void AudioDriverXAudio2::thread_func(void* p_udata) { - AudioDriverWinRT* ad = (AudioDriverWinRT*)p_udata; + AudioDriverXAudio2* ad = (AudioDriverXAudio2*)p_udata; uint64_t usdelay = (ad->buffer_size / float(ad->mix_rate)) * 1000000; @@ -139,7 +131,7 @@ void AudioDriverWinRT::thread_func(void* p_udata) { XAUDIO2_VOICE_STATE state; while (ad->source_voice->GetState(&state), state.BuffersQueued > AUDIO_BUFFERS - 1) { - WaitForSingleObject(ad->voice_callback->buffer_end_event, INFINITE); + WaitForSingleObject(ad->voice_callback.buffer_end_event, INFINITE); } } @@ -149,7 +141,7 @@ void AudioDriverWinRT::thread_func(void* p_udata) { }; -void AudioDriverWinRT::start() { +void AudioDriverXAudio2::start() { active = true; HRESULT hr = source_voice->Start(0); @@ -159,17 +151,17 @@ void AudioDriverWinRT::start() { } }; -int AudioDriverWinRT::get_mix_rate() const { +int AudioDriverXAudio2::get_mix_rate() const { return mix_rate; }; -AudioDriverSW::OutputFormat AudioDriverWinRT::get_output_format() const { +AudioDriverSW::OutputFormat AudioDriverXAudio2::get_output_format() const { return output_format; }; -float AudioDriverWinRT::get_latency() { +float AudioDriverXAudio2::get_latency() { XAUDIO2_PERFORMANCE_DATA perf_data; xaudio->GetPerformanceData(&perf_data); @@ -180,20 +172,20 @@ float AudioDriverWinRT::get_latency() { } } -void AudioDriverWinRT::lock() { +void AudioDriverXAudio2::lock() { if (!thread || !mutex) return; mutex->lock(); }; -void AudioDriverWinRT::unlock() { +void AudioDriverXAudio2::unlock() { if (!thread || !mutex) return; mutex->unlock(); }; -void AudioDriverWinRT::finish() { +void AudioDriverXAudio2::finish() { if (!thread) return; @@ -203,7 +195,7 @@ void AudioDriverWinRT::finish() { if (source_voice) { source_voice->Stop(0); - memdelete(source_voice); + source_voice->DestroyVoice(); } if (samples_in) { @@ -215,8 +207,7 @@ void AudioDriverWinRT::finish() { } }; - memdelete(voice_callback); - memdelete(mastering_voice); + mastering_voice->DestroyVoice(); memdelete(thread); if (mutex) @@ -224,7 +215,7 @@ void AudioDriverWinRT::finish() { thread = NULL; }; -AudioDriverWinRT::AudioDriverWinRT() { +AudioDriverXAudio2::AudioDriverXAudio2() { mutex = NULL; thread = NULL; @@ -236,7 +227,7 @@ AudioDriverWinRT::AudioDriverWinRT() { current_buffer = 0; }; -AudioDriverWinRT::~AudioDriverWinRT() { +AudioDriverXAudio2::~AudioDriverXAudio2() { }; diff --git a/platform/winrt/audio_driver_winrt.h b/drivers/xaudio2/audio_driver_xaudio2.h index d7a69994f8..1c6a90500d 100644 --- a/platform/winrt/audio_driver_winrt.h +++ b/drivers/xaudio2/audio_driver_xaudio2.h @@ -1,5 +1,5 @@ /*************************************************************************/ -/* audio_driver_winrt.h */ +/* audio_driver_xaudio2.h */ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ @@ -26,8 +26,8 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#ifndef AUDIO_DRIVER_WINRT_H -#define AUDIO_DRIVER_WINRT_H +#ifndef AUDIO_DRIVER_XAUDIO2_H +#define AUDIO_DRIVER_XAUDIO2_H #include "servers/audio/audio_server_sw.h" @@ -40,7 +40,7 @@ #include <xaudio2.h> #include <wrl/client.h> -class AudioDriverWinRT : public AudioDriverSW { +class AudioDriverXAudio2 : public AudioDriverSW { enum { AUDIO_BUFFERS = 2 @@ -53,12 +53,12 @@ class AudioDriverWinRT : public AudioDriverSW { void STDMETHODCALLTYPE OnBufferEnd(void* pBufferContext) { /*print_line("buffer ended");*/ SetEvent(buffer_end_event); } //Unused methods are stubs - void STDMETHODCALLTYPE OnStreamEnd() { } - void STDMETHODCALLTYPE OnVoiceProcessingPassEnd() { } - void STDMETHODCALLTYPE OnVoiceProcessingPassStart(UINT32 SamplesRequired) { } - void STDMETHODCALLTYPE OnBufferStart(void * pBufferContext) { } - void STDMETHODCALLTYPE OnLoopEnd(void * pBufferContext) { } - void STDMETHODCALLTYPE OnVoiceError(void * pBufferContext, HRESULT Error) { } + void STDMETHODCALLTYPE OnStreamEnd() {} + void STDMETHODCALLTYPE OnVoiceProcessingPassEnd() {} + void STDMETHODCALLTYPE OnVoiceProcessingPassStart(UINT32 SamplesRequired) {} + void STDMETHODCALLTYPE OnBufferStart(void * pBufferContext) {} + void STDMETHODCALLTYPE OnLoopEnd(void * pBufferContext) {} + void STDMETHODCALLTYPE OnVoiceError(void * pBufferContext, HRESULT Error) {} }; @@ -87,7 +87,7 @@ class AudioDriverWinRT : public AudioDriverSW { IXAudio2MasteringVoice* mastering_voice; XAUDIO2_BUFFER xaudio_buffer[AUDIO_BUFFERS]; IXAudio2SourceVoice* source_voice; - XAudio2DriverVoiceCallback* voice_callback; + XAudio2DriverVoiceCallback voice_callback; public: @@ -102,8 +102,8 @@ public: virtual void unlock(); virtual void finish(); - AudioDriverWinRT(); - ~AudioDriverWinRT(); + AudioDriverXAudio2(); + ~AudioDriverXAudio2(); }; #endif diff --git a/drivers/zlib/SCsub b/drivers/zlib/SCsub index d0bbcd452b..6a099aff52 100644 --- a/drivers/zlib/SCsub +++ b/drivers/zlib/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') # Not cloning the env, the includes need to be accessible for core/ diff --git a/main/SCsub b/main/SCsub index fa60ffc3e8..cd9002de0a 100644 --- a/main/SCsub +++ b/main/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.main_sources=[] diff --git a/main/input_default.cpp b/main/input_default.cpp index 92f4a6fb72..c60fcd2243 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -1050,8 +1050,8 @@ void InputDefault::parse_mapping(String p_mapping) { if (entry[idx] == "") continue; - String from = entry[idx].get_slice(":", 1); - String to = entry[idx].get_slice(":", 0); + String from = entry[idx].get_slice(":", 1).replace(" ", ""); + String to = entry[idx].get_slice(":", 0).replace(" ", ""); JoyEvent to_event = _find_to_event(to); if (to_event.type == -1) diff --git a/methods.py b/methods.py index c4951c69bd..477fe4f12f 100755 --- a/methods.py +++ b/methods.py @@ -1416,7 +1416,7 @@ def save_active_platforms(apnames,ap): logow.write(str) -def colored(sys,env): +def no_verbose(sys,env): #If the output is not a terminal, do nothing if not sys.stdout.isatty(): diff --git a/modules/SCsub b/modules/SCsub index f37c3a55c7..4084248086 100644 --- a/modules/SCsub +++ b/modules/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env_modules = env.Clone() diff --git a/modules/chibi/SCsub b/modules/chibi/SCsub index e39554977a..dffd966753 100644 --- a/modules/chibi/SCsub +++ b/modules/chibi/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/cscript/SCsub b/modules/cscript/SCsub index 9ff13fc43f..0882406761 100644 --- a/modules/cscript/SCsub +++ b/modules/cscript/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/dds/SCsub b/modules/dds/SCsub index c54a58e079..3d92ff02d6 100644 --- a/modules/dds/SCsub +++ b/modules/dds/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/enet/SCsub b/modules/enet/SCsub index 66c60baabe..5175803f44 100644 --- a/modules/enet/SCsub +++ b/modules/enet/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/etc1/SCsub b/modules/etc1/SCsub index ad343ab579..ea035fcde3 100644 --- a/modules/etc1/SCsub +++ b/modules/etc1/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub index 10c58558a5..1f759dee9a 100644 --- a/modules/freetype/SCsub +++ b/modules/freetype/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') # Not building in a separate env as core needs it diff --git a/modules/gdscript/SCsub b/modules/gdscript/SCsub index 9ff13fc43f..0882406761 100644 --- a/modules/gdscript/SCsub +++ b/modules/gdscript/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 2e2cbe7b29..b75b13551e 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1005,12 +1005,12 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo switch(s->type) { case GDParser::Node::TYPE_NEWLINE: { - +#ifdef DEBUG_ENABLED const GDParser::NewLineNode *nl = static_cast<const GDParser::NewLineNode*>(s); codegen.opcodes.push_back(GDFunction::OPCODE_LINE); codegen.opcodes.push_back(nl->line); codegen.current_line=nl->line; - +#endif } break; case GDParser::Node::TYPE_CONTROL_FLOW: { // try subblocks @@ -1201,8 +1201,10 @@ Error GDCompiler::_parse_block(CodeGen& codegen,const GDParser::BlockNode *p_blo codegen.opcodes.push_back(ret); } break; case GDParser::Node::TYPE_BREAKPOINT: { +#ifdef DEBUG_ENABLED // try subblocks codegen.opcodes.push_back(GDFunction::OPCODE_BREAKPOINT); +#endif } break; case GDParser::Node::TYPE_LOCAL_VAR: { diff --git a/modules/gridmap/SCsub b/modules/gridmap/SCsub index 9ff13fc43f..0882406761 100644 --- a/modules/gridmap/SCsub +++ b/modules/gridmap/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/ik/SCsub b/modules/ik/SCsub index 9ff13fc43f..0882406761 100644 --- a/modules/ik/SCsub +++ b/modules/ik/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/jpg/SCsub b/modules/jpg/SCsub index 258fd2f4ad..28fb81895d 100644 --- a/modules/jpg/SCsub +++ b/modules/jpg/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/mpc/SCsub b/modules/mpc/SCsub index d2662c34ab..09f0c05daa 100644 --- a/modules/mpc/SCsub +++ b/modules/mpc/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/ogg/SCsub b/modules/ogg/SCsub index fd5ddf55c8..2e1fe2e0c0 100644 --- a/modules/ogg/SCsub +++ b/modules/ogg/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/openssl/SCsub b/modules/openssl/SCsub index 79facba99a..3cc6f21bd2 100644 --- a/modules/openssl/SCsub +++ b/modules/openssl/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/opus/SCsub b/modules/opus/SCsub index 5c587a0783..603f5a48c4 100644 --- a/modules/opus/SCsub +++ b/modules/opus/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/pbm/SCsub b/modules/pbm/SCsub index e0b19fb2a3..fa328be025 100644 --- a/modules/pbm/SCsub +++ b/modules/pbm/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/pvr/SCsub b/modules/pvr/SCsub index cd0a3129da..4ead52f82f 100644 --- a/modules/pvr/SCsub +++ b/modules/pvr/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/squish/SCsub b/modules/squish/SCsub index 072921ef64..3fdc587652 100644 --- a/modules/squish/SCsub +++ b/modules/squish/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/theora/SCsub b/modules/theora/SCsub index cf1a8e6707..22c618fe8b 100644 --- a/modules/theora/SCsub +++ b/modules/theora/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/visual_script/SCsub b/modules/visual_script/SCsub index 9ff13fc43f..0882406761 100644 --- a/modules/visual_script/SCsub +++ b/modules/visual_script/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.modules_sources, "*.cpp") diff --git a/modules/vorbis/SCsub b/modules/vorbis/SCsub index f3dbc893fc..3220cb454c 100644 --- a/modules/vorbis/SCsub +++ b/modules/vorbis/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/modules/webp/SCsub b/modules/webp/SCsub index 4997aa3359..38585a1ff2 100644 --- a/modules/webp/SCsub +++ b/modules/webp/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Import('env_modules') diff --git a/platform/android/SCsub b/platform/android/SCsub index 60bb4bd613..4f9a9709cb 100644 --- a/platform/android/SCsub +++ b/platform/android/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import shutil Import('env') diff --git a/platform/android/detect.py b/platform/android/detect.py index acf4ce412a..842036f986 100644 --- a/platform/android/detect.py +++ b/platform/android/detect.py @@ -131,7 +131,7 @@ def configure(env): gcc_path=gcc_path+"/darwin-x86_64/bin" env['SHLINKFLAGS'][1] = '-shared' env['SHLIBSUFFIX'] = '.so' - elif (os.platform.startswith('win')): + elif (sys.platform.startswith('win')): if (platform.machine().endswith('64')): gcc_path=gcc_path+"/windows-x86_64/bin" else: diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index be2ffde2cd..57376f8103 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -203,7 +203,6 @@ bool DirAccessJAndroid::dir_exists(String p_dir) { return false; env->CallVoidMethod(io,_dir_close,res); - env->DeleteLocalRef(js); return true; } diff --git a/platform/bb10/SCsub b/platform/bb10/SCsub index 81f6e726e4..84fff0828b 100644 --- a/platform/bb10/SCsub +++ b/platform/bb10/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') bb10_lib = [ diff --git a/platform/haiku/SCsub b/platform/haiku/SCsub index 1952e6b59b..b5a584baa4 100644 --- a/platform/haiku/SCsub +++ b/platform/haiku/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') common_haiku = [ diff --git a/platform/iphone/SCsub b/platform/iphone/SCsub index 5b2e1533da..236630bef4 100644 --- a/platform/iphone/SCsub +++ b/platform/iphone/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') iphone_lib = [ diff --git a/platform/javascript/SCsub b/platform/javascript/SCsub index fc70d45a04..22af436470 100644 --- a/platform/javascript/SCsub +++ b/platform/javascript/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') javascript_files = [ diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index de57d770c4..f934916aa2 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -195,8 +195,8 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t>& p_html, const St } CharString cs = strnew.utf8(); - p_html.resize(cs.size()); - for(int i=9;i<cs.size();i++) { + p_html.resize(cs.length()); + for(int i=9;i<cs.length();i++) { p_html[i]=cs[i]; } } diff --git a/platform/osx/SCsub b/platform/osx/SCsub index 4169795519..217dee81eb 100644 --- a/platform/osx/SCsub +++ b/platform/osx/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') files = [ diff --git a/platform/osx/detect.py b/platform/osx/detect.py index f8b2153aee..4e772e37eb 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -91,9 +91,6 @@ def configure(env): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env["CC"]="clang" env["LD"]="clang++" - if (env["colored"]=="yes"): - if sys.stdout.isatty(): - env.Append(CPPFLAGS=["-fcolor-diagnostics"]) import methods diff --git a/platform/server/SCsub b/platform/server/SCsub index 3dda6b4395..12758c5db0 100644 --- a/platform/server/SCsub +++ b/platform/server/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/platform/server/detect.py b/platform/server/detect.py index 2f6fb00e0d..ce14100fd0 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -38,9 +38,6 @@ def configure(env): env["CC"]="clang" env["CXX"]="clang++" env["LD"]="clang++" - if (env["colored"]=="yes"): - if sys.stdout.isatty(): - env.Append(CXXFLAGS=["-fcolor-diagnostics"]) is64=sys.maxsize > 2**32 diff --git a/platform/windows/SCsub b/platform/windows/SCsub index 914cee0fa1..e53eb7af34 100644 --- a/platform/windows/SCsub +++ b/platform/windows/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 0ca5d3bd0f..286f5fb0b7 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1366,13 +1366,16 @@ void OS_Windows::set_mouse_mode(MouseMode p_mode) { POINT pos = { (int) center.x, (int) center.y }; ClientToScreen(hWnd, &pos); SetCursorPos(pos.x, pos.y); - ShowCursor(false); } else { - ShowCursor(true); ReleaseCapture(); ClipCursor(NULL); } + if (p_mode == MOUSE_MODE_CAPTURED || p_mode == MOUSE_MODE_HIDDEN) { + hCursor = SetCursor(NULL); + } else { + SetCursor(hCursor); + } } OS_Windows::MouseMode OS_Windows::get_mouse_mode() const{ @@ -2418,6 +2421,9 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) { #ifdef RTAUDIO_ENABLED AudioDriverManagerSW::add_driver(&driver_rtaudio); #endif +#ifdef XAUDIO2_ENABLED + AudioDriverManagerSW::add_driver(&driver_xaudio2); +#endif } diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 70ef694957..903dd10c70 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -41,6 +41,9 @@ #include "servers/audio/audio_server_sw.h" #include "servers/audio/sample_manager_sw.h" #include "drivers/rtaudio/audio_driver_rtaudio.h" +#ifdef XAUDIO2_ENABLED +#include "drivers/xaudio2/audio_driver_xaudio2.h" +#endif #include "servers/spatial_sound/spatial_sound_server_sw.h" #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" #include "drivers/unix/ip_unix.h" @@ -137,6 +140,9 @@ class OS_Windows : public OS { #ifdef RTAUDIO_ENABLED AudioDriverRtAudio driver_rtaudio; #endif +#ifdef XAUDIO2_ENABLED + AudioDriverXAudio2 driver_xaudio2; +#endif void _drag_event(int p_x, int p_y, int idx); void _touch_event(bool p_pressed, int p_x, int p_y, int idx); diff --git a/platform/winrt/SCsub b/platform/winrt/SCsub index fde0c11f3b..91a179084d 100644 --- a/platform/winrt/SCsub +++ b/platform/winrt/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') files = [ @@ -8,7 +10,6 @@ files = [ '#platform/windows/key_mapping_win.cpp', 'joystick_winrt.cpp', 'gl_context_egl.cpp', - 'audio_driver_winrt.cpp', 'app.cpp', 'os_winrt.cpp', ] diff --git a/platform/winrt/detect.py b/platform/winrt/detect.py index 79fc3651e9..a7bc62f685 100644 --- a/platform/winrt/detect.py +++ b/platform/winrt/detect.py @@ -31,6 +31,7 @@ def get_flags(): ('tools', 'no'), ('builtin_zlib', 'yes'), ('openssl', 'builtin'), + ('xaudio2', 'yes'), ] @@ -145,7 +146,6 @@ def configure(env): env.Append(CCFLAGS=['/DGLES2_ENABLED','/DGL_GLEXT_PROTOTYPES','/DEGL_EGLEXT_PROTOTYPES','/DANGLE_ENABLED']) LIBS = [ - 'xaudio2', 'WindowsApp', 'mincore', 'libANGLE', diff --git a/platform/winrt/os_winrt.h b/platform/winrt/os_winrt.h index 1816e0cec7..a4667f213d 100644 --- a/platform/winrt/os_winrt.h +++ b/platform/winrt/os_winrt.h @@ -40,7 +40,7 @@ #include "servers/spatial_sound/spatial_sound_server_sw.h" #include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h" #include "servers/physics_2d/physics_2d_server_sw.h" -#include "audio_driver_winrt.h" +#include "drivers/xaudio2/audio_driver_xaudio2.h" #include "gl_context_egl.h" @@ -118,7 +118,7 @@ private: MainLoop *main_loop; - AudioDriverWinRT audio_driver; + AudioDriverXAudio2 audio_driver; AudioServerSW *audio_server; SampleManagerMallocSW *sample_manager; SpatialSoundServerSW *spatial_sound_server; diff --git a/platform/x11/SCsub b/platform/x11/SCsub index 80fd347ded..e20bd44f8d 100644 --- a/platform/x11/SCsub +++ b/platform/x11/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/platform/x11/detect.py b/platform/x11/detect.py index eb71ac7409..917a8a27d7 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -94,10 +94,6 @@ def configure(env): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.extra_suffix=".llvm" - if (env["colored"]=="yes"): - if sys.stdout.isatty(): - env.Append(CXXFLAGS=["-fcolor-diagnostics"]) - if (env["use_sanitizer"]=="yes"): env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer']) env.Append(LINKFLAGS=['-fsanitize=address']) diff --git a/scene/2d/SCsub b/scene/2d/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/2d/SCsub +++ b/scene/2d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/2d/ray_cast_2d.cpp b/scene/2d/ray_cast_2d.cpp index b5d62adfb4..bd7f4faae5 100644 --- a/scene/2d/ray_cast_2d.cpp +++ b/scene/2d/ray_cast_2d.cpp @@ -187,39 +187,44 @@ void RayCast2D::_notification(int p_what) { if (!enabled) break; + _update_raycast_state(); - Ref<World2D> w2d = get_world_2d(); - ERR_BREAK( w2d.is_null() ); - - Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space()); - ERR_BREAK( !dss ); - - Matrix32 gt = get_global_transform(); + } break; + } +} - Vector2 to = cast_to; - if (to==Vector2()) - to=Vector2(0,0.01); +void RayCast2D::_update_raycast_state() { + Ref<World2D> w2d = get_world_2d(); + ERR_FAIL_COND( w2d.is_null() ); - Physics2DDirectSpaceState::RayResult rr; + Physics2DDirectSpaceState *dss = Physics2DServer::get_singleton()->space_get_direct_state(w2d->get_space()); + ERR_FAIL_COND( !dss ); - if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask,type_mask)) { + Matrix32 gt = get_global_transform(); - collided=true; - against=rr.collider_id; - collision_point=rr.position; - collision_normal=rr.normal; - against_shape=rr.shape; - } else { - collided=false; - } + Vector2 to = cast_to; + if (to==Vector2()) + to=Vector2(0,0.01); + Physics2DDirectSpaceState::RayResult rr; + if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude,layer_mask,type_mask)) { - } break; + collided=true; + against=rr.collider_id; + collision_point=rr.position; + collision_normal=rr.normal; + against_shape=rr.shape; + } else { + collided=false; } } +void RayCast2D::force_raycast_update() { + _update_raycast_state(); +} + void RayCast2D::add_exception_rid(const RID& p_rid) { exclude.insert(p_rid); @@ -265,6 +270,7 @@ void RayCast2D::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_cast_to"),&RayCast2D::get_cast_to); ObjectTypeDB::bind_method(_MD("is_colliding"),&RayCast2D::is_colliding); + ObjectTypeDB::bind_method(_MD("force_raycast_update"),&RayCast2D::force_raycast_update); ObjectTypeDB::bind_method(_MD("get_collider"),&RayCast2D::get_collider); ObjectTypeDB::bind_method(_MD("get_collider_shape"),&RayCast2D::get_collider_shape); diff --git a/scene/2d/ray_cast_2d.h b/scene/2d/ray_cast_2d.h index e1caa8b63e..9bdcc2e199 100644 --- a/scene/2d/ray_cast_2d.h +++ b/scene/2d/ray_cast_2d.h @@ -52,6 +52,7 @@ class RayCast2D : public Node2D { protected: void _notification(int p_what); + void _update_raycast_state(); static void _bind_methods(); public: @@ -70,6 +71,8 @@ public: void set_exclude_parent_body(bool p_exclude_parent_body); bool get_exclude_parent_body() const; + void force_raycast_update(); + bool is_colliding() const; Object *get_collider() const; int get_collider_shape() const; diff --git a/scene/3d/SCsub b/scene/3d/SCsub index 116e641593..1205deb94a 100644 --- a/scene/3d/SCsub +++ b/scene/3d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/scene/3d/ray_cast.cpp b/scene/3d/ray_cast.cpp index 1acda8d1f8..2b8df8265e 100644 --- a/scene/3d/ray_cast.cpp +++ b/scene/3d/ray_cast.cpp @@ -134,39 +134,44 @@ void RayCast::_notification(int p_what) { if (!enabled) break; + _update_raycast_state(); - Ref<World> w3d = get_world(); - ERR_BREAK( w3d.is_null() ); - - PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); - ERR_BREAK( !dss ); - - Transform gt = get_global_transform(); + } break; + } +} - Vector3 to = cast_to; - if (to==Vector3()) - to=Vector3(0,0.01,0); +void RayCast::_update_raycast_state(){ + Ref<World> w3d = get_world(); + ERR_FAIL_COND( w3d.is_null() ); - PhysicsDirectSpaceState::RayResult rr; + PhysicsDirectSpaceState *dss = PhysicsServer::get_singleton()->space_get_direct_state(w3d->get_space()); + ERR_FAIL_COND( !dss ); - if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude, layer_mask, type_mask)) { + Transform gt = get_global_transform(); - collided=true; - against=rr.collider_id; - collision_point=rr.position; - collision_normal=rr.normal; - against_shape=rr.shape; - } else { - collided=false; - } + Vector3 to = cast_to; + if (to==Vector3()) + to=Vector3(0,0.01,0); + PhysicsDirectSpaceState::RayResult rr; + if (dss->intersect_ray(gt.get_origin(),gt.xform(to),rr,exclude, layer_mask, type_mask)) { - } break; + collided=true; + against=rr.collider_id; + collision_point=rr.position; + collision_normal=rr.normal; + against_shape=rr.shape; + } else { + collided=false; } } +void RayCast::force_raycast_update() { + _update_raycast_state(); +} + void RayCast::add_exception_rid(const RID& p_rid) { exclude.insert(p_rid); @@ -212,6 +217,7 @@ void RayCast::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_cast_to"),&RayCast::get_cast_to); ObjectTypeDB::bind_method(_MD("is_colliding"),&RayCast::is_colliding); + ObjectTypeDB::bind_method(_MD("force_raycast_update"),&RayCast::force_raycast_update); ObjectTypeDB::bind_method(_MD("get_collider"),&RayCast::get_collider); ObjectTypeDB::bind_method(_MD("get_collider_shape"),&RayCast::get_collider_shape); diff --git a/scene/3d/ray_cast.h b/scene/3d/ray_cast.h index 4f6514e61b..47553f08ed 100644 --- a/scene/3d/ray_cast.h +++ b/scene/3d/ray_cast.h @@ -53,6 +53,7 @@ class RayCast : public Spatial { protected: void _notification(int p_what); + void _update_raycast_state(); static void _bind_methods(); public: @@ -68,6 +69,7 @@ public: void set_type_mask(uint32_t p_mask); uint32_t get_type_mask() const; + void force_raycast_update(); bool is_colliding() const; Object *get_collider() const; int get_collider_shape() const; diff --git a/scene/SCsub b/scene/SCsub index 6d1dd0044f..79da365192 100644 --- a/scene/SCsub +++ b/scene/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.scene_sources=[] diff --git a/scene/animation/SCsub b/scene/animation/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/animation/SCsub +++ b/scene/animation/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/audio/SCsub b/scene/audio/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/audio/SCsub +++ b/scene/audio/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/gui/SCsub b/scene/gui/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/gui/SCsub +++ b/scene/gui/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/io/SCsub b/scene/io/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/io/SCsub +++ b/scene/io/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/main/SCsub b/scene/main/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/main/SCsub +++ b/scene/main/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/resources/SCsub b/scene/resources/SCsub index bb9766e1ca..702ed1a9bf 100644 --- a/scene/resources/SCsub +++ b/scene/resources/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/scene/resources/default_theme/SCsub b/scene/resources/default_theme/SCsub index bbe59b3054..9fa89edbf7 100644 --- a/scene/resources/default_theme/SCsub +++ b/scene/resources/default_theme/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.scene_sources,"*.cpp") diff --git a/servers/SCsub b/servers/SCsub index d861847101..57b5b36758 100644 --- a/servers/SCsub +++ b/servers/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.servers_sources=[] diff --git a/servers/audio/SCsub b/servers/audio/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/audio/SCsub +++ b/servers/audio/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics/SCsub b/servers/physics/SCsub index 95296eadbe..b527f38ceb 100644 --- a/servers/physics/SCsub +++ b/servers/physics/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics/joints/SCsub b/servers/physics/joints/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/physics/joints/SCsub +++ b/servers/physics/joints/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/physics_2d/SCsub b/servers/physics_2d/SCsub index ebb7f8be00..2114782faa 100644 --- a/servers/physics_2d/SCsub +++ b/servers/physics_2d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/spatial_sound/SCsub b/servers/spatial_sound/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/spatial_sound/SCsub +++ b/servers/spatial_sound/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/spatial_sound_2d/SCsub b/servers/spatial_sound_2d/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/spatial_sound_2d/SCsub +++ b/servers/spatial_sound_2d/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/visual/SCsub b/servers/visual/SCsub index d31af2c1c4..4684bd6cf3 100644 --- a/servers/visual/SCsub +++ b/servers/visual/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.servers_sources,"*.cpp") diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp index 8d228ad859..1df0aafb23 100644 --- a/servers/visual/visual_server_raster.cpp +++ b/servers/visual/visual_server_raster.cpp @@ -7612,6 +7612,11 @@ void VisualServerRaster::set_default_clear_color(const Color& p_color) { clear_color=p_color; } +Color VisualServerRaster::get_default_clear_color() const { + + return clear_color; +} + void VisualServerRaster::set_boot_image(const Image& p_image, const Color& p_color,bool p_scale) { if (p_image.empty()) diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h index 496820f4a8..1f22e31ab0 100644 --- a/servers/visual/visual_server_raster.h +++ b/servers/visual/visual_server_raster.h @@ -1283,6 +1283,7 @@ public: virtual void set_boot_image(const Image& p_image, const Color& p_color, bool p_scale); virtual void set_default_clear_color(const Color& p_color); + virtual Color get_default_clear_color() const; VisualServerRaster(Rasterizer *p_rasterizer); ~VisualServerRaster(); diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h index b4e374dd6f..f0fe80d100 100644 --- a/servers/visual/visual_server_wrap_mt.h +++ b/servers/visual/visual_server_wrap_mt.h @@ -718,6 +718,7 @@ public: FUNC3(set_boot_image,const Image& , const Color&,bool ); FUNC1(set_default_clear_color,const Color& ); + FUNC0RC(Color,get_default_clear_color ); FUNC0R(RID,get_test_cube ); diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index dfa0c91c7f..6099a86b96 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -564,6 +564,7 @@ void VisualServer::_bind_methods() { ObjectTypeDB::bind_method(_MD("free_rid"),&VisualServer::free); ObjectTypeDB::bind_method(_MD("set_default_clear_color"),&VisualServer::set_default_clear_color); + ObjectTypeDB::bind_method(_MD("get_default_clear_color"),&VisualServer::get_default_clear_color); ObjectTypeDB::bind_method(_MD("get_render_info"),&VisualServer::get_render_info); diff --git a/servers/visual_server.h b/servers/visual_server.h index 2f3d8371f6..844da2d245 100644 --- a/servers/visual_server.h +++ b/servers/visual_server.h @@ -1181,6 +1181,7 @@ public: virtual void set_boot_image(const Image& p_image, const Color& p_color,bool p_scale)=0; virtual void set_default_clear_color(const Color& p_color)=0; + virtual Color get_default_clear_color() const=0; enum Features { FEATURE_SHADERS, diff --git a/tools/SCsub b/tools/SCsub index 67b1f20e72..b0b33d4f01 100644 --- a/tools/SCsub +++ b/tools/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.tool_sources=[] diff --git a/tools/collada/SCsub b/tools/collada/SCsub index 34524f10ef..473474201a 100644 --- a/tools/collada/SCsub +++ b/tools/collada/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/doc/SCsub b/tools/doc/SCsub index 34524f10ef..473474201a 100644 --- a/tools/doc/SCsub +++ b/tools/doc/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/SCsub b/tools/editor/SCsub index 34651b36f2..f6cb16dc24 100644 --- a/tools/editor/SCsub +++ b/tools/editor/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index bdbf20e348..f5741c4a9e 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -1026,6 +1026,34 @@ void EditorSettings::set_optimize_save(bool p_optimize) { optimize_save=p_optimize; } +String EditorSettings::get_last_selected_language() +{ + Ref<ConfigFile> cf = memnew( ConfigFile ); + String path = get_project_settings_path().plus_file("project_metadata.cfg"); + Error err = cf->load(path); + if (err != OK) { + WARN_PRINTS("Can't load config file: " + path); + return ""; + } + Variant last_selected_language = cf->get_value("script_setup", "last_selected_language"); + if (last_selected_language.get_type() != Variant::STRING) + return ""; + return static_cast<String>(last_selected_language); +} + +void EditorSettings::set_last_selected_language(String p_language) +{ + Ref<ConfigFile> cf = memnew( ConfigFile ); + String path = get_project_settings_path().plus_file("project_metadata.cfg"); + Error err = cf->load(path); + if (err != OK) { + WARN_PRINTS("Can't load config file: " + path); + return; + } + cf->set_value("script_setup", "last_selected_language", p_language); + cf->save(path); +} + void EditorSettings::_bind_methods() { ObjectTypeDB::bind_method(_MD("erase","property"),&EditorSettings::erase); diff --git a/tools/editor/editor_settings.h b/tools/editor/editor_settings.h index 2a7d3bb4f0..a976602304 100644 --- a/tools/editor/editor_settings.h +++ b/tools/editor/editor_settings.h @@ -160,6 +160,9 @@ public: void set_optimize_save(bool p_optimize); + String get_last_selected_language(); + void set_last_selected_language(String p_language); + EditorSettings(); ~EditorSettings(); diff --git a/tools/editor/fileserver/SCsub b/tools/editor/fileserver/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/fileserver/SCsub +++ b/tools/editor/fileserver/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/filesystem_dock.cpp b/tools/editor/filesystem_dock.cpp index 8a94c6e340..5b1e80fc3b 100644 --- a/tools/editor/filesystem_dock.cpp +++ b/tools/editor/filesystem_dock.cpp @@ -234,13 +234,6 @@ void FileSystemDock::_dir_selected() { button_favorite->set_pressed(found); - if (ti->get_parent() && ti->get_parent()->get_parent()==tree->get_root() && !ti->get_parent()->get_prev()) { - - //a favorite!!! - } else { - - - } if (!split_mode) { _open_pressed(); //go directly to dir diff --git a/tools/editor/icons/SCsub b/tools/editor/icons/SCsub index 44e28f49e6..9e05d8f391 100644 --- a/tools/editor/icons/SCsub +++ b/tools/editor/icons/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') def make_editor_icons_action(target, source, env): diff --git a/tools/editor/io_plugins/SCsub b/tools/editor/io_plugins/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/io_plugins/SCsub +++ b/tools/editor/io_plugins/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/io_plugins/editor_scene_import_plugin.cpp b/tools/editor/io_plugins/editor_scene_import_plugin.cpp index 190b56faba..56af35c6db 100644 --- a/tools/editor/io_plugins/editor_scene_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_scene_import_plugin.cpp @@ -175,6 +175,7 @@ class EditorSceneImportDialog : public ConfirmationDialog { EditorDirDialog *save_select; OptionButton *texture_action; CreateDialog *root_type_choose; + LineEdit *root_node_name; ConfirmationDialog *confirm_open; @@ -639,6 +640,7 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { } else { #endif save_path->set_text(""); + root_node_name->set_text(""); //save_path->set_text(p_path.get_file().basename()+".scn"); #if 0 } @@ -656,6 +658,9 @@ void EditorSceneImportDialog::_choose_file(const String& p_path) { import_path->set_text(p_path); + if (root_node_name->get_text().size()==0){ + root_node_name->set_text(import_path->get_text().get_file().basename()); + } } void EditorSceneImportDialog::_choose_save_file(const String& p_path) { @@ -788,6 +793,10 @@ void EditorSceneImportDialog::_import(bool p_and_open) { if (!root_default->is_pressed()) { rim->set_option("root_type",root_type->get_text()); } + if (root_node_name->get_text().size()==0) { + root_node_name->set_text(import_path->get_text().get_file().basename()); + } + rim->set_option("root_name",root_node_name->get_text()); List<String> missing; Error err = plugin->import1(rim,&scene,&missing); @@ -946,7 +955,11 @@ void EditorSceneImportDialog::popup_import(const String &p_from) { root_default->set_pressed(true); root_type->set_disabled(true); } - + if (rimd->has_option("root_name")) { + root_node_name->set_text(rimd->get_option("root_name")); + } else { + root_node_name->set_text(root_type->get_text()); // backward compatibility for 2.1 or before + } script_path->set_text(rimd->get_option("post_import_script")); save_path->set_text(p_from.get_base_dir()); @@ -1241,7 +1254,9 @@ EditorSceneImportDialog::EditorSceneImportDialog(EditorNode *p_editor, EditorSce root_default->connect("pressed",this,"_root_default_pressed"); custom_root_hb->add_child(root_default); - + root_node_name = memnew( LineEdit ); + root_node_name->set_h_size_flags(SIZE_EXPAND_FILL); + vbc->add_margin_child(TTR("Root Node Name:"),root_node_name); /* this_import = memnew( OptionButton ); this_import->add_item("Overwrite Existing Scene"); @@ -2185,6 +2200,7 @@ Error EditorSceneImportPlugin::import1(const Ref<ResourceImportMetadata>& p_from } } + scene->set_name(from->get_option("root_name")); _tag_import_paths(scene,scene); *r_node=scene; diff --git a/tools/editor/plugins/SCsub b/tools/editor/plugins/SCsub index 363a2ce4c0..6299fd416c 100644 --- a/tools/editor/plugins/SCsub +++ b/tools/editor/plugins/SCsub @@ -1,3 +1,5 @@ +#!/usr/bin/env python + Import('env') Export('env') env.add_source_files(env.tool_sources,"*.cpp") diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 3cd6d8336a..99c50efd2f 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1620,6 +1620,7 @@ void ScriptEditor::apply_scripts() const { void ScriptEditor::_editor_play() { debugger->start(); + debug_menu->get_popup()->grab_focus(); debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_NEXT), true ); debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_STEP), true ); debug_menu->get_popup()->set_item_disabled( debug_menu->get_popup()->get_item_index(DEBUG_BREAK), false ); diff --git a/tools/editor/property_editor.cpp b/tools/editor/property_editor.cpp index f18d5c928a..ef6b1aa47c 100644 --- a/tools/editor/property_editor.cpp +++ b/tools/editor/property_editor.cpp @@ -3613,9 +3613,10 @@ void PropertyEditor::update_tree() { } break; case Variant::NODE_PATH: { - item->set_cell_mode( 1, TreeItem::CELL_MODE_CUSTOM ); + item->set_cell_mode(1, TreeItem::CELL_MODE_STRING); item->set_editable( 1, !read_only ); item->set_text(1,obj->get(p.name)); + item->add_button(1, get_icon("Collapse", "EditorIcons")); } break; case Variant::OBJECT: { @@ -3892,6 +3893,7 @@ void PropertyEditor::_item_edited() { } break; case Variant::NODE_PATH: { + _edit_set(name, NodePath(item->get_text(1))); } break; @@ -4067,7 +4069,17 @@ void PropertyEditor::_edit_button(Object *p_item, int p_column, int p_button) { String n = d["name"]; String ht = d["hint_text"]; - if (t==Variant::STRING) { + if(t == Variant::NODE_PATH) { + + Variant v = obj->get(n); + custom_editor->edit(obj, n, (Variant::Type)t, v, h, ht); + Rect2 where = tree->get_item_rect(ti, 1); + where.pos -= tree->get_scroll(); + where.pos += tree->get_global_pos(); + custom_editor->set_pos(where.pos); + custom_editor->popup(); + + } else if (t==Variant::STRING) { Variant v = obj->get(n); diff --git a/tools/editor/script_create_dialog.cpp b/tools/editor/script_create_dialog.cpp index 749198314a..62d5c7cd84 100644 --- a/tools/editor/script_create_dialog.cpp +++ b/tools/editor/script_create_dialog.cpp @@ -121,6 +121,8 @@ void ScriptCreateDialog::ok_pressed() { Ref<Script> scr = ScriptServer::get_language( language_menu->get_selected() )->get_template(cname,parent_name->get_text()); //scr->set_source_code(text); + String selected_language = language_menu->get_item_text(language_menu->get_selected()); + editor_settings->set_last_selected_language(selected_language); if (cname!="") scr->set_name(cname); @@ -330,7 +332,17 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu->add_item(ScriptServer::get_language(i)->get_name()); } - language_menu->select(0); + editor_settings = EditorSettings::get_singleton(); + String last_selected_language = editor_settings->get_last_selected_language(); + if (last_selected_language != "") + for (int i = 0; i < language_menu->get_item_count(); i++) + if (language_menu->get_item_text(i) == last_selected_language) + { + language_menu->select(i); + break; + } + else language_menu->select(0); + language_menu->connect("item_selected",this,"_lang_changed"); //parent_name->set_text(); diff --git a/tools/editor/script_create_dialog.h b/tools/editor/script_create_dialog.h index 181989402e..c71ea16d39 100644 --- a/tools/editor/script_create_dialog.h +++ b/tools/editor/script_create_dialog.h @@ -33,6 +33,7 @@ #include "scene/gui/line_edit.h" #include "scene/gui/option_button.h" #include "tools/editor/editor_file_dialog.h" +#include "tools/editor/editor_settings.h" #include "scene/gui/check_button.h" class ScriptCreateDialog : public ConfirmationDialog { @@ -50,6 +51,7 @@ class ScriptCreateDialog : public ConfirmationDialog { AcceptDialog *alert; bool path_valid; String initial_bp; + EditorSettings *editor_settings; void _path_changed(const String& p_path=String()); diff --git a/tools/scripts/make_glwrapper.py b/tools/scripts/make_glwrapper.py index f3f8d39837..b4c582f1eb 100644 --- a/tools/scripts/make_glwrapper.py +++ b/tools/scripts/make_glwrapper.py @@ -1,4 +1,4 @@ -#! /usr/bin/python +#! /usr/bin/env python import sys if (len(sys.argv)<2): |