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>2009-06-18 23:48:55 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-18 23:48:55 +0400
commit4cd24cf05809557e0d620dccf1f19a570784f6fe (patch)
tree6ffd5df6ab510d4fa6766d267bef2d3099679305 /source/blender/makesrna
parent89d2559e6dbde26acdd45e3fe9d6eff2c62d98c0 (diff)
RNA
Merging changes made by Arystanbek in the soc-2009-kazanbas branch, plus some things modified and added by me. * The API files now all in the makesrna module, convention is to call them e.g. rna_mesh_api.c for rna_mesh.c. Note for visual studio build maintainers, the rna_*_api.c files are compiled as part of "makesrna", but do not have rna_*_gen.c generated as part of the library. SCons/cmake/make were updated. * Added function flags FUNC_USE_CONTEXT and FUNC_USE_REPORTS, to allow RNA functions to get context and error reporting parameters optionally. Renamed FUNC_TYPESTATIC to FUNC_NO_SELF. * RNA collections now have a pointer to add/remove FunctionRNA's, this isn't actually used anywhere yet, purpose is to make an alias main.meshes.add() for main.add_mesh() in python. * Fixes to make autogenerating property set/get for multidimensional arrays work, though a 4x4 matrix will be exposed as a length 16 one dimensional RNA array. * Functions and properties added: * Main.add_mesh() * Main.remove_mesh() * Object.matrix * Object.create_render_mesh() * WindowManager.add_fileselect()
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h13
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/RNA_types.h10
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt3
-rw-r--r--source/blender/makesrna/intern/Makefile23
-rw-r--r--source/blender/makesrna/intern/SConscript7
-rw-r--r--source/blender/makesrna/intern/makesrna.c203
-rw-r--r--source/blender/makesrna/intern/rna_ID.c6
-rw-r--r--source/blender/makesrna/intern/rna_access.c50
-rw-r--r--source/blender/makesrna/intern/rna_color.c2
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c6
-rw-r--r--source/blender/makesrna/intern/rna_group.c2
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_key.c2
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c4
-rw-r--r--source/blender/makesrna/intern/rna_main.c6
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c81
-rw-r--r--source/blender/makesrna/intern/rna_material.c2
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c25
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c108
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c2
-rw-r--r--source/blender/makesrna/intern/rna_object.c14
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c83
-rw-r--r--source/blender/makesrna/intern/rna_rna.c10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c2
-rw-r--r--source/blender/makesrna/intern/rna_sequence.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c251
-rw-r--r--source/blender/makesrna/intern/rna_wm.c2
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c56
31 files changed, 821 insertions, 163 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index f7b069d8227..1907b2cedb4 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -37,6 +37,7 @@ extern "C" {
struct bContext;
struct ID;
struct Main;
+struct ReportList;
/* Types */
@@ -719,13 +720,13 @@ void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void
void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, void *value);
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, void *value);
-int RNA_function_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *parms);
-int RNA_function_call_lookup(PointerRNA *ptr, const char *identifier, ParameterList *parms);
+int RNA_function_call(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms);
+int RNA_function_call_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms);
-int RNA_function_call_direct(PointerRNA *ptr, FunctionRNA *func, const char *format, ...);
-int RNA_function_call_direct_lookup(PointerRNA *ptr, const char *identifier, const char *format, ...);
-int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args);
-int RNA_function_call_direct_va_lookup(PointerRNA *ptr, const char *identifier, const char *format, va_list args);
+int RNA_function_call_direct(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...);
+int RNA_function_call_direct_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...);
+int RNA_function_call_direct_va(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args);
+int RNA_function_call_direct_va_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args);
/* ID */
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 6cd8cce59a3..dfe072c4b8e 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -147,7 +147,7 @@ void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item);
void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set);
void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set, const char *typef);
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring);
+void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *add, const char *remove);
/* Function */
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index b527a4f11b3..75f52ededd0 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -161,11 +161,13 @@ typedef struct ParameterIterator {
/* Function */
typedef enum FunctionFlag {
- FUNC_TYPESTATIC = 1, /* for static functions, FUNC_ STATIC is taken by some windows header it seems */
+ FUNC_NO_SELF = 1, /* for static functions */
+ FUNC_USE_CONTEXT = 2,
+ FUNC_USE_REPORTS = 4,
/* registering */
- FUNC_REGISTER = 2,
- FUNC_REGISTER_OPTIONAL = 2|4,
+ FUNC_REGISTER = 8,
+ FUNC_REGISTER_OPTIONAL = 8|16,
/* internal flags */
FUNC_BUILTIN = 128,
@@ -173,7 +175,7 @@ typedef enum FunctionFlag {
FUNC_RUNTIME = 512
} FunctionFlag;
-typedef void (*CallFunc)(PointerRNA *ptr, ParameterList *parms);
+typedef void (*CallFunc)(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, ParameterList *parms);
typedef struct FunctionRNA FunctionRNA;
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 2914e488efa..963e4f9aeff 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -25,8 +25,9 @@
# ***** END GPL LICENSE BLOCK *****
FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c")
+FILE(GLOB APISRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_api.c")
LIST(REMOVE_ITEM DEFSRC rna_access.c rna_define.c makesrna.c)
-FILE(GLOB_RECURSE APISRC "../../editors/*/*_api.c")
+LIST(REMOVE_ITEM DEFSRC ${APISRC})
STRING(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
diff --git a/source/blender/makesrna/intern/Makefile b/source/blender/makesrna/intern/Makefile
index 78757c4f4b5..03f75f0bea6 100644
--- a/source/blender/makesrna/intern/Makefile
+++ b/source/blender/makesrna/intern/Makefile
@@ -28,10 +28,11 @@ DIR = $(OCGDIR)/blender/makesrna
ALLRNA = $(wildcard rna_*.c)
DEFRNA = $(filter-out %rna_define.c, $(filter-out %rna_access.c, $(ALLRNA)))
-GENSRCS = $(patsubst rna_%.c, rna_%_gen.c, $(DEFRNA))
+GENRNA = $(filter-out %_api.c, $(DEFRNA))
+GENSRCS = $(patsubst rna_%.c, rna_%_gen.c, $(GENRNA))
GENTARGET = $(patsubst %.c, $(DIR)/$(DEBUG_DIR)%.c, $(GENSRCS))
-MAKESRCS = $(DEFRNA) makesrna.c rna_define.c $(wildcard ../../editors/*/*_api.c)
+MAKESRCS = $(DEFRNA) makesrna.c rna_define.c
MAKEOBJS = $(patsubst %.c, $(DIR)/$(DEBUG_DIR)%.o, $(notdir $(MAKESRCS)))
CSRCS = $(GENSRCS) rna_access.c
@@ -94,24 +95,6 @@ clean::
# TODO include right .mk for ldflags
-# XXX this is an ugly hack, copying code from nan_compile.mk
-# we want the .o's to be in the makesrna/ directory, but the
-# .c's are in the editors/*/ directories
-
-$(DIR)/$(DEBUG_DIR)%_api.o: ../../editors/interface/%_api.c
- ifdef NAN_DEPEND
- @set -e; $(CC) -M $(CPPFLAGS) $< 2>/dev/null \
- | sed 's@\($*\)\.o[ :]*@$(DIR)/$(DEBUG_DIR)\1.o : @g' \
- > $(DIR)/$(DEBUG_DIR)$*.d; \
- [ -s $(DIR)/$(DEBUG_DIR)$*.d ] || $(RM) $(DIR)/$*.d
- endif
- ifdef NAN_QUIET
- @echo " -- $< -- "
- @$(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
- else
- $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
- endif
-
# A small note: we do not use the debug version of the alloc lib. That
# is done quite intentionally. If there is a bug in that lib, it needs
# to be fixed by the module maintainer.
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 041f743a056..03f0afdb2cc 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -16,9 +16,12 @@ source_files.remove('rna_access.c')
generated_files = source_files[:]
generated_files.remove('rna_define.c')
generated_files.remove('makesrna.c')
-generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
-source_files.extend(env.Glob('../../editors/*/*_api.c'))
+api_files = env.Glob('*_api.c')
+for api_file in api_files:
+ generated_files.remove(api_file)
+
+generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
makesrna_tool = env.Clone()
rna = env.Clone()
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index dd438cfe164..a8fe025fd46 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -394,7 +394,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else if(rna_color_quantize(prop, dp))
fprintf(f, " values[%d]= (%s)(data->%s[%d]*(1.0f/255.0f));\n", i, rna_type_type(prop), dp->dnaname, i);
else
- fprintf(f, " values[%d]= (%s)%s(data->%s[%d]);\n", i, rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname, i);
+ fprintf(f, " values[%d]= (%s)%s(((%s*)data->%s)[%d]);\n", i, rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnatype, dp->dnaname, i);
}
}
}
@@ -559,7 +559,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
fprintf(f, " data->%s[%d]= FTOCHAR(values[%d]);\n", dp->dnaname, i, i);
}
else {
- fprintf(f, " data->%s[%d]= %s", dp->dnaname, i, (dp->booleannegative)? "!": "");
+ fprintf(f, " ((%s*)data->%s)[%d]= %s", dp->dnatype, dp->dnaname, i, (dp->booleannegative)? "!": "");
rna_clamp_value(f, prop, 1, i);
}
}
@@ -1104,6 +1104,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
FunctionRNA *func;
PropertyDefRNA *dparm;
char *funcname, *ptrstr;
+ int first;
srna= dsrna->srna;
func= dfunc->func;
@@ -1113,10 +1114,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
funcname= rna_alloc_function_name(srna->identifier, func->identifier, "call");
- fprintf(f, "void %s(PointerRNA *_ptr, ParameterList *_parms)", funcname);
+ fprintf(f, "void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)", funcname);
fprintf(f, "\n{\n");
- if((func->flag & FUNC_TYPESTATIC)==0) {
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
else fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
}
@@ -1132,7 +1133,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, ";\n");
fprintf(f, "\t\n");
- if((func->flag & FUNC_TYPESTATIC)==0) {
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname);
else fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", srna->identifier);
}
@@ -1164,16 +1165,33 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if(func->ret) fprintf(f, "%s= ", func->ret->identifier);
fprintf(f, "%s(", dfunc->call);
- if((func->flag & FUNC_TYPESTATIC)==0)
+ first= 1;
+
+ if((func->flag & FUNC_NO_SELF)==0) {
fprintf(f, "_self");
+ first= 0;
+ }
+
+ if(func->flag & FUNC_USE_CONTEXT) {
+ if(!first) fprintf(f, ", ");
+ first= 0;
+ fprintf(f, "C");
+ }
+
+ if(func->flag & FUNC_USE_REPORTS) {
+ if(!first) fprintf(f, ", ");
+ first= 0;
+ fprintf(f, "reports");
+ }
dparm= dfunc->cont.properties.first;
for(; dparm; dparm= dparm->next) {
if(dparm->prop==func->ret)
continue;
- if((func->flag & FUNC_TYPESTATIC)==0 || dparm!=dfunc->cont.properties.first)
- fprintf(f, ", ");
+ if(!first) fprintf(f, ", ");
+ first= 0;
+
fprintf(f, "%s", dparm->prop->identifier);
}
@@ -1356,7 +1374,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
base= srna->base;
while (base) {
for(func= base->functions.first; func; func= func->cont.next) {
- fprintf(f, "%s%s rna_%s_%s;\n", "extern ", "FunctionRNA", base->identifier, func->identifier);
+ fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", base->identifier, func->identifier);
rna_generate_parameter_prototypes(brna, base, func, f);
}
@@ -1367,7 +1385,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
}
for(func= srna->functions.first; func; func= func->cont.next) {
- fprintf(f, "%s%s rna_%s_%s;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
+ fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
rna_generate_parameter_prototypes(brna, srna, func, f);
}
@@ -1380,6 +1398,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
FunctionRNA *func;
PropertyDefRNA *dparm;
StructDefRNA *dsrna;
+ int first;
dsrna= rna_find_struct_def(srna);
func= dfunc->func;
@@ -1402,17 +1421,39 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "%s(", dfunc->call);
- if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
- else fprintf(f, "struct %s *_self", srna->identifier);
+ first= 1;
+
+ if((func->flag & FUNC_NO_SELF)==0) {
+ if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
+ else fprintf(f, "struct %s *_self", srna->identifier);
+ first= 0;
+ }
+
+ if(func->flag & FUNC_USE_CONTEXT) {
+ if(!first) fprintf(f, ", ");
+ first= 0;
+ fprintf(f, "bContext *C");
+ }
+
+ if(func->flag & FUNC_USE_REPORTS) {
+ if(!first) fprintf(f, ", ");
+ first= 0;
+ fprintf(f, "ReportList *reports");
+ }
for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
- if(dparm->prop==func->ret) ;
- else if(dparm->prop->arraylength)
- fprintf(f, ", %s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->arraylength);
+ if(dparm->prop==func->ret)
+ continue;
+
+ if(!first) fprintf(f, ", ");
+ first= 0;
+
+ if(dparm->prop->arraylength)
+ fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->arraylength);
else if(dparm->prop->type == PROP_POINTER)
- fprintf(f, ", %s%s *%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier);
+ fprintf(f, "%s%s *%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier);
else
- fprintf(f, ", %s%s %s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier);
+ fprintf(f, "%s%s %s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier);
}
fprintf(f, ");\n");
@@ -1629,10 +1670,14 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
case PROP_COLLECTION: {
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, ", rna_function_string(cprop->begin), rna_function_string(cprop->next), rna_function_string(cprop->end), rna_function_string(cprop->get), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring));
+ if(cprop->add) fprintf(f, "&rna_%s_%s_func, ", srna->identifier, (char*)cprop->add);
+ else fprintf(f, "NULL, ");
+ if(cprop->remove) fprintf(f, "&rna_%s_%s_func, ", srna->identifier, (char*)cprop->remove);
+ else fprintf(f, "NULL, ");
if(cprop->type) fprintf(f, "&RNA_%s\n", (char*)cprop->type);
else fprintf(f, "NULL\n");
break;
- }
+ }
}
fprintf(f, "};\n\n");
@@ -1659,11 +1704,11 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
for(parm= func->cont.properties.first; parm; parm= parm->next)
rna_generate_property(f, srna, func->identifier, parm);
- fprintf(f, "%s%s rna_%s_%s = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
+ fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
- if(func->cont.next) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s, ", srna->identifier, ((FunctionRNA*)func->cont.next)->identifier);
+ if(func->cont.next) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, ((FunctionRNA*)func->cont.next)->identifier);
else fprintf(f, "\t{NULL, ");
- if(func->cont.prev) fprintf(f, "(FunctionRNA*)&rna_%s_%s,\n", srna->identifier, ((FunctionRNA*)func->cont.prev)->identifier);
+ if(func->cont.prev) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func,\n", srna->identifier, ((FunctionRNA*)func->cont.prev)->identifier);
else fprintf(f, "NULL,\n");
parm= func->cont.properties.first;
@@ -1749,11 +1794,11 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
}
func= srna->functions.first;
- if(func) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s, ", srna->identifier, func->identifier);
+ if(func) fprintf(f, "\t{(FunctionRNA*)&rna_%s_%s_func, ", srna->identifier, func->identifier);
else fprintf(f, "\t{NULL, ");
func= srna->functions.last;
- if(func) fprintf(f, "(FunctionRNA*)&rna_%s_%s}\n", srna->identifier, func->identifier);
+ if(func) fprintf(f, "(FunctionRNA*)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
else fprintf(f, "NULL}\n");
fprintf(f, "};\n");
@@ -1763,63 +1808,64 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
typedef struct RNAProcessItem {
char *filename;
+ char *api_filename;
void (*define)(BlenderRNA *brna);
} RNAProcessItem;
RNAProcessItem PROCESS_ITEMS[]= {
- {"rna_rna.c", RNA_def_rna},
- {"rna_ID.c", RNA_def_ID},
- {"rna_texture.c", RNA_def_texture},
- {"rna_action.c", RNA_def_action},
- {"rna_animation.c", RNA_def_animation},
- {"rna_actuator.c", RNA_def_actuator},
- {"rna_armature.c", RNA_def_armature},
- {"rna_brush.c", RNA_def_brush},
- {"rna_camera.c", RNA_def_camera},
- {"rna_cloth.c", RNA_def_cloth},
- {"rna_color.c", RNA_def_color},
- {"rna_constraint.c", RNA_def_constraint},
- {"rna_context.c", RNA_def_context},
- {"rna_controller.c", RNA_def_controller},
- {"rna_curve.c", RNA_def_curve},
- {"rna_fcurve.c", RNA_def_fcurve},
- {"rna_fluidsim.c", RNA_def_fluidsim},
- {"rna_group.c", RNA_def_group},
- {"rna_image.c", RNA_def_image},
- {"rna_key.c", RNA_def_key},
- {"rna_lamp.c", RNA_def_lamp},
- {"rna_lattice.c", RNA_def_lattice},
- {"rna_main.c", RNA_def_main},
- {"rna_material.c", RNA_def_material},
- {"rna_mesh.c", RNA_def_mesh},
- {"rna_meta.c", RNA_def_meta},
- {"rna_modifier.c", RNA_def_modifier},
- {"rna_nodetree.c", RNA_def_nodetree},
- {"rna_object.c", RNA_def_object},
- {"rna_object_force.c", RNA_def_object_force},
- {"rna_packedfile.c", RNA_def_packedfile},
- {"rna_particle.c", RNA_def_particle},
- {"rna_pose.c", RNA_def_pose},
- {"rna_property.c", RNA_def_gameproperty},
- {"rna_radio.c", RNA_def_radio},
- {"rna_scene.c", RNA_def_scene},
- {"rna_screen.c", RNA_def_screen},
- {"rna_scriptlink.c", RNA_def_scriptlink},
- {"rna_sensor.c", RNA_def_sensor},
- {"rna_sequence.c", RNA_def_sequence},
- {"rna_space.c", RNA_def_space},
- {"rna_text.c", RNA_def_text},
- {"rna_timeline.c", RNA_def_timeline_marker},
- {"rna_sound.c", RNA_def_sound},
- {"rna_ui.c", RNA_def_ui},
- {"rna_userdef.c", RNA_def_userdef},
- {"rna_vfont.c", RNA_def_vfont},
- {"rna_vpaint.c", RNA_def_vpaint},
- {"rna_wm.c", RNA_def_wm},
- {"rna_world.c", RNA_def_world},
+ {"rna_rna.c", NULL, RNA_def_rna},
+ {"rna_ID.c", NULL, RNA_def_ID},
+ {"rna_texture.c", NULL, RNA_def_texture},
+ {"rna_action.c", NULL, RNA_def_action},
+ {"rna_animation.c", NULL, RNA_def_animation},
+ {"rna_actuator.c", NULL, RNA_def_actuator},
+ {"rna_armature.c", NULL, RNA_def_armature},
+ {"rna_brush.c", NULL, RNA_def_brush},
+ {"rna_camera.c", NULL, RNA_def_camera},
+ {"rna_cloth.c", NULL, RNA_def_cloth},
+ {"rna_color.c", NULL, RNA_def_color},
+ {"rna_constraint.c", NULL, RNA_def_constraint},
+ {"rna_context.c", NULL, RNA_def_context},
+ {"rna_controller.c", NULL, RNA_def_controller},
+ {"rna_curve.c", NULL, RNA_def_curve},
+ {"rna_fcurve.c", NULL, RNA_def_fcurve},
+ {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
+ {"rna_group.c", NULL, RNA_def_group},
+ {"rna_image.c", NULL, RNA_def_image},
+ {"rna_key.c", NULL, RNA_def_key},
+ {"rna_lamp.c", NULL, RNA_def_lamp},
+ {"rna_lattice.c", NULL, RNA_def_lattice},
+ {"rna_main.c", "rna_main_api.c", RNA_def_main},
+ {"rna_material.c", NULL, RNA_def_material},
+ {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
+ {"rna_meta.c", NULL, RNA_def_meta},
+ {"rna_modifier.c", NULL, RNA_def_modifier},
+ {"rna_nodetree.c", NULL, RNA_def_nodetree},
+ {"rna_object.c", "rna_object_api.c", RNA_def_object},
+ {"rna_object_force.c", NULL, RNA_def_object_force},
+ {"rna_packedfile.c", NULL, RNA_def_packedfile},
+ {"rna_particle.c", NULL, RNA_def_particle},
+ {"rna_pose.c", NULL, RNA_def_pose},
+ {"rna_property.c", NULL, RNA_def_gameproperty},
+ {"rna_radio.c", NULL, RNA_def_radio},
+ {"rna_scene.c", NULL, RNA_def_scene},
+ {"rna_screen.c", NULL, RNA_def_screen},
+ {"rna_scriptlink.c", NULL, RNA_def_scriptlink},
+ {"rna_sensor.c", NULL, RNA_def_sensor},
+ {"rna_sequence.c", NULL, RNA_def_sequence},
+ {"rna_space.c", NULL, RNA_def_space},
+ {"rna_text.c", NULL, RNA_def_text},
+ {"rna_timeline.c", NULL, RNA_def_timeline_marker},
+ {"rna_sound.c", NULL, RNA_def_sound},
+ {"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
+ {"rna_userdef.c", NULL, RNA_def_userdef},
+ {"rna_vfont.c", NULL, RNA_def_vfont},
+ {"rna_vpaint.c", NULL, RNA_def_vpaint},
+ {"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
+ {"rna_world.c", NULL, RNA_def_world},
{NULL, NULL}};
-static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
+static void rna_generate(BlenderRNA *brna, FILE *f, char *filename, char *api_filename)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
@@ -1837,7 +1883,9 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
fprintf(f, "#include \"BLI_blenlib.h\"\n\n");
+ fprintf(f, "#include \"BKE_context.h\"\n");
fprintf(f, "#include \"BKE_library.h\"\n");
+ fprintf(f, "#include \"BKE_report.h\"\n");
fprintf(f, "#include \"BKE_utildefines.h\"\n\n");
fprintf(f, "#include \"RNA_define.h\"\n");
@@ -1846,7 +1894,10 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
rna_generate_prototypes(brna, f);
- fprintf(f, "#include \"%s\"\n\n", filename);
+ fprintf(f, "#include \"%s\"\n", filename);
+ if(api_filename)
+ fprintf(f, "#include \"%s\"\n", api_filename);
+ fprintf(f, "\n");
fprintf(f, "/* Autogenerated Functions */\n\n");
@@ -2169,7 +2220,7 @@ static int rna_preprocess(char *outfile)
status = 1;
}
else {
- rna_generate(brna, file, PROCESS_ITEMS[i].filename);
+ rna_generate(brna, file, PROCESS_ITEMS[i].filename, PROCESS_ITEMS[i].api_filename);
fclose(file);
status= (DefRNA.error != 0);
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 56eda4eb735..52680e26afe 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -246,12 +246,6 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "lib");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from.");
-
- /* XXX temporary for testing */
- func= RNA_def_function(srna, "rename", "rename_id");
- RNA_def_function_ui_description(func, "Rename this ID datablock.");
- prop= RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
- RNA_def_property_flag(prop, PROP_REQUIRED);
}
static void rna_def_library(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 2413cd46eed..cfddb1daf10 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -33,7 +33,9 @@
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
+#include "BKE_context.h"
#include "BKE_idprop.h"
+#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "WM_api.h"
@@ -725,7 +727,7 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
return 0;
}
-void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop)
+void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
prop= rna_ensure_property(prop);
@@ -1321,6 +1323,7 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{
IDProperty *idprop;
+ //CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
if((idprop=rna_idproperty_check(&prop, ptr))) {
IDPropertyTemplate val = {0};
@@ -1346,8 +1349,17 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
MEM_freeN(item);
}
}
+#if 0
+ else if(cprop->add){
+ if(!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ ParameterList *params= RNA_parameter_list_create(ptr, cprop->add);
+ RNA_function_call(NULL, NULL, ptr, cprop->add, params);
+ RNA_parameter_list_free(params);
+ }
+ }
+#endif
else
- printf("RNA_property_collection_add %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);
+ printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier);
if(r_ptr) {
if(idprop) {
@@ -1365,6 +1377,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
{
IDProperty *idprop;
+ //CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
if((idprop=rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array;
@@ -1385,6 +1398,15 @@ void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
}
}
else if(prop->flag & PROP_IDPROPERTY);
+#if 0
+ else if(cprop->remove){
+ if(!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ ParameterList *params= RNA_parameter_list_create(ptr, cprop->remove);
+ RNA_function_call(NULL, NULL, ptr, cprop->remove, params);
+ RNA_parameter_list_free(params);
+ }
+ }
+#endif
else
printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);
}
@@ -2524,10 +2546,10 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, void
RNA_parameter_set(parms, parm, value);
}
-int RNA_function_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
+int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
{
if(func->call) {
- func->call(ptr, parms);
+ func->call(C, reports, ptr, parms);
return 0;
}
@@ -2535,33 +2557,33 @@ int RNA_function_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
return -1;
}
-int RNA_function_call_lookup(PointerRNA *ptr, const char *identifier, ParameterList *parms)
+int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, ParameterList *parms)
{
FunctionRNA *func;
func= RNA_struct_find_function(ptr, identifier);
if(func)
- return RNA_function_call(ptr, func, parms);
+ return RNA_function_call(C, reports, ptr, func, parms);
return -1;
}
-int RNA_function_call_direct(PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
+int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
{
va_list args;
int ret;
va_start(args, format);
- ret= RNA_function_call_direct_va(ptr, func, format, args);
+ ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
va_end(args);
return ret;
}
-int RNA_function_call_direct_lookup(PointerRNA *ptr, const char *identifier, const char *format, ...)
+int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, ...)
{
FunctionRNA *func;
@@ -2573,7 +2595,7 @@ int RNA_function_call_direct_lookup(PointerRNA *ptr, const char *identifier, con
va_start(args, format);
- ret= RNA_function_call_direct_va(ptr, func, format, args);
+ ret= RNA_function_call_direct_va(C, reports, ptr, func, format, args);
va_end(args);
@@ -2715,7 +2737,7 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
return 0;
}
-int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args)
+int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, va_list args)
{
PointerRNA funcptr;
ParameterList *parms;
@@ -2810,7 +2832,7 @@ int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *
}
if (err==0)
- err= RNA_function_call(ptr, func, parms);
+ err= RNA_function_call(C, reports, ptr, func, parms);
/* XXX throw error when more parameters than those needed are passed or leave silent? */
if (err==0 && pret && ofs<flen && format[ofs++]=='R') {
@@ -2870,14 +2892,14 @@ int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *
return err;
}
-int RNA_function_call_direct_va_lookup(PointerRNA *ptr, const char *identifier, const char *format, va_list args)
+int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args)
{
FunctionRNA *func;
func= RNA_struct_find_function(ptr, identifier);
if(func)
- return RNA_function_call_direct_va(ptr, func, format, args);
+ return RNA_function_call_direct_va(C, reports, ptr, func, format, args);
return 0;
}
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index 09b423e6753..179808ab66d 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -212,7 +212,7 @@ static void rna_def_curvemapping(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "CurveMap");
RNA_def_property_ui_text(prop, "Curves", "");
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 445a9b6070f..41a47e279e9 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -605,7 +605,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
RNA_def_property_struct_type(prop, "CurvePoint");
- RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length", 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Points", "Collection of points for Poly and Nurbs curves.");
prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 05439f71f83..d91f538d412 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -604,7 +604,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
if(DefRNA.preprocess) {
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, 0, 0, 0);
}
else {
#ifdef RNA_RUNTIME
@@ -1776,7 +1776,7 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
}
}
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring)
+void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *add, const char *remove)
{
StructRNA *srna= DefRNA.laststruct;
@@ -1796,6 +1796,8 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
if(length) cprop->length= (PropCollectionLengthFunc)length;
if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint;
if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring;
+ if(add) cprop->add= (FunctionRNA*)add;
+ if(remove) cprop->remove= (FunctionRNA*)remove;
break;
}
default:
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 059b2ce78f7..1406ad1ae60 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -61,7 +61,7 @@ void RNA_def_group(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects.");
- RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0, 0);
prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 9071efe71f7..61cde5a01a3 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -188,7 +188,11 @@ void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, ch
/* API functions */
+void RNA_api_main(struct StructRNA *srna);
+void RNA_api_mesh(struct StructRNA *srna);
+void RNA_api_object(struct StructRNA *srna);
void RNA_api_ui_layout(struct StructRNA *srna);
+void RNA_api_wm(struct StructRNA *srna);
/* ID Properties */
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 3a5a4fa1ced..d93e6f4d7cf 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -245,6 +245,7 @@ typedef struct CollectionPropertyRNA {
PropCollectionLengthFunc length; /* optional */
PropCollectionLookupIntFunc lookupint; /* optional */
PropCollectionLookupStringFunc lookupstring; /* optional */
+ FunctionRNA *add, *remove;
struct StructRNA *type;
} CollectionPropertyRNA;
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 896f660c720..b97dd95c4d4 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -335,7 +335,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
RNA_def_property_struct_type(prop, "UnknownType");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0, 0, 0);
}
static void rna_def_key(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 0e341fcdbd0..3af448b0233 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -99,7 +99,7 @@ static void rna_def_latticepoint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Deformed Location", "");
prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of.");
}
@@ -159,7 +159,7 @@ static void rna_def_lattice(BlenderRNA *brna)
prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "LatticePoint");
- RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Points", "Points of the lattice.");
}
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index fdd0349b25e..8d98036290a 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -33,6 +33,7 @@
#ifdef RNA_RUNTIME
#include "BKE_main.h"
+#include "BKE_mesh.h"
/* all the list begin functions are added manually here, Main is not in SDNA */
@@ -218,6 +219,7 @@ void RNA_def_main(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
+
const char *lists[][5]= {
{"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks."},
{"scenes", "Scene", "rna_Main_scene_begin", "Scenes", "Scene datablocks."},
@@ -262,9 +264,11 @@ void RNA_def_main(BlenderRNA *brna)
{
prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, lists[i][1]);
- RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, "add_mesh", "remove_mesh");
RNA_def_property_ui_text(prop, lists[i][3], lists[i][4]);
}
+
+ RNA_api_main(srna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
new file mode 100644
index 00000000000..6d56b2b00f9
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -0,0 +1,81 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_main.h"
+#include "BKE_mesh.h"
+#include "BKE_library.h"
+
+#include "DNA_mesh_types.h"
+
+Mesh *rna_Main_add_mesh(Main *main, char *name)
+{
+ Mesh *me= add_mesh(name);
+ me->id.us--;
+ return me;
+}
+
+void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me)
+{
+ if(me->id.us == 0)
+ free_libblock(&main->mesh, me);
+ else
+ BKE_report(reports, RPT_ERROR, "Mesh must have zero users to be removed.");
+
+ /* XXX python now has invalid pointer? */
+}
+
+#else
+
+void RNA_api_main(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ func= RNA_def_function(srna, "add_mesh", "rna_Main_add_mesh");
+ RNA_def_function_ui_description(func, "Add a new mesh.");
+ prop= RNA_def_string(func, "name", "Mesh", 0, "", "New name for the datablock.");
+ prop= RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh.");
+ RNA_def_function_return(func, prop);
+
+ func= RNA_def_function(srna, "remove_mesh", "rna_Main_remove_mesh");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a mesh if it has zero users.");
+ prop= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+}
+
+#endif
+
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 1c16e793fdc..41f31594f6e 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -1143,7 +1143,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
/* mtex */
prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, structname);
- RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures.");
prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 3499ee16258..653f9d61fa5 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -646,7 +646,7 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of.");
}
@@ -761,7 +761,7 @@ static void rna_def_mtface(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshTextureFace");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0, 0, 0);
srna= RNA_def_struct(brna, "MeshTextureFace", NULL);
RNA_def_struct_sdna(srna, "MTFace");
@@ -898,7 +898,7 @@ static void rna_def_mcol(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshColor");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0, 0, 0);
srna= RNA_def_struct(brna, "MeshColor", NULL);
RNA_def_struct_sdna(srna, "MCol");
@@ -944,7 +944,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshFloatProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0, 0, 0);
srna= RNA_def_struct(brna, "MeshFloatProperty", NULL);
RNA_def_struct_sdna(srna, "MFloatProperty");
@@ -968,7 +968,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshIntProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0, 0, 0);
srna= RNA_def_struct(brna, "MeshIntProperty", NULL);
RNA_def_struct_sdna(srna, "MIntProperty");
@@ -992,7 +992,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshStringProperty");
RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0, 0, 0);
srna= RNA_def_struct(brna, "MeshStringProperty", NULL);
RNA_def_struct_sdna(srna, "MStringProperty");
@@ -1049,6 +1049,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
RNA_def_property_struct_type(prop, "MeshVertex");
RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh.");
+ // XXX RNA_def_property_collection_funcs(prop, "rna_Mesh_verts_begin", 0, 0, 0, 0, 0, 0, "add_verts", "remove_verts");
prop= RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
@@ -1067,31 +1068,31 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", 0, 0, 0, "rna_Mesh_uv_layers_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", 0, 0, 0, "rna_Mesh_uv_layers_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_ui_text(prop, "UV Layers", "");
prop= RNA_def_property(srna, "vcol_layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vcol_layers_begin", 0, 0, 0, "rna_Mesh_vcol_layers_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_vcol_layers_begin", 0, 0, 0, "rna_Mesh_vcol_layers_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "MeshColorLayer");
RNA_def_property_ui_text(prop, "Vertex Color Layers", "");
prop= RNA_def_property(srna, "float_layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer");
RNA_def_property_ui_text(prop, "Float Property Layers", "");
prop= RNA_def_property(srna, "int_layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "MeshIntPropertyLayer");
RNA_def_property_ui_text(prop, "Int Property Layers", "");
prop= RNA_def_property(srna, "string_layers", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0, 0, 0);
RNA_def_property_struct_type(prop, "MeshStringPropertyLayer");
RNA_def_property_ui_text(prop, "String Property Layers", "");
@@ -1122,6 +1123,8 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Shape Keys", "");
rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
+
+ RNA_api_mesh(srna);
}
void RNA_def_mesh(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
new file mode 100644
index 00000000000..26fb77777d7
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -0,0 +1,108 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_scene_types.h"
+
+/*
+void rna_Mesh_copy(Mesh *me, Mesh *from)
+{
+ copy_mesh_data(me, from);
+}
+
+void rna_Mesh_copy_applied(Mesh *me, Scene *sce, Object *ob)
+{
+ DerivedMesh *dm= mesh_create_derived_view(sce, ob, CD_MASK_MESH);
+ DM_to_mesh(dm, me);
+ dm->release(dm);
+}
+*/
+
+void rna_Mesh_transform(Mesh *me, float **mat)
+{
+}
+
+#if 0
+/* extern struct EditVert *addvertlist(EditMesh *em, float *vec, struct EditVert *example); */
+
+static void rna_Mesh_verts_add(PointerRNA *ptr, PointerRNA *ptr_item)
+{
+ //Mesh *me= (Mesh*)ptr->data;
+
+ /*
+ // XXX if item is not MVert we fail silently
+ if (item->type == RNA_MeshVertex)
+ return;
+
+ // XXX this must be slow...
+ EditMesh *em= BKE_mesh_get_editmesh(me);
+
+ MVert *v = (MVert*)ptr_item->ptr->data;
+ addvertlist(em, v->co, NULL);
+
+ BKE_mesh_end_editmesh(me, em);
+ */
+}
+#endif
+
+#else
+
+void RNA_api_mesh(StructRNA *srna)
+{
+ /*FunctionRNA *func;
+ PropertyRNA *prop;*/
+
+ /*
+ func= RNA_def_function(srna, "copy", "rna_Mesh_copy");
+ RNA_def_function_ui_description(func, "Copy mesh data.");
+ prop= RNA_def_pointer(func, "src", "Mesh", "", "A mesh to copy data from.");
+ RNA_def_property_flag(prop, PROP_REQUIRED);*/
+
+ /*
+ func= RNA_def_function(srna, "add_geom", "rna_Mesh_add_geom");
+ RNA_def_function_ui_description(func, "Add geometry data to mesh.");
+ prop= RNA_def_collection(func, "verts", "?", "", "Vertices.");
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+ prop= RNA_def_collection(func, "faces", "?", "", "Faces.");
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+ */
+}
+
+#endif
+
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 30f4936a06d..dab7a94584f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -1089,7 +1089,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Projectors", "");
prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 9d7da401ec1..ff9777d283e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -584,7 +584,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Debug State", "Print state debug info in the game engine.");
}
-static StructRNA *rna_def_object(BlenderRNA *brna)
+static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
@@ -739,7 +739,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "MaterialSlot");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0); /* don't dereference pointer! */
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0, 0, 0); /* don't dereference pointer! */
RNA_def_property_ui_text(prop, "Materials", "Material slots in the object.");
prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
@@ -799,6 +799,12 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface.");
+ /* matrix */
+ prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "obmat");
+ RNA_def_property_array(prop, 16);
+ RNA_def_property_ui_text(prop, "Matrix", "Transformation matrix.");
+
/* collections */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Constraint");
@@ -1103,8 +1109,8 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "shapenr");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key index.");
-
- return srna;
+
+ RNA_api_object(srna);
}
void RNA_def_object(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
new file mode 100644
index 00000000000..053ab115b3b
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -0,0 +1,83 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+
+#include "DNA_mesh_types.h"
+#include "DNA_scene_types.h"
+
+/* copied from init_render_mesh (render code) */
+Mesh *rna_Object_create_render_mesh(Object *ob, Scene *scene)
+{
+ CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL;
+ DerivedMesh *dm;
+ Mesh *me;
+
+ /* TODO: other types */
+ if(ob->type != OB_MESH)
+ return NULL;
+
+ dm= mesh_create_derived_render(scene, ob, mask);
+
+ if(!dm)
+ return NULL;
+
+ me= add_mesh("tmp_render_mesh");
+ me->id.us--; /* we don't assign it to anything */
+ DM_to_mesh(dm, me);
+ dm->release(dm);
+
+ return me;
+}
+
+#else
+
+void RNA_api_object(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ func= RNA_def_function(srna, "create_render_mesh", "rna_Object_create_render_mesh");
+ RNA_def_function_ui_description(func, "Create a Mesh datablock with all modifiers applied.");
+ prop= RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+ prop= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh created from object, remove it if it is only used for export.");
+ RNA_def_function_return(func, prop);
+}
+
+#endif
+
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 329175ad68b..bd3a8ae5580 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -611,13 +611,13 @@ static void rna_def_struct(BlenderRNA *brna)
prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Properties", "Properties in the struct.");
prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Function");
- RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next", "rna_iterator_listbase_end", "rna_Struct_functions_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Functions", "");
}
@@ -719,7 +719,7 @@ static void rna_def_function(BlenderRNA *brna)
prop= RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
/*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function.");
prop= RNA_def_property(srna, "registered", PROP_BOOLEAN, PROP_NONE);
@@ -800,7 +800,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "EnumPropertyItem");
- RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Items", "Possible values for the property.");
srna= RNA_def_struct(brna, "EnumPropertyItem", NULL);
@@ -895,7 +895,7 @@ void RNA_def_rna(BlenderRNA *brna)
prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0, 0);
RNA_def_property_ui_text(prop, "Structs", "");
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 64ba6e11e56..1365ab75fc7 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -866,7 +866,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Objects", "");
- RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0, 0);
prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
diff --git a/source/blender/makesrna/intern/rna_sequence.c b/source/blender/makesrna/intern/rna_sequence.c
index 69e884fe249..055e67fb135 100644
--- a/source/blender/makesrna/intern/rna_sequence.c
+++ b/source/blender/makesrna/intern/rna_sequence.c
@@ -521,7 +521,7 @@ void rna_def_editor(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
RNA_def_property_struct_type(prop, "Sequence");
RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip.");
- RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0);
+ RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0, 0, 0);
prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
new file mode 100644
index 00000000000..d06d4d4406d
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -0,0 +1,251 @@
+/**
+ * $Id:
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#ifdef RNA_RUNTIME
+
+#else
+
+#define DEF_ICON(name) {name, #name, 0, #name, ""},
+static EnumPropertyItem icon_items[] = {
+#include "UI_icons.h"
+ {0, NULL, 0, NULL, NULL}};
+#undef DEF_ICON
+
+static void api_ui_item_common(FunctionRNA *func)
+{
+ PropertyRNA *prop;
+
+ RNA_def_string(func, "text", "", 0, "", "Override automatic text of the item.");
+
+ prop= RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, icon_items);
+ RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item.");
+
+}
+
+static void api_ui_item_op_common(FunctionRNA *func)
+{
+ PropertyRNA *parm;
+
+ api_ui_item_common(func);
+ parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+static void api_ui_item_rna_common(FunctionRNA *func)
+{
+ PropertyRNA *parm;
+
+ parm= RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in data.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+void RNA_api_ui_layout(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static EnumPropertyItem curve_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {'v', "VECTOR", 0, "Vector", ""},
+ {'c', "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ /* simple layout specifiers */
+ func= RNA_def_function(srna, "row", "uiLayoutRow");
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+ RNA_def_boolean(func, "align", 0, "", "Align buttons to each other.");
+
+ func= RNA_def_function(srna, "column", "uiLayoutColumn");
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+ RNA_def_boolean(func, "align", 0, "", "Align buttons to each other.");
+
+ func= RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
+ parm= RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic.", 0, INT_MAX);
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+ RNA_def_boolean(func, "align", 0, "", "Align buttons to each other.");
+
+ /* box layout */
+ func= RNA_def_function(srna, "box", "uiLayoutBox");
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+
+ /* split layout */
+ func= RNA_def_function(srna, "split", "uiLayoutSplit");
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+ RNA_def_float(func, "percentage", 0.5f, 0.0f, 1.0f, "Percentage", "Percentage of width to split at.", 0.0f, 1.0f);
+
+ /* items */
+ func= RNA_def_function(srna, "itemR", "uiItemR");
+ api_ui_item_common(func);
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
+ RNA_def_boolean(func, "slider", 0, "", "Use slider widget for numeric values.");
+ RNA_def_boolean(func, "toggle", 0, "", "Use toggle widget for boolean values.");
+
+ func= RNA_def_function(srna, "items_enumR", "uiItemsEnumR");
+ api_ui_item_rna_common(func);
+
+ func= RNA_def_function(srna, "item_menu_enumR", "uiItemMenuEnumR");
+ api_ui_item_common(func);
+ api_ui_item_rna_common(func);
+
+ /*func= RNA_def_function(srna, "item_enumR", "uiItemEnumR");
+ api_ui_item_common(func);
+ api_ui_item_rna_common(func);
+ parm= RNA_def_string(func, "value", "", 0, "", "Enum property value.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);*/
+
+ func= RNA_def_function(srna, "itemO", "uiItemO");
+ api_ui_item_op_common(func);
+
+ func= RNA_def_function(srna, "item_enumO", "uiItemEnumO_string");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_string(func, "value", "", 0, "", "Enum property value.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "items_enumO", "uiItemsEnumO");
+ parm= RNA_def_string(func, "operator", "", 0, "", "Identifier of the operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "item_menu_enumO", "uiItemMenuEnumO");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "item_booleanO", "uiItemBooleanO");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_boolean(func, "value", 0, "", "Value of the property to call the operator with.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "item_intO", "uiItemIntO");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "", "Value of the property to call the operator with.", INT_MIN, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "item_floatO", "uiItemFloatO");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "", "Value of the property to call the operator with.", -FLT_MAX, FLT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "item_stringO", "uiItemStringO");
+ api_ui_item_op_common(func);
+ parm= RNA_def_string(func, "property", "", 0, "", "Identifier of property in operator.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_string(func, "value", "", 0, "", "Value of the property to call the operator with.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "itemL", "uiItemL");
+ api_ui_item_common(func);
+
+ func= RNA_def_function(srna, "itemM", "uiItemM");
+ parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ api_ui_item_common(func);
+ parm= RNA_def_string(func, "menu", "", 0, "", "Identifier of the menu.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "itemS", "uiItemS");
+
+ /* context */
+ func= RNA_def_function(srna, "set_context_pointer", "uiLayoutSetContextPointer");
+ parm= RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
+
+ /* templates */
+ func= RNA_def_function(srna, "template_header", "uiTemplateHeader");
+ parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "template_ID", "uiTemplateID");
+ parm= RNA_def_pointer(func, "context", "Context", "", "Current context.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ api_ui_item_rna_common(func);
+ RNA_def_string(func, "new", "", 0, "", "Operator identifier to create a new ID block.");
+ RNA_def_string(func, "open", "", 0, "", "Operator identifier to open a new ID block.");
+ RNA_def_string(func, "unlink", "", 0, "", "Operator identifier to unlink the ID block.");
+
+ func= RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
+ parm= RNA_def_pointer(func, "data", "Modifier", "", "Modifier data.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
+ parm= RNA_def_pointer(func, "data", "Constraint", "", "Constraint data.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
+ parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "template_preview", "uiTemplatePreview");
+ parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
+ parm= RNA_def_pointer(func, "curvemap", "CurveMapping", "", "Curve mapping pointer.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display.");
+
+ func= RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
+ parm= RNA_def_pointer(func, "ramp", "ColorRamp", "", "Color ramp pointer.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
+
+ func= RNA_def_function(srna, "template_layers", "uiTemplateLayers");
+ api_ui_item_rna_common(func);
+}
+
+#endif
+
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 22ce207c6a9..df07e03850a 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -160,6 +160,8 @@ static void rna_def_windowmanager(BlenderRNA *brna)
prop= RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Operator");
RNA_def_property_ui_text(prop, "Operators", "Operator registry.");
+
+ RNA_api_wm(srna);
}
void RNA_def_wm(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
new file mode 100644
index 00000000000..fd34d7c4d70
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -0,0 +1,56 @@
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "RNA_define.h"
+#include "RNA_types.h"
+
+#ifdef RNA_RUNTIME
+
+#include "BKE_context.h"
+
+#include "WM_api.h"
+
+#else
+
+void RNA_api_wm(StructRNA *srna)
+{
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ func= RNA_def_function(srna, "add_fileselect", "WM_event_add_fileselect");
+ RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Show up the file selector.");
+ prop= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
+ RNA_def_property_flag(prop, PROP_REQUIRED);
+}
+
+#endif
+