summaryrefslogtreecommitdiff
path: root/scene/main
diff options
context:
space:
mode:
Diffstat (limited to 'scene/main')
-rwxr-xr-xscene/main/node.cpp28
-rw-r--r--scene/main/scene_tree.cpp1
-rw-r--r--scene/main/viewport.cpp25
-rw-r--r--scene/main/viewport.h6
4 files changed, 51 insertions, 9 deletions
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index c3d9d97c5a..a30fc03aa9 100755
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -50,7 +50,6 @@ void Node::_notification(int p_notification) {
Variant time = get_process_delta_time();
const Variant *ptr[1] = { &time };
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_process, ptr, 1);
}
} break;
@@ -60,7 +59,6 @@ void Node::_notification(int p_notification) {
Variant time = get_fixed_process_delta_time();
const Variant *ptr[1] = { &time };
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_fixed_process, ptr, 1);
}
@@ -134,7 +132,6 @@ void Node::_notification(int p_notification) {
set_fixed_process(true);
}
- Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_ready, NULL, 0);
}
//emit_signal(SceneStringNames::get_singleton()->enter_tree);
@@ -209,7 +206,6 @@ void Node::_propagate_enter_tree() {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel_reversed(SceneStringNames::get_singleton()->_enter_tree, NULL, 0);
}
@@ -273,7 +269,6 @@ void Node::_propagate_exit_tree() {
if (get_script_instance()) {
- Variant::CallError err;
get_script_instance()->call_multilevel(SceneStringNames::get_singleton()->_exit_tree, NULL, 0);
}
emit_signal(SceneStringNames::get_singleton()->tree_exited);
@@ -2117,7 +2112,15 @@ Node *Node::_duplicate(int p_flags) const {
if (!(p_flags & DUPLICATE_SCRIPTS) && name == "script/script")
continue;
- node->set(name, get(name));
+ Variant value = get(name);
+ // Duplicate dictionaries and arrays, mainly needed for __meta__
+ if (value.get_type() == Variant::DICTIONARY) {
+ value = Dictionary(value).copy();
+ } else if (value.get_type() == Variant::ARRAY) {
+ value = Array(value).duplicate();
+ }
+
+ node->set(name, value);
}
node->set_name(get_name());
@@ -2199,7 +2202,16 @@ void Node::_duplicate_and_reown(Node *p_new_parent, const Map<Node *, Node *> &p
if (!(E->get().usage & PROPERTY_USAGE_STORAGE))
continue;
String name = E->get().name;
- node->set(name, get(name));
+
+ Variant value = get(name);
+ // Duplicate dictionaries and arrays, mainly needed for __meta__
+ if (value.get_type() == Variant::DICTIONARY) {
+ value = Dictionary(value).copy();
+ } else if (value.get_type() == Variant::ARRAY) {
+ value = Array(value).duplicate();
+ }
+
+ node->set(name, value);
}
node->set_name(get_name());
@@ -2657,7 +2669,7 @@ void Node::_bind_methods() {
GLOBAL_DEF("node/name_casing", NAME_CASING_PASCAL_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", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("add_child_below_node", "node", "child_node", "legible_unique_name"), &Node::add_child_below_node, DEFVAL(false));
ClassDB::bind_method(D_METHOD("set_name", "name"), &Node::set_name);
ClassDB::bind_method(D_METHOD("get_name"), &Node::get_name);
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index a71b491bae..4f62d88934 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -870,7 +870,6 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p
if (!n->can_process())
continue;
- Variant::CallError ce;
n->call_multilevel(p_method, (const Variant **)v, 1);
//ERR_FAIL_COND(node_count != g.nodes.size());
}
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index c71a280755..d27a1a5641 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -2578,6 +2578,16 @@ int Viewport::get_render_info(RenderInfo p_info) {
return VS::get_singleton()->viewport_get_render_info(viewport, VS::ViewportRenderInfo(p_info));
}
+void Viewport::set_snap_controls_to_pixels(bool p_enable) {
+
+ snap_controls_to_pixels = p_enable;
+}
+
+bool Viewport::is_snap_controls_to_pixels_enabled() const {
+
+ return snap_controls_to_pixels;
+}
+
void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_use_arvr", "use"), &Viewport::set_use_arvr);
@@ -2680,6 +2690,9 @@ void Viewport::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_shadow_atlas_size", "size"), &Viewport::set_shadow_atlas_size);
ClassDB::bind_method(D_METHOD("get_shadow_atlas_size"), &Viewport::get_shadow_atlas_size);
+ ClassDB::bind_method(D_METHOD("set_snap_controls_to_pixels", "enabled"), &Viewport::set_snap_controls_to_pixels);
+ ClassDB::bind_method(D_METHOD("is_snap_controls_to_pixels_enabled"), &Viewport::is_snap_controls_to_pixels_enabled);
+
ClassDB::bind_method(D_METHOD("set_shadow_atlas_quadrant_subdiv", "quadrant", "subdiv"), &Viewport::set_shadow_atlas_quadrant_subdiv);
ClassDB::bind_method(D_METHOD("get_shadow_atlas_quadrant_subdiv", "quadrant"), &Viewport::get_shadow_atlas_quadrant_subdiv);
@@ -2707,6 +2720,7 @@ void Viewport::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "physics_object_picking"), "set_physics_object_picking", "get_physics_object_picking");
ADD_GROUP("GUI", "gui_");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_disable_input"), "set_disable_input", "is_input_disabled");
+ ADD_PROPERTY(PropertyInfo(Variant::BOOL, "gui_snap_controls_to_pixels"), "set_snap_controls_to_pixels", "is_snap_controls_to_pixels_enabled");
ADD_GROUP("Shadow Atlas", "shadow_atlas_");
ADD_PROPERTY(PropertyInfo(Variant::INT, "shadow_atlas_size"), "set_shadow_atlas_size", "get_shadow_atlas_size");
ADD_PROPERTYI(PropertyInfo(Variant::INT, "shadow_atlas_quad_0", PROPERTY_HINT_ENUM, "Disabled,1 Shadow,4 Shadows,16 Shadows,64 Shadows,256 Shadows,1024 Shadows"), "set_shadow_atlas_quadrant_subdiv", "get_shadow_atlas_quadrant_subdiv", 0);
@@ -2748,6 +2762,15 @@ void Viewport::_bind_methods() {
BIND_ENUM_CONSTANT(MSAA_4X);
BIND_ENUM_CONSTANT(MSAA_8X);
BIND_ENUM_CONSTANT(MSAA_16X);
+
+ BIND_ENUM_CONSTANT(USAGE_2D);
+ BIND_ENUM_CONSTANT(USAGE_2D_NO_SAMPLING);
+ BIND_ENUM_CONSTANT(USAGE_3D);
+ BIND_ENUM_CONSTANT(USAGE_3D_NO_EFFECTS);
+
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ALWAYS);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_NEVER);
+ BIND_ENUM_CONSTANT(CLEAR_MODE_ONLY_NEXT_FRAME);
}
Viewport::Viewport() {
@@ -2822,6 +2845,8 @@ Viewport::Viewport() {
usage = USAGE_3D;
debug_draw = DEBUG_DRAW_DISABLED;
clear_mode = CLEAR_MODE_ALWAYS;
+
+ snap_controls_to_pixels = true;
}
Viewport::~Viewport() {
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index ce2bc991f5..6bbd4b26b5 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -1,3 +1,4 @@
+
/*************************************************************************/
/* viewport.h */
/*************************************************************************/
@@ -193,6 +194,8 @@ private:
bool filter;
bool gen_mipmaps;
+ bool snap_controls_to_pixels;
+
bool physics_object_picking;
List<Ref<InputEvent> > physics_picking_events;
ObjectID physics_object_capture;
@@ -463,6 +466,9 @@ public:
int get_render_info(RenderInfo p_info);
+ void set_snap_controls_to_pixels(bool p_enable);
+ bool is_snap_controls_to_pixels_enabled() const;
+
Viewport();
~Viewport();
};