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:
@@ -35,7 +35,6 @@
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
void MultiMeshEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if (p_node == node) {
|
||||
node = NULL;
|
||||
hide();
|
||||
@@ -43,24 +42,20 @@ void MultiMeshEditor::_node_removed(Node *p_node) {
|
||||
}
|
||||
|
||||
void MultiMeshEditor::_populate() {
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
Ref<Mesh> mesh;
|
||||
|
||||
if (mesh_source->get_text() == "") {
|
||||
|
||||
Ref<MultiMesh> multimesh;
|
||||
multimesh = node->get_multimesh();
|
||||
if (multimesh.is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("No mesh source specified (and no MultiMesh set in node)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
if (multimesh->get_mesh().is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("No mesh source specified (and MultiMesh contains no Mesh)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -68,11 +63,9 @@ void MultiMeshEditor::_populate() {
|
||||
|
||||
mesh = multimesh->get_mesh();
|
||||
} else {
|
||||
|
||||
Node *ms_node = node->get_node(mesh_source->get_text());
|
||||
|
||||
if (!ms_node) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (invalid path)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -81,7 +74,6 @@ void MultiMeshEditor::_populate() {
|
||||
MeshInstance *ms_instance = Object::cast_to<MeshInstance>(ms_node);
|
||||
|
||||
if (!ms_instance) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (not a MeshInstance)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -90,7 +82,6 @@ void MultiMeshEditor::_populate() {
|
||||
mesh = ms_instance->get_mesh();
|
||||
|
||||
if (mesh.is_null()) {
|
||||
|
||||
err_dialog->set_text(TTR("Mesh source is invalid (contains no Mesh resource)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -98,7 +89,6 @@ void MultiMeshEditor::_populate() {
|
||||
}
|
||||
|
||||
if (surface_source->get_text() == "") {
|
||||
|
||||
err_dialog->set_text(TTR("No surface source specified."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -107,7 +97,6 @@ void MultiMeshEditor::_populate() {
|
||||
Node *ss_node = node->get_node(surface_source->get_text());
|
||||
|
||||
if (!ss_node) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (invalid path)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -116,7 +105,6 @@ void MultiMeshEditor::_populate() {
|
||||
GeometryInstance *ss_instance = Object::cast_to<MeshInstance>(ss_node);
|
||||
|
||||
if (!ss_instance) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no geometry)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -127,7 +115,6 @@ void MultiMeshEditor::_populate() {
|
||||
PoolVector<Face3> geometry = ss_instance->get_faces(VisualInstance::FACES_SOLID);
|
||||
|
||||
if (geometry.size() == 0) {
|
||||
|
||||
err_dialog->set_text(TTR("Surface source is invalid (no faces)."));
|
||||
err_dialog->popup_centered_minsize();
|
||||
return;
|
||||
@@ -155,7 +142,6 @@ void MultiMeshEditor::_populate() {
|
||||
float area_accum = 0;
|
||||
Map<float, int> triangle_area_map;
|
||||
for (int i = 0; i < facecount; i++) {
|
||||
|
||||
float area = r[i].get_area();
|
||||
if (area < CMP_EPSILON)
|
||||
continue;
|
||||
@@ -190,7 +176,6 @@ void MultiMeshEditor::_populate() {
|
||||
}
|
||||
|
||||
for (int i = 0; i < instance_count; i++) {
|
||||
|
||||
float areapos = Math::random(0.0f, area_accum);
|
||||
|
||||
Map<float, int>::Element *E = triangle_area_map.find_closest(areapos);
|
||||
@@ -229,7 +214,6 @@ void MultiMeshEditor::_populate() {
|
||||
}
|
||||
|
||||
void MultiMeshEditor::_browsed(const NodePath &p_path) {
|
||||
|
||||
NodePath path = node->get_path_to(get_node(p_path));
|
||||
|
||||
if (browsing_source)
|
||||
@@ -239,13 +223,9 @@ void MultiMeshEditor::_browsed(const NodePath &p_path) {
|
||||
}
|
||||
|
||||
void MultiMeshEditor::_menu_option(int p_option) {
|
||||
|
||||
switch (p_option) {
|
||||
|
||||
case MENU_OPTION_POPULATE: {
|
||||
|
||||
if (_last_pp_node != node) {
|
||||
|
||||
surface_source->set_text("..");
|
||||
mesh_source->set_text("..");
|
||||
populate_axis->select(1);
|
||||
@@ -264,12 +244,10 @@ void MultiMeshEditor::_menu_option(int p_option) {
|
||||
}
|
||||
|
||||
void MultiMeshEditor::edit(MultiMeshInstance *p_multimesh) {
|
||||
|
||||
node = p_multimesh;
|
||||
}
|
||||
|
||||
void MultiMeshEditor::_browse(bool p_source) {
|
||||
|
||||
browsing_source = p_source;
|
||||
std->get_scene_tree()->set_marked(node, false);
|
||||
std->popup_centered_ratio();
|
||||
@@ -280,7 +258,6 @@ void MultiMeshEditor::_browse(bool p_source) {
|
||||
}
|
||||
|
||||
void MultiMeshEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method("_menu_option", &MultiMeshEditor::_menu_option);
|
||||
ClassDB::bind_method("_populate", &MultiMeshEditor::_populate);
|
||||
ClassDB::bind_method("_browsed", &MultiMeshEditor::_browsed);
|
||||
@@ -288,7 +265,6 @@ void MultiMeshEditor::_bind_methods() {
|
||||
}
|
||||
|
||||
MultiMeshEditor::MultiMeshEditor() {
|
||||
|
||||
options = memnew(MenuButton);
|
||||
options->set_switch_on_hover(true);
|
||||
SpatialEditor::get_singleton()->add_control_to_menu_panel(options);
|
||||
@@ -385,28 +361,23 @@ MultiMeshEditor::MultiMeshEditor() {
|
||||
}
|
||||
|
||||
void MultiMeshEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
multimesh_editor->edit(Object::cast_to<MultiMeshInstance>(p_object));
|
||||
}
|
||||
|
||||
bool MultiMeshEditorPlugin::handles(Object *p_object) const {
|
||||
|
||||
return p_object->is_class("MultiMeshInstance");
|
||||
}
|
||||
|
||||
void MultiMeshEditorPlugin::make_visible(bool p_visible) {
|
||||
|
||||
if (p_visible) {
|
||||
multimesh_editor->options->show();
|
||||
} else {
|
||||
|
||||
multimesh_editor->options->hide();
|
||||
multimesh_editor->edit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
MultiMeshEditorPlugin::MultiMeshEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor = p_node;
|
||||
multimesh_editor = memnew(MultiMeshEditor);
|
||||
editor->get_viewport()->add_child(multimesh_editor);
|
||||
|
||||
Reference in New Issue
Block a user