1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +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 @@ void SpriteFramesEditor::_gui_input(Ref<InputEvent> p_event) {
}
void SpriteFramesEditor::_open_sprite_sheet() {
file_split_sheet->clear_filters();
List<String> extensions;
ResourceLoader::get_recognized_extensions_for_type("Texture", &extensions);
@@ -55,7 +54,6 @@ void SpriteFramesEditor::_open_sprite_sheet() {
}
void SpriteFramesEditor::_sheet_preview_draw() {
Size2i size = split_sheet_preview->get_size();
int h = split_sheet_h->get_value();
int v = split_sheet_v->get_value();
@@ -63,13 +61,11 @@ void SpriteFramesEditor::_sheet_preview_draw() {
int height = size.height / v;
const float a = 0.3;
for (int i = 1; i < h; i++) {
int x = i * width;
split_sheet_preview->draw_line(Point2(x, 0), Point2(x, size.height), Color(1, 1, 1, a));
split_sheet_preview->draw_line(Point2(x + 1, 0), Point2(x + 1, size.height), Color(0, 0, 0, a));
for (int j = 1; j < v; j++) {
int y = j * height;
split_sheet_preview->draw_line(Point2(0, y), Point2(size.width, y), Color(1, 1, 1, a));
@@ -105,7 +101,6 @@ void SpriteFramesEditor::_sheet_preview_draw() {
split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size()));
}
void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == BUTTON_LEFT) {
@@ -147,7 +142,6 @@ void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
}
void SpriteFramesEditor::_sheet_add_frames() {
Size2i size = split_sheet_preview->get_size();
int h = split_sheet_h->get_value();
int v = split_sheet_v->get_value();
@@ -187,7 +181,6 @@ void SpriteFramesEditor::_sheet_add_frames() {
}
void SpriteFramesEditor::_sheet_select_clear_all_frames() {
bool should_clear = true;
for (int i = 0; i < split_sheet_h->get_value() * split_sheet_v->get_value(); i++) {
if (!frames_selected.has(i)) {
@@ -203,14 +196,12 @@ void SpriteFramesEditor::_sheet_select_clear_all_frames() {
}
void SpriteFramesEditor::_sheet_spin_changed(double) {
frames_selected.clear();
last_frame_selected = -1;
split_sheet_preview->update();
}
void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) {
Ref<Resource> texture = ResourceLoader::load(p_file);
if (!texture.is_valid()) {
EditorNode::get_singleton()->show_warning(TTR("Unable to load images"));
@@ -229,7 +220,6 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) {
}
void SpriteFramesEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
load->set_icon(get_icon("Load", "EditorIcons"));
@@ -255,13 +245,11 @@ void SpriteFramesEditor::_notification(int p_what) {
}
void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, int p_at_pos) {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
List<Ref<Texture>> resources;
for (int i = 0; i < p_path.size(); i++) {
Ref<Texture> resource;
resource = ResourceLoader::load(p_path[i]);
@@ -288,7 +276,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in
int count = 0;
for (List<Ref<Texture>>::Element *E = resources.front(); E; E = E->next()) {
undo_redo->add_do_method(frames, "add_frame", edited_anim, E->get(), p_at_pos == -1 ? -1 : p_at_pos + count);
undo_redo->add_undo_method(frames, "remove_frame", edited_anim, p_at_pos == -1 ? fc : p_at_pos);
count++;
@@ -300,7 +287,6 @@ void SpriteFramesEditor::_file_load_request(const PoolVector<String> &p_path, in
}
void SpriteFramesEditor::_load_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
loading_scene = false;
@@ -316,7 +302,6 @@ void SpriteFramesEditor::_load_pressed() {
}
void SpriteFramesEditor::_paste_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
Ref<Texture> r = EditorSettings::get_singleton()->get_resource_clipboard();
@@ -351,13 +336,11 @@ void SpriteFramesEditor::_copy_pressed() {
}
void SpriteFramesEditor::_empty_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
int from = -1;
if (tree->get_current() >= 0) {
from = tree->get_current();
sel = from;
@@ -376,13 +359,11 @@ void SpriteFramesEditor::_empty_pressed() {
}
void SpriteFramesEditor::_empty2_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
int from = -1;
if (tree->get_current() >= 0) {
from = tree->get_current();
sel = from;
@@ -401,7 +382,6 @@ void SpriteFramesEditor::_empty2_pressed() {
}
void SpriteFramesEditor::_up_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
if (tree->get_current() < 0)
@@ -425,7 +405,6 @@ void SpriteFramesEditor::_up_pressed() {
}
void SpriteFramesEditor::_down_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
if (tree->get_current() < 0)
@@ -449,7 +428,6 @@ void SpriteFramesEditor::_down_pressed() {
}
void SpriteFramesEditor::_delete_pressed() {
ERR_FAIL_COND(!frames->has_animation(edited_anim));
if (tree->get_current() < 0)
@@ -469,7 +447,6 @@ void SpriteFramesEditor::_delete_pressed() {
}
void SpriteFramesEditor::_animation_select() {
if (updating)
return;
@@ -486,7 +463,6 @@ void SpriteFramesEditor::_animation_select() {
}
static void _find_anim_sprites(Node *p_node, List<Node *> *r_nodes, Ref<SpriteFrames> p_sfames) {
Node *edited = EditorNode::get_singleton()->get_edited_scene();
if (!edited)
return;
@@ -513,7 +489,6 @@ static void _find_anim_sprites(Node *p_node, List<Node *> *r_nodes, Ref<SpriteFr
}
void SpriteFramesEditor::_animation_name_edited() {
if (updating)
return;
@@ -546,7 +521,6 @@ void SpriteFramesEditor::_animation_name_edited() {
undo_redo->add_undo_method(frames, "rename_animation", name, edited_anim);
for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
String current = E->get()->call("get_animation");
undo_redo->add_do_method(E->get(), "set_animation", name);
undo_redo->add_undo_method(E->get(), "set_animation", edited_anim);
@@ -561,7 +535,6 @@ void SpriteFramesEditor::_animation_name_edited() {
}
void SpriteFramesEditor::_animation_add() {
String name = "New Anim";
int counter = 0;
while (frames->has_animation(name)) {
@@ -579,7 +552,6 @@ void SpriteFramesEditor::_animation_add() {
undo_redo->add_undo_method(this, "_update_library");
for (List<Node *>::Element *E = nodes.front(); E; E = E->next()) {
String current = E->get()->call("get_animation");
undo_redo->add_do_method(E->get(), "set_animation", name);
undo_redo->add_undo_method(E->get(), "set_animation", current);
@@ -592,7 +564,6 @@ void SpriteFramesEditor::_animation_add() {
}
void SpriteFramesEditor::_animation_remove() {
if (updating)
return;
@@ -604,7 +575,6 @@ void SpriteFramesEditor::_animation_remove() {
}
void SpriteFramesEditor::_animation_remove_confirmed() {
undo_redo->create_action(TTR("Remove Animation"));
undo_redo->add_do_method(frames, "remove_animation", edited_anim);
undo_redo->add_undo_method(frames, "add_animation", edited_anim);
@@ -624,7 +594,6 @@ void SpriteFramesEditor::_animation_remove_confirmed() {
}
void SpriteFramesEditor::_animation_loop_changed() {
if (updating)
return;
@@ -637,7 +606,6 @@ void SpriteFramesEditor::_animation_loop_changed() {
}
void SpriteFramesEditor::_animation_fps_changed(double p_value) {
if (updating)
return;
@@ -651,7 +619,6 @@ void SpriteFramesEditor::_animation_fps_changed(double p_value) {
}
void SpriteFramesEditor::_update_library(bool p_skip_selector) {
updating = true;
if (!p_skip_selector) {
@@ -666,7 +633,6 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
anim_names.sort_custom<StringName::AlphCompare>();
for (List<StringName>::Element *E = anim_names.front(); E; E = E->next()) {
String name = E->get();
TreeItem *it = animations->create_item(anim_root);
@@ -695,12 +661,10 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
sel = 0;
for (int i = 0; i < frames->get_frame_count(edited_anim); i++) {
String name;
Ref<Texture> icon;
if (frames->get_frame(edited_anim, i).is_null()) {
name = itos(i) + ": " + TTR("(empty)");
} else {
@@ -723,16 +687,13 @@ void SpriteFramesEditor::_update_library(bool p_skip_selector) {
}
void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
if (frames == p_frames)
return;
frames = p_frames;
if (p_frames) {
if (!p_frames->has_animation(edited_anim)) {
List<StringName> anim_names;
frames->get_animation_list(&anim_names);
anim_names.sort_custom<StringName::AlphCompare>();
@@ -745,13 +706,11 @@ void SpriteFramesEditor::edit(SpriteFrames *p_frames) {
_update_library();
} else {
hide();
}
}
Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
if (!frames->has_animation(edited_anim))
return false;
@@ -771,7 +730,6 @@ Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f
}
bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
Dictionary d = p_data;
if (!d.has("type"))
@@ -787,13 +745,11 @@ bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
Ref<Texture> texture = r;
if (texture.is_valid()) {
return true;
}
}
if (String(d["type"]) == "files") {
Vector<String> files = d["files"];
if (files.size() == 0)
@@ -814,7 +770,6 @@ bool SpriteFramesEditor::can_drop_data_fw(const Point2 &p_point, const Variant &
}
void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) {
if (!can_drop_data_fw(p_point, p_data, p_from))
return;
@@ -860,7 +815,6 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
}
if (String(d["type"]) == "files") {
PoolVector<String> files = d["files"];
if (Input::get_singleton()->is_key_pressed(KEY_CONTROL)) {
@@ -872,7 +826,6 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da
}
void SpriteFramesEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("_load_pressed"), &SpriteFramesEditor::_load_pressed);
ClassDB::bind_method(D_METHOD("_empty_pressed"), &SpriteFramesEditor::_empty_pressed);
ClassDB::bind_method(D_METHOD("_empty2_pressed"), &SpriteFramesEditor::_empty2_pressed);
@@ -903,7 +856,6 @@ void SpriteFramesEditor::_bind_methods() {
}
SpriteFramesEditor::SpriteFramesEditor() {
VBoxContainer *vbc_animlist = memnew(VBoxContainer);
add_child(vbc_animlist);
vbc_animlist->set_custom_minimum_size(Size2(150, 0) * EDSCALE);
@@ -1105,7 +1057,6 @@ SpriteFramesEditor::SpriteFramesEditor() {
}
void SpriteFramesEditorPlugin::edit(Object *p_object) {
frames_editor->set_undo_redo(&get_undo_redo());
SpriteFrames *s;
@@ -1120,7 +1071,6 @@ void SpriteFramesEditorPlugin::edit(Object *p_object) {
}
bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
AnimatedSprite *animated_sprite = Object::cast_to<AnimatedSprite>(p_object);
if (animated_sprite && *animated_sprite->get_sprite_frames()) {
return true;
@@ -1130,12 +1080,10 @@ bool SpriteFramesEditorPlugin::handles(Object *p_object) const {
}
void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
button->show();
editor->make_bottom_panel_item_visible(frames_editor);
} else {
button->hide();
if (frames_editor->is_visible_in_tree())
editor->hide_bottom_panel();
@@ -1143,7 +1091,6 @@ void SpriteFramesEditorPlugin::make_visible(bool p_visible) {
}
SpriteFramesEditorPlugin::SpriteFramesEditorPlugin(EditorNode *p_node) {
editor = p_node;
frames_editor = memnew(SpriteFramesEditor);
frames_editor->set_custom_minimum_size(Size2(0, 300) * EDSCALE);