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:
authorGermano Cavalcante <germano.costa@ig.com.br>2021-10-21 02:49:02 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2021-10-21 02:49:59 +0300
commit2905b493fe5b569069d6035c9a17ed855c03fa17 (patch)
treec1ce228dcccf1f2e7b2eb17df019c2d1525ed649 /source/blender/editors/space_view3d/view3d_placement.c
parent15e71f3d97ec495e623ddac92de83e317f71417e (diff)
Fix failing 'script_validate_keymap' after recent changes
Properties with `_funcs_runtime` are always saved when exporting keymaps. This is an error since changing one changes all others. For now, work around the problem by setting the `PROP_IDPROPERTY` flag.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_placement.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index b6444ebb29b..f1fd5732708 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -1359,6 +1359,12 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
/* properties */
PropertyRNA *prop;
+ /* WORKAROUND: properties with `_funcs_runtime` should not be saved in keymaps.
+ * So reasign the #PROP_IDPROPERTY flag to trick the property as not being set.
+ * (See #RNA_property_is_set). */
+ PropertyFlag unsalvageable = PROP_SKIP_SAVE | PROP_HIDDEN | PROP_PTR_NO_OWNERSHIP |
+ PROP_IDPROPERTY;
+
/* Normally not accessed directly, leave unset and check the active tool. */
static const EnumPropertyItem primitive_type[] = {
{PLACE_PRIMITIVE_TYPE_CUBE, "CUBE", 0, "Cube", ""},
@@ -1378,9 +1384,9 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
RNA_def_property_ui_text(prop, "Plane Axis", "The axis used for placing the base region");
RNA_def_property_enum_default(prop, 2);
RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_enum_funcs_runtime(
prop, idp_rna_plane_axis_get_fn, idp_rna_plane_axis_set_fn, NULL);
+ RNA_def_property_flag(prop, unsalvageable);
prop = RNA_def_boolean(ot->srna,
"plane_axis_auto",
@@ -1388,9 +1394,9 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
"Auto Axis",
"Select the closest axis when placing objects "
"(surface overrides)");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_boolean_funcs_runtime(
prop, idp_rna_use_plane_axis_auto_get_fn, idp_rna_use_plane_axis_auto_set_fn);
+ RNA_def_property_flag(prop, unsalvageable);
static const EnumPropertyItem plane_depth_items[] = {
{V3D_PLACE_DEPTH_SURFACE,
@@ -1415,9 +1421,9 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
RNA_def_property_ui_text(prop, "Position", "The initial depth used when placing the cursor");
RNA_def_property_enum_default(prop, V3D_PLACE_DEPTH_SURFACE);
RNA_def_property_enum_items(prop, plane_depth_items);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_enum_funcs_runtime(
prop, idp_rna_plane_depth_get_fn, idp_rna_plane_depth_set_fn, NULL);
+ RNA_def_property_flag(prop, unsalvageable);
static const EnumPropertyItem plane_orientation_items[] = {
{V3D_PLACE_ORIENT_SURFACE,
@@ -1436,9 +1442,9 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
RNA_def_property_ui_text(prop, "Orientation", "The initial depth used when placing the cursor");
RNA_def_property_enum_default(prop, V3D_PLACE_ORIENT_SURFACE);
RNA_def_property_enum_items(prop, plane_orientation_items);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_enum_funcs_runtime(
prop, idp_rna_plane_orient_get_fn, idp_rna_plane_orient_set_fn, NULL);
+ RNA_def_property_flag(prop, unsalvageable);
static const EnumPropertyItem snap_to_items[] = {
{PLACE_SNAP_TO_GEOMETRY, "GEOMETRY", 0, "Geometry", "Snap to all geometry"},
@@ -1449,9 +1455,9 @@ void VIEW3D_OT_interactive_add(struct wmOperatorType *ot)
RNA_def_property_ui_text(prop, "Snap to", "The target to use while snapping");
RNA_def_property_enum_default(prop, PLACE_SNAP_TO_GEOMETRY);
RNA_def_property_enum_items(prop, snap_to_items);
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
RNA_def_property_enum_funcs_runtime(
prop, idp_rna_snap_target_get_fn, idp_rna_snap_target_set_fn, NULL);
+ RNA_def_property_flag(prop, unsalvageable);
{ /* Plane Origin. */
static const EnumPropertyItem items[] = {