You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
This commit is contained in:
@@ -39,13 +39,11 @@ void ResourcePreloaderEditor::_gui_input(Ref<InputEvent> p_event) {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
load->set_icon(get_theme_icon("Folder", "EditorIcons"));
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_READY) {
|
||||
|
||||
//NodePath("/root")->connect("node_removed", this,"_node_removed",Vector<Variant>(),true);
|
||||
}
|
||||
|
||||
@@ -54,9 +52,7 @@ void ResourcePreloaderEditor::_notification(int p_what) {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_files_load_request(const Vector<String> &p_paths) {
|
||||
|
||||
for (int i = 0; i < p_paths.size(); i++) {
|
||||
|
||||
String path = p_paths[i];
|
||||
|
||||
RES resource;
|
||||
@@ -89,7 +85,6 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String> &p_paths)
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_load_pressed() {
|
||||
|
||||
loading_scene = false;
|
||||
|
||||
file->clear_filters();
|
||||
@@ -104,7 +99,6 @@ void ResourcePreloaderEditor::_load_pressed() {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_item_edited() {
|
||||
|
||||
if (!tree->get_selected())
|
||||
return;
|
||||
|
||||
@@ -118,7 +112,6 @@ void ResourcePreloaderEditor::_item_edited() {
|
||||
return;
|
||||
|
||||
if (new_name == "" || new_name.find("\\") != -1 || new_name.find("/") != -1 || preloader->has_resource(new_name)) {
|
||||
|
||||
s->set_text(0, old_name);
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +129,6 @@ void ResourcePreloaderEditor::_item_edited() {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_remove_resource(const String &p_to_remove) {
|
||||
|
||||
undo_redo->create_action(TTR("Delete Resource"));
|
||||
undo_redo->add_do_method(preloader, "remove_resource", p_to_remove);
|
||||
undo_redo->add_undo_method(preloader, "add_resource", p_to_remove, preloader->get_resource(p_to_remove));
|
||||
@@ -146,7 +138,6 @@ void ResourcePreloaderEditor::_remove_resource(const String &p_to_remove) {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_paste_pressed() {
|
||||
|
||||
RES r = EditorSettings::get_singleton()->get_resource_clipboard();
|
||||
if (!r.is_valid()) {
|
||||
dialog->set_text(TTR("Resource clipboard is empty!"));
|
||||
@@ -178,7 +169,6 @@ void ResourcePreloaderEditor::_paste_pressed() {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_update_library() {
|
||||
|
||||
tree->clear();
|
||||
tree->set_hide_root(true);
|
||||
TreeItem *root = tree->create_item(nullptr);
|
||||
@@ -194,7 +184,6 @@ void ResourcePreloaderEditor::_update_library() {
|
||||
names.sort();
|
||||
|
||||
for (List<String>::Element *E = names.front(); E; E = E->next()) {
|
||||
|
||||
TreeItem *ti = tree->create_item(root);
|
||||
ti->set_cell_mode(0, TreeItem::CELL_MODE_STRING);
|
||||
ti->set_editable(0, true);
|
||||
@@ -226,7 +215,6 @@ void ResourcePreloaderEditor::_update_library() {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id) {
|
||||
|
||||
TreeItem *item = Object::cast_to<TreeItem>(p_item);
|
||||
ERR_FAIL_COND(!item);
|
||||
|
||||
@@ -244,20 +232,17 @@ void ResourcePreloaderEditor::_cell_button_pressed(Object *p_item, int p_column,
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) {
|
||||
|
||||
preloader = p_preloader;
|
||||
|
||||
if (p_preloader) {
|
||||
_update_library();
|
||||
} else {
|
||||
|
||||
hide();
|
||||
set_physics_process(false);
|
||||
}
|
||||
}
|
||||
|
||||
Variant ResourcePreloaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) {
|
||||
|
||||
TreeItem *ti = tree->get_item_at_position(p_point);
|
||||
if (!ti)
|
||||
return Variant();
|
||||
@@ -272,7 +257,6 @@ Variant ResourcePreloaderEditor::get_drag_data_fw(const Point2 &p_point, Control
|
||||
}
|
||||
|
||||
bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
|
||||
Dictionary d = p_data;
|
||||
|
||||
if (!d.has("type"))
|
||||
@@ -288,7 +272,6 @@ bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Vari
|
||||
}
|
||||
|
||||
if (String(d["type"]) == "files") {
|
||||
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
return files.size() != 0;
|
||||
@@ -297,7 +280,6 @@ bool ResourcePreloaderEditor::can_drop_data_fw(const Point2 &p_point, const Vari
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::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;
|
||||
|
||||
@@ -310,7 +292,6 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant
|
||||
RES r = d["resource"];
|
||||
|
||||
if (r.is_valid()) {
|
||||
|
||||
String basename;
|
||||
if (r->get_name() != "") {
|
||||
basename = r->get_name();
|
||||
@@ -337,7 +318,6 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant
|
||||
}
|
||||
|
||||
if (String(d["type"]) == "files") {
|
||||
|
||||
Vector<String> files = d["files"];
|
||||
|
||||
_files_load_request(files);
|
||||
@@ -345,7 +325,6 @@ void ResourcePreloaderEditor::drop_data_fw(const Point2 &p_point, const Variant
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_gui_input"), &ResourcePreloaderEditor::_gui_input);
|
||||
ClassDB::bind_method(D_METHOD("_update_library"), &ResourcePreloaderEditor::_update_library);
|
||||
ClassDB::bind_method(D_METHOD("_remove_resource", "to_remove"), &ResourcePreloaderEditor::_remove_resource);
|
||||
@@ -356,7 +335,6 @@ void ResourcePreloaderEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
ResourcePreloaderEditor::ResourcePreloaderEditor() {
|
||||
|
||||
//add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("panel","Panel"));
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
@@ -399,7 +377,6 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() {
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
preloader_editor->set_undo_redo(&get_undo_redo());
|
||||
ResourcePreloader *s = Object::cast_to<ResourcePreloader>(p_object);
|
||||
if (!s)
|
||||
@@ -409,19 +386,16 @@ void ResourcePreloaderEditorPlugin::edit(Object *p_object) {
|
||||
}
|
||||
|
||||
bool ResourcePreloaderEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("ResourcePreloader");
|
||||
}
|
||||
|
||||
void ResourcePreloaderEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
//preloader_editor->show();
|
||||
button->show();
|
||||
editor->make_bottom_panel_item_visible(preloader_editor);
|
||||
//preloader_editor->set_process(true);
|
||||
} else {
|
||||
|
||||
if (preloader_editor->is_visible_in_tree())
|
||||
editor->hide_bottom_panel();
|
||||
button->hide();
|
||||
@@ -431,7 +405,6 @@ void ResourcePreloaderEditorPlugin::make_visible(bool p_visible) {
|
||||
}
|
||||
|
||||
ResourcePreloaderEditorPlugin::ResourcePreloaderEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
preloader_editor = memnew(ResourcePreloaderEditor);
|
||||
preloader_editor->set_custom_minimum_size(Size2(0, 250) * EDSCALE);
|
||||
|
||||
Reference in New Issue
Block a user