[Bf-extensions-cvs] [4803bc04] master: VR: Update action paths based on API changes

Peter Kim noreply at git.blender.org
Thu Feb 17 08:00:45 CET 2022


Commit: 4803bc04f3fc6b0cfcda638d9aa89dee40e6bfc5
Author: Peter Kim
Date:   Thu Feb 17 16:00:19 2022 +0900
Branches: master
https://developer.blender.org/rBA4803bc04f3fc6b0cfcda638d9aa89dee40e6bfc5

VR: Update action paths based on API changes

XR actions API was changed in rB6a8709ba136e.

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

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

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

diff --git a/viewport_vr_preview/__init__.py b/viewport_vr_preview/__init__.py
index 14315747..d5736fed 100644
--- a/viewport_vr_preview/__init__.py
+++ b/viewport_vr_preview/__init__.py
@@ -5,8 +5,8 @@
 bl_info = {
     "name": "VR Scene Inspection",
     "author": "Julian Eisel (Severin), Sebastian Koenig, Peter Kim (muxed-reality)",
-    "version": (0, 10, 0),
-    "blender": (3, 0, 0),
+    "version": (0, 11, 0),
+    "blender": (3, 2, 0),
     "location": "3D View > Sidebar > VR",
     "description": ("View the viewport with virtual reality glasses "
                     "(head-mounted displays)"),
diff --git a/viewport_vr_preview/action_map_io.py b/viewport_vr_preview/action_map_io.py
index b6e73ce7..c4e04581 100644
--- a/viewport_vr_preview/action_map_io.py
+++ b/viewport_vr_preview/action_map_io.py
@@ -36,13 +36,20 @@ def repr_f32(f):
             return "%.*f" % (i, f_test)
     return f_str
 
+
 def ami_args_as_data(ami):
     s = [
         f"\"type\": '{ami.type}'",
-        f"\"user_path0\": '{ami.user_path0}'",
-        f"\"user_path1\": '{ami.user_path1}'",
     ]
 
+    sup = f"\"user_paths\": ["
+    for user_path in ami.user_paths:
+        sup += f"'{user_path.path}', "
+    if len(ami.user_paths) > 0:
+        sup = sup[:-2]
+    sup += "]"
+    s.append(sup)
+
     if ami.type == 'FLOAT' or ami.type == 'VECTOR2D':
         s.append(f"\"op\": '{ami.op}'")
         s.append(f"\"op_mode\": '{ami.op_mode}'")
@@ -57,14 +64,14 @@ def ami_args_as_data(ami):
         s.append(f"\"pose_is_controller_grip\": '{ami.pose_is_controller_grip}'")
         s.append(f"\"pose_is_controller_aim\": '{ami.pose_is_controller_aim}'")
 
-
     return "{" + ", ".join(s) + "}"
 
 
 def ami_data_from_args(ami, args):
     ami.type = args["type"]
-    ami.user_path0 = args["user_path0"]
-    ami.user_path1 = args["user_path1"]
+    
+    for path in args["user_paths"]:
+        ami.user_paths.new(path)
 
     if ami.type == 'FLOAT' or ami.type == 'VECTOR2D':
         ami.op = args["op"]
@@ -134,10 +141,16 @@ def _ami_attrs_or_none(level, ami):
 def amb_args_as_data(amb, type):
     s = [
         f"\"profile\": '{amb.profile}'",
-        f"\"component_path0\": '{amb.component_path0}'",
-        f"\"component_path1\": '{amb.component_path1}'",
     ]
 
+    scp = f"\"component_paths\": ["
+    for component_path in amb.component_paths:
+        scp += f"'{component_path.path}', "
+    if len(amb.component_paths) > 0:
+        scp = scp[:-2]
+    scp += "]"
+    s.append(scp)
+
     if type == 'FLOAT' or type == 'VECTOR2D':
         s.append(f"\"threshold\": '{amb.threshold}'")
         if type == 'FLOAT':
@@ -154,8 +167,9 @@ def amb_args_as_data(amb, type):
 
 def amb_data_from_args(amb, args, type):
     amb.profile = args["profile"]
-    amb.component_path0 = args["component_path0"]
-    amb.component_path1 = args["component_path1"]
+
+    for path in args["component_paths"]:
+        amb.component_paths.new(path)
 
     if type == 'FLOAT' or type == 'VECTOR2D':
         amb.threshold = float(args["threshold"])
diff --git a/viewport_vr_preview/configs/default.py b/viewport_vr_preview/configs/default.py
index a42b3f45..3e6185f0 100644
--- a/viewport_vr_preview/configs/default.py
+++ b/viewport_vr_preview/configs/default.py
@@ -1,139 +1,139 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
-actionconfig_version = (3, 0, 39)
+actionconfig_version = (3, 2, 3)
 actionconfig_data = \
 [("blender_default",
   {"items":
-   [("controller_grip", {"type": 'POSE', "user_path0": '/user/hand/left', "user_path1": '/user/hand/right', "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False'}, None,
+   [("controller_grip", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'True', "pose_is_controller_aim": 'False'}, None,
      {"bindings":
-      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/grip/pose', "component_path1": '/input/grip/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_paths": ['/input/grip/pose', '/input/grip/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
        ],
       },
      ),
-    ("controller_aim", {"type": 'POSE', "user_path0": '/user/hand/left', "user_path1": '/user/hand/right', "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True'}, None,
+    ("controller_aim", {"type": 'POSE', "user_paths": ['/user/hand/left', '/user/hand/right'], "pose_is_controller_grip": 'False', "pose_is_controller_aim": 'True'}, None,
      {"bindings":
-      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("oculus", {"profile": '/interaction_profiles/oculus/touch_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("reverb_g2", {"profile": '/interaction_profiles/hp/mixed_reality_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("simple", {"profile": '/interaction_profiles/khr/simple_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("vive", {"profile": '/interaction_profiles/htc/vive_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
-       ("wmr", {"profile": '/interaction_profiles/microsoft/motion_controller', "component_path0": '/input/aim/pose', "component_path1": '/input/aim/pose', "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+      [("cosmos", {"profile": '/interaction_profiles/htc/vive_cosmos_controller', "component_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("huawei", {"profile": '/interaction_profiles/huawei/controller', "component_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0, 0.0, 0.0)', "pose_rotation": '(0.0, 0.0, 0.0)'}),
+       ("index", {"profile": '/interaction_profiles/valve/index_controller', "component_paths": ['/input/aim/pose', '/input/aim/pose'], "pose_location": '(0.0,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list