diff options
49 files changed, 402 insertions, 149 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 9df31124f8..9cc934bb6f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -857,7 +857,6 @@ void _OS::print_all_textures_by_size() { for(List<_OSCoreBindImg>::Element *E=imgs.front();E;E=E->next()) { - print_line(E->get().path+" - "+String::humanize_size(E->get().vram)+" ("+E->get().size+") - total:"+String::humanize_size(total) ); total-=E->get().vram; } } @@ -891,19 +890,6 @@ void _OS::print_resources_by_type(const Vector<String>& p_types) { type_count[r->get_type()]++; - - print_line(r->get_type()+": "+r->get_path()); - - List<String> metas; - r->get_meta_list(&metas); - for (List<String>::Element* me = metas.front(); me; me = me->next()) { - print_line(" "+String(me->get()) + ": " + r->get_meta(me->get())); - }; - } - - for(Map<String,int>::Element *E=type_count.front();E;E=E->next()) { - - print_line(E->key()+" count: "+itos(E->get())); } }; @@ -1016,6 +1002,11 @@ void _OS::alert(const String& p_alert,const String& p_title) { OS::get_singleton()->alert(p_alert,p_title); } +Dictionary _OS::get_engine_version() const { + + return OS::get_singleton()->get_engine_version(); +} + _OS *_OS::singleton=NULL; void _OS::_bind_methods() { @@ -1163,6 +1154,8 @@ void _OS::_bind_methods() { ObjectTypeDB::bind_method(_MD("set_use_vsync","enable"),&_OS::set_use_vsync); ObjectTypeDB::bind_method(_MD("is_vsnc_enabled"),&_OS::is_vsnc_enabled); + ObjectTypeDB::bind_method(_MD("get_engine_version"),&_OS::get_engine_version); + BIND_CONSTANT( DAY_SUNDAY ); BIND_CONSTANT( DAY_MONDAY ); BIND_CONSTANT( DAY_TUESDAY ); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 5bd427578a..b43c5246ed 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -315,6 +315,8 @@ public: void set_use_vsync(bool p_enable); bool is_vsnc_enabled() const; + Dictionary get_engine_version() const; + static _OS *get_singleton() { return singleton; } _OS(); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 58f3a4df2b..343a54e0d7 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1105,14 +1105,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions_for_type(const String for(List<String>::Element *E=extensions.front();E;E=E->next()) { String ext = E->get().to_lower(); - if (ext=="res") - continue; -// p_extensions->push_back("x"+ext); p_extensions->push_back(ext); } - p_extensions->push_back("res"); - } void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_extensions) const{ @@ -1122,12 +1117,9 @@ void ResourceFormatLoaderBinary::get_recognized_extensions(List<String> *p_exten for(List<String>::Element *E=extensions.front();E;E=E->next()) { String ext = E->get().to_lower(); - if (ext=="res") - continue; p_extensions->push_back(ext); } - p_extensions->push_back("res"); } bool ResourceFormatLoaderBinary::handles_type(const String& p_type) const{ @@ -2270,16 +2262,8 @@ bool ResourceFormatSaverBinary::recognize(const RES& p_resource) const { void ResourceFormatSaverBinary::get_recognized_extensions(const RES& p_resource,List<String> *p_extensions) const { - - //here comes the sun, lalalala String base = p_resource->get_base_extension().to_lower(); - if (base!="res") { - - p_extensions->push_back(base); - } - - p_extensions->push_back("res"); - + p_extensions->push_back(base); } diff --git a/scene/resources/scene_format_text.cpp b/core/io/resource_format_text.cpp index 95645107d4..ed4fbdfb73 100644 --- a/scene/resources/scene_format_text.cpp +++ b/core/io/resource_format_text.cpp @@ -26,7 +26,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ -#include "scene_format_text.h" +#include "resource_format_text.h" #include "globals.h" #include "version.h" diff --git a/scene/resources/scene_format_text.h b/core/io/resource_format_text.h index 6122a1f9d8..6122a1f9d8 100644 --- a/scene/resources/scene_format_text.h +++ b/core/io/resource_format_text.h diff --git a/core/os/input.cpp b/core/os/input.cpp index efbae57950..531db73838 100644 --- a/core/os/input.cpp +++ b/core/os/input.cpp @@ -66,6 +66,7 @@ void Input::_bind_methods() { ObjectTypeDB::bind_method(_MD("stop_joy_vibration", "device"), &Input::stop_joy_vibration); ObjectTypeDB::bind_method(_MD("get_accelerometer"),&Input::get_accelerometer); ObjectTypeDB::bind_method(_MD("get_magnetometer"),&Input::get_magnetometer); + ObjectTypeDB::bind_method(_MD("get_gyroscope"),&Input::get_gyroscope); //ObjectTypeDB::bind_method(_MD("get_mouse_pos"),&Input::get_mouse_pos); - this is not the function you want ObjectTypeDB::bind_method(_MD("get_mouse_speed"),&Input::get_mouse_speed); ObjectTypeDB::bind_method(_MD("get_mouse_button_mask"),&Input::get_mouse_button_mask); diff --git a/core/os/input.h b/core/os/input.h index d11703470b..16bcc0ff9a 100644 --- a/core/os/input.h +++ b/core/os/input.h @@ -82,6 +82,7 @@ public: virtual Vector3 get_accelerometer()=0; virtual Vector3 get_magnetometer()=0; + virtual Vector3 get_gyroscope()=0; virtual void action_press(const StringName& p_action)=0; virtual void action_release(const StringName& p_action)=0; diff --git a/core/os/os.cpp b/core/os/os.cpp index e501bc2eb5..284bcb30cb 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -32,6 +32,8 @@ #include "dir_access.h" #include "globals.h" #include "input.h" +// For get_engine_version, could be removed if it's moved to a new Engine singleton +#include "version.h" OS* OS::singleton=NULL; @@ -548,6 +550,28 @@ bool OS::is_vsnc_enabled() const{ return true; } +Dictionary OS::get_engine_version() const { + + Dictionary dict; + dict["major"] = _MKSTR(VERSION_MAJOR); + dict["minor"] = _MKSTR(VERSION_MINOR); +#ifdef VERSION_PATCH + dict["patch"] = _MKSTR(VERSION_PATCH); +#else + dict["patch"] = ""; +#endif + dict["status"] = _MKSTR(VERSION_STATUS); + dict["revision"] = _MKSTR(VERSION_REVISION); + + String stringver = String(dict["major"]) + "." + String(dict["minor"]); + if (dict["patch"] != "") + stringver += "." + String(dict["patch"]); + stringver += "-" + String(dict["status"]) + " (" + String(dict["revision"]) + ")"; + dict["string"] = stringver; + + return dict; +} + OS::OS() { last_error=NULL; frames_drawn=0; diff --git a/core/os/os.h b/core/os/os.h index c291d09250..40f3989a55 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -186,14 +186,14 @@ public: virtual void set_target_fps(int p_fps); virtual float get_target_fps() const; - virtual float get_frames_per_second() const { return _fps; }; + virtual float get_frames_per_second() const { return _fps; } virtual void set_keep_screen_on(bool p_enabled); virtual bool is_keep_screen_on() const; virtual void set_low_processor_usage_mode(bool p_enabled); virtual bool is_in_low_processor_usage_mode() const; - virtual String get_installed_templates_path() const { return ""; }; + virtual String get_installed_templates_path() const { return ""; } virtual String get_executable_path() const; virtual Error execute(const String& p_path, const List<String>& p_arguments,bool p_blocking,ProcessID *r_child_id=NULL,String* r_pipe=NULL,int *r_exitcode=NULL)=0; virtual Error kill(const ProcessID& p_pid)=0; @@ -363,7 +363,7 @@ public: virtual void set_screen_orientation(ScreenOrientation p_orientation); ScreenOrientation get_screen_orientation() const; - virtual void move_window_to_foreground() {}; + virtual void move_window_to_foreground() {} virtual void debug_break(); @@ -423,6 +423,8 @@ public: virtual void set_use_vsync(bool p_enable); virtual bool is_vsnc_enabled() const; + Dictionary get_engine_version() const; + bool is_hidpi_allowed() const { return _allow_hidpi; } OS(); virtual ~OS(); diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp index 97bd5f2a32..65427b1ea7 100644 --- a/core/register_core_types.cpp +++ b/core/register_core_types.cpp @@ -42,6 +42,7 @@ #include "translation.h" #include "compressed_translation.h" #include "io/translation_loader_po.h" +#include "io/resource_format_text.h" #include "io/resource_format_xml.h" #include "io/resource_format_binary.h" #include "io/stream_peer_ssl.h" @@ -53,6 +54,9 @@ #include "input_map.h" #include "undo_redo.h" + +static ResourceFormatSaverText *resource_saver_text=NULL; +static ResourceFormatLoaderText *resource_loader_text=NULL; #ifdef XML_ENABLED static ResourceFormatSaverXML *resource_saver_xml=NULL; static ResourceFormatLoaderXML *resource_loader_xml=NULL; @@ -96,6 +100,11 @@ void register_core_types() { resource_format_po = memnew( TranslationLoaderPO ); ResourceLoader::add_resource_format_loader( resource_format_po ); + // Register text formats before to give them precedence on saving + resource_saver_text = memnew( ResourceFormatSaverText ); + ResourceSaver::add_resource_format_saver(resource_saver_text); + resource_loader_text = memnew( ResourceFormatLoaderText ); + ResourceLoader::add_resource_format_loader(resource_loader_text); resource_saver_binary = memnew( ResourceFormatSaverBinary ); ResourceSaver::add_resource_format_saver(resource_saver_binary); @@ -202,6 +211,11 @@ void unregister_core_types() { if (resource_loader_binary) memdelete(resource_loader_binary); + if (resource_saver_text) + memdelete(resource_saver_text); + if (resource_loader_text) + memdelete(resource_loader_text); + memdelete( resource_format_po ); diff --git a/core/resource.cpp b/core/resource.cpp index b80ec7012d..e8d4069779 100644 --- a/core/resource.cpp +++ b/core/resource.cpp @@ -95,10 +95,9 @@ bool ResourceImportMetadata::has_option(const String& p_key) const { return options.has(p_key); } + Variant ResourceImportMetadata::get_option(const String& p_key) const { - if (!options.has(p_key)) - print_line(p_key); ERR_FAIL_COND_V(!options.has(p_key),Variant()); return options[p_key]; @@ -487,8 +486,6 @@ void ResourceCache::dump(const char* p_file,bool p_short) { if (!p_short) { if (f) f->store_line(r->get_type()+": "+r->get_path()); - else - print_line(r->get_type()+": "+r->get_path()); } } @@ -496,8 +493,6 @@ void ResourceCache::dump(const char* p_file,bool p_short) { if (f) f->store_line(E->key()+" count: "+itos(E->get())); - else - print_line(E->key()+" count: "+itos(E->get())); } if (f) { f->close(); diff --git a/core/translation.cpp b/core/translation.cpp index ee0ef2ea09..01789747ea 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -54,6 +54,9 @@ static const char* locale_list[]={ "be_BY", // Belarusian (Belarus) "bg", // Bulgarian "bg_BG", // Bulgarian (Bulgaria) +"bn", // Bengali +"bn_BD", // Bengali (Bangladesh) +"bn_IN", // Bengali (India) "ca", // Catalan "ca_ES", // Catalan (Spain) "cs", // Czech @@ -178,6 +181,9 @@ static const char* locale_list[]={ "tr_TR", // Turkish (Turkey) "uk", // Ukrainian "uk_UA", // Ukrainian (Ukraine) +"ur", // Urdu +"ur_IN", // Urdu (India) +"ur_PK", // Urdu (Pakistan) "vi", // Vietnamese "vi_VN", // Vietnamese (Vietnam) "zh", // Chinese @@ -211,6 +217,9 @@ static const char* locale_names[]={ "Belarusian (Belarus)", "Bulgarian", "Bulgarian (Bulgaria)", +"Bengali", +"Bengali (Bangladesh)", +"Bengali (India)", "Catalan", "Catalan (Spain)", "Czech", @@ -335,6 +344,9 @@ static const char* locale_names[]={ "Turkish (Turkey)", "Ukrainian", "Ukrainian (Ukraine)", +"Urdu", +"Urdu (India)", +"Urdu (Pakistan)", "Vietnamese", "Vietnamese (Vietnam)", "Chinese", diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 02dba3b7a8..5be3639d9f 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -12999,6 +12999,11 @@ Return the font descent (number of pixels below the baseline). </description> </method> + <method name="update_changes"> + <description> + After editing a font (changing size, ascent, char rects, etc.). Call this function to propagate changes to controls that might use it. + </description> + </method> <method name="get_height" qualifiers="const"> <return type="float"> </return> @@ -15797,6 +15802,13 @@ Returns an [Array] containing the device IDs of all currently connected joysticks. </description> </method> + <method name="get_gyroscope"> + <return type="Vector3"> + </return> + <description> + If the device has a gyroscope, this will return the rate of rotation in rad/s around a device's x, y, and z axis. + </description> + </method> <method name="get_joy_axis"> <return type="float"> </return> @@ -39234,6 +39246,20 @@ Set the text editor caret blink speed. Cannot be less then or equal to 0. </description> </method> + <method name="cursor_set_block_mode"> + <argument index="0" name="enable" type="bool"> + </argument> + <description> + Set the text editor caret to block mode. + </description> + </method> + <method name="cursor_is_block_mode" qualifiers="const"> + <return type="bool"> + </return> + <description> + Gets whether the text editor caret is in block mode. + </description> + </method> <method name="cursor_set_column"> <argument index="0" name="column" type="int"> </argument> @@ -39479,6 +39505,11 @@ </method> </methods> <signals> + <signal name="breakpoint_toggled"> + <description> + Emitted when a breakpoint is placed via the breakpoint gutter. + </description> + </signal> <signal name="cursor_changed"> <description> Emitted when the cursor changes. @@ -39524,6 +39555,8 @@ </theme_item> <theme_item name="breakpoint_color" type="Color"> </theme_item> + <theme_item name="caret_background_color" type="Color"> + </theme_item> <theme_item name="caret_color" type="Color"> </theme_item> <theme_item name="completion" type="StyleBox"> diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 8cb7c7b698..fd515d6dd3 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -357,7 +357,6 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo pid_t pid = fork(); ERR_FAIL_COND_V(pid<0,ERR_CANT_FORK); - //print("execute: %s\n",p_path.utf8().get_data()); if (pid==0) { @@ -394,8 +393,6 @@ Error OS_Unix::execute(const String& p_path, const List<String>& p_arguments,boo pid_t rpid = waitpid(pid,&status,0); if (r_exitcode) *r_exitcode=WEXITSTATUS(status); - - print("returned: %i, waiting for: %i\n",rpid,pid); } else { if (r_child_id) @@ -498,7 +495,6 @@ String OS_Unix::get_executable_path() const { char buf[256]; memset(buf,0,256); readlink("/proc/self/exe", buf, sizeof(buf)); - //print_line("Exec path is:"+String(buf)); String b; b.parse_utf8(buf); if (b=="") { diff --git a/main/input_default.cpp b/main/input_default.cpp index 945898f1f3..5e66a8b585 100644 --- a/main/input_default.cpp +++ b/main/input_default.cpp @@ -259,6 +259,12 @@ Vector3 InputDefault::get_magnetometer() { return magnetometer; } +Vector3 InputDefault::get_gyroscope() { + + _THREAD_SAFE_METHOD_ + return gyroscope; +} + void InputDefault::parse_input_event(const InputEvent& p_event) { _THREAD_SAFE_METHOD_ @@ -386,6 +392,14 @@ void InputDefault::set_magnetometer(const Vector3& p_magnetometer) { } +void InputDefault::set_gyroscope(const Vector3& p_gyroscope) { + + _THREAD_SAFE_METHOD_ + + gyroscope=p_gyroscope; + +} + void InputDefault::set_main_loop(MainLoop *p_main_loop) { main_loop=p_main_loop; diff --git a/main/input_default.h b/main/input_default.h index 644af15e3b..cb71312e22 100644 --- a/main/input_default.h +++ b/main/input_default.h @@ -44,6 +44,7 @@ class InputDefault : public Input { Map<StringName,int> custom_action_press; Vector3 accelerometer; Vector3 magnetometer; + Vector3 gyroscope; Vector2 mouse_pos; MainLoop *main_loop; @@ -179,6 +180,7 @@ public: virtual Vector3 get_accelerometer(); virtual Vector3 get_magnetometer(); + virtual Vector3 get_gyroscope(); virtual Point2 get_mouse_pos() const; virtual Point2 get_mouse_speed() const; @@ -190,6 +192,7 @@ public: void parse_input_event(const InputEvent& p_event); void set_accelerometer(const Vector3& p_accel); void set_magnetometer(const Vector3& p_magnetometer); + void set_gyroscope(const Vector3& p_gyroscope); void set_joy_axis(int p_device,int p_axis,float p_value); virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration=0); diff --git a/modules/gdscript/gd_compiler.cpp b/modules/gdscript/gd_compiler.cpp index 304ed6b100..68c3dc98d3 100644 --- a/modules/gdscript/gd_compiler.cpp +++ b/modules/gdscript/gd_compiler.cpp @@ -1436,6 +1436,7 @@ Error GDCompiler::_parse_class(GDScript *p_script, GDScript *p_owner, const GDPa p_script->member_functions.clear(); p_script->member_indices.clear(); p_script->member_info.clear(); + p_script->_signals.clear(); p_script->initializer=NULL; p_script->subclasses.clear(); diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 9f909d7041..2371274d9d 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -314,6 +314,7 @@ struct engine { ASensorManager* sensorManager; const ASensor* accelerometerSensor; const ASensor* magnetometerSensor; + const ASensor* gyroscopeSensor; ASensorEventQueue* sensorEventQueue; bool display_active; @@ -746,6 +747,15 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { engine->magnetometerSensor, (1000L/60)*1000); } + // And the gyroscope. + if (engine->gyroscopeSensor != NULL) { + ASensorEventQueue_enableSensor(engine->sensorEventQueue, + engine->gyroscopeSensor); + // We'd like to get 60 events per second (in us). + ASensorEventQueue_setEventRate(engine->sensorEventQueue, + engine->gyroscopeSensor, (1000L/60)*1000); + + } engine->animating = 1; break; case APP_CMD_LOST_FOCUS: @@ -759,6 +769,10 @@ static void engine_handle_cmd(struct android_app* app, int32_t cmd) { ASensorEventQueue_disableSensor(engine->sensorEventQueue, engine->magnetometerSensor); } + if (engine->gyroscopeSensor != NULL) { + ASensorEventQueue_disableSensor(engine->sensorEventQueue, + engine->gyroscopeSensor); + } // Also stop animating. engine->animating = 0; engine_draw_frame(engine); @@ -788,6 +802,8 @@ void android_main(struct android_app* state) { ASENSOR_TYPE_ACCELEROMETER); engine.magnetometerSensor = ASensorManager_getDefaultSensor(engine.sensorManager, ASENSOR_TYPE_MAGNETIC_FIELD); + engine.gyroscopeSensor = ASensorManager_getDefaultSensor(engine.sensorManager, + ASENSOR_TYPE_GYROSCOPE); engine.sensorEventQueue = ASensorManager_createEventQueue(engine.sensorManager, state->looper, LOOPER_ID_USER, NULL, NULL); @@ -828,7 +844,7 @@ void android_main(struct android_app* state) { // If a sensor has data, process it now. // LOGI("events\n"); if (ident == LOOPER_ID_USER) { - if (engine.accelerometerSensor != NULL || engine.magnetometerSensor != NULL) { + if (engine.accelerometerSensor != NULL || engine.magnetometerSensor != NULL || engine.gyroscopeSensor != NULL) { ASensorEvent event; while (ASensorEventQueue_getEvents(engine.sensorEventQueue, &event, 1) > 0) { @@ -843,6 +859,10 @@ void android_main(struct android_app* state) { engine.os->process_magnetometer(Vector3(event.magnetic.x, event.magnetic.y, event.magnetic.z)); } + if (event.vector != NULL) { + engine.os->process_gyroscope(Vector3(event.vector.x, event.vector.y, + event.vector.z)); + } } } diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index 4c0f4878f5..4b80db7e33 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -217,6 +217,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC private SensorManager mSensorManager; private Sensor mAccelerometer; private Sensor mMagnetometer; + private Sensor mGyroscope; public FrameLayout layout; public RelativeLayout adLayout; @@ -387,6 +388,8 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); mMagnetometer = mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD); mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME); + mGyroscope = mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); + mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME); result_callback = null; @@ -604,6 +607,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC mView.onResume(); mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_GAME); mSensorManager.registerListener(this, mMagnetometer, SensorManager.SENSOR_DELAY_GAME); + mSensorManager.registerListener(this, mGyroscope, SensorManager.SENSOR_DELAY_GAME); GodotLib.focusin(); if(use_immersive && Build.VERSION.SDK_INT >= 19.0){ // check if the application runs on an android 4.4+ Window window = getWindow(); @@ -670,6 +674,9 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC if (typeOfSensor == event.sensor.TYPE_MAGNETIC_FIELD) { GodotLib.magnetometer(x,y,z); } + if (typeOfSensor == event.sensor.TYPE_GYROSCOPE) { + GodotLib.gyroscope(x,y,z); + } } @Override public final void onAccuracyChanged(Sensor sensor, int accuracy) { diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java index df181ae1bb..9a2ea7df10 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java @@ -52,6 +52,7 @@ public class GodotLib { public static native void touch(int what,int pointer,int howmany, int[] arr); public static native void accelerometer(float x, float y, float z); public static native void magnetometer(float x, float y, float z); + public static native void gyroscope(float x, float y, float z); public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed); public static native void joybutton(int p_device, int p_but, boolean p_pressed); public static native void joyaxis(int p_device, int p_axis, float p_value); diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 45d02876ba..b9d178280c 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -653,6 +653,7 @@ static bool quit_request=false; static Size2 new_size; static Vector3 accelerometer; static Vector3 magnetometer; +static Vector3 gyroscope; static HashMap<String,JNISingleton*> jni_singletons; static jobject godot_io; @@ -1093,6 +1094,8 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_step(JNIEnv * env, jo os_android->process_magnetometer(magnetometer); + os_android->process_gyroscope(gyroscope); + if (os_android->main_loop_iterate()==true) { jclass cls = env->FindClass("org/godotengine/godot/Godot"); @@ -1501,6 +1504,14 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * } +JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z) { + + input_mutex->lock(); + gyroscope=Vector3(x,y,z); + input_mutex->unlock(); + +} + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj){ if (!suspend_mutex) diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h index f7916efe2c..ae7ced45ee 100644 --- a/platform/android/java_glue.h +++ b/platform/android/java_glue.h @@ -50,6 +50,7 @@ extern "C" { JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_audio(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_accelerometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_magnetometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z); + JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_gyroscope(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusin(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_focusout(JNIEnv * env, jobject obj); JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv * env, jobject obj, jstring name,jobject p_object); diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 13cdf2a020..3c2b4c22e7 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -614,6 +614,11 @@ void OS_Android::process_magnetometer(const Vector3& p_magnetometer) { input->set_magnetometer(p_magnetometer); } +void OS_Android::process_gyroscope(const Vector3& p_gyroscope) { + + input->set_gyroscope(p_gyroscope); +} + bool OS_Android::has_touchscreen_ui_hint() const { return true; diff --git a/platform/android/os_android.h b/platform/android/os_android.h index e82e08ea49..7f39784a74 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -242,6 +242,7 @@ public: void process_accelerometer(const Vector3& p_accelerometer); void process_magnetometer(const Vector3& p_magnetometer); + void process_gyroscope(const Vector3& p_gyroscope); void process_touch(int p_what,int p_pointer, const Vector<TouchPos>& p_points); void process_joy_event(JoystickEvent p_event); void process_event(InputEvent p_event); diff --git a/platform/windows/godot.manifest b/platform/windows/godot.manifest deleted file mode 100644 index c095f007b0..0000000000 --- a/platform/windows/godot.manifest +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="yes"?> -<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> - <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> - <security> - <requestedPrivileges> - <requestedExecutionLevel level="asInvoker" uiAccess="false"/> - </requestedPrivileges> - </security> - </trustInfo> - <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> - <application> - <!-- Windows 10 --> - <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> - <!-- Windows 8.1 --> - <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> - <!-- Windows 8 --> - <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> - <!-- Windows 7 --> - <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> - <!-- Windows Vista --> - <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> - </application> - </compatibility> -</assembly> diff --git a/platform/windows/godot_res.rc b/platform/windows/godot_res.rc index d069ecdc79..5f1e951e0f 100644 --- a/platform/windows/godot_res.rc +++ b/platform/windows/godot_res.rc @@ -1,4 +1,3 @@ -#include <winuser.h> #include "core/version.h" #ifndef _STR #define _STR(m_x) #m_x @@ -7,8 +6,6 @@ GODOT_ICON ICON platform/windows/godot.ico -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST platform/windows/godot.manifest - 1 VERSIONINFO FILEVERSION VERSION_MAJOR,VERSION_MINOR,0,0 PRODUCTVERSION VERSION_MAJOR,VERSION_MINOR,0,0 diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 28d67287d5..d6e084765d 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -39,7 +39,8 @@ void MenuButton::_unhandled_key_input(InputEvent p_event) { return; - int item = popup->activate_item_by_event(p_event); + if (popup->activate_item_by_event(p_event)) + accept_event(); } } diff --git a/scene/gui/popup.cpp b/scene/gui/popup.cpp index 8d02d0e4e5..5b83c3f8b8 100644 --- a/scene/gui/popup.cpp +++ b/scene/gui/popup.cpp @@ -125,8 +125,6 @@ void Popup::set_as_minsize() { } - print_line(String(c->get_type())+": "+minsize); - total_minsize.width = MAX( total_minsize.width, minsize.width ); total_minsize.height = MAX( total_minsize.height, minsize.height ); } @@ -168,8 +166,6 @@ void Popup::popup_centered_minsize(const Size2& p_minsize) { } - print_line(String(c->get_type())+": "+minsize); - total_minsize.width = MAX( total_minsize.width, minsize.width ); total_minsize.height = MAX( total_minsize.height, minsize.height ); } diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index b4fa463cde..73a3cda5f3 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -662,7 +662,9 @@ void RichTextLabel::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { - set_bbcode(bbcode); + if (bbcode != "") + set_bbcode(bbcode); + main->first_invalid_line=0; //invalidate ALL update(); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index a680d5d873..46b64ce401 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -999,34 +999,38 @@ void TextEdit::_notification(int p_what) { } } - - if (str[j]>=32) - cache.font->draw_char(ci,Point2i( char_ofs+char_margin, ofs_y+ascent),str[j],str[j+1],in_selection?cache.font_selected_color:color); - - else if (draw_tabs && str[j]=='\t') { - int yofs= (get_row_height() - cache.tab_icon->get_height())/2; - cache.tab_icon->draw(ci, Point2(char_ofs+char_margin,ofs_y+yofs),in_selection?cache.font_selected_color:color); - } - - if (cursor.column==j && cursor.line==line) { cursor_pos = Point2i( char_ofs+char_margin, ofs_y ); if (insert_mode) { - cursor_pos.y += get_row_height(); + cursor_pos.y += (get_row_height() - 3); } if (draw_caret) { if (insert_mode) { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); + int caret_h = (block_caret) ? 4 : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,caret_h)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); + int caret_w = (block_caret) ? char_w : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(caret_w,get_row_height())),cache.caret_color); } } } - char_ofs+=char_w; + if (cursor.column==j && cursor.line==line && block_caret && draw_caret && !insert_mode) { + color = cache.caret_background_color; + } + + if (str[j]>=32) + cache.font->draw_char(ci,Point2i( char_ofs+char_margin, ofs_y+ascent),str[j],str[j+1],in_selection?cache.font_selected_color:color); + + else if (draw_tabs && str[j]=='\t') { + int yofs= (get_row_height() - cache.tab_icon->get_height())/2; + cache.tab_icon->draw(ci, Point2(char_ofs+char_margin,ofs_y+yofs),in_selection?cache.font_selected_color:color); + } + + char_ofs+=char_w; } if (cursor.column==str.length() && cursor.line==line && (char_ofs+char_margin)>=xmargin_beg) { @@ -1034,15 +1038,18 @@ void TextEdit::_notification(int p_what) { cursor_pos=Point2i( char_ofs+char_margin, ofs_y ); if (insert_mode) { - cursor_pos.y += get_row_height(); + cursor_pos.y += (get_row_height() - 3); } if (draw_caret) { if (insert_mode) { int char_w = cache.font->get_char_size(' ').width; - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,1)),cache.caret_color); + int caret_h = (block_caret) ? 4 : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(char_w,caret_h)),cache.caret_color); } else { - VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(1,get_row_height())),cache.caret_color); + int char_w = cache.font->get_char_size(' ').width; + int caret_w = (block_caret) ? char_w : 1; + VisualServer::get_singleton()->canvas_item_add_rect(ci,Rect2(cursor_pos, Size2i(caret_w,get_row_height())),cache.caret_color); } } } @@ -1502,6 +1509,7 @@ void TextEdit::_input_event(const InputEvent& p_input_event) { int gutter=cache.style_normal->get_margin(MARGIN_LEFT); if (mb.x > gutter && mb.x <= gutter + cache.breakpoint_gutter_width + 3) { set_line_as_breakpoint(row, !is_line_set_as_breakpoint(row)); + emit_signal("breakpoint_toggled", row); return; } } @@ -3074,6 +3082,15 @@ void TextEdit::cursor_set_blink_speed(const float p_speed) { caret_blink_timer->set_wait_time(p_speed); } +void TextEdit::cursor_set_block_mode(const bool p_enable){ + block_caret = p_enable; + update(); +} + +bool TextEdit::cursor_is_block_mode() const { + return block_caret; +} + void TextEdit::_scroll_moved(double p_to_val) { @@ -3315,6 +3332,7 @@ void TextEdit::_update_caches() { cache.completion_font_color=get_color("completion_font_color"); cache.font=get_font("font"); cache.caret_color=get_color("caret_color"); + cache.caret_background_color=get_color("caret_background_color"); cache.line_number_color=get_color("line_number_color"); cache.font_color=get_color("font_color"); cache.font_selected_color=get_color("font_selected_color"); @@ -4417,6 +4435,8 @@ void TextEdit::_bind_methods() { ObjectTypeDB::bind_method(_MD("cursor_get_blink_enabled"),&TextEdit::cursor_get_blink_enabled); ObjectTypeDB::bind_method(_MD("cursor_set_blink_speed", "blink_speed"),&TextEdit::cursor_set_blink_speed); ObjectTypeDB::bind_method(_MD("cursor_get_blink_speed"),&TextEdit::cursor_get_blink_speed); + ObjectTypeDB::bind_method(_MD("cursor_set_block_mode", "enable"), &TextEdit::cursor_set_block_mode); + ObjectTypeDB::bind_method(_MD("cursor_is_block_mode"), &TextEdit::cursor_is_block_mode); ObjectTypeDB::bind_method(_MD("set_readonly","enable"),&TextEdit::set_readonly); ObjectTypeDB::bind_method(_MD("set_wrap","enable"),&TextEdit::set_wrap); @@ -4462,12 +4482,14 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_line_numbers"), _SCS("set_show_line_numbers"), _SCS("is_show_line_numbers_enabled")); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "highlight_all_occurrences"), _SCS("set_highlight_all_occurrences"), _SCS("is_highlight_all_occurrences_enabled")); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/block_caret"), _SCS("cursor_set_block_mode"), _SCS("cursor_is_block_mode")); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "caret/caret_blink"), _SCS("cursor_set_blink_enabled"), _SCS("cursor_get_blink_enabled")); ADD_PROPERTYNZ(PropertyInfo(Variant::REAL, "caret/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1,10,0.1"), _SCS("cursor_set_blink_speed"),_SCS("cursor_get_blink_speed") ); ADD_SIGNAL(MethodInfo("cursor_changed")); ADD_SIGNAL(MethodInfo("text_changed")); ADD_SIGNAL(MethodInfo("request_completion")); + ADD_SIGNAL(MethodInfo("breakpoint_toggled", PropertyInfo( Variant::INT, "row"))); BIND_CONSTANT( MENU_CUT ); BIND_CONSTANT( MENU_COPY ); @@ -4527,6 +4549,7 @@ TextEdit::TextEdit() { selection.active=false; syntax_coloring=false; + block_caret=false; caret_blink_enabled=false; caret_blink_timer = memnew(Timer); add_child(caret_blink_timer); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 270a1723b1..65e9615911 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -79,6 +79,7 @@ class TextEdit : public Control { Color completion_existing_color; Color completion_font_color; Color caret_color; + Color caret_background_color; Color line_number_color; Color font_color; Color font_selected_color; @@ -222,6 +223,7 @@ class TextEdit : public Control { bool caret_blink_enabled; bool draw_caret; bool window_has_focus; + bool block_caret; bool setting_row; bool wrap; @@ -406,6 +408,9 @@ public: float cursor_get_blink_speed() const; void cursor_set_blink_speed(const float p_speed); + void cursor_set_block_mode(const bool p_enable); + bool cursor_is_block_mode() const; + void set_readonly(bool p_readonly); void set_max_chars(int p_max_chars); diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 305a3920da..82459ba0ab 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -693,6 +693,7 @@ void TreeItem::_bind_methods() { ObjectTypeDB::bind_method(_MD("add_button","column","button:Texture","button_idx","disabled"),&TreeItem::add_button,DEFVAL(-1),DEFVAL(false)); ObjectTypeDB::bind_method(_MD("get_button_count","column"),&TreeItem::get_button_count); ObjectTypeDB::bind_method(_MD("get_button:Texture","column","button_idx"),&TreeItem::get_button); + ObjectTypeDB::bind_method(_MD("set_button","column","button_idx","button:Texture"),&TreeItem::set_button); ObjectTypeDB::bind_method(_MD("erase_button","column","button_idx"),&TreeItem::erase_button); ObjectTypeDB::bind_method(_MD("is_button_disabled","column","button_idx"),&TreeItem::is_button_disabled); diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp index c83ab88c73..d848b9e5a5 100644 --- a/scene/register_scene_types.cpp +++ b/scene/register_scene_types.cpp @@ -222,8 +222,6 @@ #include "scene/3d/collision_polygon.h" #endif -#include "scene/resources/scene_format_text.h" - static ResourceFormatLoaderImage *resource_loader_image=NULL; static ResourceFormatLoaderWAV *resource_loader_wav=NULL; @@ -235,9 +233,6 @@ static ResourceFormatLoaderWAV *resource_loader_wav=NULL; static ResourceFormatLoaderTheme *resource_loader_theme=NULL; static ResourceFormatLoaderShader *resource_loader_shader=NULL; -static ResourceFormatSaverText *resource_saver_text=NULL; -static ResourceFormatLoaderText *resource_loader_text=NULL; - static ResourceFormatLoaderDynamicFont *resource_loader_dynamic_font=NULL; //static SceneStringNames *string_names; @@ -635,13 +630,6 @@ void register_scene_types() { OS::get_singleton()->yield(); //may take time to init - - resource_saver_text = memnew( ResourceFormatSaverText ); - ResourceSaver::add_resource_format_saver(resource_saver_text); - - resource_loader_text = memnew( ResourceFormatLoaderText ); - ResourceLoader::add_resource_format_loader(resource_loader_text); - } void unregister_scene_types() { @@ -661,11 +649,5 @@ void unregister_scene_types() { memdelete( resource_loader_theme ); memdelete( resource_loader_shader ); - if (resource_saver_text) { - memdelete(resource_saver_text); - } - if (resource_loader_text) { - memdelete(resource_loader_text); - } SceneStringNames::free(); } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 182bc5dabc..ffc5232e8f 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -481,6 +481,7 @@ void fill_default_theme(Ref<Theme>& t,const Ref<Font> & default_font,const Ref<F t->set_color("breakpoint_color","TextEdit", Color(0.8,0.8,0.4,0.2) ); t->set_color("current_line_color","TextEdit", Color(0.25,0.25,0.26,0.8) ); t->set_color("caret_color","TextEdit", control_font_color ); + t->set_color("caret_background_color", "TextEdit", Color::html("000000")); t->set_color("symbol_color","TextEdit", control_font_color_hover ); t->set_color("brace_mismatch_color","TextEdit", Color(1,0.2,0.2) ); t->set_color("line_number_color","TextEdit",Color::html("66aaaaaa")); diff --git a/scene/resources/font.cpp b/scene/resources/font.cpp index 6ad8a95565..1afa3fec19 100644 --- a/scene/resources/font.cpp +++ b/scene/resources/font.cpp @@ -71,6 +71,11 @@ void Font::draw(RID p_canvas_item, const Point2& p_pos, const String& p_text, co } } +void Font::update_changes() { + + emit_changed(); +} + void Font::_bind_methods() { ObjectTypeDB::bind_method(_MD("draw","canvas_item","pos","string","modulate","clip_w"),&Font::draw,DEFVAL(Color(1,1,1)),DEFVAL(-1)); @@ -80,6 +85,7 @@ void Font::_bind_methods() { ObjectTypeDB::bind_method(_MD("is_distance_field_hint"),&Font::is_distance_field_hint); ObjectTypeDB::bind_method(_MD("get_string_size","string"),&Font::get_string_size); ObjectTypeDB::bind_method(_MD("draw_char","canvas_item","pos","char","next","modulate"),&Font::draw_char,DEFVAL(-1),DEFVAL(Color(1,1,1))); + ObjectTypeDB::bind_method(_MD("update_changes"),&Font::update_changes); } diff --git a/scene/resources/font.h b/scene/resources/font.h index 67836564cd..fe4558f9e3 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -61,6 +61,7 @@ public: void draw_halign(RID p_canvas_item, const Point2& p_pos, HAlign p_align,float p_width,const String& p_text,const Color& p_modulate=Color(1,1,1)) const; virtual float draw_char(RID p_canvas_item, const Point2& p_pos, CharType p_char, CharType p_next=0,const Color& p_modulate=Color(1,1,1)) const=0; + void update_changes(); Font(); }; diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp index f6213f74e8..9dc54ef0e4 100644 --- a/scene/resources/material.cpp +++ b/scene/resources/material.cpp @@ -68,7 +68,7 @@ void Material::set_flag(Flag p_flag,bool p_enabled) { void Material::set_blend_mode(BlendMode p_blend_mode) { - ERR_FAIL_INDEX(p_blend_mode,3); + ERR_FAIL_INDEX(p_blend_mode,4); blend_mode=p_blend_mode; VisualServer::get_singleton()->material_set_blend_mode(material,(VS::MaterialBlendMode)p_blend_mode); _change_notify(); diff --git a/servers/physics_2d/body_pair_2d_sw.cpp b/servers/physics_2d/body_pair_2d_sw.cpp index 35f19605df..ba0358a1f2 100644 --- a/servers/physics_2d/body_pair_2d_sw.cpp +++ b/servers/physics_2d/body_pair_2d_sw.cpp @@ -298,19 +298,17 @@ bool BodyPair2DSW::setup(float p_step) { if (A->is_using_one_way_collision()) { Vector2 direction = A->get_one_way_collision_direction(); bool valid=false; - for(int i=0;i<contact_count;i++) { - Contact& c = contacts[i]; - - if (c.normal.dot(direction)<0) - continue; - if (B->get_linear_velocity().dot(direction)<0) - continue; - - if (!c.reused) { - continue; + if (B->get_linear_velocity().dot(direction)>=0){ + for(int i=0;i<contact_count;i++) { + Contact& c = contacts[i]; + if (!c.reused) + continue; + if (c.normal.dot(direction)<0) + continue; + + valid=true; + break; } - - valid=true; } if (!valid) { @@ -323,20 +321,17 @@ bool BodyPair2DSW::setup(float p_step) { if (B->is_using_one_way_collision()) { Vector2 direction = B->get_one_way_collision_direction(); bool valid=false; - for(int i=0;i<contact_count;i++) { - - Contact& c = contacts[i]; - - if (c.normal.dot(direction)<0) - continue; - if (A->get_linear_velocity().dot(direction)<0) - continue; - - if (!c.reused) { - continue; + if (A->get_linear_velocity().dot(direction)>=0){ + for(int i=0;i<contact_count;i++) { + Contact& c = contacts[i]; + if (!c.reused) + continue; + if (c.normal.dot(direction)<0) + continue; + + valid=true; + break; } - - valid=true; } if (!valid) { collided=false; diff --git a/tools/editor/editor_node.cpp b/tools/editor/editor_node.cpp index 81f9927b92..dee521beb3 100644 --- a/tools/editor/editor_node.cpp +++ b/tools/editor/editor_node.cpp @@ -704,7 +704,7 @@ void EditorNode::_get_scene_metadata(const String& p_file) { cf.instance(); Error err = cf->load(path); - if (err!=OK) + if (err!=OK || !cf->has_section("editor_states")) return; //must not exist List<String> esl; @@ -740,7 +740,14 @@ void EditorNode::_set_scene_metadata(const String& p_file, int p_idx) { Ref<ConfigFile> cf; cf.instance(); - Dictionary md = editor_data.get_edited_scene()==p_idx?editor_data.get_editor_states():editor_data.get_scene_editor_states(p_idx); + Dictionary md; + + if (p_idx<0 || editor_data.get_edited_scene()==p_idx) { + md = editor_data.get_editor_states(); + } else { + md = editor_data.get_scene_editor_states(p_idx); + } + List<Variant> keys; md.get_key_list(&keys); @@ -2154,7 +2161,7 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) { String existing; if (extensions.size()) { String root_name(get_edited_scene()->get_name()); - existing=root_name+".tscn";//+extensions.front()->get().to_lower(); + existing=root_name+"."+extensions.front()->get().to_lower(); } file->set_current_path(existing); diff --git a/tools/editor/editor_settings.cpp b/tools/editor/editor_settings.cpp index 7f496d0e22..c150e62754 100644 --- a/tools/editor/editor_settings.cpp +++ b/tools/editor/editor_settings.cpp @@ -554,6 +554,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) { set("text_editor/create_signal_callbacks",true); set("text_editor/autosave_interval_secs",0); + set("text_editor/block_caret", false); set("text_editor/caret_blink", false); set("text_editor/caret_blink_speed", 0.65); hints["text_editor/caret_blink_speed"]=PropertyInfo(Variant::REAL,"text_editor/caret_blink_speed",PROPERTY_HINT_RANGE,"0.1, 10, 0.1"); @@ -685,6 +686,7 @@ void EditorSettings::_load_default_text_editor_theme() { set("text_editor/completion_scroll_color", Color::html("ffffff")); set("text_editor/completion_font_color", Color::html("aaaaaa")); set("text_editor/caret_color",Color::html("aaaaaa")); + set("text_editor/caret_background_color", Color::html("000000")); set("text_editor/line_number_color",Color::html("66aaaaaa")); set("text_editor/text_color",Color::html("aaaaaa")); set("text_editor/text_selected_color",Color::html("000000")); @@ -922,6 +924,7 @@ bool EditorSettings::_save_text_editor_theme(String p_file) { cf->set_value(theme_section, "completion_scroll_color", ((Color)get("text_editor/completion_scroll_color")).to_html()); cf->set_value(theme_section, "completion_font_color", ((Color)get("text_editor/completion_font_color")).to_html()); cf->set_value(theme_section, "caret_color", ((Color)get("text_editor/caret_color")).to_html()); + cf->set_value(theme_section, "caret_background_color", ((Color)get("text_editor/caret_background_color")).to_html()); cf->set_value(theme_section, "line_number_color", ((Color)get("text_editor/line_number_color")).to_html()); cf->set_value(theme_section, "text_color", ((Color)get("text_editor/text_color")).to_html()); cf->set_value(theme_section, "text_selected_color", ((Color)get("text_editor/text_selected_color")).to_html()); diff --git a/tools/editor/io_plugins/editor_texture_import_plugin.cpp b/tools/editor/io_plugins/editor_texture_import_plugin.cpp index 1d8319d460..60642999f2 100644 --- a/tools/editor/io_plugins/editor_texture_import_plugin.cpp +++ b/tools/editor/io_plugins/editor_texture_import_plugin.cpp @@ -147,8 +147,6 @@ void EditorImportTextureOptions::_changed() { void EditorImportTextureOptions::_bind_methods() { - print_line("bind toptions"); - ObjectTypeDB::bind_method("_changed",&EditorImportTextureOptions::_changed); ObjectTypeDB::bind_method("_changedp",&EditorImportTextureOptions::_changedp); diff --git a/tools/editor/plugins/canvas_item_editor_plugin.cpp b/tools/editor/plugins/canvas_item_editor_plugin.cpp index db500cdcdf..f9499904db 100644 --- a/tools/editor/plugins/canvas_item_editor_plugin.cpp +++ b/tools/editor/plugins/canvas_item_editor_plugin.cpp @@ -3404,7 +3404,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_shortcut(ED_SHORTCUT("canvas_item_editor/zoom_set", TTR("Zoom Set..")), ZOOM_SET); p->add_separator(); p->add_shortcut(ED_SHORTCUT("canvas_item_editor/center_selection", TTR("Center Selection"), KEY_F), VIEW_CENTER_TO_SELECTION); - p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_CMD | KEY_F), VIEW_FRAME_TO_SELECTION); + p->add_shortcut(ED_SHORTCUT("canvas_item_editor/frame_selection", TTR("Frame Selection"), KEY_MASK_SHIFT | KEY_F), VIEW_FRAME_TO_SELECTION); anchor_menu = memnew( MenuButton ); anchor_menu->set_text(TTR("Anchor")); diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index fc5f552723..65741fd072 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -317,6 +317,7 @@ void ScriptTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); @@ -1012,6 +1013,18 @@ void ScriptEditor::swap_lines(TextEdit *tx, int line1, int line2) tx->cursor_set_line(line2); } +void ScriptEditor::_breakpoint_toggled(const int p_row) { + int selected = tab_container->get_current_tab(); + if (selected<0 || selected>=tab_container->get_child_count()) { + return; + } + + ScriptTextEditor *current = tab_container->get_child(selected)->cast_to<ScriptTextEditor>(); + if (current) { + get_debugger()->set_breakpoint(current->get_edited_script()->get_path(),p_row+1,current->get_text_edit()->is_line_set_as_breakpoint(p_row)); + } +} + void ScriptEditor::_file_dialog_action(String p_file) { switch (file_dialog_option) { @@ -2195,9 +2208,11 @@ void ScriptEditor::edit(const Ref<Script>& p_script) { ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); + ste->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); ste->get_text_edit()->set_callhint_settings( EditorSettings::get_singleton()->get("text_editor/put_callhint_tooltip_below_current_line"), EditorSettings::get_singleton()->get("text_editor/callhint_tooltip_offset")); + ste->get_text_edit()->connect("breakpoint_toggled", this, "_breakpoint_toggled"); tab_container->add_child(ste); _go_to_tab(tab_container->get_tab_count()-1); @@ -2362,6 +2377,7 @@ void ScriptEditor::_editor_settings_changed() { ste->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); ste->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); ste->get_text_edit()->set_draw_breakpoint_gutter(EditorSettings::get_singleton()->get("text_editor/show_breakpoint_gutter")); + ste->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); } ScriptServer::set_reload_scripts_on_save(EDITOR_DEF("text_editor/auto_reload_and_parse_scripts_on_save",true)); @@ -2671,6 +2687,7 @@ void ScriptEditor::_bind_methods() { ObjectTypeDB::bind_method("_res_saved_callback",&ScriptEditor::_res_saved_callback); ObjectTypeDB::bind_method("_goto_script_line",&ScriptEditor::_goto_script_line); ObjectTypeDB::bind_method("_goto_script_line2",&ScriptEditor::_goto_script_line2); + ObjectTypeDB::bind_method("_breakpoint_toggled", &ScriptEditor::_breakpoint_toggled); ObjectTypeDB::bind_method("_breaked",&ScriptEditor::_breaked); ObjectTypeDB::bind_method("_show_debugger",&ScriptEditor::_show_debugger); ObjectTypeDB::bind_method("_get_debug_tooltip",&ScriptEditor::_get_debug_tooltip); diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h index 2e6e2c035c..dfa72490a5 100644 --- a/tools/editor/plugins/script_editor_plugin.h +++ b/tools/editor/plugins/script_editor_plugin.h @@ -321,6 +321,7 @@ public: void get_breakpoints(List<String> *p_breakpoints); void swap_lines(TextEdit *tx, int line1, int line2); + void _breakpoint_toggled(const int p_row); void save_all_scripts(); diff --git a/tools/editor/plugins/shader_editor_plugin.cpp b/tools/editor/plugins/shader_editor_plugin.cpp index 9ef84af260..b3317e8313 100644 --- a/tools/editor/plugins/shader_editor_plugin.cpp +++ b/tools/editor/plugins/shader_editor_plugin.cpp @@ -86,6 +86,7 @@ void ShaderTextEditor::_load_theme_settings() { get_text_edit()->add_color_override("font_color",EDITOR_DEF("text_editor/text_color",Color(0,0,0))); get_text_edit()->add_color_override("line_number_color",EDITOR_DEF("text_editor/line_number_color",Color(0,0,0))); get_text_edit()->add_color_override("caret_color",EDITOR_DEF("text_editor/caret_color",Color(0,0,0))); + get_text_edit()->add_color_override("caret_background_color",EDITOR_DEF("text_editor/caret_background_color",Color(0,0,0))); get_text_edit()->add_color_override("font_selected_color",EDITOR_DEF("text_editor/text_selected_color",Color(1,1,1))); get_text_edit()->add_color_override("selection_color",EDITOR_DEF("text_editor/selection_color",Color(0.2,0.2,1))); get_text_edit()->add_color_override("brace_mismatch_color",EDITOR_DEF("text_editor/brace_mismatch_color",Color(1,0.2,0.2))); @@ -381,6 +382,7 @@ void ShaderEditor::_editor_settings_changed() { vertex_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); vertex_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); vertex_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + vertex_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); fragment_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); fragment_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -392,6 +394,7 @@ void ShaderEditor::_editor_settings_changed() { fragment_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); fragment_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); fragment_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + fragment_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); light_editor->get_text_edit()->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/auto_brace_complete")); light_editor->get_text_edit()->set_scroll_pass_end_of_file(EditorSettings::get_singleton()->get("text_editor/scroll_past_end_of_file")); @@ -403,6 +406,7 @@ void ShaderEditor::_editor_settings_changed() { light_editor->get_text_edit()->cursor_set_blink_enabled(EditorSettings::get_singleton()->get("text_editor/caret_blink")); light_editor->get_text_edit()->cursor_set_blink_speed(EditorSettings::get_singleton()->get("text_editor/caret_blink_speed")); light_editor->get_text_edit()->add_constant_override("line_spacing", EditorSettings::get_singleton()->get("text_editor/line_spacing")); + light_editor->get_text_edit()->cursor_set_block_mode(EditorSettings::get_singleton()->get("text_editor/block_caret")); } void ShaderEditor::_bind_methods() { diff --git a/tools/editor/scene_tree_editor.cpp b/tools/editor/scene_tree_editor.cpp index f174bc2f1b..cc11cbc562 100644 --- a/tools/editor/scene_tree_editor.cpp +++ b/tools/editor/scene_tree_editor.cpp @@ -260,13 +260,21 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item,int p_column,int p_id) } else if (p_id==BUTTON_SIGNALS) { - item->select(0); + editor_selection->clear(); + editor_selection->add_node(n); + + set_selected(n); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); NodeDock::singleton->show_connections(); } else if (p_id==BUTTON_GROUPS) { - item->select(0); + editor_selection->clear(); + editor_selection->add_node(n); + + set_selected(n); + NodeDock::singleton->get_parent()->call("set_current_tab",NodeDock::singleton->get_index()); NodeDock::singleton->show_groups(); } diff --git a/tools/editor/script_editor_debugger.cpp b/tools/editor/script_editor_debugger.cpp index fc746bc21d..b6390e5aae 100644 --- a/tools/editor/script_editor_debugger.cpp +++ b/tools/editor/script_editor_debugger.cpp @@ -338,8 +338,9 @@ void ScriptEditorDebugger::_parse_message(const String& p_msg,const Array& p_dat docontinue->set_disabled(false); emit_signal("breaked",true,can_continue); OS::get_singleton()->move_window_to_foreground(); - if (!profiler->is_seeking()) + if (error!="") { tabs->set_current_tab(0); + } profiler->set_enabled(false); diff --git a/tools/editor_fonts/LICENSE.DroidSans.txt b/tools/editor_fonts/LICENSE.DroidSans.txt new file mode 100644 index 0000000000..636f1e2975 --- /dev/null +++ b/tools/editor_fonts/LICENSE.DroidSans.txt @@ -0,0 +1,13 @@ +Copyright (C) 2008 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/tools/editor_fonts/LICENSE.SourceCodePro.txt b/tools/editor_fonts/LICENSE.SourceCodePro.txt new file mode 100644 index 0000000000..f430ee5dbe --- /dev/null +++ b/tools/editor_fonts/LICENSE.SourceCodePro.txt @@ -0,0 +1,94 @@ +Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries. + +This Font Software is licensed under the SIL Open Font License, Version 1.1. + +This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. + |