diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 30 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 3 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 1 | ||||
-rw-r--r-- | scene/gui/rich_text_label.cpp | 3 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 20 | ||||
-rw-r--r-- | scene/gui/tree.h | 1 | ||||
-rw-r--r-- | scene/main/http_request.cpp | 1 |
7 files changed, 56 insertions, 3 deletions
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index 064a249190..e1e0b9b1ce 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -231,7 +231,7 @@ void ARVRController::_notification(int p_what) { void ARVRController::_bind_methods() { ClassDB::bind_method(D_METHOD("set_controller_id", "controller_id"), &ARVRController::set_controller_id); ClassDB::bind_method(D_METHOD("get_controller_id"), &ARVRController::get_controller_id); - ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_id"), "set_controller_id", "get_controller_id"); + ADD_PROPERTY(PropertyInfo(Variant::INT, "controller_id", PROPERTY_HINT_RANGE, "1,32,1"), "set_controller_id", "get_controller_id"); ClassDB::bind_method(D_METHOD("get_controller_name"), &ARVRController::get_controller_name); // passthroughs to information about our related joystick @@ -242,6 +242,10 @@ void ARVRController::_bind_methods() { ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRController::get_is_active); ClassDB::bind_method(D_METHOD("get_hand"), &ARVRController::get_hand); + 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_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::INT, "button"))); ADD_SIGNAL(MethodInfo("button_release", PropertyInfo(Variant::INT, "button"))); }; @@ -299,6 +303,30 @@ float ARVRController::get_joystick_axis(int p_axis) const { return Input::get_singleton()->get_joy_axis(joy_id, p_axis); }; +real_t ARVRController::get_rumble() const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, 0.0); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); + if (tracker == NULL) { + return 0.0; + }; + + return tracker->get_rumble(); +}; + +void ARVRController::set_rumble(real_t p_rumble) { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL(arvr_server); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); + if (tracker != NULL) { + tracker->set_rumble(p_rumble); + }; +}; + bool ARVRController::get_is_active() const { return is_active; }; diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index e0ccfab58b..6e940351f2 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -89,6 +89,9 @@ public: int is_button_pressed(int p_button) const; float get_joystick_axis(int p_axis) const; + real_t get_rumble() const; + void set_rumble(real_t p_rumble); + bool get_is_active() const; ARVRPositionalTracker::TrackerHand get_hand() const; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index 0f631c69b6..80b7748078 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -202,7 +202,6 @@ void AnimationPlayer::_notification(int p_what) { if (!Engine::get_singleton()->is_editor_hint() && animation_set.has(autoplay)) { play(autoplay); - set_autoplay(""); //this line is the fix for autoplay issues with animatio _animation_process(0); } } break; diff --git a/scene/gui/rich_text_label.cpp b/scene/gui/rich_text_label.cpp index ad519d8d0c..65a8350bd3 100644 --- a/scene/gui/rich_text_label.cpp +++ b/scene/gui/rich_text_label.cpp @@ -1195,8 +1195,9 @@ void RichTextLabel::add_newline() { return; ItemNewline *item = memnew(ItemNewline); item->line = current_frame->lines.size(); - current_frame->lines.resize(current_frame->lines.size() + 1); _add_item(item, false); + current_frame->lines.resize(current_frame->lines.size() + 1); + _invalidate_current_line(current_frame); } bool RichTextLabel::remove_line(const int p_line) { diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index 5c6f2b0d01..f2e5919b5f 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -3332,6 +3332,26 @@ Point2 Tree::get_scroll() const { return ofs; } +void Tree::scroll_to_item(TreeItem *p_item) { + + if (!is_visible_in_tree()) { + + // hack to work around crash in get_item_rect() if Tree is not in tree. + return; + } + + // make sure the scrollbar min and max are up to date with latest changes. + update_scrollbars(); + + const Rect2 r = get_item_rect(p_item); + + if (r.position.y < v_scroll->get_value()) { + v_scroll->set_value(r.position.y); + } else if (r.position.y + r.size.y + 2 * cache.vseparation > v_scroll->get_value() + get_size().y) { + v_scroll->set_value(r.position.y + r.size.y + 2 * cache.vseparation - get_size().y); + } +} + TreeItem *Tree::_search_item_text(TreeItem *p_at, const String &p_find, int *r_col, bool p_selectable, bool p_backwards) { while (p_at) { diff --git a/scene/gui/tree.h b/scene/gui/tree.h index 2ee91a8b73..64d6016942 100644 --- a/scene/gui/tree.h +++ b/scene/gui/tree.h @@ -570,6 +570,7 @@ public: TreeItem *search_item_text(const String &p_find, int *r_col = NULL, bool p_selectable = false); Point2 get_scroll() const; + void scroll_to_item(TreeItem *p_item); void set_cursor_can_exit_tree(bool p_enable); bool can_cursor_exit_tree() const; diff --git a/scene/main/http_request.cpp b/scene/main/http_request.cpp index 1e1e4f2d5f..672e893f1b 100644 --- a/scene/main/http_request.cpp +++ b/scene/main/http_request.cpp @@ -579,6 +579,7 @@ HTTPRequest::HTTPRequest() { client.instance(); use_threads = false; thread_done = false; + downloaded = 0; body_size_limit = -1; file = NULL; status = HTTPClient::STATUS_DISCONNECTED; |