Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'viewport_vr_preview/action_map_io.py')
-rw-r--r--viewport_vr_preview/action_map_io.py50
1 files changed, 24 insertions, 26 deletions
diff --git a/viewport_vr_preview/action_map_io.py b/viewport_vr_preview/action_map_io.py
index fedea82e..c4e04581 100644
--- a/viewport_vr_preview/action_map_io.py
+++ b/viewport_vr_preview/action_map_io.py
@@ -1,20 +1,4 @@
-# ##### BEGIN GPL LICENSE BLOCK #####
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
+# SPDX-License-Identifier: GPL-2.0-or-later
# <pep8 compliant>
@@ -52,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}'")
@@ -73,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"]
@@ -150,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':
@@ -170,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"])