Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

6.5 KB
Raw Blame
# SpaceMouse navigation (#6), with a virtual joystick that has a SpaceMouse Compact's USB ids (the app finds and
# opens it as it would the real device): twisting, tilting, pushing and pulling the cap turn, pan and zoom the view;
# a resting cap inside the dead zone does nothing; Preferences > Input > SpaceMouse inverts axes, locks the
# rotation to a turntable and turns it off; the side buttons frame and show the front; a stroke holds the view still
# (Hold during strokes) or, with that off, stays one stroke while the view turns; unplugging and plugging back in
# works; every input style.
run ui_look look=classic layout=classic        # written for the Classic look and the classic palette bar and shelves
run new_sphere subdivisions=4
snapshot
expect_value spacemouse_connected == 0

# Twist the cap clockwise for half a second: the model turns (about 45 degrees at speed 1).
camera 0 0
spacemouse 0 0 0 0 0 0.8 0.5
expect_value spacemouse_connected == 1
expect_value camera_yaw > 25
expect_value camera_yaw < 65
expect_value spacemouse_moving == 0
expect_value moved == 0

# Tilt it towards you: the model's top comes towards you.
camera 0 0
spacemouse 0 0 0 0.8 0 0 0.3
expect_value camera_pitch < -10

# Roll the cap's top to the left: free rotation rolls the model anticlockwise (the camera the other way).
camera 0 0
spacemouse 0 0 0 0 0.8 0 0.3
expect_value camera_roll > 10

# Push it right: the view pans. Pull it towards you: closer. Push it away: further.
key f
camera 0 0
remember camera_pan p0
spacemouse 0.8 0 0 0 0 0 0.3
expect_value camera_pan > $p0
key f
remember camera_distance d0
spacemouse 0 0.8 0 0 0 0 0.3
expect_value camera_distance < $d0
remember camera_distance d1
spacemouse 0 -0.8 0 0 0 0 0.3
expect_value camera_distance > $d1

# A hand resting on the cap (inside the 8% dead zone) doesn't drift the view.
key f
camera 0 0
remember camera_distance d2
remember camera_pan p2
spacemouse 0.05 -0.06 0.04 0.07 -0.05 0.06 0.5
expect_value camera_yaw == 0
expect_value camera_pitch == 0
expect_value camera_distance == $d2
expect_value camera_pan == $p2

# Side buttons: the right one shows the front (an orthographic axis view), the left one frames the model.
camera 30 20
expect_value camera_aligned == 0
spacemouse_button 2
expect_value camera_aligned == 1
expect_value camera_ortho == 1
spacemouse 0 0 0 0 0 0.5 0.2
expect_value camera_ortho == 0
key f
remember camera_distance framed
zoom 3
spacemouse_button 1
expect_value camera_distance >= $framed-0.001
expect_value camera_distance <= $framed+0.001

# Preferences > Input > SpaceMouse: invert the twist.
click "Preferences##palette.preferences"
click "Input##preferences.input"
expect_text "SpaceMouse (experimental)"
expect_text "SpaceMouse Compact (UI test)"
shot spacemouse_prefs
click "Spin##spacemouse.invert5"
key escape
camera 0 0
spacemouse 0 0 0 0 0 0.8 0.5
expect_value camera_yaw < -25

# Lock rotation to turntable: rolling the cap does nothing, a twist turns about the world's up axis.
click "Preferences##palette.preferences"
click "Lock rotation to turntable##spacemouse.turntable"
key escape
camera 0 0
spacemouse 0 0 0 0 0.9 0 0.3
expect_value camera_roll == 0
expect_value camera_yaw == 0
spacemouse 0 0 0 0.6 0 0.8 0.4
expect_value camera_roll == 0
expect_value camera_up > 0

