summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/cpu_particles_2d.cpp15
-rw-r--r--scene/2d/cpu_particles_2d.h4
-rw-r--r--scene/3d/arvr_nodes.cpp10
-rw-r--r--scene/3d/camera.cpp10
-rw-r--r--scene/animation/animation_blend_tree.cpp4
-rw-r--r--scene/animation/skeleton_ik.cpp13
-rw-r--r--scene/animation/skeleton_ik.h1
-rw-r--r--scene/animation/tween.cpp1
-rw-r--r--scene/gui/control.cpp6
-rw-r--r--scene/gui/line_edit.cpp4
-rw-r--r--scene/resources/tile_set.cpp1
-rw-r--r--scene/resources/visual_shader.cpp10
-rw-r--r--scene/resources/visual_shader.h5
13 files changed, 38 insertions, 46 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index c325de00b8..f59e3461b1 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -294,15 +294,6 @@ float CPUParticles2D::get_spread() const {
return spread;
}
-void CPUParticles2D::set_flatness(float p_flatness) {
-
- flatness = p_flatness;
-}
-float CPUParticles2D::get_flatness() const {
-
- return flatness;
-}
-
void CPUParticles2D::set_param(Parameter p_param, float p_value) {
ERR_FAIL_INDEX(p_param, PARAM_MAX);
@@ -1169,7 +1160,6 @@ void CPUParticles2D::convert_from_particles(Node *p_particles) {
Vector3 dir = material->get_direction();
set_direction(Vector2(dir.x, dir.y));
set_spread(material->get_spread());
- set_flatness(material->get_flatness());
set_color(material->get_color());
@@ -1283,9 +1273,6 @@ void CPUParticles2D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_spread", "degrees"), &CPUParticles2D::set_spread);
ClassDB::bind_method(D_METHOD("get_spread"), &CPUParticles2D::get_spread);
- ClassDB::bind_method(D_METHOD("set_flatness", "amount"), &CPUParticles2D::set_flatness);
- ClassDB::bind_method(D_METHOD("get_flatness"), &CPUParticles2D::get_flatness);
-
ClassDB::bind_method(D_METHOD("set_param", "param", "value"), &CPUParticles2D::set_param);
ClassDB::bind_method(D_METHOD("get_param", "param"), &CPUParticles2D::get_param);
@@ -1341,7 +1328,6 @@ void CPUParticles2D::_bind_methods() {
ADD_GROUP("Direction", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "direction"), "set_direction", "get_direction");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "spread", PROPERTY_HINT_RANGE, "0,180,0.01"), "set_spread", "get_spread");
- ADD_PROPERTY(PropertyInfo(Variant::REAL, "flatness", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_flatness", "get_flatness");
ADD_GROUP("Gravity", "");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "gravity"), "set_gravity", "get_gravity");
ADD_GROUP("Initial Velocity", "initial_");
@@ -1452,7 +1438,6 @@ CPUParticles2D::CPUParticles2D() {
set_direction(Vector2(1, 0));
set_spread(45);
- set_flatness(0);
set_param(PARAM_INITIAL_LINEAR_VELOCITY, 0);
set_param(PARAM_ANGULAR_VELOCITY, 0);
set_param(PARAM_ORBIT_VELOCITY, 0);
diff --git a/scene/2d/cpu_particles_2d.h b/scene/2d/cpu_particles_2d.h
index cbaff70c2a..085ec99ea0 100644
--- a/scene/2d/cpu_particles_2d.h
+++ b/scene/2d/cpu_particles_2d.h
@@ -154,7 +154,6 @@ private:
Vector2 direction;
float spread;
- float flatness;
float parameters[PARAM_MAX];
float randomness[PARAM_MAX];
@@ -243,9 +242,6 @@ public:
void set_spread(float p_spread);
float get_spread() const;
- void set_flatness(float p_flatness);
- float get_flatness() const;
-
void set_param(Parameter p_param, float p_value);
float get_param(Parameter p_param) const;
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp
index f0aaba1065..8d1556ef1c 100644
--- a/scene/3d/arvr_nodes.cpp
+++ b/scene/3d/arvr_nodes.cpp
@@ -85,9 +85,8 @@ Vector3 ARVRCamera::project_local_ray_normal(const Point2 &p_pos) const {
Vector3 ray;
CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
- float screen_w, screen_h;
- cm.get_viewport_size(screen_w, screen_h);
- ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_w, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_h, -get_znear()).normalized();
+ Vector2 screen_he = cm.get_viewport_half_extents();
+ ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -get_znear()).normalized();
return ray;
};
@@ -138,13 +137,12 @@ Vector3 ARVRCamera::project_position(const Point2 &p_point, float p_z_depth) con
CameraMatrix cm = arvr_interface->get_projection_for_eye(ARVRInterface::EYE_MONO, viewport_size.aspect(), get_znear(), get_zfar());
- Size2 vp_size;
- cm.get_viewport_size(vp_size.x, vp_size.y);
+ Vector2 vp_he = cm.get_viewport_half_extents();
Vector2 point;
point.x = (p_point.x / viewport_size.x) * 2.0 - 1.0;
point.y = (1.0 - (p_point.y / viewport_size.y)) * 2.0 - 1.0;
- point *= vp_size;
+ point *= vp_he;
Vector3 p(point.x, point.y, -p_z_depth);
diff --git a/scene/3d/camera.cpp b/scene/3d/camera.cpp
index 3a30755f7f..640189a26e 100644
--- a/scene/3d/camera.cpp
+++ b/scene/3d/camera.cpp
@@ -291,9 +291,8 @@ Vector3 Camera::project_local_ray_normal(const Point2 &p_pos) const {
} else {
CameraMatrix cm;
cm.set_perspective(fov, viewport_size.aspect(), near, far, keep_aspect == KEEP_WIDTH);
- float screen_w, screen_h;
- cm.get_viewport_size(screen_w, screen_h);
- ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_w, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_h, -near).normalized();
+ Vector2 screen_he = cm.get_viewport_half_extents();
+ ray = Vector3(((cpos.x / viewport_size.width) * 2.0 - 1.0) * screen_he.x, ((1.0 - (cpos.y / viewport_size.height)) * 2.0 - 1.0) * screen_he.y, -near).normalized();
}
return ray;
@@ -402,13 +401,12 @@ Vector3 Camera::project_position(const Point2 &p_point, float p_z_depth) const {
else
cm.set_perspective(fov, viewport_size.aspect(), p_z_depth, far, keep_aspect == KEEP_WIDTH);
- Size2 vp_size;
- cm.get_viewport_size(vp_size.x, vp_size.y);
+ Vector2 vp_he = cm.get_viewport_half_extents();
Vector2 point;
point.x = (p_point.x / viewport_size.x) * 2.0 - 1.0;
point.y = (1.0 - (p_point.y / viewport_size.y)) * 2.0 - 1.0;
- point *= vp_size;
+ point *= vp_he;
Vector3 p(point.x, point.y, -p_z_depth);
diff --git a/scene/animation/animation_blend_tree.cpp b/scene/animation/animation_blend_tree.cpp
index 5f606ff4c5..5c284cb483 100644
--- a/scene/animation/animation_blend_tree.cpp
+++ b/scene/animation/animation_blend_tree.cpp
@@ -832,8 +832,8 @@ void AnimationNodeTransition::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::REAL, "xfade_time", PROPERTY_HINT_RANGE, "0,120,0.01"), "set_cross_fade_time", "get_cross_fade_time");
for (int i = 0; i < MAX_INPUTS; i++) {
- ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name"), "set_input_caption", "get_input_caption", i);
- ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance"), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::STRING, "input_" + itos(i) + "/name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_caption", "get_input_caption", i);
+ ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "input_" + itos(i) + "/auto_advance", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_input_as_auto_advance", "is_input_set_as_auto_advance", i);
}
}
diff --git a/scene/animation/skeleton_ik.cpp b/scene/animation/skeleton_ik.cpp
index 518c243dd0..46028a9ce2 100644
--- a/scene/animation/skeleton_ik.cpp
+++ b/scene/animation/skeleton_ik.cpp
@@ -329,6 +329,17 @@ void FabrikInverseKinematic::solve(Task *p_task, real_t blending_delta, bool ove
}
}
+void FabrikInverseKinematic::reset(Task *p_task) {
+ ChainItem *ci(&p_task->chain.chain_root);
+ while (ci) {
+ p_task->skeleton->set_bone_global_pose_override(ci->bone, Transform(), 0);
+ if (!ci->children.empty())
+ ci = &ci->children.write[0];
+ else
+ ci = NULL;
+ }
+}
+
void SkeletonIK::_validate_property(PropertyInfo &property) const {
if (property.name == "root_bone" || property.name == "tip_bone") {
@@ -531,6 +542,8 @@ void SkeletonIK::start(bool p_one_time) {
void SkeletonIK::stop() {
set_process_internal(false);
+ if (task)
+ FabrikInverseKinematic::reset(task);
}
Transform SkeletonIK::_get_target_transform() {
diff --git a/scene/animation/skeleton_ik.h b/scene/animation/skeleton_ik.h
index 9ae010dc4e..8fc8a58b99 100644
--- a/scene/animation/skeleton_ik.h
+++ b/scene/animation/skeleton_ik.h
@@ -139,6 +139,7 @@ public:
static void set_goal(Task *p_task, const Transform &p_goal);
static void make_goal(Task *p_task, const Transform &p_inverse_transf, real_t blending_delta);
static void solve(Task *p_task, real_t blending_delta, bool override_tip_basis, bool p_use_magnet, const Vector3 &p_magnet_position);
+ static void reset(Task *p_task);
};
class SkeletonIK : public Node {
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index 58212335c2..331a6c769c 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -827,6 +827,7 @@ bool Tween::start() {
// Are there any pending updates?
if (pending_update != 0) {
// Start the tweens after deferring
+ call_deferred("start");
return true;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 4f499af186..ae48a1356e 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -2475,9 +2475,9 @@ void Control::_window_find_focus_neighbour(const Vector2 &p_dir, Node *p_at, con
Transform2D xform = c->get_global_transform();
points[0] = xform.xform(Point2());
- points[1] = xform.xform(Point2(get_size().x, 0));
- points[2] = xform.xform(get_size());
- points[3] = xform.xform(Point2(0, get_size().y));
+ points[1] = xform.xform(Point2(c->get_size().x, 0));
+ points[2] = xform.xform(c->get_size());
+ points[3] = xform.xform(Point2(0, c->get_size().y));
float min = 1e7;
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index 0f3328dac5..7afc3b0d00 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -128,7 +128,7 @@ void LineEdit::_gui_input(Ref<InputEvent> p_event) {
selection.doubleclick = false;
if (OS::get_singleton()->has_virtual_keyboard())
- OS::get_singleton()->show_virtual_keyboard(text, get_global_rect());
+ OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length);
}
update();
@@ -913,7 +913,7 @@ void LineEdit::_notification(int p_what) {
OS::get_singleton()->set_ime_position(get_global_position() + cursor_pos);
if (OS::get_singleton()->has_virtual_keyboard())
- OS::get_singleton()->show_virtual_keyboard(text, get_global_rect());
+ OS::get_singleton()->show_virtual_keyboard(text, get_global_rect(), max_length);
} break;
case NOTIFICATION_FOCUS_EXIT: {
diff --git a/scene/resources/tile_set.cpp b/scene/resources/tile_set.cpp
index d9caf1d657..a827793f67 100644
--- a/scene/resources/tile_set.cpp
+++ b/scene/resources/tile_set.cpp
@@ -1038,6 +1038,7 @@ void TileSet::_tile_set_shapes(int p_id, const Array &p_shapes) {
}
tile_map[p_id].shapes_data = shapes_data;
+ emit_changed();
}
Array TileSet::_tile_get_shapes(int p_id) const {
diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp
index 4d2082e3c1..a9d7cad07f 100644
--- a/scene/resources/visual_shader.cpp
+++ b/scene/resources/visual_shader.cpp
@@ -79,7 +79,7 @@ Vector<StringName> VisualShaderNode::get_editable_properties() const {
return Vector<StringName>();
}
-Array VisualShaderNode::_get_default_input_values() const {
+Array VisualShaderNode::get_default_input_values() const {
Array ret;
for (Map<int, Variant>::Element *E = default_input_values.front(); E; E = E->next()) {
@@ -88,7 +88,7 @@ Array VisualShaderNode::_get_default_input_values() const {
}
return ret;
}
-void VisualShaderNode::_set_default_input_values(const Array &p_values) {
+void VisualShaderNode::set_default_input_values(const Array &p_values) {
if (p_values.size() % 2 == 0) {
for (int i = 0; i < p_values.size(); i += 2) {
@@ -115,11 +115,11 @@ void VisualShaderNode::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_input_port_default_value", "port", "value"), &VisualShaderNode::set_input_port_default_value);
ClassDB::bind_method(D_METHOD("get_input_port_default_value", "port"), &VisualShaderNode::get_input_port_default_value);
- ClassDB::bind_method(D_METHOD("_set_default_input_values", "values"), &VisualShaderNode::_set_default_input_values);
- ClassDB::bind_method(D_METHOD("_get_default_input_values"), &VisualShaderNode::_get_default_input_values);
+ ClassDB::bind_method(D_METHOD("set_default_input_values", "values"), &VisualShaderNode::set_default_input_values);
+ ClassDB::bind_method(D_METHOD("get_default_input_values"), &VisualShaderNode::get_default_input_values);
ADD_PROPERTY(PropertyInfo(Variant::INT, "output_port_for_preview"), "set_output_port_for_preview", "get_output_port_for_preview");
- ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "_set_default_input_values", "_get_default_input_values");
+ ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "default_input_values", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL), "set_default_input_values", "get_default_input_values");
ADD_SIGNAL(MethodInfo("editor_refresh_request"));
BIND_ENUM_CONSTANT(PORT_TYPE_SCALAR);
diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h
index b2803d1dfb..d120ea6610 100644
--- a/scene/resources/visual_shader.h
+++ b/scene/resources/visual_shader.h
@@ -175,9 +175,6 @@ class VisualShaderNode : public Resource {
Map<int, Variant> default_input_values;
- Array _get_default_input_values() const;
- void _set_default_input_values(const Array &p_values);
-
protected:
static void _bind_methods();
@@ -199,6 +196,8 @@ public:
void set_input_port_default_value(int p_port, const Variant &p_value);
Variant get_input_port_default_value(int p_port) const; // if NIL (default if node does not set anything) is returned, it means no default value is wanted if disconnected, thus no input var must be supplied (empty string will be supplied)
+ Array get_default_input_values() const;
+ void set_default_input_values(const Array &p_values);
virtual int get_output_port_count() const = 0;
virtual PortType get_output_port_type(int p_port) const = 0;