diff options
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | core/io/resource_importer.cpp | 3 | ||||
-rw-r--r-- | core/io/resource_importer.h | 2 | ||||
-rw-r--r-- | editor/editor_folding.cpp | 6 | ||||
-rwxr-xr-x | misc/travis/clang-format.sh | 2 | ||||
-rw-r--r-- | scene/audio/audio_stream_player.cpp | 30 | ||||
-rw-r--r-- | scene/audio/audio_stream_player.h | 1 | ||||
-rw-r--r-- | scene/resources/bit_map.cpp | 40 | ||||
-rw-r--r-- | scene/resources/bit_map.h | 4 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 11 | ||||
-rw-r--r-- | scene/resources/resource_format_text.h | 3 |
11 files changed, 46 insertions, 60 deletions
diff --git a/.travis.yml b/.travis.yml index 727567b8e7..b8e02a5be8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,9 +23,9 @@ matrix: addons: apt: sources: - - llvm-toolchain-xenial-6.0 + - llvm-toolchain-xenial-8 packages: - - clang-format-6.0 + - clang-format-8 - env: PLATFORM=x11 TOOLS=yes TARGET=debug CACHE_NAME=${PLATFORM}-tools-mono-gcc-8 MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" EXTRA_ARGS="module_mono_enabled=yes mono_glue=no warnings=extra werror=yes" os: linux diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp index 038a34ed51..4a58d37ca5 100644 --- a/core/io/resource_importer.cpp +++ b/core/io/resource_importer.cpp @@ -301,8 +301,7 @@ String ResourceFormatImporter::get_import_group_file(const String &p_path) const bool valid = true; PathAndType pat; _get_path_and_type(p_path, pat, &valid); - return valid?pat.group_file:String(); - + return valid ? pat.group_file : String(); } bool ResourceFormatImporter::is_import_valid(const String &p_path) const { diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h index bdbdde6df6..2e01989564 100644 --- a/core/io/resource_importer.h +++ b/core/io/resource_importer.h @@ -126,7 +126,7 @@ public: virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL) = 0; - virtual Error import_group_file(const String& p_group_file,const Map<String,Map<StringName, Variant> >&p_source_file_options, const Map<String,String>& p_base_paths) { return ERR_UNAVAILABLE; } + virtual Error import_group_file(const String &p_group_file, const Map<String, Map<StringName, Variant> > &p_source_file_options, const Map<String, String> &p_base_paths) { return ERR_UNAVAILABLE; } virtual bool are_import_settings_valid(const String &p_path) const { return true; } virtual String get_import_settings_string() const { return String(); } }; diff --git a/editor/editor_folding.cpp b/editor/editor_folding.cpp index f6079624de..96653fec70 100644 --- a/editor/editor_folding.cpp +++ b/editor/editor_folding.cpp @@ -92,7 +92,7 @@ void EditorFolding::load_resource_folding(RES p_resource, const String &p_path) _set_unfolds(p_resource.ptr(), unfolds); } -void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array& nodes_folded,Set<RES> &resources) { +void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p_folds, Array &resource_folds, Array &nodes_folded, Set<RES> &resources) { if (p_root != p_node) { if (!p_node->get_owner()) { return; //not owned, bye @@ -130,7 +130,7 @@ void EditorFolding::_fill_folds(const Node *p_root, const Node *p_node, Array &p } for (int i = 0; i < p_node->get_child_count(); i++) { - _fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded,resources); + _fill_folds(p_root, p_node->get_child(i), p_folds, resource_folds, nodes_folded, resources); } } void EditorFolding::save_scene_folding(const Node *p_scene, const String &p_path) { @@ -205,7 +205,7 @@ void EditorFolding::load_scene_folding(Node *p_scene, const String &p_path) { _set_unfolds(res.ptr(), unfolds2); } - for(int i=0;i<nodes_folded.size();i++) { + for (int i = 0; i < nodes_folded.size(); i++) { NodePath fold_path = nodes_folded[i]; if (p_scene->has_node(fold_path)) { Node *node = p_scene->get_node(fold_path); diff --git a/misc/travis/clang-format.sh b/misc/travis/clang-format.sh index ee4d0b2a10..5463a6cedf 100755 --- a/misc/travis/clang-format.sh +++ b/misc/travis/clang-format.sh @@ -1,6 +1,6 @@ #!/bin/sh -CLANG_FORMAT=clang-format-6.0 +CLANG_FORMAT=clang-format-8 if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then # Check the whole commit range against $TRAVIS_BRANCH, the base merge branch diff --git a/scene/audio/audio_stream_player.cpp b/scene/audio/audio_stream_player.cpp index 144e58d8b9..2def9fe8fc 100644 --- a/scene/audio/audio_stream_player.cpp +++ b/scene/audio/audio_stream_player.cpp @@ -32,8 +32,7 @@ #include "core/engine.h" - -void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) { +void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames, int p_amount) { int bus_index = AudioServer::get_singleton()->thread_find_bus_index(bus); @@ -66,10 +65,8 @@ void AudioStreamPlayer::_mix_to_bus(const AudioFrame *p_frames,int p_amount) { } } - void AudioStreamPlayer::_mix_internal(bool p_fadeout) { - //get data AudioFrame *buffer = mix_buffer.ptrw(); int buffer_size = mix_buffer.size(); @@ -94,15 +91,14 @@ void AudioStreamPlayer::_mix_internal(bool p_fadeout) { //set volume for next mix mix_volume_db = target_volume; - _mix_to_bus(buffer,buffer_size); - + _mix_to_bus(buffer, buffer_size); } void AudioStreamPlayer::_mix_audio() { if (use_fadeout) { - _mix_to_bus(fadeout_buffer.ptr(),fadeout_buffer.size()); - use_fadeout=false; + _mix_to_bus(fadeout_buffer.ptr(), fadeout_buffer.size()); + use_fadeout = false; } if (!stream_playback.is_valid() || !active || @@ -121,7 +117,7 @@ void AudioStreamPlayer::_mix_audio() { if (setstop) { _mix_internal(true); stream_playback->stop(); - setstop=false; + setstop = false; } if (setseek >= 0.0 && !stop_has_priority) { @@ -154,7 +150,7 @@ void AudioStreamPlayer::_notification(int p_what) { if (p_what == NOTIFICATION_INTERNAL_PROCESS) { if (!active || (setseek < 0 && !stream_playback->is_playing())) { - active = false; + active = false; set_process_internal(false); emit_signal("finished"); } @@ -200,7 +196,7 @@ void AudioStreamPlayer::set_stream(Ref<AudioStream> p_stream) { vol += vol_inc; } - use_fadeout=true; + use_fadeout = true; } mix_buffer.resize(AudioServer::get_singleton()->thread_get_mix_buffer_size()); @@ -252,7 +248,7 @@ void AudioStreamPlayer::play(float p_from_pos) { if (stream_playback.is_valid()) { //mix_volume_db = volume_db; do not reset volume ramp here, can cause clicks setseek = p_from_pos; - stop_has_priority=false; + stop_has_priority = false; active = true; set_process_internal(true); } @@ -268,8 +264,8 @@ void AudioStreamPlayer::seek(float p_seconds) { void AudioStreamPlayer::stop() { if (stream_playback.is_valid() && active) { - setstop=true; - stop_has_priority=true; + setstop = true; + stop_has_priority = true; } } @@ -357,7 +353,7 @@ void AudioStreamPlayer::_validate_property(PropertyInfo &property) const { if (property.name == "bus") { String options; - for (int i = 0; i <AudioServer::get_singleton()->get_bus_count(); i++) { + for (int i = 0; i < AudioServer::get_singleton()->get_bus_count(); i++) { if (i > 0) options += ","; String name = AudioServer::get_singleton()->get_bus_name(i); @@ -442,8 +438,8 @@ AudioStreamPlayer::AudioStreamPlayer() { stream_paused_fade = false; mix_target = MIX_TARGET_STEREO; fadeout_buffer.resize(512); - setstop=false; - use_fadeout=false; + setstop = false; + use_fadeout = false; AudioServer::get_singleton()->connect("bus_layout_changed", this, "_bus_layout_changed"); } diff --git a/scene/audio/audio_stream_player.h b/scene/audio/audio_stream_player.h index 0b782b67e7..7987bd7e7d 100644 --- a/scene/audio/audio_stream_player.h +++ b/scene/audio/audio_stream_player.h @@ -112,7 +112,6 @@ public: Ref<AudioStreamPlayback> get_stream_playback(); - AudioStreamPlayer(); ~AudioStreamPlayer(); }; diff --git a/scene/resources/bit_map.cpp b/scene/resources/bit_map.cpp index a9d85be0dc..e4a64a1de1 100644 --- a/scene/resources/bit_map.cpp +++ b/scene/resources/bit_map.cpp @@ -595,16 +595,16 @@ Array BitMap::_opaque_to_polygons_bind(const Rect2 &p_rect, float p_epsilon) con return result_array; } -void BitMap::resize(const Size2& p_new_size) { +void BitMap::resize(const Size2 &p_new_size) { Ref<BitMap> new_bitmap; new_bitmap.instance(); new_bitmap->create(p_new_size); - int lw = MIN(width,p_new_size.width); - int lh = MIN(height,p_new_size.height); - for(int x=0;x<lw;x++) { - for(int y=0;y<lh;y++) { - new_bitmap->set_bit(Vector2(x,y),get_bit(Vector2(x,y))); + int lw = MIN(width, p_new_size.width); + int lh = MIN(height, p_new_size.height); + for (int x = 0; x < lw; x++) { + for (int y = 0; y < lh; y++) { + new_bitmap->set_bit(Vector2(x, y), get_bit(Vector2(x, y))); } } @@ -617,11 +617,11 @@ Ref<Image> BitMap::convert_to_image() const { Ref<Image> image; image.instance(); - image->create(width,height,false,Image::FORMAT_L8); + image->create(width, height, false, Image::FORMAT_L8); image->lock(); - for(int i=0;i<width;i++) { - for(int j=0;j<height;j++) { - image->set_pixel( i,j,get_bit(Point2(i,j)) ? Color(1,1,1) : Color(0,0,0)); + for (int i = 0; i < width; i++) { + for (int j = 0; j < height; j++) { + image->set_pixel(i, j, get_bit(Point2(i, j)) ? Color(1, 1, 1) : Color(0, 0, 0)); } } @@ -629,30 +629,28 @@ Ref<Image> BitMap::convert_to_image() const { return image; } -void BitMap::blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap) { +void BitMap::blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap) { int x = p_pos.x; int y = p_pos.y; int w = p_bitmap->get_size().width; int h = p_bitmap->get_size().height; - for(int i=0;i<w;i++) { - for (int j=0;j<h;j++) { - int px = x+i; - int py = y+j; - if (px<0 || px>=width) + for (int i = 0; i < w; i++) { + for (int j = 0; j < h; j++) { + int px = x + i; + int py = y + j; + if (px < 0 || px >= width) continue; - if (py<0 || py>=height) + if (py < 0 || py >= height) continue; - if (p_bitmap->get_bit(Vector2(i,j))) { - set_bit(Vector2(x,y),true); + if (p_bitmap->get_bit(Vector2(i, j))) { + set_bit(Vector2(x, y), true); } } } - } - void BitMap::_bind_methods() { ClassDB::bind_method(D_METHOD("create", "size"), &BitMap::create); diff --git a/scene/resources/bit_map.h b/scene/resources/bit_map.h index 6e1171b8a9..daf24affb1 100644 --- a/scene/resources/bit_map.h +++ b/scene/resources/bit_map.h @@ -64,11 +64,11 @@ public: int get_true_bit_count() const; Size2 get_size() const; - void resize(const Size2& p_new_size); + void resize(const Size2 &p_new_size); void grow_mask(int p_pixels, const Rect2 &p_rect); - void blit(const Vector2& p_pos,const Ref<BitMap>& p_bitmap); + void blit(const Vector2 &p_pos, const Ref<BitMap> &p_bitmap); Ref<Image> convert_to_image() const; Vector<Vector<Vector2> > clip_opaque_to_polygons(const Rect2 &p_rect, float p_epsilon = 2.0) const; diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index e9f90fc85f..6e7bb27e74 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -447,9 +447,8 @@ Error ResourceInteractiveLoaderText::poll() { resource_cache.push_back(res); #ifdef TOOLS_ENABLED //remember ID for saving - res->set_id_for_path(local_path,index); + res->set_id_for_path(local_path, index); #endif - } ExtResource er; @@ -1545,9 +1544,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r } { - - - } #ifdef TOOLS_ENABLED @@ -1569,7 +1565,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r } int attempt = 1; //start from one, more readable format - while(cached_ids_found.has(attempt)) { + while (cached_ids_found.has(attempt)) { attempt++; } @@ -1577,7 +1573,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r E->get() = attempt; //update also in resource Ref<Resource> res = E->key(); - res->set_id_for_path(local_path,attempt); + res->set_id_for_path(local_path, attempt); } #else //make sure to start from one, as it makes format more readable @@ -1598,7 +1594,6 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const RES &p_r sorted_er.sort(); - for (int i = 0; i < sorted_er.size(); i++) { String p = sorted_er[i].resource->get_path(); diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h index ab6f94986c..06c841229b 100644 --- a/scene/resources/resource_format_text.h +++ b/scene/resources/resource_format_text.h @@ -172,10 +172,9 @@ class ResourceFormatSaverTextInstance { struct ResourceSort { RES resource; int index; - bool operator<(const ResourceSort& p_right) const { + bool operator<(const ResourceSort &p_right) const { return index < p_right.index; } - }; void _find_resources(const Variant &p_variant, bool p_main = false); |