diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/animation/animation_player.cpp | 2 | ||||
-rw-r--r-- | scene/gui/control.cpp | 10 | ||||
-rw-r--r-- | scene/main/viewport.cpp | 6 | ||||
-rw-r--r-- | scene/main/window.cpp | 20 | ||||
-rw-r--r-- | scene/main/window.h | 4 |
5 files changed, 29 insertions, 13 deletions
diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 2f39c973a0..66c587e2d4 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -1055,6 +1055,8 @@ void AnimationPlayer::get_animation_list(List<StringName> *p_animations) const { } void AnimationPlayer::set_blend_time(const StringName &p_animation1, const StringName &p_animation2, float p_time) { + ERR_FAIL_COND(!animation_set.has(p_animation1)); + ERR_FAIL_COND(!animation_set.has(p_animation2)); ERR_FAIL_COND_MSG(p_time < 0, "Blend time cannot be smaller than 0."); BlendKey bk; diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 97daeceda9..2cdee4641e 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1173,7 +1173,17 @@ Rect2 Control::get_parent_anchorable_rect() const { if (data.parent_canvas_item) { parent_rect = data.parent_canvas_item->get_anchorable_rect(); } else { +#ifdef TOOLS_ENABLED + Node *edited_root = get_tree()->get_edited_scene_root(); + if (edited_root && (this == edited_root || edited_root->is_a_parent_of(this))) { + parent_rect.size = Size2(ProjectSettings::get_singleton()->get("display/window/size/width"), ProjectSettings::get_singleton()->get("display/window/size/height")); + } else { + parent_rect = get_viewport()->get_visible_rect(); + } + +#else parent_rect = get_viewport()->get_visible_rect(); +#endif } return parent_rect; diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 65a72267b1..1c259b7d32 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -2083,7 +2083,11 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) { Control *c = over; Vector2 cpos = pos; while (c) { - cursor_shape = c->get_cursor_shape(cpos); + if (gui.mouse_focus_mask != 0 || c->has_point(cpos)) { + cursor_shape = c->get_cursor_shape(cpos); + } else { + cursor_shape = Control::CURSOR_ARROW; + } cpos = c->get_transform().xform(cpos); if (cursor_shape != Control::CURSOR_ARROW) { break; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 0463615d4d..48540b7bc9 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -309,6 +309,7 @@ void Window::_event_callback(DisplayServer::WindowEvent p_event) { case DisplayServer::WINDOW_EVENT_MOUSE_ENTER: { _propagate_window_notification(this, NOTIFICATION_WM_MOUSE_ENTER); emit_signal("mouse_entered"); + DisplayServer::get_singleton()->cursor_set_shape(DisplayServer::CURSOR_ARROW); //restore cursor shape } break; case DisplayServer::WINDOW_EVENT_MOUSE_EXIT: { _propagate_window_notification(this, NOTIFICATION_WM_MOUSE_EXIT); @@ -624,26 +625,25 @@ void Window::_update_viewport_size() { // Already handled above //_update_font_oversampling(1.0); } break; - case CONTENT_SCALE_MODE_OBJECTS: { + case CONTENT_SCALE_MODE_CANVAS_ITEMS: { final_size = screen_size; final_size_override = viewport_size; attach_to_screen_rect = Rect2(margin, screen_size); font_oversampling = screen_size.x / viewport_size.x; + + Size2 scale = Vector2(screen_size) / Vector2(final_size_override); + stretch_transform.scale(scale); + } break; - case CONTENT_SCALE_MODE_PIXELS: { + case CONTENT_SCALE_MODE_VIEWPORT: { final_size = viewport_size; attach_to_screen_rect = Rect2(margin, screen_size); } break; } - - Size2 scale = size / (Vector2(final_size) + margin * 2); - stretch_transform.scale(scale); - stretch_transform.elements[2] = margin * scale; } bool allocate = is_inside_tree() && visible && (window_id != DisplayServer::INVALID_WINDOW_ID || embedder != nullptr); - _set_size(final_size, final_size_override, attach_to_screen_rect, stretch_transform, allocate); if (window_id != DisplayServer::INVALID_WINDOW_ID) { @@ -1372,7 +1372,7 @@ void Window::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "max_size"), "set_max_size", "get_max_size"); ADD_GROUP("Content Scale", "content_scale_"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "content_scale_size"), "set_content_scale_size", "get_content_scale_size"); - ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_mode", PROPERTY_HINT_ENUM, "Disabled,Object,Pixels"), "set_content_scale_mode", "get_content_scale_mode"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_mode", PROPERTY_HINT_ENUM, "Disabled,CanvasItems,Viewport"), "set_content_scale_mode", "get_content_scale_mode"); ADD_PROPERTY(PropertyInfo(Variant::INT, "content_scale_aspect", PROPERTY_HINT_ENUM, "Ignore,Keep,KeepWidth,KeepHeight,Expand"), "set_content_scale_aspect", "get_content_scale_aspect"); ADD_GROUP("Theme", ""); ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "theme", PROPERTY_HINT_RESOURCE_TYPE, "Theme"), "set_theme", "get_theme"); @@ -1403,8 +1403,8 @@ void Window::_bind_methods() { BIND_ENUM_CONSTANT(FLAG_MAX); BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_DISABLED); - BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_OBJECTS); - BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_PIXELS); + BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_CANVAS_ITEMS); + BIND_ENUM_CONSTANT(CONTENT_SCALE_MODE_VIEWPORT); BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_IGNORE); BIND_ENUM_CONSTANT(CONTENT_SCALE_ASPECT_KEEP); diff --git a/scene/main/window.h b/scene/main/window.h index 5fd59e06f5..c8c02b8984 100644 --- a/scene/main/window.h +++ b/scene/main/window.h @@ -57,8 +57,8 @@ public: enum ContentScaleMode { CONTENT_SCALE_MODE_DISABLED, - CONTENT_SCALE_MODE_OBJECTS, - CONTENT_SCALE_MODE_PIXELS, + CONTENT_SCALE_MODE_CANVAS_ITEMS, + CONTENT_SCALE_MODE_VIEWPORT, }; enum ContentScaleAspect { |