summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-06-29 12:28:30 +0200
committerGitHub <noreply@github.com>2019-06-29 12:28:30 +0200
commit52355c638b03ff9316ee3f39e32ac968252489d3 (patch)
treecabf1815270f0b415c3640e680ef40535793dae5 /scene
parente222e31fe633f6b4ae0abbc3cb2fb6a80ad2f9cd (diff)
parent0c4c36d823bb6792917dfac86491f61cec3f9b27 (diff)
Merge pull request #29380 from bojidar-bg/16086-docs-default-value
Add default values to the editor help, docs, and generated RST
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/physics_body_2d.cpp2
-rw-r--r--scene/3d/arvr_nodes.cpp1
-rw-r--r--scene/3d/physics_body.cpp2
-rw-r--r--scene/main/scene_tree.cpp11
-rw-r--r--scene/resources/concave_polygon_shape_2d.cpp2
5 files changed, 15 insertions, 3 deletions
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 2bd9e5e2a2..95acf13fad 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -1541,7 +1541,7 @@ Vector2 KinematicCollision2D::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision2D::get_local_shape() const {
- ERR_FAIL_COND_V(!owner, NULL);
+ if (!owner) return NULL;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index 95eec41fb2..dfa8fce9be 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -264,6 +264,7 @@ void ARVRController::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_rumble"), &ARVRController::get_rumble);
ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &ARVRController::set_rumble);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "rumble", PROPERTY_HINT_RANGE, "0.0,1.0,0.01"), "set_rumble", "get_rumble");
+ ADD_PROPERTY_DEFAULT("rumble", 0.0);
ClassDB::bind_method(D_METHOD("get_mesh"), &ARVRController::get_mesh);
diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp
index 3624e04434..d3aad7000d 100644
--- a/scene/3d/physics_body.cpp
+++ b/scene/3d/physics_body.cpp
@@ -1470,7 +1470,7 @@ Vector3 KinematicCollision::get_remainder() const {
return collision.remainder;
}
Object *KinematicCollision::get_local_shape() const {
- ERR_FAIL_COND_V(!owner, NULL);
+ if (!owner) return NULL;
uint32_t ownerid = owner->shape_find_owner(collision.local_shape);
return owner->shape_owner_get_owner(ownerid);
}
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 7f0cebd492..0e7cec57a4 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -614,6 +614,7 @@ void SceneTree::finish() {
root->_set_tree(NULL);
root->_propagate_after_exit_tree();
memdelete(root); //delete root
+ root = NULL;
}
}
@@ -1889,6 +1890,7 @@ void SceneTree::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_navigation_hint"), "set_debug_navigation_hint", "is_debugging_navigation_hint");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
+ ADD_PROPERTY_DEFAULT("refuse_new_network_connections", false);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_font_oversampling"), "set_use_font_oversampling", "is_using_font_oversampling");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "edited_scene_root", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_edited_scene_root", "get_edited_scene_root");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "current_scene", PROPERTY_HINT_RESOURCE_TYPE, "Node", 0), "set_current_scene", "get_current_scene");
@@ -1962,7 +1964,7 @@ bool SceneTree::is_using_font_oversampling() const {
SceneTree::SceneTree() {
- singleton = this;
+ if (singleton == NULL) singleton = this;
_quit = false;
accept_quit = true;
quit_on_go_back = true;
@@ -2107,4 +2109,11 @@ SceneTree::SceneTree() {
}
SceneTree::~SceneTree() {
+ if (root) {
+ root->_set_tree(NULL);
+ root->_propagate_after_exit_tree();
+ memdelete(root);
+ }
+
+ if (singleton == this) singleton = NULL;
}
diff --git a/scene/resources/concave_polygon_shape_2d.cpp b/scene/resources/concave_polygon_shape_2d.cpp
index 51dd91fff5..de853f0c30 100644
--- a/scene/resources/concave_polygon_shape_2d.cpp
+++ b/scene/resources/concave_polygon_shape_2d.cpp
@@ -104,4 +104,6 @@ void ConcavePolygonShape2D::_bind_methods() {
ConcavePolygonShape2D::ConcavePolygonShape2D() :
Shape2D(Physics2DServer::get_singleton()->concave_polygon_shape_create()) {
+ PoolVector<Vector2> empty;
+ set_segments(empty);
}