1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

This commit is contained in:
Rémi Verschelde
2021-05-04 14:41:06 +02:00
parent 64a63e0861
commit b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions

View File

@@ -43,7 +43,6 @@
#include "servers/audio/audio_stream.h"
void post_process_preview(Ref<Image> p_image) {
if (p_image->get_format() != Image::FORMAT_RGBA8)
p_image->convert(Image::FORMAT_RGBA8);
@@ -75,7 +74,6 @@ void post_process_preview(Ref<Image> p_image) {
}
bool EditorTexturePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Texture");
}
@@ -84,7 +82,6 @@ bool EditorTexturePreviewPlugin::generate_small_preview_automatically() const {
}
Ref<Texture> EditorTexturePreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<Image> img;
Ref<AtlasTexture> atex = p_from;
Ref<LargeTexture> ltex = p_from;
@@ -148,12 +145,10 @@ EditorTexturePreviewPlugin::EditorTexturePreviewPlugin() {
////////////////////////////////////////////////////////////////////////////
bool EditorImagePreviewPlugin::handles(const String &p_type) const {
return p_type == "Image";
}
Ref<Texture> EditorImagePreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<Image> img = p_from;
if (img.is_null() || img->empty())
@@ -196,12 +191,10 @@ bool EditorImagePreviewPlugin::generate_small_preview_automatically() const {
////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////
bool EditorBitmapPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "BitMap");
}
Ref<Texture> EditorBitmapPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<BitMap> bm = p_from;
if (bm->get_size() == Size2()) {
@@ -264,16 +257,13 @@ EditorBitmapPreviewPlugin::EditorBitmapPreviewPlugin() {
///////////////////////////////////////////////////////////////////////////
bool EditorPackedScenePreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "PackedScene");
}
Ref<Texture> EditorPackedScenePreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
return generate_from_path(p_from->get_path(), p_size);
}
Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_path, const Size2 &p_size) const {
String temp_path = EditorSettings::get_singleton()->get_cache_dir();
String cache_base = ProjectSettings::get_singleton()->globalize_path(p_path).md5_text();
cache_base = temp_path.plus_file("resthumb-" + cache_base);
@@ -289,7 +279,6 @@ Ref<Texture> EditorPackedScenePreviewPlugin::generate_from_path(const String &p_
img.instance();
Error err = img->load(path);
if (err == OK) {
Ref<ImageTexture> ptex = Ref<ImageTexture>(memnew(ImageTexture));
post_process_preview(img);
@@ -307,17 +296,14 @@ EditorPackedScenePreviewPlugin::EditorPackedScenePreviewPlugin() {
//////////////////////////////////////////////////////////////////
void EditorMaterialPreviewPlugin::_preview_done(const Variant &p_udata) {
preview_done.set();
}
void EditorMaterialPreviewPlugin::_bind_methods() {
ClassDB::bind_method("_preview_done", &EditorMaterialPreviewPlugin::_preview_done);
}
bool EditorMaterialPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Material"); //any material
}
@@ -326,12 +312,10 @@ bool EditorMaterialPreviewPlugin::generate_small_preview_automatically() const {
}
Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<Material> material = p_from;
ERR_FAIL_COND_V(material.is_null(), Ref<Texture>());
if (material->get_shader_mode() == Shader::MODE_SPATIAL) {
VS::get_singleton()->mesh_surface_set_material(sphere, 0, material->get_rid());
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_ONCE); //once used for capture
@@ -361,7 +345,6 @@ Ref<Texture> EditorMaterialPreviewPlugin::generate(const RES &p_from, const Size
}
EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
scenario = VS::get_singleton()->scenario_create();
viewport = VS::get_singleton()->viewport_create();
@@ -413,7 +396,6 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
double zr1 = Math::cos(lat1);
for (int j = lons; j >= 1; j--) {
double lng0 = 2 * Math_PI * (double)(j - 1) / lons;
double x0 = Math::cos(lng0);
double y0 = Math::sin(lng0);
@@ -467,7 +449,6 @@ EditorMaterialPreviewPlugin::EditorMaterialPreviewPlugin() {
}
EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() {
VS::get_singleton()->free(sphere);
VS::get_singleton()->free(sphere_instance);
VS::get_singleton()->free(viewport);
@@ -482,17 +463,14 @@ EditorMaterialPreviewPlugin::~EditorMaterialPreviewPlugin() {
///////////////////////////////////////////////////////////////////////////
static bool _is_text_char(CharType c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_';
}
bool EditorScriptPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Script");
}
Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<Script> scr = p_from;
if (scr.is_null())
return Ref<Texture>();
@@ -507,7 +485,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2
Set<String> keywords;
for (List<String>::Element *E = kwors.front(); E; E = E->next()) {
keywords.insert(E->get());
}
@@ -545,7 +522,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2
bool in_keyword = false;
bool in_comment = false;
for (int i = 0; i < code.length(); i++) {
CharType c = code[i];
if (c > 32) {
if (col < thumbnail_size) {
@@ -591,7 +567,6 @@ Ref<Texture> EditorScriptPreviewPlugin::generate(const RES &p_from, const Size2
}
col++;
} else {
prev_is_text = false;
in_keyword = false;
@@ -625,12 +600,10 @@ EditorScriptPreviewPlugin::EditorScriptPreviewPlugin() {
///////////////////////////////////////////////////////////////////
bool EditorAudioStreamPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "AudioStream");
}
Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<AudioStream> stream = p_from;
ERR_FAIL_COND_V(stream.is_null(), Ref<Texture>());
@@ -660,7 +633,6 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S
playback->stop();
for (int i = 0; i < w; i++) {
float max = -1000;
float min = 1000;
int from = uint64_t(i) * frame_length / w;
@@ -672,7 +644,6 @@ Ref<Texture> EditorAudioStreamPreviewPlugin::generate(const RES &p_from, const S
}
for (int j = from; j < to; j++) {
max = MAX(max, frames[j].l);
max = MAX(max, frames[j].r);
@@ -714,21 +685,17 @@ EditorAudioStreamPreviewPlugin::EditorAudioStreamPreviewPlugin() {
///////////////////////////////////////////////////////////////////////////
void EditorMeshPreviewPlugin::_preview_done(const Variant &p_udata) {
preview_done.set();
}
void EditorMeshPreviewPlugin::_bind_methods() {
ClassDB::bind_method("_preview_done", &EditorMeshPreviewPlugin::_preview_done);
}
bool EditorMeshPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "Mesh"); //any Mesh
}
Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
Ref<Mesh> mesh = p_from;
ERR_FAIL_COND_V(mesh.is_null(), Ref<Texture>());
@@ -784,7 +751,6 @@ Ref<Texture> EditorMeshPreviewPlugin::generate(const RES &p_from, const Size2 &p
}
EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
scenario = VS::get_singleton()->scenario_create();
viewport = VS::get_singleton()->viewport_create();
@@ -819,7 +785,6 @@ EditorMeshPreviewPlugin::EditorMeshPreviewPlugin() {
}
EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
//VS::get_singleton()->free(sphere);
VS::get_singleton()->free(mesh_instance);
VS::get_singleton()->free(viewport);
@@ -834,22 +799,18 @@ EditorMeshPreviewPlugin::~EditorMeshPreviewPlugin() {
///////////////////////////////////////////////////////////////////////////
void EditorFontPreviewPlugin::_preview_done(const Variant &p_udata) {
preview_done.set();
}
void EditorFontPreviewPlugin::_bind_methods() {
ClassDB::bind_method("_preview_done", &EditorFontPreviewPlugin::_preview_done);
}
bool EditorFontPreviewPlugin::handles(const String &p_type) const {
return ClassDB::is_parent_class(p_type, "DynamicFontData") || ClassDB::is_parent_class(p_type, "DynamicFont");
}
Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, const Size2 &p_size) const {
Ref<ResourceInteractiveLoader> ril = ResourceLoader::load_interactive(p_path);
ril.ptr()->wait();
RES res = ril.ptr()->get_resource();
@@ -911,7 +872,6 @@ Ref<Texture> EditorFontPreviewPlugin::generate_from_path(const String &p_path, c
}
Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from, const Size2 &p_size) const {
String path = p_from->get_path();
if (!FileAccess::exists(path)) {
return Ref<Texture>();
@@ -920,7 +880,6 @@ Ref<Texture> EditorFontPreviewPlugin::generate(const RES &p_from, const Size2 &p
}
EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
viewport = VS::get_singleton()->viewport_create();
VS::get_singleton()->viewport_set_update_mode(viewport, VS::VIEWPORT_UPDATE_DISABLED);
VS::get_singleton()->viewport_set_vflip(viewport, true);
@@ -936,7 +895,6 @@ EditorFontPreviewPlugin::EditorFontPreviewPlugin() {
}
EditorFontPreviewPlugin::~EditorFontPreviewPlugin() {
VS::get_singleton()->free(canvas_item);
VS::get_singleton()->free(canvas);
VS::get_singleton()->free(viewport);