From 22b5a3735fa124cd91910bb527688d664329bd4b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Nov 2011 18:41:37 +0000 Subject: add flag FUNC_USE_MAIN for rna functions which don't need the context. (currently unused) --- source/blender/makesrna/RNA_types.h | 9 +++++---- source/blender/makesrna/intern/makesrna.c | 12 ++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'source') diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index e768594fe73..85869115e79 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -303,13 +303,14 @@ typedef struct ParameterDynAlloc { typedef enum FunctionFlag { FUNC_NO_SELF = 1, /* for static functions */ - FUNC_USE_CONTEXT = 2, - FUNC_USE_REPORTS = 4, + FUNC_USE_MAIN = 2, + FUNC_USE_CONTEXT = 4, + FUNC_USE_REPORTS = 8, FUNC_USE_SELF_ID = 2048, /* registering */ - FUNC_REGISTER = 8, - FUNC_REGISTER_OPTIONAL = 8|16, + FUNC_REGISTER = 16, + FUNC_REGISTER_OPTIONAL = 16|32, /* internal flags */ FUNC_BUILTIN = 128, diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 6dbf7b9c553..c21685c9add 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1709,6 +1709,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA first= 0; } + if(func->flag & FUNC_USE_MAIN) { + if(!first) fprintf(f, ", "); + first= 0; + fprintf(f, "CTX_data_main(C)"); /* may have direct access later */ + } + if(func->flag & FUNC_USE_CONTEXT) { if(!first) fprintf(f, ", "); first= 0; @@ -2007,6 +2013,12 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA first= 0; } + if(func->flag & FUNC_USE_MAIN) { + if(!first) fprintf(f, ", "); + first= 0; + fprintf(f, "Main *bmain"); + } + if(func->flag & FUNC_USE_CONTEXT) { if(!first) fprintf(f, ", "); first= 0; -- cgit v1.2.3