[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [36745] trunk/blender/source/blender: RNA: pass Main rather than Context to register/unregister callbacks.
Brecht Van Lommel
brechtvanlommel at pandora.be
Wed May 18 12:56:27 CEST 2011
Revision: 36745
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=36745
Author: blendix
Date: 2011-05-18 10:56:26 +0000 (Wed, 18 May 2011)
Log Message:
-----------
RNA: pass Main rather than Context to register/unregister callbacks.
Modified Paths:
--------------
trunk/blender/source/blender/editors/animation/keyingsets.c
trunk/blender/source/blender/editors/include/ED_keyframing.h
trunk/blender/source/blender/editors/util/undo.c
trunk/blender/source/blender/makesrna/RNA_types.h
trunk/blender/source/blender/makesrna/intern/rna_ID.c
trunk/blender/source/blender/makesrna/intern/rna_animation.c
trunk/blender/source/blender/makesrna/intern/rna_internal.h
trunk/blender/source/blender/makesrna/intern/rna_render.c
trunk/blender/source/blender/makesrna/intern/rna_ui.c
trunk/blender/source/blender/makesrna/intern/rna_wm.c
trunk/blender/source/blender/python/intern/bpy_rna.c
trunk/blender/source/blender/windowmanager/WM_api.h
trunk/blender/source/blender/windowmanager/intern/wm.c
Modified: trunk/blender/source/blender/editors/animation/keyingsets.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyingsets.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/editors/animation/keyingsets.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -578,9 +578,8 @@
}
/* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */
-void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
+void ANIM_keyingset_info_unregister (Main *bmain, KeyingSetInfo *ksi)
{
- Main *bmain= CTX_data_main(C);
KeyingSet *ks, *ksn;
/* find relevant builtin KeyingSets which use this, and remove them */
Modified: trunk/blender/source/blender/editors/include/ED_keyframing.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_keyframing.h 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/editors/include/ED_keyframing.h 2011-05-18 10:56:26 UTC (rev 36745)
@@ -36,6 +36,7 @@
extern "C" {
#endif
+struct Main;
struct ListBase;
struct ID;
struct Scene;
@@ -190,7 +191,7 @@
/* for RNA type registrations... */
void ANIM_keyingset_info_register(KeyingSetInfo *ksi);
-void ANIM_keyingset_info_unregister(const struct bContext *C, KeyingSetInfo *ksi);
+void ANIM_keyingset_info_unregister(struct Main *bmain, KeyingSetInfo *ksi);
/* cleanup on exit */
void ANIM_keyingset_infos_exit(void);
Modified: trunk/blender/source/blender/editors/util/undo.c
===================================================================
--- trunk/blender/source/blender/editors/util/undo.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/editors/util/undo.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -260,7 +260,7 @@
static int ed_undo_exec(bContext *C, wmOperator *UNUSED(op))
{
/* "last operator" should disappear, later we can tie ths with undo stack nicer */
- WM_operator_stack_clear(C);
+ WM_operator_stack_clear(CTX_wm_manager(C));
return ed_undo_step(C, 1, NULL);
}
Modified: trunk/blender/source/blender/makesrna/RNA_types.h
===================================================================
--- trunk/blender/source/blender/makesrna/RNA_types.h 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/RNA_types.h 2011-05-18 10:56:26 UTC (rev 36745)
@@ -43,6 +43,7 @@
struct BlenderRNA;
struct IDProperty;
struct bContext;
+struct Main;
struct ReportList;
/** Pointer
@@ -329,9 +330,9 @@
typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function);
typedef int (*StructCallbackFunc)(struct bContext *C, struct PointerRNA *ptr, struct FunctionRNA *func, ParameterList *list);
typedef void (*StructFreeFunc)(void *data);
-typedef struct StructRNA *(*StructRegisterFunc)(struct bContext *C, struct ReportList *reports, void *data,
+typedef struct StructRNA *(*StructRegisterFunc)(struct Main *bmain, struct ReportList *reports, void *data,
const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
-typedef void (*StructUnregisterFunc)(const struct bContext *C, struct StructRNA *type);
+typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type);
typedef struct StructRNA StructRNA;
Modified: trunk/blender/source/blender/makesrna/intern/rna_ID.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ID.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/intern/rna_ID.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -210,12 +210,12 @@
return ptr->data;
}
-void rna_PropertyGroup_unregister(const bContext *C, StructRNA *type)
+void rna_PropertyGroup_unregister(Main *bmain, StructRNA *type)
{
RNA_struct_free(&BLENDER_RNA, type);
}
-StructRNA *rna_PropertyGroup_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+StructRNA *rna_PropertyGroup_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
PointerRNA dummyptr;
Modified: trunk/blender/source/blender/makesrna/intern/rna_animation.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_animation.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/intern/rna_animation.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -188,7 +188,7 @@
return (ksi->ext.srna)? ksi->ext.srna: &RNA_KeyingSetInfo;
}
-static void rna_KeyingSetInfo_unregister(const bContext *C, StructRNA *type)
+static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
{
KeyingSetInfo *ksi= RNA_struct_blender_type_get(type);
@@ -200,10 +200,10 @@
RNA_struct_free(&BLENDER_RNA, type);
/* unlink Blender-side data */
- ANIM_keyingset_info_unregister(C, ksi);
+ ANIM_keyingset_info_unregister(bmain, ksi);
}
-static StructRNA *rna_KeyingSetInfo_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
KeyingSetInfo dummyksi = {NULL};
KeyingSetInfo *ksi;
@@ -226,7 +226,7 @@
/* check if we have registered this info before, and remove it */
ksi = ANIM_keyingset_info_find_named(dummyksi.idname);
if (ksi && ksi->ext.srna)
- rna_KeyingSetInfo_unregister(C, ksi->ext.srna);
+ rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
/* create a new KeyingSetInfo type */
ksi= MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
Modified: trunk/blender/source/blender/makesrna/intern/rna_internal.h
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_internal.h 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/intern/rna_internal.h 2011-05-18 10:56:26 UTC (rev 36745)
@@ -197,8 +197,8 @@
struct IDProperty *rna_ID_idprops(struct PointerRNA *ptr, int create);
void rna_ID_fake_user_set(struct PointerRNA *ptr, int value);
struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, int create);
-void rna_PropertyGroup_unregister(const struct bContext *C, struct StructRNA *type);
-struct StructRNA *rna_PropertyGroup_register(struct bContext *C, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
+void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
+struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free);
struct StructRNA* rna_PropertyGroup_refine(struct PointerRNA *ptr);
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
Modified: trunk/blender/source/blender/makesrna/intern/rna_render.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_render.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/intern/rna_render.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -101,7 +101,7 @@
RNA_parameter_list_free(&list);
}
-static void rna_RenderEngine_unregister(const bContext *C, StructRNA *type)
+static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
{
RenderEngineType *et= RNA_struct_blender_type_get(type);
@@ -113,7 +113,7 @@
RNA_struct_free(&BLENDER_RNA, type);
}
-static StructRNA *rna_RenderEngine_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
RenderEngineType *et, dummyet = {NULL};
RenderEngine dummyengine= {NULL};
@@ -137,7 +137,7 @@
for(et=R_engines.first; et; et=et->next) {
if(strcmp(et->idname, dummyet.idname) == 0) {
if(et->ext.srna)
- rna_RenderEngine_unregister(C, et->ext.srna);
+ rna_RenderEngine_unregister(bmain, et->ext.srna);
break;
}
}
Modified: trunk/blender/source/blender/makesrna/intern/rna_ui.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_ui.c 2011-05-18 10:01:41 UTC (rev 36744)
+++ trunk/blender/source/blender/makesrna/intern/rna_ui.c 2011-05-18 10:56:26 UTC (rev 36745)
@@ -148,7 +148,7 @@
RNA_parameter_list_free(&list);
}
-static void rna_Panel_unregister(const bContext *C, StructRNA *type)
+static void rna_Panel_unregister(Main *bmain, StructRNA *type)
{
ARegionType *art;
PanelType *pt= RNA_struct_blender_type_get(type);
@@ -164,11 +164,10 @@
RNA_struct_free(&BLENDER_RNA, type);
/* 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);
}
-static StructRNA *rna_Panel_register(bContext *C, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *data, const char *identifier, StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
{
ARegionType *art;
PanelType *pt, dummypt = {NULL};
@@ -196,7 +195,7 @@
for(pt=art->paneltypes.first; pt; pt=pt->next) {
if(strcmp(pt->idname, dummypt.idname) == 0) {
if(pt->ext.srna)
- rna_Panel_unregister(C, pt->ext.srna);
+ rna_Panel_unregister(bmain, pt->ext.srna);
else
BLI_freelinkN(&art->paneltypes, pt);
break;
@@ -233,8 +232,7 @@
BLI_addtail(&art->paneltypes, pt);
/* 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 pt->ext.srna;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list