Fix T58474: Gizmo Operator template fails on rerun
authorCampbell Barton <ideasman42@gmail.com>
Mon, 3 Dec 2018 23:15:02 +0000 (10:15 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 3 Dec 2018 23:17:42 +0000 (10:17 +1100)
release/scripts/templates_py/gizmo_operator.py
source/blender/makesrna/intern/rna_wm_api.c

index 524dd1dd20ed61b579a248affefd78375661ae0b..96f4f4de9405646aa4be955641186399facbd9d4 100644 (file)
@@ -68,7 +68,7 @@ class SelectSideOfPlane(Operator):
 
         if context.space_data.type == 'VIEW_3D':
             wm = context.window_manager
-            wm.gizmo_group_type_add(SelectSideOfPlaneGizmoGroup.bl_idname)
+            wm.gizmo_group_type_ensure(SelectSideOfPlaneGizmoGroup.bl_idname)
 
         return {'FINISHED'}
 
@@ -106,7 +106,7 @@ class SelectSideOfPlaneGizmoGroup(GizmoGroup):
         op = cls.my_target_operator(context)
         if op is None:
             wm = context.window_manager
-            wm.gizmo_group_type_remove(SelectSideOfPlaneGizmoGroup.bl_idname)
+            wm.gizmo_group_type_unlink_delayed(SelectSideOfPlaneGizmoGroup.bl_idname)
             return False
         return True
 
index 874fdb620292a6f808c1e86e235c12c995e2e207..92a396c22b99d6e1f57add8e1c8691e079f770f9 100644 (file)
@@ -138,19 +138,19 @@ static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *repor
        return gzgt;
 }
 
-static void rna_gizmo_group_type_add(ReportList *reports, const char *idname)
+static void rna_gizmo_group_type_ensure(ReportList *reports, const char *idname)
 {
        wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
        if (gzgt != NULL) {
-               WM_gizmo_group_type_add_ptr(gzgt);
+               WM_gizmo_group_type_ensure_ptr(gzgt);
        }
 }
 
-static void rna_gizmo_group_type_remove(Main *bmain, ReportList *reports, const char *idname)
+static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char *idname)
 {
        wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
        if (gzgt != NULL) {
-               WM_gizmo_group_type_remove_ptr(bmain, gzgt);
+               WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
        }
 }
 
@@ -549,15 +549,15 @@ void RNA_api_wm(StructRNA *srna)
        parm = RNA_def_pointer(func, "timer", "Timer", "", "");
        RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
 
-       func = RNA_def_function(srna, "gizmo_group_type_add", "rna_gizmo_group_type_add");
+       func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
        RNA_def_function_ui_description(func, "Activate an existing widget group (when the persistent option isn't set)");
        RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
        parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
 
-       func = RNA_def_function(srna, "gizmo_group_type_remove", "rna_gizmo_group_type_remove");
-       RNA_def_function_ui_description(func, "De-activate a widget group (when the persistent option isn't set)");
-       RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+       func = RNA_def_function(srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
+       RNA_def_function_ui_description(func, "Unlink a widget group (when the persistent option is set)");
+       RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
        parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
        RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);