aboutsummaryrefslogtreecommitdiff
path: root/editor/plugins/camera_editor_plugin.cpp
diff options
context:
space:
mode:
authorRémi Verschelde2017-03-05 16:44:50 +0100
committerRémi Verschelde2017-03-05 16:44:50 +0100
commit5dbf1809c6e3e905b94b8764e99491e608122261 (patch)
tree5e5a5360db15d86d59ec8c6e4f7eb511388c5a9a /editor/plugins/camera_editor_plugin.cpp
parent45438e9918d421b244bfd7776a30e67dc7f2d3e3 (diff)
downloadgodot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.gz
godot-5dbf1809c6e3e905b94b8764e99491e608122261.tar.zst
godot-5dbf1809c6e3e905b94b8764e99491e608122261.zip
Diffstat (limited to 'editor/plugins/camera_editor_plugin.cpp')
-rw-r--r--editor/plugins/camera_editor_plugin.cpp50
1 files changed, 18 insertions, 32 deletions
diff --git a/editor/plugins/camera_editor_plugin.cpp b/editor/plugins/camera_editor_plugin.cpp
index 7073acd2c..96b6da51f 100644
--- a/editor/plugins/camera_editor_plugin.cpp
+++ b/editor/plugins/camera_editor_plugin.cpp
@@ -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() {
}
-
-