Commit: c631782542f49ae2ce9ff45ae2cdb5f61af80e68
Author: Campbell Barton
Date:   Tue Dec 4 10:15:02 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBc631782542f49ae2ce9ff45ae2cdb5f61af80e68

Fix T58474: Gizmo Operator template fails on rerun

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

M       release/scripts/templates_py/gizmo_operator.py
M       source/blender/makesrna/intern/rna_wm_api.c

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

diff --git a/release/scripts/templates_py/gizmo_operator.py 
b/release/scripts/templates_py/gizmo_operator.py
index 524dd1dd20e..96f4f4de940 100644
--- a/release/scripts/templates_py/gizmo_operator.py
+++ b/release/scripts/templates_py/gizmo_operator.py
@@ -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
 
diff --git a/source/blender/makesrna/intern/rna_wm_api.c 
b/source/blender/makesrna/intern/rna_wm_api.c
index 874fdb62029..92a396c22b9 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -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);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to