# Off: the SpaceMouse is ignored, buttons too.
click "Preferences##palette.preferences"
click "Use SpaceMouse##spacemouse.enabled"
key escape
camera 10 0
spacemouse 0 0 0 0 0 0.8 0.3
expect_value camera_yaw == 10
spacemouse_button 2
expect_value camera_yaw == 10
click "Preferences##palette.preferences"
click "Use SpaceMouse##spacemouse.enabled"
click "SpaceMouse defaults##spacemouse.defaults"
key escape

# Hold during strokes (on by default, phoenix 11-05): while a stroke runs the cap neither turns the view nor runs
# its buttons; the view moves again once the stroke ends.
key f
camera 30 0
snapshot
drag_path 0.3 0.45 0.7 0.55 keep
expect_value stroking == 1
spacemouse 0 0 0 0 0 0.8 0.3
expect_value camera_yaw > 29.9
expect_value camera_yaw < 30.1
expect_value spacemouse_moving == 0
spacemouse_button 2
expect_value camera_aligned == 0
release
expect_value stroking == 0
key ctrl+z
expect_value moved == 0
spacemouse 0 0 0 0 0 0.8 0.3
expect_value camera_yaw > 40

# Hold during strokes off: a pen stroke held while the cap turns the view stays one stroke, and one undo takes it back.
click "Preferences##palette.preferences"
click "Hold during strokes##spacemouse.hold"
key escape
key f
camera 0 0
snapshot
spacemouse_hold 0 0 0 0 0 0.5
pen_stroke 0.3 0.45 0.7 0.55 0.6 0.6
expect_value camera_yaw > 5
spacemouse_hold 0 0 0 0 0 0
expect_value stroking == 0
expect_value moved_out > 0
key ctrl+z
expect_value moved == 0
# The pen still navigates and sculpts afterwards.
pen_stroke 0.3 0.45 0.7 0.55 0.6 0.6
expect_value moved_out > 0
key ctrl+z
pen_out
click "Preferences##palette.preferences"
click "Hold during strokes##spacemouse.hold"
key escape

# Unplugged and plugged back in (hot-plug).
spacemouse_unplug
expect_value spacemouse_connected == 0
camera 0 0
spacemouse 0 0 0 0 0 0.8 0.5
expect_value spacemouse_connected == 1
expect_value camera_yaw > 25

# Every input style: SculptForge and Blender navigate the same way. (Lift the pen out of range first: while it is in
# range the interface follows only the pen, #13.)
pen_out
click "Preferences##palette.preferences"
click "SculptForge##input.style_sculptforge"
key escape
camera 0 0
spacemouse 0 0 0 0 0 0.8 0.5
expect_value camera_yaw > 25
click "Preferences##palette.preferences"
click "Blender##input.style_blender"
key escape
camera 0 0
spacemouse 0 0 0 0 0 0.8 0.5
expect_value camera_yaw > 25
remember camera_distance d3
spacemouse 0 0.8 0 0 0 0 0.3
expect_value camera_distance < $d3

# #104: Preferences lists what SDL sees and why; a SpaceMouse that is open but has not moved gets the 3DxWare hint;
# Copy device report puts the list on the clipboard; once the cap moves, the hint and the report go away.
spacemouse_unplug
click "Preferences##palette.preferences"
hover "Copy device report##spacemouse.report"
expect_text "No joysticks or game controllers seen."
click "Copy device report##spacemouse.report"
expect_clipboard SpaceMouse: none
key escape
spacemouse 0 0 0 0 0 0 0.2
click "Preferences##palette.preferences"
hover "Copy device report##spacemouse.report"
expect_text "SpaceMouse Compact (UI test) (256f:c635): in use"
expect_text "holds the SpaceMouse"
click "Copy device report##spacemouse.report"
expect_clipboard (256f:c635): in use
shot spacemouse_report
key escape
spacemouse 0 0 0 0 0 0.8 0.2
click "Preferences##palette.preferences"
expect_no_text "holds the SpaceMouse"
key escape