diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/array.cpp | 47 | ||||
-rw-r--r-- | core/array.h | 3 | ||||
-rw-r--r-- | core/bind/core_bind.cpp | 10 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/compressed_translation.cpp | 23 | ||||
-rw-r--r-- | core/io/file_access_encrypted.cpp | 1 | ||||
-rw-r--r-- | core/io/file_access_network.cpp | 2 | ||||
-rw-r--r-- | core/io/file_access_pack.h | 1 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 17 | ||||
-rw-r--r-- | core/io/stream_peer_ssl.cpp | 2 | ||||
-rw-r--r-- | core/math/expression.cpp | 9 | ||||
-rw-r--r-- | core/math/geometry.cpp | 10 | ||||
-rw-r--r-- | core/math/quick_hull.cpp | 9 | ||||
-rw-r--r-- | core/message_queue.cpp | 19 | ||||
-rw-r--r-- | core/oa_hash_map.h | 2 | ||||
-rw-r--r-- | core/object.cpp | 6 | ||||
-rw-r--r-- | core/os/dir_access.cpp | 6 | ||||
-rw-r--r-- | core/os/os.cpp | 12 | ||||
-rw-r--r-- | core/os/os.h | 2 | ||||
-rw-r--r-- | core/os/rw_lock.h | 6 | ||||
-rw-r--r-- | core/print_string.cpp | 7 | ||||
-rw-r--r-- | core/print_string.h | 1 | ||||
-rw-r--r-- | core/project_settings.cpp | 2 | ||||
-rw-r--r-- | core/script_debugger_remote.cpp | 5 | ||||
-rw-r--r-- | core/string_db.cpp | 5 | ||||
-rw-r--r-- | core/translation.cpp | 1 | ||||
-rw-r--r-- | core/ustring.cpp | 2 | ||||
-rw-r--r-- | core/variant_call.cpp | 4 |
28 files changed, 117 insertions, 99 deletions
diff --git a/core/array.cpp b/core/array.cpp index 44c553e4eb..ebad0df126 100644 --- a/core/array.cpp +++ b/core/array.cpp @@ -355,11 +355,58 @@ Variant Array::pop_front() { return Variant(); } +Variant Array::min() const { + + Variant minval; + for (int i = 0; i < size(); i++) { + if (i == 0) { + minval = get(i); + } else { + bool valid; + Variant ret; + Variant test = get(i); + Variant::evaluate(Variant::OP_LESS, test, minval, ret, valid); + if (!valid) { + return Variant(); //not a valid comparison + } + if (bool(ret)) { + //is less + minval = test; + } + } + } + return minval; +} + +Variant Array::max() const { + + Variant maxval; + for (int i = 0; i < size(); i++) { + if (i == 0) { + maxval = get(i); + } else { + bool valid; + Variant ret; + Variant test = get(i); + Variant::evaluate(Variant::OP_GREATER, test, maxval, ret, valid); + if (!valid) { + return Variant(); //not a valid comparison + } + if (bool(ret)) { + //is less + maxval = test; + } + } + } + return maxval; +} + Array::Array(const Array &p_from) { _p = NULL; _ref(p_from); } + Array::Array() { _p = memnew(ArrayPrivate); diff --git a/core/array.h b/core/array.h index e549a886e6..c824c9b4f7 100644 --- a/core/array.h +++ b/core/array.h @@ -90,6 +90,9 @@ public: Array duplicate(bool p_deep = false) const; + Variant min() const; + Variant max() const; + Array(const Array &p_from); Array(); ~Array(); diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index 26ba28370f..2bd271205a 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -240,6 +240,14 @@ PoolStringArray _OS::get_connected_midi_inputs() { return OS::get_singleton()->get_connected_midi_inputs(); } +void _OS::open_midi_inputs() { + return OS::get_singleton()->open_midi_inputs(); +} + +void _OS::close_midi_inputs() { + return OS::get_singleton()->close_midi_inputs(); +} + void _OS::set_video_mode(const Size2 &p_size, bool p_fullscreen, bool p_resizeable, int p_screen) { OS::VideoMode vm; @@ -1085,6 +1093,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count); ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name); ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs); + ClassDB::bind_method(D_METHOD("open_midi_inputs"), &_OS::open_midi_inputs); + ClassDB::bind_method(D_METHOD("close_midi_inputs"), &_OS::close_midi_inputs); ClassDB::bind_method(D_METHOD("get_screen_count"), &_OS::get_screen_count); ClassDB::bind_method(D_METHOD("get_current_screen"), &_OS::get_current_screen); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index b587b9257f..21aea12b23 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -157,6 +157,8 @@ public: virtual String get_audio_driver_name(int p_driver) const; virtual PoolStringArray get_connected_midi_inputs(); + virtual void open_midi_inputs(); + virtual void close_midi_inputs(); virtual int get_screen_count() const; virtual int get_current_screen() const; diff --git a/core/compressed_translation.cpp b/core/compressed_translation.cpp index 5c1fd26e2a..46df63066b 100644 --- a/core/compressed_translation.cpp +++ b/core/compressed_translation.cpp @@ -50,7 +50,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { int size = Math::larger_prime(keys.size()); - print_line("compressing keys: " + itos(keys.size())); Vector<Vector<Pair<int, CharString> > > buckets; Vector<Map<uint32_t, int> > table; Vector<uint32_t> hfunc_table; @@ -107,7 +106,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { } int bucket_table_size = 0; - print_line("total compressed string size: " + itos(total_compression_size) + " (" + itos(total_string_size) + " uncompressed)."); for (int i = 0; i < size; i++) { @@ -117,8 +115,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { if (b.size() == 0) continue; - //print_line("bucket: "+itos(i)+" - elements: "+itos(b.size())); - int d = 1; int item = 0; @@ -140,9 +136,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { bucket_table_size += 2 + b.size() * 4; } - print_line("bucket table size: " + itos(bucket_table_size * 4)); - print_line("hash table size: " + itos(size * 4)); - hash_table.resize(size); bucket_table.resize(bucket_table_size); @@ -178,8 +171,6 @@ void PHashTranslation::generate(const Ref<Translation> &p_from) { } } - print_line("total collisions: " + itos(collisions)); - strings.resize(total_compression_size); PoolVector<uint8_t>::Write cw = strings.write(); @@ -198,15 +189,11 @@ bool PHashTranslation::_set(const StringName &p_name, const Variant &p_value) { String name = p_name.operator String(); if (name == "hash_table") { hash_table = p_value; - //print_line("translation: loaded hash table of size: "+itos(hash_table.size())); } else if (name == "bucket_table") { bucket_table = p_value; - //print_line("translation: loaded bucket table of size: "+itos(bucket_table.size())); } else if (name == "strings") { strings = p_value; - //print_line("translation: loaded string table of size: "+itos(strings.size())); } else if (name == "load_from") { - //print_line("generating"); generate(p_value); } else return false; @@ -248,11 +235,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { uint32_t p = htptr[h % htsize]; - //print_line("String: "+p_src_text.operator String()); - //print_line("Hash: "+itos(p)); - if (p == 0xFFFFFFFF) { - //print_line("GETMSG: Nothing!"); return StringName(); //nothing } @@ -271,9 +254,7 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { } } - //print_line("bucket pos: "+itos(idx)); if (idx == -1) { - //print_line("GETMSG: Not in Bucket!"); return StringName(); } @@ -281,8 +262,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { String rstr; rstr.parse_utf8(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].uncomp_size); - //print_line("Uncompressed, size: "+itos(bucket.elem[idx].comp_size)); - //print_line("Return: "+rstr); return rstr; } else { @@ -292,8 +271,6 @@ StringName PHashTranslation::get_message(const StringName &p_src_text) const { smaz_decompress(&sptr[bucket.elem[idx].str_offset], bucket.elem[idx].comp_size, uncomp.ptrw(), bucket.elem[idx].uncomp_size); String rstr; rstr.parse_utf8(uncomp.get_data()); - //print_line("Compressed, size: "+itos(bucket.elem[idx].comp_size)); - //print_line("Return: "+rstr); return rstr; } } diff --git a/core/io/file_access_encrypted.cpp b/core/io/file_access_encrypted.cpp index bb7a444ccc..812e881114 100644 --- a/core/io/file_access_encrypted.cpp +++ b/core/io/file_access_encrypted.cpp @@ -43,7 +43,6 @@ Error FileAccessEncrypted::open_and_parse(FileAccess *p_base, const Vector<uint8_t> &p_key, Mode p_mode) { - //print_line("open and parse!"); ERR_FAIL_COND_V(file != NULL, ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(p_key.size() != 32, ERR_INVALID_PARAMETER); diff --git a/core/io/file_access_network.cpp b/core/io/file_access_network.cpp index e0a2dbf507..d72d3ca9f1 100644 --- a/core/io/file_access_network.cpp +++ b/core/io/file_access_network.cpp @@ -93,8 +93,6 @@ void FileAccessNetworkClient::_thread_func() { DEBUG_TIME("sem_unlock"); //DEBUG_PRINT("semwait returned "+itos(werr)); DEBUG_PRINT("MUTEX LOCK " + itos(lockcount)); - DEBUG_PRINT("POPO"); - DEBUG_PRINT("PEPE"); lock_mutex(); DEBUG_PRINT("MUTEX PASS"); diff --git a/core/io/file_access_pack.h b/core/io/file_access_pack.h index 8a40e6d78c..f29e431d9a 100644 --- a/core/io/file_access_pack.h +++ b/core/io/file_access_pack.h @@ -175,7 +175,6 @@ public: FileAccess *PackedData::try_open_path(const String &p_path) { - //print_line("try open path " + p_path); PathMD5 pmd5(p_path.md5_buffer()); Map<PathMD5, PackedFile>::Element *E = files.find(pmd5); if (!E) diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index 8b0655deb0..c01aff9144 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -204,8 +204,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p if (!p_no_cache && ResourceCache::has(local_path)) { - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + local_path + " (cached)"); + print_verbose("Loading resource: " + local_path + " (cached)"); if (r_error) *r_error = OK; return RES(ResourceCache::get(local_path)); @@ -216,9 +215,7 @@ RES ResourceLoader::load(const String &p_path, const String &p_type_hint, bool p ERR_FAIL_COND_V(path == "", RES()); - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + path); - + print_verbose("Loading resource: " + path); RES res = _load(path, local_path, p_type_hint, p_no_cache, r_error); if (res.is_null()) { @@ -286,9 +283,7 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ if (!p_no_cache && ResourceCache::has(local_path)) { - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: " + local_path + " (cached)"); - + print_verbose("Loading resource: " + local_path + " (cached)"); Ref<Resource> res_cached = ResourceCache::get(local_path); Ref<ResourceInteractiveLoaderDefault> ril = Ref<ResourceInteractiveLoaderDefault>(memnew(ResourceInteractiveLoaderDefault)); @@ -298,14 +293,10 @@ Ref<ResourceInteractiveLoader> ResourceLoader::load_interactive(const String &p_ bool xl_remapped = false; String path = _path_remap(local_path, &xl_remapped); - ERR_FAIL_COND_V(path == "", Ref<ResourceInteractiveLoader>()); - - if (OS::get_singleton()->is_stdout_verbose()) - print_line("load resource: "); + print_verbose("Loading resource: " + path); bool found = false; - for (int i = 0; i < loader_count; i++) { if (!loader[i]->recognize_path(path, p_type_hint)) diff --git a/core/io/stream_peer_ssl.cpp b/core/io/stream_peer_ssl.cpp index e7e9662d24..25adb6a6ee 100644 --- a/core/io/stream_peer_ssl.cpp +++ b/core/io/stream_peer_ssl.cpp @@ -81,7 +81,7 @@ PoolByteArray StreamPeerSSL::get_project_cert_array() { memdelete(f); #ifdef DEBUG_ENABLED - print_line("Loaded certs from '" + certs_path); + print_verbose(vformat("Loaded certs from '%s'.", certs_path)); #endif } } diff --git a/core/math/expression.cpp b/core/math/expression.cpp index a161dbddba..ba40cb4586 100644 --- a/core/math/expression.cpp +++ b/core/math/expression.cpp @@ -177,7 +177,7 @@ int Expression::get_func_argument_count(BuiltinFunc p_func) { } void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant *r_return, Variant::CallError &r_error, String &r_error_str) { - + r_error.error = Variant::CallError::CALL_OK; switch (p_func) { case MATH_SIN: { @@ -622,15 +622,12 @@ void Expression::exec_func(BuiltinFunc p_func, const Variant **p_inputs, Variant case TEXT_PRINTERR: { String str = *p_inputs[0]; - - //str+="\n"; print_error(str); } break; case TEXT_PRINTRAW: { - String str = *p_inputs[0]; - //str+="\n"; + String str = *p_inputs[0]; OS::get_singleton()->print("%s", str.utf8().get_data()); } break; @@ -1916,7 +1913,7 @@ bool Expression::_execute(const Array &p_inputs, Object *p_instance, Expression: bool valid; r_ret = base.get_named(index->name, &valid); if (!valid) { - r_error_str = vformat(RTR("Invalid named index '%s' for base type "), String(index->name), Variant::get_type_name(base.get_type())); + r_error_str = vformat(RTR("Invalid named index '%s' for base type %s"), String(index->name), Variant::get_type_name(base.get_type())); return true; } diff --git a/core/math/geometry.cpp b/core/math/geometry.cpp index 7ab28daf20..d8cb657b5e 100644 --- a/core/math/geometry.cpp +++ b/core/math/geometry.cpp @@ -626,7 +626,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e voxelsize.z /= div_z; // create and initialize cells to zero - //print_line("Wrapper: Initializing Cells"); uint8_t ***cell_status = memnew_arr(uint8_t **, div_x); for (int i = 0; i < div_x; i++) { @@ -645,7 +644,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } // plot faces into cells - //print_line("Wrapper (1/6): Plotting Faces"); for (int i = 0; i < face_count; i++) { @@ -659,8 +657,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // determine which cells connect to the outside by traversing the outside and recursively flood-fill marking - //print_line("Wrapper (2/6): Flood Filling"); - for (int i = 0; i < div_x; i++) { for (int j = 0; j < div_y; j++) { @@ -690,8 +686,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e // build faces for the inside-outside cell divisors - //print_line("Wrapper (3/6): Building Faces"); - PoolVector<Face3> wrapped_faces; for (int i = 0; i < div_x; i++) { @@ -705,8 +699,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } } - //print_line("Wrapper (4/6): Transforming Back Vertices"); - // transform face vertices to global coords int wrapped_faces_count = wrapped_faces.size(); @@ -724,7 +716,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e } // clean up grid - //print_line("Wrapper (5/6): Grid Cleanup"); for (int i = 0; i < div_x; i++) { @@ -740,7 +731,6 @@ PoolVector<Face3> Geometry::wrap_geometry(PoolVector<Face3> p_array, real_t *p_e if (p_error) *p_error = voxelsize.length(); - //print_line("Wrapper (6/6): Finished."); return wrapped_faces; } diff --git a/core/math/quick_hull.cpp b/core/math/quick_hull.cpp index 45c106102e..9d4f4f66b7 100644 --- a/core/math/quick_hull.cpp +++ b/core/math/quick_hull.cpp @@ -62,7 +62,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me Vector3 sp = p_points[i].snapped(Vector3(0.0001, 0.0001, 0.0001)); if (valid_cache.has(sp)) { valid_points.write[i] = false; - //print_line("INVALIDATED: "+itos(i)); } else { valid_points.write[i] = true; valid_cache.insert(sp); @@ -455,7 +454,6 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me //fill mesh r_mesh.faces.clear(); r_mesh.faces.resize(ret_faces.size()); - //print_line("FACECOUNT: "+itos(r_mesh.faces.size())); int idx = 0; for (List<Geometry::MeshData::Face>::Element *E = ret_faces.front(); E; E = E->next()) { @@ -473,12 +471,5 @@ Error QuickHull::build(const Vector<Vector3> &p_points, Geometry::MeshData &r_me r_mesh.vertices = p_points; - //r_mesh.optimize_vertices(); - /* - print_line("FACES: "+itos(r_mesh.faces.size())); - print_line("EDGES: "+itos(r_mesh.edges.size())); - print_line("VERTICES: "+itos(r_mesh.vertices.size())); -*/ - return OK; } diff --git a/core/message_queue.cpp b/core/message_queue.cpp index 3adaad868a..97ee236a46 100644 --- a/core/message_queue.cpp +++ b/core/message_queue.cpp @@ -50,9 +50,9 @@ Error MessageQueue::push_call(ObjectID p_id, const StringName &p_method, const V String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed method: " + type + ":" + p_method + " target ID: " + itos(p_id)); + print_line("Failed method: " + type + ":" + p_method + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -101,9 +101,9 @@ Error MessageQueue::push_set(ObjectID p_id, const StringName &p_prop, const Vari String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id)); + print_line("Failed set: " + type + ":" + p_prop + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -134,9 +134,9 @@ Error MessageQueue::push_notification(ObjectID p_id, int p_notification) { String type; if (ObjectDB::get_instance(p_id)) type = ObjectDB::get_instance(p_id)->get_class(); - print_line("failed notification: " + itos(p_notification) + " target ID: " + itos(p_id)); + print_line("Failed notification: " + itos(p_notification) + " target ID: " + itos(p_id)); statistics(); - ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings"); + ERR_EXPLAIN("Message queue out of memory. Try increasing 'message_queue_size_kb' in project settings."); ERR_FAIL_V(ERR_OUT_OF_MEMORY); } @@ -210,8 +210,7 @@ void MessageQueue::statistics() { } //object was deleted - //WARN_PRINT("Object was deleted while awaiting a callback") - //should it print a warning? + print_line("Object was deleted while awaiting a callback"); } else { null_count++; @@ -226,17 +225,14 @@ void MessageQueue::statistics() { print_line("NULL count: " + itos(null_count)); for (Map<StringName, int>::Element *E = set_count.front(); E; E = E->next()) { - print_line("SET " + E->key() + ": " + itos(E->get())); } for (Map<StringName, int>::Element *E = call_count.front(); E; E = E->next()) { - print_line("CALL " + E->key() + ": " + itos(E->get())); } for (Map<int, int>::Element *E = notify_count.front(); E; E = E->next()) { - print_line("NOTIFY " + itos(E->key()) + ": " + itos(E->get())); } } @@ -268,7 +264,6 @@ void MessageQueue::flush() { if (buffer_end > buffer_max_used) { buffer_max_used = buffer_end; - //statistics(); } uint32_t read_pos = 0; diff --git a/core/oa_hash_map.h b/core/oa_hash_map.h index 0b3b40f30c..3a17fc21f3 100644 --- a/core/oa_hash_map.h +++ b/core/oa_hash_map.h @@ -320,7 +320,7 @@ public: memdelete_arr(keys); memdelete_arr(values); - memdelete(hashes); + memdelete_arr(hashes); } }; diff --git a/core/object.cpp b/core/object.cpp index 76226d113a..e83abaece7 100644 --- a/core/object.cpp +++ b/core/object.cpp @@ -2080,10 +2080,10 @@ void ObjectDB::cleanup() { String node_name; if (instances[*K]->is_class("Node")) - node_name = " - Node Name: " + String(instances[*K]->call("get_name")); + node_name = " - Node name: " + String(instances[*K]->call("get_name")); if (instances[*K]->is_class("Resource")) - node_name = " - Resource Name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); - print_line("Leaked Instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); + node_name = " - Resource name: " + String(instances[*K]->call("get_name")) + " Path: " + String(instances[*K]->call("get_path")); + print_line("Leaked instance: " + String(instances[*K]->get_class()) + ":" + itos(*K) + node_name); } } } diff --git a/core/os/dir_access.cpp b/core/os/dir_access.cpp index 330a9153ef..e631d6e994 100644 --- a/core/os/dir_access.cpp +++ b/core/os/dir_access.cpp @@ -98,22 +98,18 @@ static Error _erase_recursive(DirAccess *da) { err = _erase_recursive(da); if (err) { - print_line("err recurso " + E->get()); da->change_dir(".."); return err; } err = da->change_dir(".."); if (err) { - print_line("no go back " + E->get()); return err; } err = da->remove(da->get_current_dir().plus_file(E->get())); if (err) { - print_line("no remove dir" + E->get()); return err; } } else { - print_line("no change to " + E->get()); return err; } } @@ -122,8 +118,6 @@ static Error _erase_recursive(DirAccess *da) { Error err = da->remove(da->get_current_dir().plus_file(E->get())); if (err) { - - print_line("no remove file" + E->get()); return err; } } diff --git a/core/os/os.cpp b/core/os/os.cpp index 97dae05919..e90d714450 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -689,6 +689,18 @@ PoolStringArray OS::get_connected_midi_inputs() { return list; } +void OS::open_midi_inputs() { + + if (MIDIDriver::get_singleton()) + MIDIDriver::get_singleton()->open(); +} + +void OS::close_midi_inputs() { + + if (MIDIDriver::get_singleton()) + MIDIDriver::get_singleton()->close(); +} + OS::OS() { void *volatile stack_bottom; diff --git a/core/os/os.h b/core/os/os.h index 12c0222ad4..6f9a72d451 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -190,6 +190,8 @@ public: virtual const char *get_audio_driver_name(int p_driver) const; virtual PoolStringArray get_connected_midi_inputs(); + virtual void open_midi_inputs(); + virtual void close_midi_inputs(); virtual int get_screen_count() const { return 1; } virtual int get_current_screen() const { return 0; } diff --git a/core/os/rw_lock.h b/core/os/rw_lock.h index 9053794c83..3e53300c9f 100644 --- a/core/os/rw_lock.h +++ b/core/os/rw_lock.h @@ -56,8 +56,10 @@ class RWLockRead { RWLock *lock; public: - RWLockRead(RWLock *p_lock) { - lock = p_lock; + RWLockRead(const RWLock *p_lock) { + if (p_lock) { + lock = const_cast<RWLock *>(p_lock); + } if (lock) lock->read_lock(); } ~RWLockRead() { diff --git a/core/print_string.cpp b/core/print_string.cpp index 0355154488..e1e42d2b56 100644 --- a/core/print_string.cpp +++ b/core/print_string.cpp @@ -107,3 +107,10 @@ void print_error(String p_string) { _global_unlock(); } + +void print_verbose(String p_string) { + + if (OS::get_singleton()->is_stdout_verbose()) { + print_line(p_string); + } +} diff --git a/core/print_string.h b/core/print_string.h index 3465888d4c..c1d2d0ff3a 100644 --- a/core/print_string.h +++ b/core/print_string.h @@ -58,5 +58,6 @@ extern bool _print_line_enabled; extern bool _print_error_enabled; extern void print_line(String p_string); extern void print_error(String p_string); +extern void print_verbose(String p_string); #endif diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 87a5c3e493..890789ec6f 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -191,7 +191,7 @@ bool ProjectSettings::_get(const StringName &p_name, Variant &r_ret) const { name = feature_overrides[name]; } if (!props.has(name)) { - print_line("WARNING: not found: " + String(name)); + WARN_PRINTS("Property not found: " + String(name)); return false; } r_ret = props[name].variant; diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp index c5daaeea47..2b9b5d6037 100644 --- a/core/script_debugger_remote.cpp +++ b/core/script_debugger_remote.cpp @@ -82,17 +82,16 @@ Error ScriptDebuggerRemote::connect_to_host(const String &p_host, uint16_t p_por const int ms = waits[i]; OS::get_singleton()->delay_usec(ms * 1000); - print_line("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec."); + ERR_PRINTS("Remote Debugger: Connection failed with status: '" + String::num(tcp_client->get_status()) + "', retrying in " + String::num(ms) + " msec."); }; }; if (tcp_client->get_status() != StreamPeerTCP::STATUS_CONNECTED) { - print_line("Remote Debugger: Unable to connect"); + ERR_PRINTS("Remote Debugger: Unable to connect."); return FAILED; }; - // print_line("Remote Debugger: Connection OK!"); packet_peer_stream->set_stream_peer(tcp_client); return OK; diff --git a/core/string_db.cpp b/core/string_db.cpp index 2475cbe3e8..067e4493a1 100644 --- a/core/string_db.cpp +++ b/core/string_db.cpp @@ -73,7 +73,6 @@ void StringName::cleanup() { _Data *d = _table[i]; lost_strings++; if (OS::get_singleton()->is_stdout_verbose()) { - if (d->cname) { print_line("Orphan StringName: " + String(d->cname)); } else { @@ -85,8 +84,8 @@ void StringName::cleanup() { memdelete(d); } } - if (OS::get_singleton()->is_stdout_verbose() && lost_strings) { - print_line("StringName: " + itos(lost_strings) + " unclaimed string names at exit."); + if (lost_strings) { + print_verbose("StringName: " + itos(lost_strings) + " unclaimed string names at exit."); } lock->unlock(); diff --git a/core/translation.cpp b/core/translation.cpp index 78115c3749..82a16d0b17 100644 --- a/core/translation.cpp +++ b/core/translation.cpp @@ -1098,7 +1098,6 @@ bool TranslationServer::_load_translations(const String &p_from) { for (int i = 0; i < tcount; i++) { - //print_line( "Loading translation from " + r[i] ); Ref<Translation> tr = ResourceLoader::load(r[i]); if (tr.is_valid()) add_translation(tr); diff --git a/core/ustring.cpp b/core/ustring.cpp index 35cd27f7f3..96e3a3d784 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -1340,7 +1340,7 @@ String String::utf8(const char *p_utf8, int p_len) { bool String::parse_utf8(const char *p_utf8, int p_len) { -#define _UNICERROR(m_err) print_line("unicode error: " + String(m_err)); +#define _UNICERROR(m_err) print_line("Unicode error: " + String(m_err)); String aux; diff --git a/core/variant_call.cpp b/core/variant_call.cpp index 1c50df75f5..8b18b274b6 100644 --- a/core/variant_call.cpp +++ b/core/variant_call.cpp @@ -516,6 +516,8 @@ struct _VariantCall { VCALL_LOCALMEM4R(Array, bsearch_custom); VCALL_LOCALMEM1R(Array, duplicate); VCALL_LOCALMEM0(Array, invert); + VCALL_LOCALMEM0R(Array, max); + VCALL_LOCALMEM0R(Array, min); static void _call_PoolByteArray_get_string_from_ascii(Variant &r_ret, Variant &p_self, const Variant **p_args) { @@ -1705,6 +1707,8 @@ void register_variant_methods() { ADDFUNC4R(ARRAY, INT, Array, bsearch_custom, NIL, "value", OBJECT, "obj", STRING, "func", BOOL, "before", varray(true)); ADDFUNC0NC(ARRAY, NIL, Array, invert, varray()); ADDFUNC1R(ARRAY, ARRAY, Array, duplicate, BOOL, "deep", varray(false)); + ADDFUNC0R(ARRAY, NIL, Array, max, varray()); + ADDFUNC0R(ARRAY, NIL, Array, min, varray()); ADDFUNC0R(POOL_BYTE_ARRAY, INT, PoolByteArray, size, varray()); ADDFUNC2(POOL_BYTE_ARRAY, NIL, PoolByteArray, set, INT, "idx", INT, "byte", varray()); |