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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/makesrna/intern/rna_xr.c')
-rw-r--r--source/blender/makesrna/intern/rna_xr.c97
1 files changed, 42 insertions, 55 deletions
diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c
index 9a512e351cb..4cab92ad878 100644
--- a/source/blender/makesrna/intern/rna_xr.c
+++ b/source/blender/makesrna/intern/rna_xr.c
@@ -96,7 +96,7 @@ static XrActionMapBinding *rna_XrActionMapBinding_find(XrActionMapItem *ami, con
# endif
}
-static int rna_XrActionMapBinding_axis0_flag_get(PointerRNA *ptr)
+static int rna_XrActionMapBinding_axis0_region_get(PointerRNA *ptr)
{
# ifdef WITH_XR_OPENXR
XrActionMapBinding *amb = ptr->data;
@@ -112,7 +112,7 @@ static int rna_XrActionMapBinding_axis0_flag_get(PointerRNA *ptr)
return 0;
}
-static void rna_XrActionMapBinding_axis0_flag_set(PointerRNA *ptr, int value)
+static void rna_XrActionMapBinding_axis0_region_set(PointerRNA *ptr, int value)
{
# ifdef WITH_XR_OPENXR
XrActionMapBinding *amb = ptr->data;
@@ -123,7 +123,7 @@ static void rna_XrActionMapBinding_axis0_flag_set(PointerRNA *ptr, int value)
# endif
}
-static int rna_XrActionMapBinding_axis1_flag_get(PointerRNA *ptr)
+static int rna_XrActionMapBinding_axis1_region_get(PointerRNA *ptr)
{
# ifdef WITH_XR_OPENXR
XrActionMapBinding *amb = ptr->data;
@@ -139,7 +139,7 @@ static int rna_XrActionMapBinding_axis1_flag_get(PointerRNA *ptr)
return 0;
}
-static void rna_XrActionMapBinding_axis1_flag_set(PointerRNA *ptr, int value)
+static void rna_XrActionMapBinding_axis1_region_set(PointerRNA *ptr, int value)
{
# ifdef WITH_XR_OPENXR
XrActionMapBinding *amb = ptr->data;
@@ -289,12 +289,7 @@ static void rna_XrActionMapItem_bimanual_set(PointerRNA *ptr, bool value)
{
# ifdef WITH_XR_OPENXR
XrActionMapItem *ami = ptr->data;
- if (value) {
- ami->action_flag |= XR_ACTION_BIMANUAL;
- }
- else {
- ami->action_flag &= ~XR_ACTION_BIMANUAL;
- }
+ SET_FLAG_FROM_TEST(ami->action_flag, value, XR_ACTION_BIMANUAL);
# else
UNUSED_VARS(ptr, value);
# endif
@@ -317,18 +312,13 @@ static void rna_XrActionMapItem_haptic_match_user_paths_set(PointerRNA *ptr, boo
{
# ifdef WITH_XR_OPENXR
XrActionMapItem *ami = ptr->data;
- if (value) {
- ami->haptic_flag |= XR_HAPTIC_MATCHUSERPATHS;
- }
- else {
- ami->haptic_flag &= ~XR_HAPTIC_MATCHUSERPATHS;
- }
+ SET_FLAG_FROM_TEST(ami->haptic_flag, value, XR_HAPTIC_MATCHUSERPATHS);
# else
UNUSED_VARS(ptr, value);
# endif
}
-static int rna_XrActionMapItem_haptic_flag_get(PointerRNA *ptr)
+static int rna_XrActionMapItem_haptic_mode_get(PointerRNA *ptr)
{
# ifdef WITH_XR_OPENXR
XrActionMapItem *ami = ptr->data;
@@ -345,7 +335,7 @@ static int rna_XrActionMapItem_haptic_flag_get(PointerRNA *ptr)
return XR_HAPTIC_PRESS;
}
-static void rna_XrActionMapItem_haptic_flag_set(PointerRNA *ptr, int value)
+static void rna_XrActionMapItem_haptic_mode_set(PointerRNA *ptr, int value)
{
# ifdef WITH_XR_OPENXR
XrActionMapItem *ami = ptr->data;
@@ -622,7 +612,6 @@ static bool rna_XrSessionState_action_create(bContext *C,
const bool is_button_action = (is_float_action || ami->type == XR_BOOLEAN_INPUT);
wmOperatorType *ot = NULL;
IDProperty *op_properties = NULL;
- const char *haptic_name = NULL;
int64_t haptic_duration_msec;
if (is_button_action) {
@@ -635,7 +624,6 @@ static bool rna_XrSessionState_action_create(bContext *C,
}
}
- haptic_name = &ami->haptic_name[0];
haptic_duration_msec = (int64_t)(ami->haptic_duration * 1000.0f);
}
@@ -647,7 +635,7 @@ static bool rna_XrSessionState_action_create(bContext *C,
subaction_paths,
ot,
op_properties,
- is_button_action ? &haptic_name : NULL,
+ is_button_action ? ami->haptic_name : NULL,
is_button_action ? &haptic_duration_msec : NULL,
is_button_action ? &ami->haptic_frequency : NULL,
is_button_action ? &ami->haptic_amplitude : NULL,
@@ -803,7 +791,7 @@ bool rna_XrSessionState_haptic_action_apply(bContext *C,
return WM_xr_haptic_action_apply(&wm->xr,
action_set_name,
action_name,
- user_path[0] ? &user_path : NULL,
+ user_path[0] ? user_path : NULL,
&duration_msec,
&frequency,
&amplitude);
@@ -820,20 +808,19 @@ void rna_XrSessionState_haptic_action_stop(bContext *C,
{
# ifdef WITH_XR_OPENXR
wmWindowManager *wm = CTX_wm_manager(C);
- WM_xr_haptic_action_stop(
- &wm->xr, action_set_name, action_name, user_path[0] ? &user_path : NULL);
+ WM_xr_haptic_action_stop(&wm->xr, action_set_name, action_name, user_path[0] ? user_path : NULL);
# else
UNUSED_VARS(C, action_set_name, action_name, user_path);
# endif
}
static void rna_XrSessionState_controller_grip_location_get(bContext *C,
- int *index,
+ int index,
float r_values[3])
{
# ifdef WITH_XR_OPENXR
const wmWindowManager *wm = CTX_wm_manager(C);
- WM_xr_session_state_controller_grip_location_get(&wm->xr, *index, r_values);
+ WM_xr_session_state_controller_grip_location_get(&wm->xr, index, r_values);
# else
UNUSED_VARS(C, index);
zero_v3(r_values);
@@ -854,12 +841,12 @@ static void rna_XrSessionState_controller_grip_rotation_get(bContext *C,
}
static void rna_XrSessionState_controller_aim_location_get(bContext *C,
- int *index,
+ int index,
float r_values[3])
{
# ifdef WITH_XR_OPENXR
const wmWindowManager *wm = CTX_wm_manager(C);
- WM_xr_session_state_controller_aim_location_get(&wm->xr, *index, r_values);
+ WM_xr_session_state_controller_aim_location_get(&wm->xr, index, r_values);
# else
UNUSED_VARS(C, index);
zero_v3(r_values);
@@ -1061,7 +1048,7 @@ static void rna_def_xr_actionmap_bindings(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "XR Action Map Bindings", "Collection of XR action map bindings");
func = RNA_def_function(srna, "new", "rna_XrActionMapBinding_new");
- parm = RNA_def_string(func, "name", NULL, 0, "Name of the action map binding", "");
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name of the action map binding", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(func,
"replace_existing",
@@ -1110,7 +1097,7 @@ static void rna_def_xr_actionmap_items(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_ui_text(srna, "XR Action Map Items", "Collection of XR action map items");
func = RNA_def_function(srna, "new", "rna_XrActionMapItem_new");
- parm = RNA_def_string(func, "name", NULL, 0, "Name of the action map item", "");
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name of the action map item", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
parm = RNA_def_boolean(func,
"replace_existing",
@@ -1314,7 +1301,7 @@ static void rna_def_xr_actionmap(BlenderRNA *brna)
prop = RNA_def_property(srna, "haptic_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_xr_haptic_flags);
RNA_def_property_enum_funcs(
- prop, "rna_XrActionMapItem_haptic_flag_get", "rna_XrActionMapItem_haptic_flag_set", NULL);
+ prop, "rna_XrActionMapItem_haptic_mode_get", "rna_XrActionMapItem_haptic_mode_set", NULL);
RNA_def_property_ui_text(prop, "Haptic mode", "Haptic application mode");
prop = RNA_def_property(srna, "bindings", PROP_COLLECTION, PROP_NONE);
@@ -1357,8 +1344,8 @@ static void rna_def_xr_actionmap(BlenderRNA *brna)
prop = RNA_def_property(srna, "axis0_region", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_xr_axis0_flags);
RNA_def_property_enum_funcs(prop,
- "rna_XrActionMapBinding_axis0_flag_get",
- "rna_XrActionMapBinding_axis0_flag_set",
+ "rna_XrActionMapBinding_axis0_region_get",
+ "rna_XrActionMapBinding_axis0_region_set",
NULL);
RNA_def_property_ui_text(
prop, "Axis 0 Region", "Action execution region for the first input axis");
@@ -1366,8 +1353,8 @@ static void rna_def_xr_actionmap(BlenderRNA *brna)
prop = RNA_def_property(srna, "axis1_region", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, rna_enum_xr_axis1_flags);
RNA_def_property_enum_funcs(prop,
- "rna_XrActionMapBinding_axis1_flag_get",
- "rna_XrActionMapBinding_axis1_flag_set",
+ "rna_XrActionMapBinding_axis1_region_get",
+ "rna_XrActionMapBinding_axis1_region_set",
NULL);
RNA_def_property_ui_text(
prop, "Axis 1 Region", "Action execution region for the second input axis");
@@ -1695,16 +1682,16 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_int(func, "index", 0, 0, 255, "Index", "Controller index", 0, 255);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float_translation(func,
- "location",
- 3,
- NULL,
- -FLT_MAX,
- FLT_MAX,
- "Location",
- "Controller grip location",
- -FLT_MAX,
- FLT_MAX);
+ parm = RNA_def_float_translation(func,
+ "location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "Controller grip location",
+ -FLT_MAX,
+ FLT_MAX);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_OUTPUT);
func = RNA_def_function(
@@ -1739,16 +1726,16 @@ static void rna_def_xr_session_state(BlenderRNA *brna)
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
parm = RNA_def_int(func, "index", 0, 0, 255, "Index", "Controller index", 0, 255);
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float_translation(func,
- "location",
- 3,
- NULL,
- -FLT_MAX,
- FLT_MAX,
- "Location",
- "Controller aim location",
- -FLT_MAX,
- FLT_MAX);
+ parm = RNA_def_float_translation(func,
+ "location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "Controller aim location",
+ -FLT_MAX,
+ FLT_MAX);
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_OUTPUT);
func = RNA_def_function(