You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
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:
@@ -30,45 +30,41 @@
|
||||
|
||||
#include "spatial_editor_plugin.h"
|
||||
|
||||
|
||||
void CameraEditor::_notification(int p_what) {
|
||||
|
||||
switch(p_what) {
|
||||
switch (p_what) {
|
||||
|
||||
/* case NOTIFICATION_PROCESS: {
|
||||
/* case NOTIFICATION_PROCESS: {
|
||||
|
||||
if (preview->is_pressed() && node)
|
||||
node->call("make_current");
|
||||
|
||||
} break;*/
|
||||
}
|
||||
|
||||
}
|
||||
void CameraEditor::_node_removed(Node *p_node) {
|
||||
|
||||
if(p_node==node) {
|
||||
node=NULL;
|
||||
if (p_node == node) {
|
||||
node = NULL;
|
||||
SpatialEditor::get_singleton()->set_custom_camera(NULL);
|
||||
hide();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CameraEditor::_pressed() {
|
||||
|
||||
Node *sn = (node && preview->is_pressed())?node:NULL;
|
||||
Node *sn = (node && preview->is_pressed()) ? node : NULL;
|
||||
SpatialEditor::get_singleton()->set_custom_camera(sn);
|
||||
}
|
||||
|
||||
void CameraEditor::_bind_methods() {
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_pressed"),&CameraEditor::_pressed);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("_pressed"), &CameraEditor::_pressed);
|
||||
}
|
||||
|
||||
void CameraEditor::edit(Node *p_camera) {
|
||||
|
||||
node=p_camera;
|
||||
node = p_camera;
|
||||
|
||||
if (!node) {
|
||||
preview->set_pressed(false);
|
||||
@@ -82,25 +78,22 @@ void CameraEditor::edit(Node *p_camera) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CameraEditor::CameraEditor() {
|
||||
|
||||
preview = memnew( Button );
|
||||
preview = memnew(Button);
|
||||
add_child(preview);
|
||||
|
||||
preview->set_text(TTR("Preview"));
|
||||
preview->set_toggle_mode(true);
|
||||
preview->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
|
||||
preview->set_anchor(MARGIN_RIGHT,Control::ANCHOR_END);
|
||||
preview->set_margin(MARGIN_LEFT,60);
|
||||
preview->set_margin(MARGIN_RIGHT,0);
|
||||
preview->set_margin(MARGIN_TOP,0);
|
||||
preview->set_margin(MARGIN_BOTTOM,10);
|
||||
preview->connect("pressed",this,"_pressed");
|
||||
|
||||
preview->set_anchor(MARGIN_LEFT, Control::ANCHOR_END);
|
||||
preview->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
|
||||
preview->set_margin(MARGIN_LEFT, 60);
|
||||
preview->set_margin(MARGIN_RIGHT, 0);
|
||||
preview->set_margin(MARGIN_TOP, 0);
|
||||
preview->set_margin(MARGIN_BOTTOM, 10);
|
||||
preview->connect("pressed", this, "_pressed");
|
||||
}
|
||||
|
||||
|
||||
void CameraEditorPlugin::edit(Object *p_object) {
|
||||
|
||||
SpatialEditor::get_singleton()->set_can_preview(p_object->cast_to<Camera>());
|
||||
@@ -119,13 +112,12 @@ void CameraEditorPlugin::make_visible(bool p_visible) {
|
||||
} else {
|
||||
SpatialEditor::get_singleton()->set_can_preview(NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CameraEditorPlugin::CameraEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
editor=p_node;
|
||||
/* camera_editor = memnew( CameraEditor );
|
||||
editor = p_node;
|
||||
/* camera_editor = memnew( CameraEditor );
|
||||
editor->get_viewport()->add_child(camera_editor);
|
||||
|
||||
camera_editor->set_anchor(MARGIN_LEFT,Control::ANCHOR_END);
|
||||
@@ -138,13 +130,7 @@ CameraEditorPlugin::CameraEditorPlugin(EditorNode *p_node) {
|
||||
|
||||
camera_editor->hide();
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
CameraEditorPlugin::~CameraEditorPlugin()
|
||||
{
|
||||
CameraEditorPlugin::~CameraEditorPlugin() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user