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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-18 14:56:26 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-05-18 14:56:26 +0400
commit178ba76b09fc923213a26257bbd5b82d0ad26bf0 (patch)
tree61b594404c29b920eeb25499180c2079f68d436a /source/blender/makesrna/intern/rna_wm.c
parent304ce06a5a026041fb0d0410c6a4600e995e1534 (diff)
RNA: pass Main rather than Context to register/unregister callbacks.
Diffstat (limited to 'source/blender/makesrna/intern/rna_wm.c')
-rw-r--r--source/blender/makesrna/intern/rna_wm.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 4c79c27e0de..b6d22def81e 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -669,19 +669,20 @@ static void rna_wmClipboard_set(PointerRNA *ptr, const char *value)
}
#ifdef WITH_PYTHON
-static void rna_Operator_unregister(const bContext *C, StructRNA *type)
+static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
{
const char *idname;
wmOperatorType *ot= RNA_struct_blender_type_get(type);
+ wmWindowManager *wm;
if(!ot)
return;
/* update while blender is running */
- if(C) {
- WM_operator_stack_clear((bContext*)C);
- WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
- }
+ wm= bmain->wm.first;
+ if(wm)
+ WM_operator_stack_clear(wm);
+ WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
RNA_struct_free_extension(type, &ot->ext);
@@ -858,7 +859,7 @@ void macro_wrapper(wmOperatorType *ot, void *userdata);
static char _operator_idname[OP_MAX_TYPENAME];
static char _operator_name[OP_MAX_TYPENAME];
static char _operator_descr[1024];
-static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
wmOperatorType dummyot = {NULL};
wmOperator dummyop= {NULL};
@@ -935,7 +936,7 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *
{
wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
if(ot && ot->ext.srna)
- rna_Operator_unregister(C, ot->ext.srna);
+ rna_Operator_unregister(bmain, ot->ext.srna);
}
/* create a new menu type */
@@ -955,14 +956,13 @@ static StructRNA *rna_Operator_register(bContext *C, ReportList *reports, void *
WM_operatortype_append_ptr(operator_wrapper, (void *)&dummyot);
/* update while blender is running */
- if(C)
- WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
return dummyot.ext.srna;
}
-static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_MacroOperator_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
wmOperatorType dummyot = {NULL};
wmOperator dummyop= {NULL};
@@ -1006,7 +1006,7 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v
{
wmOperatorType *ot= WM_operatortype_find(dummyot.idname, TRUE);
if(ot && ot->ext.srna)
- rna_Operator_unregister(C, ot->ext.srna);
+ rna_Operator_unregister(bmain, ot->ext.srna);
}
/* create a new menu type */
@@ -1021,8 +1021,7 @@ static StructRNA *rna_MacroOperator_register(bContext *C, ReportList *reports, v
WM_operatortype_append_macro_ptr(macro_wrapper, (void *)&dummyot);
/* update while blender is running */
- if(C)
- WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCREEN|NA_EDITED, NULL);
return dummyot.ext.srna;
}