From cecbb3498b245fbf2226c967001c4ab40b1c7b87 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 9 Jan 2013 05:32:15 +0000 Subject: add RNA_def_struct_ptr(...) to use for runtime struct registration, saves over 2000 string lookups on startup and gives overall ~10% speedup for starting blender on my system. --- source/blender/windowmanager/intern/wm_operators.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/windowmanager/intern/wm_operators.c') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 81e469f8c5a..b2c3c935553 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -151,7 +151,7 @@ void WM_operatortype_append(void (*opfunc)(wmOperatorType *)) wmOperatorType *ot; ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); - ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); + ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); opfunc(ot); @@ -173,7 +173,7 @@ void WM_operatortype_append_ptr(void (*opfunc)(wmOperatorType *, void *), void * wmOperatorType *ot; ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); - ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); + ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); /* Set the default i18n context now, so that opfunc can redefine it if needed! */ RNA_def_struct_translation_context(ot->srna, BLF_I18NCONTEXT_OPERATOR_DEFAULT); opfunc(ot, userdata); @@ -360,7 +360,7 @@ wmOperatorType *WM_operatortype_append_macro(const char *idname, const char *nam } ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); - ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); + ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); ot->idname = idname; ot->name = name; @@ -390,7 +390,7 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType *, void *), wmOperatorType *ot; ot = MEM_callocN(sizeof(wmOperatorType), "operatortype"); - ot->srna = RNA_def_struct(&BLENDER_RNA, "", "OperatorProperties"); + ot->srna = RNA_def_struct_ptr(&BLENDER_RNA, "", &RNA_OperatorProperties); ot->flag = OPTYPE_MACRO; ot->exec = wm_macro_exec; -- cgit v1.2.3