summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/cpu_particles_2d.cpp7
-rw-r--r--scene/2d/physics_body_2d.cpp8
-rw-r--r--scene/2d/tile_map.cpp1
-rw-r--r--scene/3d/area.cpp1
-rw-r--r--scene/3d/cpu_particles.cpp10
-rw-r--r--scene/animation/animation_node_state_machine.cpp6
-rw-r--r--scene/animation/animation_tree.cpp30
-rw-r--r--scene/gui/control.cpp5
-rw-r--r--scene/gui/graph_edit.cpp4
-rw-r--r--scene/gui/line_edit.cpp1
-rw-r--r--scene/gui/rich_text_label.cpp2
-rw-r--r--scene/gui/text_edit.h1
-rw-r--r--scene/gui/texture_button.cpp3
-rw-r--r--scene/main/node.cpp14
-rw-r--r--scene/main/node.h16
-rw-r--r--scene/main/scene_tree.cpp4
-rw-r--r--scene/main/scene_tree.h2
-rw-r--r--scene/main/viewport.cpp29
-rw-r--r--scene/main/viewport.h1
-rw-r--r--scene/resources/animation.cpp1
20 files changed, 111 insertions, 35 deletions
diff --git a/scene/2d/cpu_particles_2d.cpp b/scene/2d/cpu_particles_2d.cpp
index 05c2253a5b..721b52edaa 100644
--- a/scene/2d/cpu_particles_2d.cpp
+++ b/scene/2d/cpu_particles_2d.cpp
@@ -37,7 +37,8 @@
void CPUParticles2D::set_emitting(bool p_emitting) {
emitting = p_emitting;
- set_process_internal(true);
+ if (emitting)
+ set_process_internal(true);
}
void CPUParticles2D::set_amount(int p_amount) {
@@ -965,7 +966,7 @@ void CPUParticles2D::_update_render_thread() {
void CPUParticles2D::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- _set_redraw(true);
+ set_process_internal(emitting);
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -1001,7 +1002,6 @@ void CPUParticles2D::_notification(int p_what) {
float delta = get_process_delta_time();
if (emitting) {
- _set_redraw(true);
inactive_time = 0;
} else {
inactive_time += delta;
@@ -1017,6 +1017,7 @@ void CPUParticles2D::_notification(int p_what) {
return;
}
}
+ _set_redraw(true);
if (time == 0 && pre_process_time > 0.0) {
diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp
index 1b7e1a6b8b..690f1d4b4a 100644
--- a/scene/2d/physics_body_2d.cpp
+++ b/scene/2d/physics_body_2d.cpp
@@ -199,7 +199,7 @@ real_t StaticBody2D::get_constant_angular_velocity() const {
#ifndef DISABLE_DEPRECATED
void StaticBody2D::set_friction(real_t p_friction) {
- if (p_friction == 1.0) { // default value, don't create an override for that
+ if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -229,7 +229,7 @@ real_t StaticBody2D::get_friction() const {
void StaticBody2D::set_bounce(real_t p_bounce) {
- if (p_bounce == 0.0) { // default value, don't create an override for that
+ if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -626,7 +626,7 @@ real_t RigidBody2D::get_weight() const {
#ifndef DISABLE_DEPRECATED
void RigidBody2D::set_friction(real_t p_friction) {
- if (p_friction == 1.0) { // default value, don't create an override for that
+ if (p_friction == 1.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
@@ -655,7 +655,7 @@ real_t RigidBody2D::get_friction() const {
void RigidBody2D::set_bounce(real_t p_bounce) {
- if (p_bounce == 0.0) { // default value, don't create an override for that
+ if (p_bounce == 0.0 && physics_material_override.is_null()) { // default value, don't create an override for that
return;
}
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index ed0a9c4915..46b4f0a5d2 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -773,6 +773,7 @@ void TileMap::set_cell(int p_x, int p_y, int p_tile, bool p_flip_x, bool p_flip_
else
_make_quadrant_dirty(Q);
+ used_size_cache_dirty = true;
return;
}
diff --git a/scene/3d/area.cpp b/scene/3d/area.cpp
index e58e26d2d1..13d9181082 100644
--- a/scene/3d/area.cpp
+++ b/scene/3d/area.cpp
@@ -756,7 +756,6 @@ Area::Area() :
monitorable = false;
collision_mask = 1;
collision_layer = 1;
- set_ray_pickable(false);
set_monitoring(true);
set_monitorable(true);
diff --git a/scene/3d/cpu_particles.cpp b/scene/3d/cpu_particles.cpp
index 85bc2dd529..469a1e87db 100644
--- a/scene/3d/cpu_particles.cpp
+++ b/scene/3d/cpu_particles.cpp
@@ -47,7 +47,8 @@ PoolVector<Face3> CPUParticles::get_faces(uint32_t p_usage_flags) const {
void CPUParticles::set_emitting(bool p_emitting) {
emitting = p_emitting;
- set_process_internal(true);
+ if (emitting)
+ set_process_internal(true);
}
void CPUParticles::set_amount(int p_amount) {
@@ -1002,9 +1003,11 @@ void CPUParticles::_set_redraw(bool p_redraw) {
if (redraw) {
VS::get_singleton()->connect("frame_pre_draw", this, "_update_render_thread");
VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, true);
+ VS::get_singleton()->multimesh_set_visible_instances(multimesh, -1);
} else {
VS::get_singleton()->disconnect("frame_pre_draw", this, "_update_render_thread");
VS::get_singleton()->instance_geometry_set_flag(get_instance(), VS::INSTANCE_FLAG_DRAW_NEXT_FRAME_IF_VISIBLE, false);
+ VS::get_singleton()->multimesh_set_visible_instances(multimesh, 0);
}
#ifndef NO_THREADS
update_mutex->unlock();
@@ -1029,7 +1032,7 @@ void CPUParticles::_update_render_thread() {
void CPUParticles::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE) {
- _set_redraw(true);
+ set_process_internal(emitting);
}
if (p_what == NOTIFICATION_EXIT_TREE) {
@@ -1048,8 +1051,6 @@ void CPUParticles::_notification(int p_what) {
float delta = get_process_delta_time();
if (emitting) {
-
- _set_redraw(true);
inactive_time = 0;
} else {
inactive_time += delta;
@@ -1065,6 +1066,7 @@ void CPUParticles::_notification(int p_what) {
return;
}
}
+ _set_redraw(true);
bool processed = false;
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index 5df3da93e1..68ad71d01c 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -440,13 +440,13 @@ float AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *sm,
bool goto_next = false;
- if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_IMMEDIATE) {
- goto_next = fading_from == StringName();
- } else {
+ if (switch_mode == AnimationNodeStateMachineTransition::SWITCH_MODE_AT_END) {
goto_next = next_xfade >= (len_current - pos_current) || loops_current > 0;
if (loops_current > 0) {
next_xfade = 0;
}
+ } else {
+ goto_next = fading_from == StringName();
}
if (goto_next) { //loops should be used because fade time may be too small or zero and animation may have looped
diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp
index 0b6fa26bfc..fe1b8247ff 100644
--- a/scene/animation/animation_tree.cpp
+++ b/scene/animation/animation_tree.cpp
@@ -883,16 +883,16 @@ void AnimationTree::_process_graph(float p_delta) {
TrackCacheTransform *t = static_cast<TrackCacheTransform *>(track);
- if (t->process_pass != process_pass) {
+ if (track->root_motion) {
- t->process_pass = process_pass;
- t->loc = Vector3();
- t->rot = Quat();
- t->rot_blend_accum = 0;
- t->scale = Vector3();
- }
+ if (t->process_pass != process_pass) {
- if (track->root_motion) {
+ t->process_pass = process_pass;
+ t->loc = Vector3();
+ t->rot = Quat();
+ t->rot_blend_accum = 0;
+ t->scale = Vector3();
+ }
float prev_time = time - delta;
if (prev_time < 0) {
@@ -946,6 +946,15 @@ void AnimationTree::_process_graph(float p_delta) {
Error err = a->transform_track_interpolate(i, time, &loc, &rot, &scale);
//ERR_CONTINUE(err!=OK); //used for testing, should be removed
+ if (t->process_pass != process_pass) {
+
+ t->process_pass = process_pass;
+ t->loc = loc;
+ t->rot = rot;
+ t->rot_blend_accum = 0;
+ t->scale = Vector3();
+ }
+
scale -= Vector3(1.0, 1.0, 1.0); //helps make it work properly with Add nodes
if (err != OK)
@@ -978,8 +987,7 @@ void AnimationTree::_process_graph(float p_delta) {
continue;
if (t->process_pass != process_pass) {
- Variant::CallError ce;
- t->value = Variant::construct(value.get_type(), NULL, 0, ce); //reset
+ t->value = value;
t->process_pass = process_pass;
}
@@ -1036,7 +1044,7 @@ void AnimationTree::_process_graph(float p_delta) {
float bezier = a->bezier_track_interpolate(i, time);
if (t->process_pass != process_pass) {
- t->value = 0;
+ t->value = bezier;
t->process_pass = process_pass;
}
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index 86894ce070..c7cd2bb6d8 100644
--- a/scene/gui/control.cpp
+++ b/scene/gui/control.cpp
@@ -1388,7 +1388,10 @@ void Control::set_anchor(Margin p_margin, float p_anchor, bool p_keep_margin, bo
}
update();
- _change_notify("anchor");
+ _change_notify("anchor_left");
+ _change_notify("anchor_right");
+ _change_notify("anchor_top");
+ _change_notify("anchor_bottom");
}
void Control::_set_anchor(Margin p_margin, float p_anchor) {
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index 68e734502b..30ad81bb2e 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -770,7 +770,9 @@ void GraphEdit::_top_layer_draw() {
}
if (box_selecting)
- top_layer->draw_rect(box_selecting_rect, Color(0.7, 0.7, 1.0, 0.3));
+ top_layer->draw_rect(
+ box_selecting_rect,
+ get_color("accent_color", "Editor") * Color(1, 1, 1, 0.375));
}
void GraphEdit::set_selected(Node *p_child) {
diff --git a/scene/gui/line_edit.cpp b/scene/gui/line_edit.cpp
index bf6833e512..874246586d 100644
--- a/scene/gui/line_edit.cpp
+++ b/scene/gui/line_edit.cpp
@@ -1223,6 +1223,7 @@ void LineEdit::append_at_cursor(String p_text) {
void LineEdit::clear_internal() {
+ deselect();
_clear_undo_stack();
cached_width = 0;
cursor_pos = 0;
diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp
index 8968923b2c..00d6ac3b94 100644
--- a/scene/gui/rich_text_label.cpp
+++ b/scene/gui/rich_text_label.cpp
@@ -1136,8 +1136,8 @@ void RichTextLabel::_gui_input(Ref<InputEvent> p_event) {
emit_signal("meta_hover_started", meta);
}
} else if (meta_hovering) {
- emit_signal("meta_hover_ended", current_meta);
meta_hovering = NULL;
+ emit_signal("meta_hover_ended", current_meta);
current_meta = false;
}
}
diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h
index 95f1fbbee5..33f0a3f45d 100644
--- a/scene/gui/text_edit.h
+++ b/scene/gui/text_edit.h
@@ -683,6 +683,7 @@ protected:
TextEdit *text_editor;
public:
+ virtual ~SyntaxHighlighter() {}
virtual void _update_cache() = 0;
virtual Map<int, TextEdit::HighlighterInfo> _get_line_syntax_highlighting(int p_line) = 0;
diff --git a/scene/gui/texture_button.cpp b/scene/gui/texture_button.cpp
index 19bef9fdf5..795b25cce0 100644
--- a/scene/gui/texture_button.cpp
+++ b/scene/gui/texture_button.cpp
@@ -223,8 +223,7 @@ void TextureButton::_notification(int p_what) {
}
if (has_focus() && focused.is_valid()) {
- Rect2 drect(Point2(), get_size());
- draw_texture_rect(focused, drect, false);
+ draw_texture_rect(focused, _position_rect, false);
};
} break;
}
diff --git a/scene/main/node.cpp b/scene/main/node.cpp
index 04d7107fa4..96e286602a 100644
--- a/scene/main/node.cpp
+++ b/scene/main/node.cpp
@@ -2830,10 +2830,22 @@ void Node::_bind_methods() {
BIND_CONSTANT(NOTIFICATION_DRAG_BEGIN);
BIND_CONSTANT(NOTIFICATION_DRAG_END);
BIND_CONSTANT(NOTIFICATION_PATH_CHANGED);
- BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
BIND_CONSTANT(NOTIFICATION_INTERNAL_PROCESS);
BIND_CONSTANT(NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
+ BIND_CONSTANT(NOTIFICATION_WM_MOUSE_ENTER);
+ BIND_CONSTANT(NOTIFICATION_WM_MOUSE_EXIT);
+ BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
+ BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
+ BIND_CONSTANT(NOTIFICATION_WM_QUIT_REQUEST);
+ BIND_CONSTANT(NOTIFICATION_WM_GO_BACK_REQUEST);
+ BIND_CONSTANT(NOTIFICATION_WM_UNFOCUS_REQUEST);
+ BIND_CONSTANT(NOTIFICATION_OS_MEMORY_WARNING);
+ BIND_CONSTANT(NOTIFICATION_TRANSLATION_CHANGED);
+ BIND_CONSTANT(NOTIFICATION_WM_ABOUT);
+ BIND_CONSTANT(NOTIFICATION_CRASH);
+ BIND_CONSTANT(NOTIFICATION_OS_IME_UPDATE);
+
BIND_ENUM_CONSTANT(PAUSE_MODE_INHERIT);
BIND_ENUM_CONSTANT(PAUSE_MODE_STOP);
BIND_ENUM_CONSTANT(PAUSE_MODE_PROCESS);
diff --git a/scene/main/node.h b/scene/main/node.h
index e6189389cb..b490db37c5 100644
--- a/scene/main/node.h
+++ b/scene/main/node.h
@@ -216,6 +216,7 @@ protected:
public:
enum {
+
// you can make your own, but don't use the same numbers as other notifications in other nodes
NOTIFICATION_ENTER_TREE = 10,
NOTIFICATION_EXIT_TREE = 11,
@@ -231,10 +232,23 @@ public:
NOTIFICATION_DRAG_BEGIN = 21,
NOTIFICATION_DRAG_END = 22,
NOTIFICATION_PATH_CHANGED = 23,
- NOTIFICATION_TRANSLATION_CHANGED = 24,
+ //NOTIFICATION_TRANSLATION_CHANGED = 24, moved below
NOTIFICATION_INTERNAL_PROCESS = 25,
NOTIFICATION_INTERNAL_PHYSICS_PROCESS = 26,
NOTIFICATION_POST_ENTER_TREE = 27,
+ //keep these linked to node
+ NOTIFICATION_WM_MOUSE_ENTER = MainLoop::NOTIFICATION_WM_MOUSE_ENTER,
+ NOTIFICATION_WM_MOUSE_EXIT = MainLoop::NOTIFICATION_WM_MOUSE_EXIT,
+ NOTIFICATION_WM_FOCUS_IN = MainLoop::NOTIFICATION_WM_FOCUS_IN,
+ NOTIFICATION_WM_FOCUS_OUT = MainLoop::NOTIFICATION_WM_FOCUS_OUT,
+ NOTIFICATION_WM_QUIT_REQUEST = MainLoop::NOTIFICATION_WM_QUIT_REQUEST,
+ NOTIFICATION_WM_GO_BACK_REQUEST = MainLoop::NOTIFICATION_WM_GO_BACK_REQUEST,
+ NOTIFICATION_WM_UNFOCUS_REQUEST = MainLoop::NOTIFICATION_WM_UNFOCUS_REQUEST,
+ NOTIFICATION_OS_MEMORY_WARNING = MainLoop::NOTIFICATION_OS_MEMORY_WARNING,
+ NOTIFICATION_TRANSLATION_CHANGED = MainLoop::NOTIFICATION_TRANSLATION_CHANGED,
+ NOTIFICATION_WM_ABOUT = MainLoop::NOTIFICATION_WM_ABOUT,
+ NOTIFICATION_CRASH = MainLoop::NOTIFICATION_CRASH,
+ NOTIFICATION_OS_IME_UPDATE = MainLoop::NOTIFICATION_OS_IME_UPDATE
};
diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp
index 689f18a09d..81c38cec89 100644
--- a/scene/main/scene_tree.cpp
+++ b/scene/main/scene_tree.cpp
@@ -658,13 +658,15 @@ void SceneTree::_notification(int p_notification) {
} break;
case NOTIFICATION_TRANSLATION_CHANGED: {
if (!Engine::get_singleton()->is_editor_hint()) {
- get_root()->propagate_notification(Node::NOTIFICATION_TRANSLATION_CHANGED);
+ get_root()->propagate_notification(p_notification);
}
} break;
case NOTIFICATION_WM_UNFOCUS_REQUEST: {
notify_group_flags(GROUP_CALL_REALTIME | GROUP_CALL_MULTILEVEL, "input", NOTIFICATION_WM_UNFOCUS_REQUEST);
+ get_root()->propagate_notification(p_notification);
+
} break;
case NOTIFICATION_WM_ABOUT: {
diff --git a/scene/main/scene_tree.h b/scene/main/scene_tree.h
index e15a64604d..e098b3d53c 100644
--- a/scene/main/scene_tree.h
+++ b/scene/main/scene_tree.h
@@ -287,7 +287,7 @@ protected:
public:
enum {
- NOTIFICATION_TRANSFORM_CHANGED = 29
+ NOTIFICATION_TRANSFORM_CHANGED = 2000
};
enum GroupCallFlags {
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp
index a5d86c3e1a..2524af9cfb 100644
--- a/scene/main/viewport.cpp
+++ b/scene/main/viewport.cpp
@@ -659,7 +659,11 @@ void Viewport::_notification(int p_what) {
}
} break;
+ case SceneTree::NOTIFICATION_WM_MOUSE_EXIT:
case SceneTree::NOTIFICATION_WM_FOCUS_OUT: {
+
+ _drop_physics_mouseover();
+
if (gui.mouse_focus) {
//if mouse is being pressed, send a release event
_drop_mouse_focus();
@@ -2561,6 +2565,31 @@ void Viewport::_drop_mouse_focus() {
}
}
+void Viewport::_drop_physics_mouseover() {
+
+ physics_has_last_mousepos = false;
+
+ while (physics_2d_mouseover.size()) {
+ Object *o = ObjectDB::get_instance(physics_2d_mouseover.front()->key());
+ if (o) {
+ CollisionObject2D *co = Object::cast_to<CollisionObject2D>(o);
+ co->_mouse_exit();
+ }
+ physics_2d_mouseover.erase(physics_2d_mouseover.front());
+ }
+
+#ifndef _3D_DISABLED
+ if (physics_object_over) {
+ CollisionObject *co = Object::cast_to<CollisionObject>(ObjectDB::get_instance(physics_object_over));
+ if (co) {
+ co->_mouse_exit();
+ }
+ }
+
+ physics_object_over = physics_object_capture = 0;
+#endif
+}
+
List<Control *>::Element *Viewport::_gui_show_modal(Control *p_control) {
gui.modal_stack.push_back(p_control);
diff --git a/scene/main/viewport.h b/scene/main/viewport.h
index 831c285517..d67b4ac348 100644
--- a/scene/main/viewport.h
+++ b/scene/main/viewport.h
@@ -383,6 +383,7 @@ private:
void _canvas_layer_remove(CanvasLayer *p_canvas_layer);
void _drop_mouse_focus();
+ void _drop_physics_mouseover();
void _update_canvas_items(Node *p_node);
diff --git a/scene/resources/animation.cpp b/scene/resources/animation.cpp
index 3eb16c544c..f73914b186 100644
--- a/scene/resources/animation.cpp
+++ b/scene/resources/animation.cpp
@@ -2638,6 +2638,7 @@ void Animation::copy_track(int p_track, Ref<Animation> p_to_animation) {
p_to_animation->track_set_enabled(dst_track, track_is_enabled(p_track));
p_to_animation->track_set_interpolation_type(dst_track, track_get_interpolation_type(p_track));
p_to_animation->track_set_interpolation_loop_wrap(dst_track, track_get_interpolation_loop_wrap(p_track));
+ p_to_animation->value_track_set_update_mode(dst_track, value_track_get_update_mode(p_track));
for (int i = 0; i < track_get_key_count(p_track); i++) {
p_to_animation->track_insert_key(dst_track, track_get_key_time(p_track, i), track_get_key_value(p_track, i), track_get_key_transition(p_track, i));
}