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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-01-23 11:01:52 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-01-23 12:05:56 +0400
commitb64f897606ecd1cc14ccbef9f54a054452e39a63 (patch)
tree09d6c5b512629646115d20956a4de41d0a9d3138 /source
parent12348318d1533c6ff62b9f4b1c64268fb13cefad (diff)
WM: add WM_operatortype_remove_ptr to remove a known operator
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/windowmanager/WM_api.h3
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c21
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c3
4 files changed, 19 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index f4f2f834398..b82dae1bf23 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -887,7 +887,7 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
RNA_struct_free_extension(type, &ot->ext);
idname = ot->idname;
- WM_operatortype_remove(ot->idname);
+ WM_operatortype_remove_ptr(ot);
MEM_freeN((void *)idname);
/* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index b635544add0..1690a1a8641 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -218,7 +218,8 @@ struct GHashIterator *WM_operatortype_iter(void);
void WM_operatortype_append(void (*opfunc)(struct wmOperatorType *));
void WM_operatortype_append_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata);
void WM_operatortype_append_macro_ptr(void (*opfunc)(struct wmOperatorType *, void *), void *userdata);
-int WM_operatortype_remove(const char *idname);
+void WM_operatortype_remove_ptr(struct wmOperatorType *ot);
+bool WM_operatortype_remove(const char *idname);
struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *name, const char *description, int flag);
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname);
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 */
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index e0d27eb9b28..18422554dce 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -535,7 +535,8 @@ struct GHashIterator *WM_operatortype_iter() {STUB_ASSERT(0); return (struct GHa
struct wmOperatorType *WM_operatortype_exists(const char *idname) {STUB_ASSERT(0); return (struct wmOperatorType *) NULL;}
struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname) {STUB_ASSERT(0); return (struct wmOperatorTypeMacro *) NULL;}
int WM_operator_call_py(struct bContext *C, struct wmOperatorType *ot, short context, short is_undo, struct PointerRNA *properties, struct ReportList *reports) {STUB_ASSERT(0); return 0;}
-int WM_operatortype_remove(const char *idname) {STUB_ASSERT(0); return 0;}
+void WM_operatortype_remove_ptr(struct wmOperatorType *ot) {STUB_ASSERT(0); }
+bool WM_operatortype_remove(const char *idname) {STUB_ASSERT(0); return 0;}
int WM_operator_poll(struct bContext *C, struct wmOperatorType *ot) {STUB_ASSERT(0); return 0;}
int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, int context) {STUB_ASSERT(0); return 0;}
int WM_operator_props_popup(struct bContext *C, struct wmOperator *op, struct wmEvent *event) {STUB_ASSERT(0); return 0;}