diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-23 11:01:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-23 12:05:56 +0400 |
commit | b64f897606ecd1cc14ccbef9f54a054452e39a63 (patch) | |
tree | 09d6c5b512629646115d20956a4de41d0a9d3138 /source/blender/windowmanager/intern/wm_operators.c | |
parent | 12348318d1533c6ff62b9f4b1c64268fb13cefad (diff) |
WM: add WM_operatortype_remove_ptr to remove a known operator
Diffstat (limited to 'source/blender/windowmanager/intern/wm_operators.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 255d6f19789..3638403660d 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -461,14 +461,10 @@ static void wm_operatortype_free_macro(wmOperatorType *ot) BLI_freelistN(&ot->macro); } - -int WM_operatortype_remove(const char *idname) +void WM_operatortype_remove_ptr(wmOperatorType *ot) { - wmOperatorType *ot = WM_operatortype_find(idname, 0); + BLI_assert(ot == WM_operatortype_find(ot->idname, false)); - if (ot == NULL) - return 0; - RNA_struct_free(&BLENDER_RNA, ot->srna); if (ot->last_properties) { @@ -482,7 +478,18 @@ int WM_operatortype_remove(const char *idname) BLI_ghash_remove(global_ops_hash, (void *)ot->idname, NULL, NULL); MEM_freeN(ot); - return 1; +} + +bool WM_operatortype_remove(const char *idname) +{ + wmOperatorType *ot = WM_operatortype_find(idname, 0); + + if (ot == NULL) + return false; + + WM_operatortype_remove_ptr(ot); + + return true; } /* SOME_OT_op -> some.op */ |