summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rwxr-xr-xscene/main/node.cpp10
-rw-r--r--scene/main/node.h2
-rw-r--r--scene/main/scene_tree.cpp30
-rw-r--r--scene/main/scene_tree.h3
-rw-r--r--scene/main/viewport.cpp2
5 files changed, 27 insertions, 20 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 61e563143c..26d1deadf9 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -1258,7 +1258,7 @@ String Node::_generate_serial_child_name(Node *p_child) {
name = p_child->get_class();
// Adjust casing according to project setting. The current type name is expected to be in PascalCase.
- switch (GlobalConfig::get_singleton()->get("node/name_casing").operator int()) {
+ switch (ProjectSettings::get_singleton()->get("node/name_casing").operator int()) {
case NAME_CASING_PASCAL_CASE:
break;
case NAME_CASING_CAMEL_CASE:
@@ -2712,9 +2712,9 @@ void Node::request_ready() {
void Node::_bind_methods() {
GLOBAL_DEF("node/name_num_separator", 0);
- GlobalConfig::get_singleton()->set_custom_property_info("node/name_num_separator", PropertyInfo(Variant::INT, "node/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"));
+ ProjectSettings::get_singleton()->set_custom_property_info("node/name_num_separator", PropertyInfo(Variant::INT, "node/name_num_separator", PROPERTY_HINT_ENUM, "None,Space,Underscore,Dash"));
GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_CASE);
- GlobalConfig::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"));
+ ProjectSettings::get_singleton()->set_custom_property_info("node/name_casing", PropertyInfo(Variant::INT, "node/name_casing", PROPERTY_HINT_ENUM, "PascalCase,camelCase,snake_case"));
ClassDB::bind_method(D_METHOD("_add_child_below_node", "node:Node", "child_node:Node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
@@ -2786,7 +2786,7 @@ void Node::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_scene_instance_load_placeholder", "load_placeholder"), &Node::set_scene_instance_load_placeholder);
ClassDB::bind_method(D_METHOD("get_scene_instance_load_placeholder"), &Node::get_scene_instance_load_placeholder);
- ClassDB::bind_method(D_METHOD("get_viewport"), &Node::get_viewport);
+ ClassDB::bind_method(D_METHOD("get_viewport:Viewport"), &Node::get_viewport);
ClassDB::bind_method(D_METHOD("queue_free"), &Node::queue_delete);
@@ -2890,7 +2890,7 @@ void Node::_bind_methods() {
}
String Node::_get_name_num_separator() {
- switch (GlobalConfig::get_singleton()->get("node/name_num_separator").operator int()) {
+ switch (ProjectSettings::get_singleton()->get("node/name_num_separator").operator int()) {
case 0: return "";
case 1: return " ";
case 2: return "_";
diff --git a/scene/main/node.h b/scene/main/node.h
index 7baa65c022..cfd5c07921 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -31,7 +31,7 @@
#define NODE_H
#include "class_db.h"
-#include "global_config.h"
+#include "project_settings.h"
#include "map.h"
#include "object.h"
#include "path_db.h"
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 65c7c1a36f..8f0467afc3 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -29,12 +29,12 @@
/*************************************************************************/
#include "scene_tree.h"
-#include "global_config.h"
#include "message_queue.h"
#include "node.h"
#include "os/keyboard.h"
#include "os/os.h"
#include "print_string.h"
+#include "project_settings.h"
#include <stdio.h>
//#include "servers/spatial_sound_2d_server.h"
@@ -614,7 +614,7 @@ bool SceneTree::idle(float p_time) {
if (is_editor_hint()) {
//simple hack to reload fallback environment if it changed from editor
- String env_path = GlobalConfig::get_singleton()->get("rendering/environment/default_environment");
+ String env_path = ProjectSettings::get_singleton()->get("rendering/environment/default_environment");
env_path = env_path.strip_edges(); //user may have added a space or two
String cpath;
Ref<Environment> fallback = get_root()->get_world()->get_fallback_environment();
@@ -1153,7 +1153,7 @@ void SceneTree::_update_root_rect() {
if (stretch_mode == STRETCH_MODE_DISABLED) {
- root->set_size(last_screen_size);
+ root->set_size((last_screen_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(Point2(), last_screen_size));
root->set_size_override_stretch(false);
root->set_size_override(false, Size2());
@@ -1231,15 +1231,15 @@ void SceneTree::_update_root_rect() {
switch (stretch_mode) {
case STRETCH_MODE_2D: {
- root->set_size(screen_size);
+ root->set_size((screen_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(margin, screen_size));
root->set_size_override_stretch(true);
- root->set_size_override(true, viewport_size);
+ root->set_size_override(true, (viewport_size / stretch_shrink).floor());
} break;
case STRETCH_MODE_VIEWPORT: {
- root->set_size(viewport_size);
+ root->set_size((viewport_size / stretch_shrink).floor());
root->set_attach_to_screen_rect(Rect2(margin, screen_size));
root->set_size_override_stretch(false);
root->set_size_override(false, Size2());
@@ -1248,11 +1248,12 @@ void SceneTree::_update_root_rect() {
}
}
-void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize) {
+void SceneTree::set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, int p_shrink) {
stretch_mode = p_mode;
stretch_aspect = p_aspect;
stretch_min = p_minsize;
+ stretch_shrink = p_shrink;
_update_root_rect();
}
@@ -2207,7 +2208,7 @@ void SceneTree::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_frame"), &SceneTree::get_frame);
ClassDB::bind_method(D_METHOD("quit"), &SceneTree::quit);
- ClassDB::bind_method(D_METHOD("set_screen_stretch", "mode", "aspect", "minsize"), &SceneTree::set_screen_stretch);
+ ClassDB::bind_method(D_METHOD("set_screen_stretch", "mode", "aspect", "minsize", "shrink"), &SceneTree::set_screen_stretch, DEFVAL(1));
ClassDB::bind_method(D_METHOD("queue_delete", "obj"), &SceneTree::queue_delete);
@@ -2351,9 +2352,13 @@ SceneTree::SceneTree() {
int ref_atlas_size = GLOBAL_DEF("rendering/quality/reflections/atlas_size", 2048);
int ref_atlas_subdiv = GLOBAL_DEF("rendering/quality/reflections/atlas_subdiv", 8);
int msaa_mode = GLOBAL_DEF("rendering/quality/filters/msaa", 0);
- GlobalConfig::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x"));
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/quality/filters/msaa", PropertyInfo(Variant::INT, "rendering/quality/filters/msaa", PROPERTY_HINT_ENUM, "Disabled,2x,4x,8x,16x"));
root->set_msaa(Viewport::MSAA(msaa_mode));
- bool hdr = GLOBAL_DEF("rendering/quality/depth/hdr", true);
+
+ GLOBAL_DEF("rendering/quality/depth/hdr", true);
+ GLOBAL_DEF("rendering/quality/depth/hdr.mobile", false);
+
+ bool hdr = GLOBAL_GET("rendering/quality/depth/hdr");
root->set_hdr(hdr);
VS::get_singleton()->scenario_set_reflection_atlas_size(root->get_world()->get_scenario(), ref_atlas_size, ref_atlas_subdiv);
@@ -2371,7 +2376,7 @@ SceneTree::SceneTree() {
//get path
String env_path = GLOBAL_DEF("rendering/environment/default_environment", "");
//setup property
- GlobalConfig::get_singleton()->set_custom_property_info("rendering/environment/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint));
+ ProjectSettings::get_singleton()->set_custom_property_info("rendering/environment/default_environment", PropertyInfo(Variant::STRING, "rendering/viewport/default_environment", PROPERTY_HINT_FILE, ext_hint));
env_path = env_path.strip_edges();
if (env_path != String()) {
Ref<Environment> env = ResourceLoader::load(env_path);
@@ -2380,7 +2385,7 @@ SceneTree::SceneTree() {
} else {
if (is_editor_hint()) {
//file was erased, clear the field.
- GlobalConfig::get_singleton()->set("rendering/environment/default_environment", "");
+ ProjectSettings::get_singleton()->set("rendering/environment/default_environment", "");
} else {
//file was erased, notify user.
ERR_PRINTS(RTR("Default Environment as specified in Project Setings (Rendering -> Viewport -> Default Environment) could not be loaded."));
@@ -2391,6 +2396,7 @@ SceneTree::SceneTree() {
stretch_mode = STRETCH_MODE_DISABLED;
stretch_aspect = STRETCH_ASPECT_IGNORE;
+ stretch_shrink = 1;
last_screen_size = Size2(OS::get_singleton()->get_video_mode().width, OS::get_singleton()->get_video_mode().height);
_update_root_rect();
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index 76a4becdbc..90d42ef01b 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -149,6 +149,7 @@ private:
StretchMode stretch_mode;
StretchAspect stretch_aspect;
Size2i stretch_min;
+ int stretch_shrink;
void _update_root_rect();
@@ -420,7 +421,7 @@ public:
void get_nodes_in_group(const StringName &p_group, List<Node *> *p_list);
bool has_group(const StringName &p_identifier) const;
- void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize);
+ void set_screen_stretch(StretchMode p_mode, StretchAspect p_aspect, const Size2 p_minsize, int p_shrink = 1);
//void change_scene(const String& p_path);
//Node *get_loaded_scene();
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index 824f968c49..ce7950285d 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -48,7 +48,7 @@
#include "scene/main/timer.h"
#include "scene/scene_string_names.h"
-#include "global_config.h"
+#include "project_settings.h"
#include "scene/3d/scenario_fx.h"
void ViewportTexture::setup_local_to_scene() {