You've already forked godot
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:
@@ -40,7 +40,6 @@
|
||||
#include "thirdparty/misc/clipper.hpp"
|
||||
|
||||
void SpriteEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
node = NULL;
|
||||
options->hide();
|
||||
@@ -48,7 +47,6 @@ void SpriteEditor::_node_removed(Node *p_node) {
|
||||
}
|
||||
|
||||
void SpriteEditor::edit(Sprite *p_sprite) {
|
||||
|
||||
node = p_sprite;
|
||||
}
|
||||
|
||||
@@ -63,7 +61,6 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
|
||||
ClipperLib::PolyTree out;
|
||||
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
|
||||
subj << ClipperLib::IntPoint(points[i].x * PRECISION, points[i].y * PRECISION);
|
||||
}
|
||||
ClipperLib::ClipperOffset co;
|
||||
@@ -104,7 +101,6 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
|
||||
int lasti = p2->Contour.size() - 1;
|
||||
Vector2 prev = Vector2(p2->Contour[lasti].X / PRECISION, p2->Contour[lasti].Y / PRECISION);
|
||||
for (uint64_t i = 0; i < p2->Contour.size(); i++) {
|
||||
|
||||
Vector2 cur = Vector2(p2->Contour[i].X / PRECISION, p2->Contour[i].Y / PRECISION);
|
||||
if (cur.distance_to(prev) > 0.5) {
|
||||
outPoints.push_back(cur);
|
||||
@@ -115,7 +111,6 @@ Vector<Vector2> expand(const Vector<Vector2> &points, const Rect2i &rect, float
|
||||
}
|
||||
|
||||
void SpriteEditor::_menu_option(int p_option) {
|
||||
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
@@ -124,7 +119,6 @@ void SpriteEditor::_menu_option(int p_option) {
|
||||
|
||||
switch (p_option) {
|
||||
case MENU_OPTION_CONVERT_TO_MESH_2D: {
|
||||
|
||||
debug_uv_dialog->get_ok()->set_text(TTR("Create Mesh2D"));
|
||||
debug_uv_dialog->set_title(TTR("Mesh2D Preview"));
|
||||
|
||||
@@ -134,7 +128,6 @@ void SpriteEditor::_menu_option(int p_option) {
|
||||
|
||||
} break;
|
||||
case MENU_OPTION_CONVERT_TO_POLYGON_2D: {
|
||||
|
||||
debug_uv_dialog->get_ok()->set_text(TTR("Create Polygon2D"));
|
||||
debug_uv_dialog->set_title(TTR("Polygon2D Preview"));
|
||||
|
||||
@@ -143,7 +136,6 @@ void SpriteEditor::_menu_option(int p_option) {
|
||||
debug_uv->update();
|
||||
} break;
|
||||
case MENU_OPTION_CREATE_COLLISION_POLY_2D: {
|
||||
|
||||
debug_uv_dialog->get_ok()->set_text(TTR("Create CollisionPolygon2D"));
|
||||
debug_uv_dialog->set_title(TTR("CollisionPolygon2D Preview"));
|
||||
|
||||
@@ -153,7 +145,6 @@ void SpriteEditor::_menu_option(int p_option) {
|
||||
|
||||
} break;
|
||||
case MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D: {
|
||||
|
||||
debug_uv_dialog->get_ok()->set_text(TTR("Create LightOccluder2D"));
|
||||
debug_uv_dialog->set_title(TTR("LightOccluder2D Preview"));
|
||||
|
||||
@@ -166,7 +157,6 @@ void SpriteEditor::_menu_option(int p_option) {
|
||||
}
|
||||
|
||||
void SpriteEditor::_update_mesh_data() {
|
||||
|
||||
Ref<Texture> texture = node->get_texture();
|
||||
if (texture.is_null()) {
|
||||
err_dialog->set_text(TTR("Sprite is empty!"));
|
||||
@@ -223,7 +213,6 @@ void SpriteEditor::_update_mesh_data() {
|
||||
}
|
||||
|
||||
if (selected_menu_item == MENU_OPTION_CONVERT_TO_MESH_2D) {
|
||||
|
||||
for (int j = 0; j < lines.size(); j++) {
|
||||
int index_ofs = computed_vertices.size();
|
||||
|
||||
@@ -267,7 +256,6 @@ void SpriteEditor::_update_mesh_data() {
|
||||
outline_lines.resize(lines.size());
|
||||
computed_outline_lines.resize(lines.size());
|
||||
for (int pi = 0; pi < lines.size(); pi++) {
|
||||
|
||||
Vector<Vector2> ol;
|
||||
Vector<Vector2> col;
|
||||
|
||||
@@ -319,7 +307,6 @@ void SpriteEditor::_create_node() {
|
||||
}
|
||||
|
||||
void SpriteEditor::_convert_to_mesh_2d_node() {
|
||||
|
||||
if (computed_vertices.size() < 3) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't replace by mesh."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
@@ -350,7 +337,6 @@ void SpriteEditor::_convert_to_mesh_2d_node() {
|
||||
}
|
||||
|
||||
void SpriteEditor::_convert_to_polygon_2d_node() {
|
||||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create polygon."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
@@ -377,7 +363,6 @@ void SpriteEditor::_convert_to_polygon_2d_node() {
|
||||
polys.resize(computed_outline_lines.size());
|
||||
|
||||
for (int i = 0; i < computed_outline_lines.size(); i++) {
|
||||
|
||||
Vector<Vector2> outline = computed_outline_lines[i];
|
||||
Vector<Vector2> uv_outline = outline_lines[i];
|
||||
|
||||
@@ -409,7 +394,6 @@ void SpriteEditor::_convert_to_polygon_2d_node() {
|
||||
}
|
||||
|
||||
void SpriteEditor::_create_collision_polygon_2d_node() {
|
||||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create collision polygon."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
@@ -417,7 +401,6 @@ void SpriteEditor::_create_collision_polygon_2d_node() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < computed_outline_lines.size(); i++) {
|
||||
|
||||
Vector<Vector2> outline = computed_outline_lines[i];
|
||||
|
||||
CollisionPolygon2D *collision_polygon_2d_instance = memnew(CollisionPolygon2D);
|
||||
@@ -433,7 +416,6 @@ void SpriteEditor::_create_collision_polygon_2d_node() {
|
||||
}
|
||||
|
||||
void SpriteEditor::_create_light_occluder_2d_node() {
|
||||
|
||||
if (computed_outline_lines.empty()) {
|
||||
err_dialog->set_text(TTR("Invalid geometry, can't create light occluder."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
@@ -441,7 +423,6 @@ void SpriteEditor::_create_light_occluder_2d_node() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < computed_outline_lines.size(); i++) {
|
||||
|
||||
Vector<Vector2> outline = computed_outline_lines[i];
|
||||
|
||||
Ref<OccluderPolygon2D> polygon;
|
||||
@@ -480,7 +461,6 @@ void SpriteEditor::_add_as_sibling_or_child(Node *p_own_node, Node *p_new_node)
|
||||
}
|
||||
|
||||
void SpriteEditor::_debug_uv_draw() {
|
||||
|
||||
Ref<Texture> tex = node->get_texture();
|
||||
ERR_FAIL_COND(!tex.is_valid());
|
||||
|
||||
@@ -508,7 +488,6 @@ void SpriteEditor::_debug_uv_draw() {
|
||||
}
|
||||
|
||||
void SpriteEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_menu_option", &SpriteEditor::_menu_option);
|
||||
ClassDB::bind_method("_debug_uv_draw", &SpriteEditor::_debug_uv_draw);
|
||||
ClassDB::bind_method("_update_mesh_data", &SpriteEditor::_update_mesh_data);
|
||||
@@ -517,7 +496,6 @@ void SpriteEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
SpriteEditor::SpriteEditor() {
|
||||
|
||||
options = memnew(MenuButton);
|
||||
|
||||
CanvasItemEditor::get_singleton()->add_control_to_menu_panel(options);
|
||||
@@ -586,28 +564,23 @@ SpriteEditor::SpriteEditor() {
|
||||
}
|
||||
|
||||
void SpriteEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
sprite_editor->edit(Object::cast_to<Sprite>(p_object));
|
||||
}
|
||||
|
||||
bool SpriteEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("Sprite");
|
||||
}
|
||||
|
||||
void SpriteEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
sprite_editor->options->show();
|
||||
} else {
|
||||
|
||||
sprite_editor->options->hide();
|
||||
sprite_editor->edit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SpriteEditorPlugin::SpriteEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
sprite_editor = memnew(SpriteEditor);
|
||||
editor->get_viewport()->add_child(sprite_editor);
|
||||
|
||||
Reference in New Issue
Block a user