Skip to content

Commit

Permalink
Fix hold button accessing non existant property on start xr (GodotVR#665
Browse files Browse the repository at this point in the history
)
  • Loading branch information
DanielKinsman authored Aug 13, 2024
1 parent fc664b9 commit da566ff
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions addons/godot-xr-tools/desktop-support/controler_hider.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions addons/godot-xr-tools/desktop-support/mouse_capture.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion addons/godot-xr-tools/misc/hold_button.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit da566ff

Please sign in to comment.