diff options
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/arvr_nodes.cpp | 15 | ||||
-rw-r--r-- | scene/3d/arvr_nodes.h | 2 | ||||
-rw-r--r-- | scene/3d/bone_attachment.cpp | 6 | ||||
-rw-r--r-- | scene/3d/collision_shape.cpp | 3 | ||||
-rw-r--r-- | scene/3d/gi_probe.cpp | 3 | ||||
-rw-r--r-- | scene/3d/interpolated_camera.cpp | 4 | ||||
-rw-r--r-- | scene/3d/light.cpp | 9 | ||||
-rw-r--r-- | scene/3d/path.cpp | 4 |
8 files changed, 31 insertions, 15 deletions
diff --git a/scene/3d/arvr_nodes.cpp b/scene/3d/arvr_nodes.cpp index caf313190b..966dd88a2c 100644 --- a/scene/3d/arvr_nodes.cpp +++ b/scene/3d/arvr_nodes.cpp @@ -31,7 +31,6 @@ #include "arvr_nodes.h" #include "core/os/input.h" #include "servers/arvr/arvr_interface.h" -#include "servers/arvr/arvr_positional_tracker.h" #include "servers/arvr_server.h" //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -142,6 +141,7 @@ void ARVRController::_bind_methods() { ClassDB::bind_method(D_METHOD("get_joystick_axis", "axis"), &ARVRController::get_joystick_axis); ClassDB::bind_method(D_METHOD("get_is_active"), &ARVRController::get_is_active); + ClassDB::bind_method(D_METHOD("get_hand"), &ARVRController::get_hand); ADD_SIGNAL(MethodInfo("button_pressed", PropertyInfo(Variant::INT, "button"))); ADD_SIGNAL(MethodInfo("button_release", PropertyInfo(Variant::INT, "button"))); @@ -204,6 +204,19 @@ bool ARVRController::get_is_active() const { return is_active; }; +ARVRPositionalTracker::TrackerHand ARVRController::get_hand() const { + // get our ARVRServer + ARVRServer *arvr_server = ARVRServer::get_singleton(); + ERR_FAIL_NULL_V(arvr_server, ARVRPositionalTracker::TRACKER_HAND_UNKNOWN); + + ARVRPositionalTracker *tracker = arvr_server->find_by_type_and_id(ARVRServer::TRACKER_CONTROLLER, controller_id); + if (tracker == NULL) { + return ARVRPositionalTracker::TRACKER_HAND_UNKNOWN; + }; + + return tracker->get_hand(); +}; + String ARVRController::get_configuration_warning() const { if (!is_visible() || !is_inside_tree()) return String(); diff --git a/scene/3d/arvr_nodes.h b/scene/3d/arvr_nodes.h index 4c14be71b5..5269ec0248 100644 --- a/scene/3d/arvr_nodes.h +++ b/scene/3d/arvr_nodes.h @@ -33,6 +33,7 @@ #include "scene/3d/camera.h" #include "scene/3d/spatial.h" +#include "servers/arvr/arvr_positional_tracker.h" /** @author Bastiaan Olij <mux213@gmail.com> @@ -84,6 +85,7 @@ public: float get_joystick_axis(int p_axis) const; bool get_is_active() const; + ARVRPositionalTracker::TrackerHand get_hand() const; String get_configuration_warning() const; diff --git a/scene/3d/bone_attachment.cpp b/scene/3d/bone_attachment.cpp index e1a5329fb0..2580b645e2 100644 --- a/scene/3d/bone_attachment.cpp +++ b/scene/3d/bone_attachment.cpp @@ -71,7 +71,8 @@ void BoneAttachment::_get_property_list(List<PropertyInfo> *p_list) const { void BoneAttachment::_check_bind() { - if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) { + Skeleton *sk = Object::cast_to<Skeleton>(get_parent()); + if (sk) { int idx = sk->find_bone(bone_name); if (idx != -1) { @@ -86,7 +87,8 @@ void BoneAttachment::_check_unbind() { if (bound) { - if (Skeleton *sk = Object::cast_to<Skeleton>(get_parent())) { + Skeleton *sk = Object::cast_to<Skeleton>(get_parent()); + if (sk) { int idx = sk->find_bone(bone_name); if (idx != -1) { diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp index 5f1151f8e9..f49d89122d 100644 --- a/scene/3d/collision_shape.cpp +++ b/scene/3d/collision_shape.cpp @@ -50,7 +50,8 @@ void CollisionShape::make_convex_from_brothers() { for (int i = 0; i < p->get_child_count(); i++) { Node *n = p->get_child(i); - if (MeshInstance *mi = Object::cast_to<MeshInstance>(n)) { + MeshInstance *mi = Object::cast_to<MeshInstance>(n); + if (mi) { Ref<Mesh> m = mi->get_mesh(); if (m.is_valid()) { diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp index 444036de3a..66364d40f9 100644 --- a/scene/3d/gi_probe.cpp +++ b/scene/3d/gi_probe.cpp @@ -1097,7 +1097,8 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) { } } - if (Spatial *s = Object::cast_to<Spatial>(p_at_node)) { + Spatial *s = Object::cast_to<Spatial>(p_at_node); + if (s) { if (s->is_visible_in_tree()) { diff --git a/scene/3d/interpolated_camera.cpp b/scene/3d/interpolated_camera.cpp index 157ae42571..0f281b694d 100644 --- a/scene/3d/interpolated_camera.cpp +++ b/scene/3d/interpolated_camera.cpp @@ -55,8 +55,8 @@ void InterpolatedCamera::_notification(int p_what) { Transform local_transform = get_global_transform(); local_transform = local_transform.interpolate_with(target_xform, delta); set_global_transform(local_transform); - - if (Camera *cam = Object::cast_to<Camera>(node)) { + Camera *cam = Object::cast_to<Camera>(node); + if (cam) { if (cam->get_projection() == get_projection()) { diff --git a/scene/3d/light.cpp b/scene/3d/light.cpp index d410ba1e2a..096f787873 100644 --- a/scene/3d/light.cpp +++ b/scene/3d/light.cpp @@ -308,9 +308,8 @@ DirectionalLight::ShadowMode DirectionalLight::get_shadow_mode() const { } void DirectionalLight::set_shadow_depth_range(ShadowDepthRange p_range) { - shadow_depth_range=p_range; + shadow_depth_range = p_range; VS::get_singleton()->light_directional_set_shadow_depth_range_mode(light, VS::LightDirectionalShadowDepthRangeMode(p_range)); - } DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() const { @@ -318,7 +317,6 @@ DirectionalLight::ShadowDepthRange DirectionalLight::get_shadow_depth_range() co return shadow_depth_range; } - void DirectionalLight::set_blend_splits(bool p_enable) { blend_splits = p_enable; @@ -356,8 +354,8 @@ void DirectionalLight::_bind_methods() { BIND_ENUM_CONSTANT(SHADOW_PARALLEL_2_SPLITS); BIND_ENUM_CONSTANT(SHADOW_PARALLEL_4_SPLITS); - BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_STABLE ); - BIND_ENUM_CONSTANT( SHADOW_DEPTH_RANGE_OPTIMIZED ); + BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_STABLE); + BIND_ENUM_CONSTANT(SHADOW_DEPTH_RANGE_OPTIMIZED); } DirectionalLight::DirectionalLight() @@ -370,7 +368,6 @@ DirectionalLight::DirectionalLight() set_shadow_mode(SHADOW_PARALLEL_4_SPLITS); set_shadow_depth_range(SHADOW_DEPTH_RANGE_STABLE); - blend_splits = false; } diff --git a/scene/3d/path.cpp b/scene/3d/path.cpp index ed4d88417c..60245fe6ce 100644 --- a/scene/3d/path.cpp +++ b/scene/3d/path.cpp @@ -155,8 +155,8 @@ void PathFollow::_notification(int p_what) { Node *parent = get_parent(); if (parent) { - - if ((path = Object::cast_to<Path>(parent))) { + path = Object::cast_to<Path>(parent); + if (path) { _update_transform(); } } |