summaryrefslogtreecommitdiff
path: root/editor/io_plugins
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
committerRémi Verschelde <rverschelde@gmail.com>2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /editor/io_plugins
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
A Whole New World (clang-format edition)
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
Diffstat (limited to 'editor/io_plugins')
-rw-r--r--editor/io_plugins/editor_atlas.cpp92
-rw-r--r--editor/io_plugins/editor_atlas.h5
-rw-r--r--editor/io_plugins/editor_bitmask_import_plugin.cpp8
-rw-r--r--editor/io_plugins/editor_export_scene.cpp4
-rw-r--r--editor/io_plugins/editor_font_import_plugin.cpp6
-rw-r--r--editor/io_plugins/editor_mesh_import_plugin.cpp4
-rw-r--r--editor/io_plugins/editor_sample_import_plugin.cpp6
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.cpp25
-rw-r--r--editor/io_plugins/editor_scene_import_plugin.h16
-rw-r--r--editor/io_plugins/editor_scene_importer_fbxconv.cpp2
-rw-r--r--editor/io_plugins/editor_texture_import_plugin.cpp12
-rw-r--r--editor/io_plugins/editor_texture_import_plugin.h15
-rw-r--r--editor/io_plugins/editor_translation_import_plugin.cpp6
13 files changed, 91 insertions, 110 deletions
diff --git a/editor/io_plugins/editor_atlas.cpp b/editor/io_plugins/editor_atlas.cpp
index c5f1ee73cf..1aa480f442 100644
--- a/editor/io_plugins/editor_atlas.cpp
+++ b/editor/io_plugins/editor_atlas.cpp
@@ -35,7 +35,7 @@ struct _EditorAtlasWorkRect {
Size2i s;
Point2i p;
int idx;
- _FORCE_INLINE_ bool operator<(const _EditorAtlasWorkRect& p_r) const { return s.width > p_r.s.width; };
+ _FORCE_INLINE_ bool operator<(const _EditorAtlasWorkRect &p_r) const { return s.width > p_r.s.width; };
};
struct _EditorAtlasWorkRectResult {
@@ -45,7 +45,7 @@ struct _EditorAtlasWorkRectResult {
int max_h;
};
-void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, Size2i& r_size) {
+void EditorAtlas::fit(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size) {
//super simple, almost brute force scanline stacking fitter
//it's pretty basic for now, but it tries to make sure that the aspect ratio of the
@@ -55,106 +55,98 @@ void EditorAtlas::fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, S
// for example, it will prioritize a 1024x1024 atlas (works everywhere) instead of a
// 256x8192 atlas (won't work anywhere).
- ERR_FAIL_COND(p_rects.size()==0);
+ ERR_FAIL_COND(p_rects.size() == 0);
Vector<_EditorAtlasWorkRect> wrects;
wrects.resize(p_rects.size());
- for(int i=0;i<p_rects.size();i++) {
- wrects[i].s=p_rects[i];
- wrects[i].idx=i;
+ for (int i = 0; i < p_rects.size(); i++) {
+ wrects[i].s = p_rects[i];
+ wrects[i].idx = i;
}
wrects.sort();
int widest = wrects[0].s.width;
Vector<_EditorAtlasWorkRectResult> results;
- for(int i=0;i<=12;i++) {
+ for (int i = 0; i <= 12; i++) {
- int w = 1<<i;
- int max_h=0;
- int max_w=0;
- if ( w < widest )
+ int w = 1 << i;
+ int max_h = 0;
+ int max_w = 0;
+ if (w < widest)
continue;
Vector<int> hmax;
hmax.resize(w);
- for(int j=0;j<w;j++)
- hmax[j]=0;
+ for (int j = 0; j < w; j++)
+ hmax[j] = 0;
//place them
- int ofs=0;
+ int ofs = 0;
- for(int j=0;j<wrects.size();j++) {
+ for (int j = 0; j < wrects.size(); j++) {
+ if (ofs + wrects[j].s.width > w) {
- if (ofs+wrects[j].s.width > w) {
-
- ofs=0;
+ ofs = 0;
}
- int from_y=0;
- for(int k=0;k<wrects[j].s.width;k++) {
+ int from_y = 0;
+ for (int k = 0; k < wrects[j].s.width; k++) {
- if (hmax[ofs+k] > from_y)
- from_y=hmax[ofs+k];
+ if (hmax[ofs + k] > from_y)
+ from_y = hmax[ofs + k];
}
- wrects[j].p.x=ofs;
- wrects[j].p.y=from_y;
-
+ wrects[j].p.x = ofs;
+ wrects[j].p.y = from_y;
+ int end_h = from_y + wrects[j].s.height;
+ int end_w = ofs + wrects[j].s.width;
- int end_h = from_y+wrects[j].s.height;
- int end_w = ofs+wrects[j].s.width;
+ for (int k = 0; k < wrects[j].s.width; k++) {
- for(int k=0;k<wrects[j].s.width;k++) {
-
- hmax[ofs+k]=end_h;
+ hmax[ofs + k] = end_h;
}
if (end_h > max_h)
- max_h=end_h;
+ max_h = end_h;
if (end_w > max_w)
- max_w=end_w;
-
- ofs+=wrects[j].s.width;
+ max_w = end_w;
+ ofs += wrects[j].s.width;
}
_EditorAtlasWorkRectResult result;
- result.result=wrects;
- result.max_h=max_h;
- result.max_w=max_w;
+ result.result = wrects;
+ result.max_h = max_h;
+ result.max_w = max_w;
results.push_back(result);
-
}
//find the result with the best aspect ratio
- int best=-1;
- float best_aspect=1e20;
+ int best = -1;
+ float best_aspect = 1e20;
- for(int i=0;i<results.size();i++) {
+ for (int i = 0; i < results.size(); i++) {
float h = results[i].max_h;
float w = results[i].max_w;
- float aspect = h>w ? h/w : w/h;
+ float aspect = h > w ? h / w : w / h;
if (aspect < best_aspect) {
- best=i;
- best_aspect=aspect;
+ best = i;
+ best_aspect = aspect;
}
}
r_result.resize(p_rects.size());
- for(int i=0;i<p_rects.size();i++) {
+ for (int i = 0; i < p_rects.size(); i++) {
- r_result[ results[best].result[i].idx ]=results[best].result[i].p;
+ r_result[results[best].result[i].idx] = results[best].result[i].p;
}
- r_size=Size2(results[best].max_w,results[best].max_h );
-
+ r_size = Size2(results[best].max_w, results[best].max_h);
}
-
-
diff --git a/editor/io_plugins/editor_atlas.h b/editor/io_plugins/editor_atlas.h
index e0cf76576e..1fb8a8ed4e 100644
--- a/editor/io_plugins/editor_atlas.h
+++ b/editor/io_plugins/editor_atlas.h
@@ -34,10 +34,7 @@
class EditorAtlas {
public:
-
- static void fit(const Vector<Size2i>& p_rects,Vector<Point2i>& r_result, Size2i& r_size);
-
-
+ static void fit(const Vector<Size2i> &p_rects, Vector<Point2i> &r_result, Size2i &r_size);
};
#endif // EDITOR_ATLAS_H
diff --git a/editor/io_plugins/editor_bitmask_import_plugin.cpp b/editor/io_plugins/editor_bitmask_import_plugin.cpp
index 7282cbe4e7..bccf6c262f 100644
--- a/editor/io_plugins/editor_bitmask_import_plugin.cpp
+++ b/editor/io_plugins/editor_bitmask_import_plugin.cpp
@@ -28,15 +28,15 @@
/*************************************************************************/
#include "editor_bitmask_import_plugin.h"
#if 0
-#include "io/image_loader.h"
-#include "editor/editor_file_dialog.h"
#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/property_editor.h"
+#include "io/image_loader.h"
+#include "io/marshalls.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
-#include "io/marshalls.h"
-#include "editor/editor_settings.h"
class _EditorBitMaskImportOptions : public Object {
diff --git a/editor/io_plugins/editor_export_scene.cpp b/editor/io_plugins/editor_export_scene.cpp
index a593b870f9..e6066b9075 100644
--- a/editor/io_plugins/editor_export_scene.cpp
+++ b/editor/io_plugins/editor_export_scene.cpp
@@ -28,13 +28,13 @@
/*************************************************************************/
#include "editor_export_scene.h"
#if 0
+#include "editor/editor_settings.h"
+#include "global_config.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/dir_access.h"
#include "os/file_access.h"
-#include "editor/editor_settings.h"
#include "scene/resources/packed_scene.h"
-#include "global_config.h"
Vector<uint8_t> EditorSceneExportPlugin::custom_export(String& p_path,const Ref<EditorExportPlatform> &p_platform) {
diff --git a/editor/io_plugins/editor_font_import_plugin.cpp b/editor/io_plugins/editor_font_import_plugin.cpp
index c792ad717a..bad3b36383 100644
--- a/editor/io_plugins/editor_font_import_plugin.cpp
+++ b/editor/io_plugins/editor_font_import_plugin.cpp
@@ -28,13 +28,13 @@
/*************************************************************************/
#include "editor_font_import_plugin.h"
#if 0
-#include "scene/gui/dialogs.h"
#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
-#include "os/file_access.h"
#include "editor_atlas.h"
#include "io/image_loader.h"
#include "io/resource_saver.h"
+#include "os/file_access.h"
+#include "scene/gui/dialogs.h"
#ifdef FREETYPE_ENABLED
#include <ft2build.h>
@@ -1406,7 +1406,7 @@ Ref<BitmapFont> EditorFontImportPlugin::generate_font(const Ref<ResourceImportMe
for(int si=0;si<2;si++) {
-#define S_VAR(m_v) (String(si==0?"shadow/":"shadow2/")+m_v)
+#define S_VAR(m_v) (String(si == 0 ? "shadow/" : "shadow2/") + m_v)
if (from->get_option(S_VAR("enabled")).operator bool()) {
int r = from->get_option(S_VAR("radius"));
diff --git a/editor/io_plugins/editor_mesh_import_plugin.cpp b/editor/io_plugins/editor_mesh_import_plugin.cpp
index df9d0a62e6..f4d0868d16 100644
--- a/editor/io_plugins/editor_mesh_import_plugin.cpp
+++ b/editor/io_plugins/editor_mesh_import_plugin.cpp
@@ -30,14 +30,14 @@
#if 0
-#include "editor/editor_file_dialog.h"
#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
#include "editor/property_editor.h"
//#include "scene/resources/sample.h"
+#include "io/marshalls.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
-#include "io/marshalls.h"
#include "scene/resources/surface_tool.h"
class _EditorMeshImportOptions : public Object {
diff --git a/editor/io_plugins/editor_sample_import_plugin.cpp b/editor/io_plugins/editor_sample_import_plugin.cpp
index d446d39027..a21d41d8c8 100644
--- a/editor/io_plugins/editor_sample_import_plugin.cpp
+++ b/editor/io_plugins/editor_sample_import_plugin.cpp
@@ -28,14 +28,14 @@
/*************************************************************************/
#include "editor_sample_import_plugin.h"
-#include "editor/editor_file_dialog.h"
#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_dialog.h"
#include "editor/editor_node.h"
+#include "editor/editor_settings.h"
#include "editor/property_editor.h"
+#include "io/marshalls.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
-#include "io/marshalls.h"
-#include "editor/editor_settings.h"
#if 0
diff --git a/editor/io_plugins/editor_scene_import_plugin.cpp b/editor/io_plugins/editor_scene_import_plugin.cpp
index 963968ce47..52a554f6d1 100644
--- a/editor/io_plugins/editor_scene_import_plugin.cpp
+++ b/editor/io_plugins/editor_scene_import_plugin.cpp
@@ -28,27 +28,27 @@
/*************************************************************************/
#include "editor_scene_import_plugin.h"
#if 0
-#include "global_config.h"
+#include "editor/create_dialog.h"
#include "editor/editor_node.h"
-#include "scene/resources/packed_scene.h"
-#include "scene/resources/box_shape.h"
-#include "os/file_access.h"
-#include "scene/3d/path.h"
-#include "scene/animation/animation_player.h"
+#include "global_config.h"
#include "io/resource_saver.h"
+#include "os/file_access.h"
+#include "os/os.h"
+#include "scene/3d/body_shape.h"
#include "scene/3d/mesh_instance.h"
#include "scene/3d/navigation.h"
-#include "scene/3d/room_instance.h"
-#include "scene/3d/body_shape.h"
+#include "scene/3d/path.h"
#include "scene/3d/physics_body.h"
#include "scene/3d/portal.h"
+#include "scene/3d/room_instance.h"
#include "scene/3d/vehicle_body.h"
+#include "scene/animation/animation_player.h"
+#include "scene/resources/box_shape.h"
+#include "scene/resources/packed_scene.h"
#include "scene/resources/sphere_shape.h"
#include <scene/resources/box_shape.h>
-#include <scene/resources/ray_shape.h>
#include <scene/resources/plane_shape.h>
-#include "editor/create_dialog.h"
-#include "os/os.h"
+#include <scene/resources/ray_shape.h>
@@ -2086,9 +2086,6 @@ Node* EditorSceneImportPlugin::_fix_node(Node *p_node,Node *p_root,Map<Ref<Mesh>
return p_node;
}
-
-
-
#if 0
Error EditorImport::import_scene(const String& p_path,const String& p_dest_path,const String& p_resource_path,uint32_t p_flags,ImageFormat p_image_format,ImageCompression p_image_compression,uint32_t p_image_flags,float p_quality,uint32_t animation_flags,Node **r_scene,Ref<EditorPostImport> p_post_import) {
diff --git a/editor/io_plugins/editor_scene_import_plugin.h b/editor/io_plugins/editor_scene_import_plugin.h
index 2ae0693600..e365a003a3 100644
--- a/editor/io_plugins/editor_scene_import_plugin.h
+++ b/editor/io_plugins/editor_scene_import_plugin.h
@@ -29,21 +29,21 @@
#ifndef EDITOR_SCENE_IMPORT_PLUGIN_H
#define EDITOR_SCENE_IMPORT_PLUGIN_H
#if 0
+#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_system.h"
+#include "editor/editor_import_export.h"
+#include "editor/io_plugins/editor_texture_import_plugin.h"
#include "scene/gui/dialogs.h"
-#include "scene/gui/tree.h"
+#include "scene/gui/file_dialog.h"
#include "scene/gui/label.h"
-#include "scene/gui/option_button.h"
#include "scene/gui/line_edit.h"
-#include "scene/gui/file_dialog.h"
+#include "scene/gui/option_button.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
-#include "scene/resources/mesh.h"
-#include "editor/editor_file_system.h"
-#include "editor/editor_dir_dialog.h"
-#include "editor/editor_import_export.h"
-#include "editor/io_plugins/editor_texture_import_plugin.h"
+#include "scene/gui/tree.h"
#include "scene/resources/animation.h"
+#include "scene/resources/mesh.h"
class EditorNode;
diff --git a/editor/io_plugins/editor_scene_importer_fbxconv.cpp b/editor/io_plugins/editor_scene_importer_fbxconv.cpp
index d75a26a948..a2fe4a649b 100644
--- a/editor/io_plugins/editor_scene_importer_fbxconv.cpp
+++ b/editor/io_plugins/editor_scene_importer_fbxconv.cpp
@@ -28,9 +28,9 @@
/*************************************************************************/
#include "editor_scene_importer_fbxconv.h"
+#include "editor/editor_settings.h"
#include "os/file_access.h"
#include "os/os.h"
-#include "editor/editor_settings.h"
#include "scene/3d/mesh_instance.h"
#include "scene/animation/animation_player.h"
diff --git a/editor/io_plugins/editor_texture_import_plugin.cpp b/editor/io_plugins/editor_texture_import_plugin.cpp
index 8bafe80673..32742483bc 100644
--- a/editor/io_plugins/editor_texture_import_plugin.cpp
+++ b/editor/io_plugins/editor_texture_import_plugin.cpp
@@ -28,16 +28,16 @@
/*************************************************************************/
#include "editor_texture_import_plugin.h"
#if 0
-#include "io/image_loader.h"
#include "editor/editor_node.h"
-#include "io/resource_saver.h"
-#include "editor_atlas.h"
#include "editor/editor_settings.h"
-#include "io/md5.h"
-#include "io/marshalls.h"
+#include "editor_atlas.h"
#include "global_config.h"
-#include "scene/gui/check_button.h"
+#include "io/image_loader.h"
+#include "io/marshalls.h"
+#include "io/md5.h"
+#include "io/resource_saver.h"
#include "scene/gui/button_group.h"
+#include "scene/gui/check_button.h"
#include "scene/gui/margin_container.h"
#include "scene/io/resource_format_image.h"
diff --git a/editor/io_plugins/editor_texture_import_plugin.h b/editor/io_plugins/editor_texture_import_plugin.h
index f63bc57ecd..5d0d21f116 100644
--- a/editor/io_plugins/editor_texture_import_plugin.h
+++ b/editor/io_plugins/editor_texture_import_plugin.h
@@ -29,24 +29,19 @@
#ifndef EDITOR_TEXTURE_IMPORT_PLUGIN_H
#define EDITOR_TEXTURE_IMPORT_PLUGIN_H
-
-
-
-
-
#if 0
+#include "editor/editor_dir_dialog.h"
+#include "editor/editor_file_system.h"
#include "editor/editor_import_export.h"
#include "scene/gui/dialogs.h"
-#include "scene/gui/tree.h"
+#include "scene/gui/file_dialog.h"
#include "scene/gui/label.h"
-#include "scene/gui/option_button.h"
#include "scene/gui/line_edit.h"
-#include "scene/gui/file_dialog.h"
+#include "scene/gui/option_button.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/slider.h"
#include "scene/gui/spin_box.h"
-#include "editor/editor_file_system.h"
-#include "editor/editor_dir_dialog.h"
+#include "scene/gui/tree.h"
diff --git a/editor/io_plugins/editor_translation_import_plugin.cpp b/editor/io_plugins/editor_translation_import_plugin.cpp
index 0fd298d6d3..9aa9f043b3 100644
--- a/editor/io_plugins/editor_translation_import_plugin.cpp
+++ b/editor/io_plugins/editor_translation_import_plugin.cpp
@@ -29,16 +29,16 @@
#include "editor_translation_import_plugin.h"
#if 0
-#include "scene/gui/file_dialog.h"
#include "editor/editor_dir_dialog.h"
#include "editor/editor_node.h"
#include "editor/property_editor.h"
+#include "scene/gui/file_dialog.h"
//#include "scene/resources/sample.h"
+#include "compressed_translation.h"
+#include "editor/project_settings.h"
#include "io/resource_saver.h"
#include "os/file_access.h"
#include "translation.h"
-#include "compressed_translation.h"
-#include "editor/project_settings.h"
class EditorTranslationImportDialog : public ConfirmationDialog {