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
This commit is contained in:
Rémi Verschelde
2017-03-05 16:44:50 +01:00
parent 45438e9918
commit 5dbf1809c6
1318 changed files with 140051 additions and 166004 deletions
+18 -24
View File
@@ -29,9 +29,9 @@
#ifndef EDITORRESOURCEPREVIEW_H
#define EDITORRESOURCEPREVIEW_H
#include "scene/main/node.h"
#include "os/semaphore.h"
#include "os/thread.h"
#include "scene/main/node.h"
#include "scene/resources/texture.h"
/* make previews for:
@@ -52,30 +52,26 @@
-curve and curve2D
*/
class EditorResourcePreviewGenerator : public Reference {
GDCLASS(EditorResourcePreviewGenerator,Reference );
GDCLASS(EditorResourcePreviewGenerator, Reference);
protected:
static void _bind_methods();
public:
virtual bool handles(const String& p_type) const;
virtual Ref<Texture> generate(const RES& p_from);
virtual Ref<Texture> generate_from_path(const String& p_path);
public:
virtual bool handles(const String &p_type) const;
virtual Ref<Texture> generate(const RES &p_from);
virtual Ref<Texture> generate_from_path(const String &p_path);
EditorResourcePreviewGenerator();
};
class EditorResourcePreview : public Node {
GDCLASS(EditorResourcePreview,Node);
GDCLASS(EditorResourcePreview, Node);
static EditorResourcePreview* singleton;
static EditorResourcePreview *singleton;
struct QueueItem {
Ref<Resource> resource;
@@ -101,31 +97,29 @@ class EditorResourcePreview : public Node {
int order;
Map<String,Item> cache;
Map<String, Item> cache;
void _preview_ready(const String& p_str,const Ref<Texture>& p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
Ref<Texture> _generate_preview(const QueueItem& p_item, const String &cache_base);
void _preview_ready(const String &p_str, const Ref<Texture> &p_texture, ObjectID id, const StringName &p_func, const Variant &p_ud);
Ref<Texture> _generate_preview(const QueueItem &p_item, const String &cache_base);
static void _thread_func(void *ud);
void _thread();
Vector<Ref<EditorResourcePreviewGenerator> > preview_generators;
protected:
static void _bind_methods();
public:
static EditorResourcePreview* get_singleton();
public:
static EditorResourcePreview *get_singleton();
//callback funtion is callback(String p_path,Ref<Texture> preview,Variant udata) preview null if could not load
void queue_resource_preview(const String& p_res, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void queue_edited_resource_preview(const Ref<Resource>& p_path, Object* p_receiver, const StringName& p_receiver_func, const Variant& p_userdata);
void queue_resource_preview(const String &p_res, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
void queue_edited_resource_preview(const Ref<Resource> &p_path, Object *p_receiver, const StringName &p_receiver_func, const Variant &p_userdata);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
void remove_preview_generator(const Ref<EditorResourcePreviewGenerator>& p_generator);
void check_for_invalidation(const String& p_path);
void add_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
void remove_preview_generator(const Ref<EditorResourcePreviewGenerator> &p_generator);
void check_for_invalidation(const String &p_path);
EditorResourcePreview();
~EditorResourcePreview();