[Bf-blender-cvs] [2905b493fe5] master: Fix failing 'script_validate_keymap' after recent changes

Germano Cavalcante noreply at git.blender.org
Thu Oct 21 01:50:50 CEST 2021


Commit: 2905b493fe5b569069d6035c9a17ed855c03fa17
Author: Germano Cavalcante
Date:   Wed Oct 20 20:49:02 2021 -0300
Branches: master
https://developer.blender.org/rB2905b493fe5b569069d6035c9a17ed855c03fa17

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.

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

M	source/blender/editors/space_view3d/view3d_placement.c

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

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[] = {



More information about the Bf-blender-cvs mailing list