summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rw-r--r--scene/main/canvas_item.cpp63
-rw-r--r--scene/main/canvas_item.h14
-rw-r--r--scene/main/node.cpp24
-rw-r--r--scene/main/scene_tree.cpp6
-rw-r--r--scene/main/shader_globals_override.cpp32
-rw-r--r--scene/main/shader_globals_override.h30
-rw-r--r--scene/main/timer.cpp8
-rw-r--r--scene/main/viewport.cpp4
8 files changed, 144 insertions, 37 deletions
diff --git a/scene/main/canvas_item.cpp b/scene/main/canvas_item.cpp
index b5d54b2199..e91826d44b 100644
--- a/scene/main/canvas_item.cpp
+++ b/scene/main/canvas_item.cpp
@@ -95,18 +95,35 @@ void CanvasItemMaterial::_update_shader() {
String code = "shader_type canvas_item;\nrender_mode ";
switch (blend_mode) {
- case BLEND_MODE_MIX: code += "blend_mix"; break;
- case BLEND_MODE_ADD: code += "blend_add"; break;
- case BLEND_MODE_SUB: code += "blend_sub"; break;
- case BLEND_MODE_MUL: code += "blend_mul"; break;
- case BLEND_MODE_PREMULT_ALPHA: code += "blend_premul_alpha"; break;
- case BLEND_MODE_DISABLED: code += "blend_disabled"; break;
+ case BLEND_MODE_MIX:
+ code += "blend_mix";
+ break;
+ case BLEND_MODE_ADD:
+ code += "blend_add";
+ break;
+ case BLEND_MODE_SUB:
+ code += "blend_sub";
+ break;
+ case BLEND_MODE_MUL:
+ code += "blend_mul";
+ break;
+ case BLEND_MODE_PREMULT_ALPHA:
+ code += "blend_premul_alpha";
+ break;
+ case BLEND_MODE_DISABLED:
+ code += "blend_disabled";
+ break;
}
switch (light_mode) {
- case LIGHT_MODE_NORMAL: break;
- case LIGHT_MODE_UNSHADED: code += ",unshaded"; break;
- case LIGHT_MODE_LIGHT_ONLY: code += ",light_only"; break;
+ case LIGHT_MODE_NORMAL:
+ break;
+ case LIGHT_MODE_UNSHADED:
+ code += ",unshaded";
+ break;
+ case LIGHT_MODE_LIGHT_ONLY:
+ code += ",light_only";
+ break;
}
code += ";\n";
@@ -1372,10 +1389,18 @@ void CanvasItem::_update_texture_filter_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_filter()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS: texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS; break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR_WITH_MIPMAPS;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS:
+ texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_NEAREST_WITH_MIPMAPS;
+ break;
default: {
}
}
@@ -1421,9 +1446,15 @@ void CanvasItem::_update_texture_repeat_changed(bool p_propagate) {
} else {
//from viewport
switch (get_viewport()->get_default_canvas_item_texture_repeat()) {
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED; break;
- case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR: texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR; break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_DISABLED:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_ENABLED:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_ENABLED;
+ break;
+ case Viewport::DEFAULT_CANVAS_ITEM_TEXTURE_REPEAT_MIRROR:
+ texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_MIRROR;
+ break;
default: {
}
}
diff --git a/scene/main/canvas_item.h b/scene/main/canvas_item.h
index dc17c5283b..805659376a 100644
--- a/scene/main/canvas_item.h
+++ b/scene/main/canvas_item.h
@@ -247,9 +247,11 @@ private:
protected:
_FORCE_INLINE_ void _notify_transform() {
- if (!is_inside_tree()) return;
+ if (!is_inside_tree())
+ return;
_notify_transform(this);
- if (!block_transform_notify && notify_local_transform) notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
+ if (!block_transform_notify && notify_local_transform)
+ notification(NOTIFICATION_LOCAL_TRANSFORM_CHANGED);
}
void item_rect_changed(bool p_size_changed = true);
@@ -275,7 +277,7 @@ public:
virtual bool _edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const;
// Save and restore a CanvasItem state
- virtual void _edit_set_state(const Dictionary &p_state){};
+ virtual void _edit_set_state(const Dictionary &p_state) {}
virtual Dictionary _edit_get_state() const { return Dictionary(); };
// Used to move the node
@@ -288,18 +290,18 @@ public:
// Used to rotate the node
virtual bool _edit_use_rotation() const { return false; };
- virtual void _edit_set_rotation(float p_rotation){};
+ virtual void _edit_set_rotation(float p_rotation) {}
virtual float _edit_get_rotation() const { return 0.0; };
// Used to resize/move the node
virtual bool _edit_use_rect() const { return false; }; // MAYBE REPLACE BY A _edit_get_editmode()
- virtual void _edit_set_rect(const Rect2 &p_rect){};
+ virtual void _edit_set_rect(const Rect2 &p_rect) {}
virtual Rect2 _edit_get_rect() const { return Rect2(0, 0, 0, 0); };
virtual Size2 _edit_get_minimum_size() const { return Size2(-1, -1); }; // LOOKS WEIRD
// Used to set a pivot
virtual bool _edit_use_pivot() const { return false; };
- virtual void _edit_set_pivot(const Point2 &p_pivot){};
+ virtual void _edit_set_pivot(const Point2 &p_pivot) {}
virtual Point2 _edit_get_pivot() const { return Point2(); };
virtual Transform2D _edit_get_transform() const;
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 4c02a15531..3d56b51e26 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -819,10 +819,14 @@ String Node::get_rpc_md5() const {
bool Node::can_process_notification(int p_what) const {
switch (p_what) {
- case NOTIFICATION_PHYSICS_PROCESS: return data.physics_process;
- case NOTIFICATION_PROCESS: return data.idle_process;
- case NOTIFICATION_INTERNAL_PROCESS: return data.idle_process_internal;
- case NOTIFICATION_INTERNAL_PHYSICS_PROCESS: return data.physics_process_internal;
+ case NOTIFICATION_PHYSICS_PROCESS:
+ return data.physics_process;
+ case NOTIFICATION_PROCESS:
+ return data.idle_process;
+ case NOTIFICATION_INTERNAL_PROCESS:
+ return data.idle_process_internal;
+ case NOTIFICATION_INTERNAL_PHYSICS_PROCESS:
+ return data.physics_process_internal;
}
return true;
@@ -2994,10 +2998,14 @@ void Node::_bind_methods() {
String Node::_get_name_num_separator() {
switch (ProjectSettings::get_singleton()->get("node/name_num_separator").operator int()) {
- case 0: return "";
- case 1: return " ";
- case 2: return "_";
- case 3: return "-";
+ case 0:
+ return "";
+ case 1:
+ return " ";
+ case 2:
+ return "_";
+ case 3:
+ return "-";
}
return " ";
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 7afc1b2edd..94be22ccd2 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -1372,7 +1372,8 @@ void SceneTree::get_argument_options(const StringName &p_function, int p_idx, Li
SceneTree::SceneTree() {
- if (singleton == nullptr) singleton = this;
+ if (singleton == nullptr)
+ singleton = this;
_quit = false;
accept_quit = true;
quit_on_go_back = true;
@@ -1478,5 +1479,6 @@ SceneTree::~SceneTree() {
memdelete(root);
}
- if (singleton == this) singleton = nullptr;
+ if (singleton == this)
+ singleton = nullptr;
}
diff --git a/scene/main/shader_globals_override.cpp b/scene/main/shader_globals_override.cpp
index 13582cf655..272cea8f2b 100644
--- a/scene/main/shader_globals_override.cpp
+++ b/scene/main/shader_globals_override.cpp
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* shader_globals_override.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#include "shader_globals_override.h"
#include "core/core_string_names.h"
@@ -176,7 +206,7 @@ void ShaderGlobalsOverride::_get_property_list(List<PropertyInfo> *p_list) const
Override o;
o.in_use = false;
Callable::CallError ce;
- o.override = Variant::construct(pinfo.type, NULL, 0, ce);
+ o.override = Variant::construct(pinfo.type, nullptr, 0, ce);
overrides[variables[i]] = o;
}
diff --git a/scene/main/shader_globals_override.h b/scene/main/shader_globals_override.h
index 33d0dc948f..d470e6a7dc 100644
--- a/scene/main/shader_globals_override.h
+++ b/scene/main/shader_globals_override.h
@@ -1,3 +1,33 @@
+/*************************************************************************/
+/* shader_globals_override.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+
#ifndef SHADER_GLOBALS_OVERRIDE_H
#define SHADER_GLOBALS_OVERRIDE_H
diff --git a/scene/main/timer.cpp b/scene/main/timer.cpp
index 7c847095e1..7cab4028b8 100644
--- a/scene/main/timer.cpp
+++ b/scene/main/timer.cpp
@@ -173,8 +173,12 @@ Timer::TimerProcessMode Timer::get_timer_process_mode() const {
void Timer::_set_process(bool p_process, bool p_force) {
switch (timer_process_mode) {
- case TIMER_PROCESS_PHYSICS: set_physics_process_internal(p_process && !paused); break;
- case TIMER_PROCESS_IDLE: set_process_internal(p_process && !paused); break;
+ case TIMER_PROCESS_PHYSICS:
+ set_physics_process_internal(p_process && !paused);
+ break;
+ case TIMER_PROCESS_IDLE:
+ set_process_internal(p_process && !paused);
+ break;
}
processing = p_process;
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index e9827d521b..58024dab38 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -173,7 +173,7 @@ class TooltipPanel : public PopupPanel {
GDCLASS(TooltipPanel, PopupPanel);
public:
- TooltipPanel(){};
+ TooltipPanel() {}
};
class TooltipLabel : public Label {
@@ -181,7 +181,7 @@ class TooltipLabel : public Label {
GDCLASS(TooltipLabel, Label);
public:
- TooltipLabel(){};
+ TooltipLabel() {}
};
Viewport::GUI::GUI() {