From da566ff2b2b6cecd1021b03f6a5f4271b45c43b2 Mon Sep 17 00:00:00 2001 From: Daniel Kinsman Date: Tue, 13 Aug 2024 11:49:08 +1000 Subject: [PATCH] Fix hold button accessing non existant property on start xr (#665) --- addons/godot-xr-tools/desktop-support/controler_hider.gd | 8 ++++---- .../desktop-support/function_desktop_pointer.gd | 2 +- addons/godot-xr-tools/desktop-support/mouse_capture.gd | 6 +++--- .../desktop-support/movement_desktop_crouch.gd | 2 +- .../desktop-support/movement_desktop_direct.gd | 2 +- .../desktop-support/movement_desktop_flight.gd | 2 +- .../desktop-support/movement_desktop_jump.gd | 2 +- .../desktop-support/movement_desktop_sprint.gd | 2 +- .../desktop-support/movement_desktop_turn.gd | 4 ++-- addons/godot-xr-tools/misc/hold_button.gd | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/godot-xr-tools/desktop-support/controler_hider.gd b/addons/godot-xr-tools/desktop-support/controler_hider.gd index d726beef..4863e4da 100644 --- a/addons/godot-xr-tools/desktop-support/controler_hider.gd +++ b/addons/godot-xr-tools/desktop-support/controler_hider.gd @@ -32,13 +32,13 @@ func is_xr_class(name : String) -> bool: func _process(_delta: float) -> void: if Engine.is_editor_hint() or !is_inside_tree(): return - if xr_start_node.xr_active==_last_xr_active: + if xr_start_node.is_xr_active()==_last_xr_active: return if _pointer_disabler: - get_parent().enabled=xr_start_node.xr_active + get_parent().enabled=xr_start_node.is_xr_active() elif is_instance_valid(_controller): - _controller.visible=xr_start_node.xr_active - _last_xr_active=xr_start_node.xr_active + _controller.visible=xr_start_node.is_xr_active() + _last_xr_active=xr_start_node.is_xr_active() # This method verifies the movement provider has a valid configuration. diff --git a/addons/godot-xr-tools/desktop-support/function_desktop_pointer.gd b/addons/godot-xr-tools/desktop-support/function_desktop_pointer.gd index d95247d6..017708e2 100644 --- a/addons/godot-xr-tools/desktop-support/function_desktop_pointer.gd +++ b/addons/godot-xr-tools/desktop-support/function_desktop_pointer.gd @@ -153,7 +153,7 @@ func _process(_delta): if (_world_scale != new_world_scale): _world_scale = new_world_scale _update_y_offset() - set_enabled(!xr_start_node.xr_active) + set_enabled(!xr_start_node.is_xr_active()) if Input.is_action_just_released(active_button_action): _on_button_pressed(active_button_action) diff --git a/addons/godot-xr-tools/desktop-support/mouse_capture.gd b/addons/godot-xr-tools/desktop-support/mouse_capture.gd index 179338bd..1ce4fcfb 100644 --- a/addons/godot-xr-tools/desktop-support/mouse_capture.gd +++ b/addons/godot-xr-tools/desktop-support/mouse_capture.gd @@ -33,7 +33,7 @@ func is_xr_class(name : String) -> bool: # Perform jump movement func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the player body isn't active - var check1 :bool= (xr_start_node.xr_active and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED) + var check1 :bool= (xr_start_node.is_xr_active() and Input.mouse_mode==Input.MOUSE_MODE_CAPTURED) if !player_body.enabled or check1: return @@ -43,9 +43,9 @@ func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: #print(Input.mouse_mode==Input.MOUSE_MODE_CAPTURED) - if Input.mouse_mode==Input.MOUSE_MODE_CAPTURED and (xr_start_node.xr_active or !capture): + if Input.mouse_mode==Input.MOUSE_MODE_CAPTURED and (xr_start_node.is_xr_active() or !capture): Input.mouse_mode=Input.MOUSE_MODE_VISIBLE - elif (!xr_start_node.xr_active and capture): + elif (!xr_start_node.is_xr_active() and capture): Input.mouse_mode=Input.MOUSE_MODE_CAPTURED return diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_crouch.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_crouch.gd index 3d4206a4..6946f767 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_crouch.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_crouch.gd @@ -54,7 +54,7 @@ func is_xr_class(name : String) -> bool: # Perform jump movement func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the controller isn't active - if !player_body.enabled or xr_start_node.xr_active: + if !player_body.enabled or xr_start_node.is_xr_active(): return # Detect crouch button down and pressed states diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_direct.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_direct.gd index ace39a5a..9f810ebf 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_direct.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_direct.gd @@ -43,7 +43,7 @@ func is_xr_class(name : String) -> bool: # Perform jump movement func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the controller isn't active - if !player_body.enabled or xr_start_node.xr_active: + if !player_body.enabled or xr_start_node.is_xr_active(): return #Calculate input vector diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_flight.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_flight.gd index fe0a4d02..2b0a079c 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_flight.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_flight.gd @@ -91,7 +91,7 @@ func _ready(): # Process physics movement for flight func physics_movement(delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Disable flying if requested, or if no controller - if disabled or !enabled or !player_body.enabled or xr_start_node.xr_active: + if disabled or !enabled or !player_body.enabled or xr_start_node.is_xr_active(): set_flying(false) return diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_jump.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_jump.gd index 4493cee2..da621685 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_jump.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_jump.gd @@ -35,7 +35,7 @@ func is_xr_class(name : String) -> bool: # Perform jump movement func physics_movement(_delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the jump controller isn't active - if !player_body.enabled or xr_start_node.xr_active: + if !player_body.enabled or xr_start_node.is_xr_active(): return # Request jump if the button is pressed diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_sprint.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_sprint.gd index 55c64722..783a7680 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_sprint.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_sprint.gd @@ -72,7 +72,7 @@ func _ready(): # Perform sprinting func physics_movement(_delta: float, player_body: XRToolsPlayerBody, disabled: bool): # Skip if the controller isn't active or is not enabled - if !player_body.enabled or xr_start_node.xr_active or disabled == true or !enabled: + if !player_body.enabled or xr_start_node.is_xr_active() or disabled == true or !enabled: set_sprinting(false) return diff --git a/addons/godot-xr-tools/desktop-support/movement_desktop_turn.gd b/addons/godot-xr-tools/desktop-support/movement_desktop_turn.gd index 29dd4a87..34c9638d 100644 --- a/addons/godot-xr-tools/desktop-support/movement_desktop_turn.gd +++ b/addons/godot-xr-tools/desktop-support/movement_desktop_turn.gd @@ -73,7 +73,7 @@ func _unhandled_input(event): func _process(_delta: float) -> void: if is_instance_valid(plr_body): - if !plr_body.enabled and !xr_start_node.xr_active and _last_plr_bd_status!=plr_body.enabled: + if !plr_body.enabled and !xr_start_node.is_xr_active() and _last_plr_bd_status!=plr_body.enabled: if clear_mouse_move_when_body_not_active: mouse_move_vector=Vector2.ZERO if clear_cam_x_when_body_not_active: @@ -87,7 +87,7 @@ func _process(_delta: float) -> void: func physics_movement(delta: float, player_body: XRToolsPlayerBody, _disabled: bool): # Skip if the player body isn't active plr_body=player_body - if !player_body.enabled or xr_start_node.xr_active: + if !player_body.enabled or xr_start_node.is_xr_active(): if clear_mouse_move_when_body_not_active: mouse_move_vector=Vector2.ZERO if clear_cam_x_when_body_not_active: diff --git a/addons/godot-xr-tools/misc/hold_button.gd b/addons/godot-xr-tools/misc/hold_button.gd index ac53352a..391d05d2 100644 --- a/addons/godot-xr-tools/misc/hold_button.gd +++ b/addons/godot-xr-tools/misc/hold_button.gd @@ -62,7 +62,7 @@ func _process(delta): button_pressed = true - if !xr_start_node.xr_active: + if !xr_start_node.is_xr_active(): if Input.is_action_pressed("ui_accept") or Input.is_action_pressed(activate_action_desktop): button_pressed = true