Fix on_transform_changed "rounding" transform

Setting `value` without `set_value_no_signal` will trigger
`_on_value_changed` with the rounded values as per the `Step`
value of the `SpinBox`es which in turn updates the transform.

This resulted in small movements when dragging the model with
the mouse to not have any effect.
main
copygirl 10 months ago
parent 6284c4e3c7
commit 7438052842
  1. 15
      Scenes/player_settings.gd

@ -17,16 +17,16 @@ func set_nickname(value: String) -> void:
$Nickname.text = value
func on_transform_changed(value: Transform3D) -> void:
offset_x.value = value.origin.x
offset_y.value = value.origin.y
offset_z.value = value.origin.z
offset_x.set_value_no_signal(value.origin.x)
offset_y.set_value_no_signal(value.origin.y)
offset_z.set_value_no_signal(value.origin.z)
var rot := value.basis.get_euler()
rotation_x.value = rad_to_deg(rot.x)
rotation_y.value = rad_to_deg(rot.y)
rotation_z.value = rad_to_deg(rot.z)
rotation_x.set_value_no_signal(rad_to_deg(rot.x))
rotation_y.set_value_no_signal(rad_to_deg(rot.y))
rotation_z.set_value_no_signal(rad_to_deg(rot.z))
scale_xyz.value = value.basis.get_scale().x
scale_xyz.set_value_no_signal(value.basis.get_scale().x)
func _on_value_changed(_value: float) -> void:
var origin := Vector3(offset_x.value, offset_y.value, offset_z.value)
@ -38,4 +38,3 @@ func _on_value_changed(_value: float) -> void:
rotation_x.set_value_no_signal(fposmod(rotation_x.value, 360))
rotation_y.set_value_no_signal(fposmod(rotation_y.value, 360))
rotation_z.set_value_no_signal(fposmod(rotation_z.value, 360))

Loading…
Cancel
Save