[Bf-extensions-cvs] [d5ce86a9] xr-controller-support: Update with changes from D10943

Peter Kim noreply at git.blender.org
Tue May 18 15:11:38 CEST 2021


Commit: d5ce86a915bb3348d74e4257214c5fa96f336da5
Author: Peter Kim
Date:   Tue May 18 19:14:17 2021 +0900
Branches: xr-controller-support
https://developer.blender.org/rBAd5ce86a915bb3348d74e4257214c5fa96f336da5

Update with changes from D10943

===================================================================

M	viewport_vr_preview/__init__.py
M	viewport_vr_preview/configs/default.py
M	viewport_vr_preview/defaults.py
M	viewport_vr_preview/versioning.py

===================================================================

diff --git a/viewport_vr_preview/__init__.py b/viewport_vr_preview/__init__.py
index 5d398813..b71885f5 100644
--- a/viewport_vr_preview/__init__.py
+++ b/viewport_vr_preview/__init__.py
@@ -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)"),
diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py
index 04267488..d3b31c36 100644
--- a/viewport_vr_preview/configs/default.py
+++ b/viewport_vr_preview/configs/default.py
@@ -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
diff --git a/viewport_vr_preview/defaults.py b/viewport_vr_preview/defaults.py
index 0367bf9f..7bbd436a 100644
--- a/viewport_vr_preview/defaults.py
+++ b/viewport_vr_preview/defaults.py
@@ -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
diff --git a/viewport_vr_preview/versioning.py b/viewport_vr_preview/versioning.py
index 9afcab11..70bbb55a 100644
--- a/viewport_vr_preview/versioning.py
+++ b/viewport_vr_preview/versioning.py
@@ -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 actio

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list