Update with changes from D10943

This commit is contained in:
Peter Kim 2021-05-18 19:14:17 +09:00
parent 67ebde367a
commit d5ce86a915
4 changed files with 49 additions and 9 deletions

View File

@ -22,7 +22,7 @@ bl_info = {
"name": "VR Scene Inspection",
"author": "Julian Eisel (Severin), Sebastian Koenig, Peter Kim (muxed-reality)",
"version": (0, 10, 0),
"blender": (2, 93, 0),
"blender": (3, 0, 0),
"location": "3D View > Sidebar > VR",
"description": ("View the viewport with virtual reality glasses "
"(head-mounted displays)"),

View File

@ -1,4 +1,4 @@
actionconfig_version = (2, 93, 10)
actionconfig_version = (3, 0, 1)
actionconfig_data = \
[("blender_oculus",
{"profile": '/interaction_profiles/oculus/touch_controller'},
@ -8,6 +8,7 @@ actionconfig_data = \
("grab", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/squeeze/value', "user_path1": '/user/hand/right', "component_path1": '/input/squeeze/value', "threshold": '0.30000001192092896', "op": 'wm.xr_grab', "op_flag": 'MODAL'}, None),
("undo", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/x/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.undo', "op_flag": 'PRESS'}, None),
("redo", {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/a/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.redo', "op_flag": 'PRESS'}, None),
("haptic", {"type": 'HAPTIC', "user_path0": '/user/hand/left', "component_path0": '/output/haptic', "user_path1": '/user/hand/right', "component_path1": '/output/haptic', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5'}, None),
],
},
),
@ -19,6 +20,7 @@ actionconfig_data = \
("grab", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/squeeze/click', "user_path1": '/user/hand/right', "component_path1": '/input/squeeze/click', "threshold": '0.30000001192092896', "op": 'wm.xr_grab', "op_flag": 'MODAL'}, None),
("undo", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/menu/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.undo', "op_flag": 'PRESS'}, None),
("redo", {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/menu/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.redo', "op_flag": 'PRESS'}, None),
("haptic", {"type": 'HAPTIC', "user_path0": '/user/hand/left', "component_path0": '/output/haptic', "user_path1": '/user/hand/right', "component_path1": '/output/haptic', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5'}, None),
],
},
),
@ -30,6 +32,7 @@ actionconfig_data = \
("grab", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/squeeze/click', "user_path1": '/user/hand/right', "component_path1": '/input/squeeze/click', "threshold": '0.30000001192092896', "op": 'wm.xr_grab', "op_flag": 'MODAL'}, None),
("undo", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/menu/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.undo', "op_flag": 'PRESS'}, None),
("redo", {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/menu/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.redo', "op_flag": 'PRESS'}, None),
("haptic", {"type": 'HAPTIC', "user_path0": '/user/hand/left', "component_path0": '/output/haptic', "user_path1": '/user/hand/right', "component_path1": '/output/haptic', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5'}, None),
],
},
),
@ -41,6 +44,7 @@ actionconfig_data = \
("grab", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/squeeze/value', "user_path1": '/user/hand/right', "component_path1": '/input/squeeze/value', "threshold": '0.30000001192092896', "op": 'wm.xr_grab', "op_flag": 'MODAL'}, None),
("undo", {"type": 'BUTTON', "user_path0": '/user/hand/left', "component_path0": '/input/a/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.undo', "op_flag": 'PRESS'}, None),
("redo", {"type": 'BUTTON', "user_path0": '/user/hand/right', "component_path0": '/input/a/click', "user_path1": '', "component_path1": '', "threshold": '0.30000001192092896', "op": 'ed.redo', "op_flag": 'PRESS'}, None),
("haptic", {"type": 'HAPTIC', "user_path0": '/user/hand/left', "component_path0": '/output/haptic', "user_path1": '/user/hand/right', "component_path1": '/output/haptic', "haptic_duration": '0.30000001192092896', "haptic_frequency": '3000.0', "haptic_amplitude": '0.5'}, None),
],
},
),
@ -51,7 +55,7 @@ if __name__ == "__main__":
# Only add keywords that are supported.
from bpy.app import version as blender_version
keywords = {}
if blender_version >= (2, 93, 0):
if blender_version >= (3, 0, 0):
keywords["actionconfig_version"] = actionconfig_version
import os
from viewport_vr_preview.io import actionconfig_import_from_data

View File

@ -45,7 +45,7 @@ class VRDefaultActions(Enum):
GRAB = "grab"
UNDO = "undo"
REDO = "redo"
HAPTIC = "haptic"
def vr_defaults_actionmap_add(ac, name, profile):
am = ac.actionmaps.new(name, True)
@ -118,9 +118,9 @@ def vr_defaults_haptic_actionmap_item_add(am,
ami.component_path0 = component_path0
ami.user_path1 = user_path1
ami.component_path1 = component_path1
ami.duration = duration
ami.frequency = frequency
ami.amplitude = amplitude
ami.haptic_duration = duration
ami.haptic_frequency = frequency
ami.haptic_amplitude = amplitude
return ami
@ -177,6 +177,15 @@ def vr_defaults_create_oculus(ac):
0.3,
"ed.redo",
'PRESS')
vr_defaults_haptic_actionmap_item_add(am,
VRDefaultActions.HAPTIC.value,
"/user/hand/left",
"/output/haptic",
"/user/hand/right",
"/output/haptic",
0.3,
3000.0,
0.5)
def vr_defaults_create_wmr(ac):
@ -231,6 +240,15 @@ def vr_defaults_create_wmr(ac):
0.3,
"ed.redo",
'PRESS')
vr_defaults_haptic_actionmap_item_add(am,
VRDefaultActions.HAPTIC.value,
"/user/hand/left",
"/output/haptic",
"/user/hand/right",
"/output/haptic",
0.3,
3000.0,
0.5)
def vr_defaults_create_vive(ac):
@ -285,6 +303,15 @@ def vr_defaults_create_vive(ac):
0.3,
"ed.redo",
'PRESS')
vr_defaults_haptic_actionmap_item_add(am,
VRDefaultActions.HAPTIC.value,
"/user/hand/left",
"/output/haptic",
"/user/hand/right",
"/output/haptic",
0.3,
3000.0,
0.5)
def vr_defaults_create_index(ac):
@ -339,6 +366,15 @@ def vr_defaults_create_index(ac):
0.3,
"ed.redo",
'PRESS')
vr_defaults_haptic_actionmap_item_add(am,
VRDefaultActions.HAPTIC.value,
"/user/hand/left",
"/output/haptic",
"/user/hand/right",
"/output/haptic",
0.3,
3000.0,
0.5)
@persistent

View File

@ -21,7 +21,7 @@
# Update Blender version this action-map was written in:
#
# When the version is ``(0, 0, 0)``, the action-map being loaded didn't contain any versioning information.
# This will older than ``(2, 93, 0)``.
# This will older than ``(3, 0, 0)``.
def actionconfig_update(actionconfig_data, actionconfig_version):
from bpy.app import version_file as blender_version
@ -32,7 +32,7 @@ def actionconfig_update(actionconfig_data, actionconfig_version):
## import copy
## has_copy = False
##
## if actionconfig_version <= (2, 93, 0):
## if actionconfig_version <= (3, 0, 0):
## # Only copy once.
## if not has_copy:
## actionconfig_data = copy.deepcopy(actionconfig_data)