Branch soc-2009-kazanbas

Merge with trunk revision 20991, and update scripts for the changes too.
Reload Scripts and Export OBJ still work for me.
This commit is contained in:
Brecht Van Lommel 2009-06-18 19:59:20 +00:00
commit dc7028cee4
64 changed files with 1085 additions and 556 deletions

@ -4,10 +4,7 @@ def write_obj(filepath, scene, ob):
out = open(filepath, 'w') out = open(filepath, 'w')
# create a temporary mesh # create a temporary mesh
mesh = bpy.data.add_mesh("tmpmesh") mesh = ob.create_render_mesh(scene)
# copy data with modifiers applied
mesh.copy_applied(scene, ob)
# for vert in mesh.verts: # for vert in mesh.verts:
# ^ iterating that way doesn't work atm for some reason # ^ iterating that way doesn't work atm for some reason
@ -25,7 +22,8 @@ def write_obj(filepath, scene, ob):
out.write(' {0}'.format(index + 1)) out.write(' {0}'.format(index + 1))
out.write('\n') out.write('\n')
# TODO: delete mesh here # delete mesh gain
bpy.data.remove_mesh(mesh)
out.close() out.close()
@ -37,13 +35,13 @@ class SCRIPT_OT_export_obj(bpy.types.Operator):
# List of operator properties, the attributes will be assigned # List of operator properties, the attributes will be assigned
# to the class instance from the operator settings before calling. # to the class instance from the operator settings before calling.
__props__ = [ __props__ = [
bpy.props["StringProperty"](attr="filename", name="filename") bpy.props.StringProperty(attr="filename", name="filename")
] ]
def debug(self, message): def debug(self, message):
print("{0}: {1}".format(self.__class__.__name__, message)) print("{0}: {1}".format(self.__class__.__name__, message))
def exec(self, context): def execute(self, context):
self.debug("exec") self.debug("exec")
self.debug("filename = " + self.filename) self.debug("filename = " + self.filename)
@ -61,9 +59,13 @@ class SCRIPT_OT_export_obj(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
self.debug("invoke") self.debug("invoke")
context.add_fileselect(self.__operator__) wm = context.manager
wm.add_fileselect(self.__operator__)
return ('RUNNING_MODAL',) return ('RUNNING_MODAL',)
def poll(self, context): # poll isnt working yet def poll(self, context): # poll isnt working yet
self.debug("poll") self.debug("poll")
return True return True
bpy.ops.add(SCRIPT_OT_export_obj)

@ -61,8 +61,8 @@ class SCRIPT_MT_export(bpy.types.Menu):
class SCRIPT_OT_reload_scripts(bpy.types.Operator): class SCRIPT_OT_reload_scripts(bpy.types.Operator):
__label__ = 'Reload Scripts' __label__ = 'Reload Scripts'
def exec(self, context): def execute(self, context):
print("SCRIPT_OT_reload_scripts: exec") print("SCRIPT_OT_reload_scripts: execute")
# add ../io to sys.path # add ../io to sys.path
@ -116,7 +116,7 @@ class SCRIPT_OT_reload_scripts(bpy.types.Operator):
def invoke(self, context, event): def invoke(self, context, event):
print("SCRIPT_OT_reload_scripts: invoke") print("SCRIPT_OT_reload_scripts: invoke")
return self.exec(context) return self.execute(context)
def poll(self, context): def poll(self, context):
pass pass
@ -129,3 +129,4 @@ if (hasattr(bpy.ops, "SCRIPT_OT_reload_scripts")):
bpy.ops.remove(bpy.ops.SCRIPT_OT_reload_scripts) bpy.ops.remove(bpy.ops.SCRIPT_OT_reload_scripts)
bpy.ops.add(SCRIPT_OT_reload_scripts) bpy.ops.add(SCRIPT_OT_reload_scripts)

@ -162,6 +162,7 @@ COMLIB += $(OCGDIR)/blender/makesdna/$(DEBUG_DIR)libdna.a
COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a COMLIB += $(NAN_GUARDEDALLOC)/lib/libguardedalloc.a
COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a COMLIB += $(NAN_MEMUTIL)/lib/libmemutil.a
COMLIB += $(NAN_PNG)/lib/libpng.a COMLIB += $(NAN_PNG)/lib/libpng.a
COMLIB += $(OCGDIR)/blender/gen_python/$(DEBUG_DIR)libgen_python.a
ifeq ($(WITH_QUICKTIME), true) ifeq ($(WITH_QUICKTIME), true)
COMLIB += $(OCGDIR)/blender/blenderqt/$(DEBUG_DIR)libblenderqt.a COMLIB += $(OCGDIR)/blender/blenderqt/$(DEBUG_DIR)libblenderqt.a

@ -2027,39 +2027,3 @@ void em_setup_viewcontext(bContext *C, ViewContext *vc)
vc->em= me->edit_mesh; vc->em= me->edit_mesh;
} }
} }
/*
* This version of copy_mesh doesn't allocate a new mesh,
* instead it copies data between two existing meshes.
*
* XXX not used anywhere...
*/
void copy_mesh_data(Mesh *dest, Mesh *src)
{
int totvert, totedge, totface;
int has_layer;
CustomData_free(&dest->vdata, dest->totvert);
CustomData_free(&dest->edata, dest->totedge);
CustomData_free(&dest->fdata, dest->totface);
memset(&dest->vdata, 0, sizeof(dest->vdata));
memset(&dest->edata, 0, sizeof(dest->edata));
memset(&dest->fdata, 0, sizeof(dest->fdata));
totvert = dest->totvert = src->totvert;
totedge = dest->totedge = src->totedge;
totface = dest->totface = src->totface;
CustomData_copy(&src->vdata, &dest->vdata, CD_MASK_MESH, CD_DUPLICATE, totvert);
CustomData_copy(&src->edata, &dest->edata, CD_MASK_MESH, CD_DUPLICATE, totedge);
CustomData_copy(&src->fdata, &dest->fdata, CD_MASK_MESH, CD_DUPLICATE, totface);
CustomData_has_layer(&dest->vdata, CD_MVERT);
CustomData_add_layer(&dest->vdata, CD_MVERT, CD_ASSIGN, src->mvert, totvert);
CustomData_add_layer(&dest->edata, CD_MEDGE, CD_ASSIGN, src->medge, totedge);
CustomData_add_layer(&dest->fdata, CD_MFACE, CD_ASSIGN, src->mface, totface);
mesh_update_customdata_pointers(dest);
}

@ -574,9 +574,15 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
return 1; return 1;
} }
else if(CTX_data_equals(member, "cloth")) { else if(CTX_data_equals(member, "cloth")) {
set_pointer_type(path, result, &RNA_ClothModifier); PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
if(ptr && ptr->data) {
Object *ob= ptr->data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md);
return 1; return 1;
} }
}
else if(CTX_data_equals(member, "soft_body")) { else if(CTX_data_equals(member, "soft_body")) {
PointerRNA *ptr= get_pointer_type(path, &RNA_Object); PointerRNA *ptr= get_pointer_type(path, &RNA_Object);

@ -175,31 +175,11 @@ static void script_main_area_draw(const bContext *C, ARegion *ar)
/* add handlers, stuff you only do once or on area/region changes */ /* add handlers, stuff you only do once or on area/region changes */
static void script_header_area_init(wmWindowManager *wm, ARegion *ar) static void script_header_area_init(wmWindowManager *wm, ARegion *ar)
{ {
/* UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); */
ED_region_header_init(ar); ED_region_header_init(ar);
} }
static void script_header_area_draw(const bContext *C, ARegion *ar) static void script_header_area_draw(const bContext *C, ARegion *ar)
{ {
/* float col[3]; */
/* /\* clear *\/ */
/* if(ED_screen_area_active(C)) */
/* UI_GetThemeColor3fv(TH_HEADER, col); */
/* else */
/* UI_GetThemeColor3fv(TH_HEADERDESEL, col); */
/* glClearColor(col[0], col[1], col[2], 0.0); */
/* glClear(GL_COLOR_BUFFER_BIT); */
/* /\* set view2d view matrix for scrolling (without scrollers) *\/ */
/* UI_view2d_view_ortho(C, &ar->v2d); */
/* script_header_buttons(C, ar); */
/* /\* restore view matrix? *\/ */
/* UI_view2d_view_restore(C); */
ED_region_header(C, ar); ED_region_header(C, ar);
} }

@ -37,6 +37,7 @@ extern "C" {
struct bContext; struct bContext;
struct ID; struct ID;
struct Main; struct Main;
struct ReportList;
/* Types */ /* 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(ParameterList *parms, PropertyRNA *parm, void *value);
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, 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(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms);
int RNA_function_call_lookup(PointerRNA *ptr, const char *identifier, 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(struct bContext *C, struct ReportList *reports, 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_lookup(struct bContext *C, struct ReportList *reports, 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(struct bContext *C, struct ReportList *reports, 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_va_lookup(struct bContext *C, struct ReportList *reports, PointerRNA *ptr, const char *identifier, const char *format, va_list args);
/* ID */ /* ID */

@ -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_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_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_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, const char *add); 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 */ /* Function */

@ -161,11 +161,13 @@ typedef struct ParameterIterator {
/* Function */ /* Function */
typedef enum FunctionFlag { 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 */ /* registering */
FUNC_REGISTER = 2, FUNC_REGISTER = 8,
FUNC_REGISTER_OPTIONAL = 2|4, FUNC_REGISTER_OPTIONAL = 8|16,
/* internal flags */ /* internal flags */
FUNC_BUILTIN = 128, FUNC_BUILTIN = 128,
@ -173,7 +175,7 @@ typedef enum FunctionFlag {
FUNC_RUNTIME = 512 FUNC_RUNTIME = 512
} FunctionFlag; } 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; typedef struct FunctionRNA FunctionRNA;

@ -25,8 +25,9 @@
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
FILE(GLOB DEFSRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") 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) 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}") STRING(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")

@ -28,10 +28,11 @@ DIR = $(OCGDIR)/blender/makesrna
ALLRNA = $(wildcard rna_*.c) ALLRNA = $(wildcard rna_*.c)
DEFRNA = $(filter-out %rna_define.c, $(filter-out %rna_access.c, $(ALLRNA))) 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)) 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))) MAKEOBJS = $(patsubst %.c, $(DIR)/$(DEBUG_DIR)%.o, $(notdir $(MAKESRCS)))
CSRCS = $(GENSRCS) rna_access.c CSRCS = $(GENSRCS) rna_access.c
@ -94,24 +95,6 @@ clean::
# TODO include right .mk for ldflags # 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 # 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 # is done quite intentionally. If there is a bug in that lib, it needs
# to be fixed by the module maintainer. # to be fixed by the module maintainer.

@ -13,17 +13,15 @@ root_build_dir=normpath(env['BF_BUILDDIR'])
source_files = env.Glob('*.c') source_files = env.Glob('*.c')
source_files.remove('rna_access.c') source_files.remove('rna_access.c')
api_runtime_files = env.Glob('*_api.c')
for api_file in api_runtime_files:
source_files.remove(api_file)
generated_files = source_files[:] generated_files = source_files[:]
generated_files.remove('rna_define.c') generated_files.remove('rna_define.c')
generated_files.remove('makesrna.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')
source_files.extend(env.Glob('rna_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() makesrna_tool = env.Clone()
rna = env.Clone() rna = env.Clone()
@ -119,9 +117,8 @@ else:
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir) rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
api_runtime_files.remove('rna_api.c')
obj = ['intern/rna_access.c'] obj = ['intern/rna_access.c']
for generated_file in generated_files + api_runtime_files: for generated_file in generated_files:
obj += ['intern/' + generated_file] obj += ['intern/' + generated_file]
Return ('obj') Return ('obj')

@ -1,26 +0,0 @@
#include <stdlib.h>
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_library.h"
#include "BLI_listbase.h"
#include "DNA_mesh_types.h"
Mesh *RNA_api_main_add_mesh(Main *main, char *name)
{
return add_mesh(name);
}
void RNA_api_main_remove_mesh(Main *main, Mesh *me)
{
if (BLI_findindex(&main->mesh, me) == -1) {
/* XXX report error */
return;
}
/* XXX correct ? */
if (me->id.us == 1)
free_libblock(&main->mesh, me);
}

@ -394,7 +394,7 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
else if(rna_color_quantize(prop, dp)) 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); fprintf(f, " values[%d]= (%s)(data->%s[%d]*(1.0f/255.0f));\n", i, rna_type_type(prop), dp->dnaname, i);
else 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); fprintf(f, " data->%s[%d]= FTOCHAR(values[%d]);\n", dp->dnaname, i, i);
} }
else { 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); rna_clamp_value(f, prop, 1, i);
} }
} }
@ -1104,6 +1104,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
FunctionRNA *func; FunctionRNA *func;
PropertyDefRNA *dparm; PropertyDefRNA *dparm;
char *funcname, *ptrstr; char *funcname, *ptrstr;
int first;
srna= dsrna->srna; srna= dsrna->srna;
func= dfunc->func; 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"); 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"); 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); if(dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
else fprintf(f, "\tstruct %s *_self;\n", srna->identifier); 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, ";\n");
fprintf(f, "\t\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); 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); 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); if(func->ret) fprintf(f, "%s= ", func->ret->identifier);
fprintf(f, "%s(", dfunc->call); fprintf(f, "%s(", dfunc->call);
if((func->flag & FUNC_TYPESTATIC)==0) first= 1;
if((func->flag & FUNC_NO_SELF)==0) {
fprintf(f, "_self"); 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; dparm= dfunc->cont.properties.first;
for(; dparm; dparm= dparm->next) { for(; dparm; dparm= dparm->next) {
if(dparm->prop==func->ret) if(dparm->prop==func->ret)
continue; continue;
if((func->flag & FUNC_TYPESTATIC)==0 || dparm!=dfunc->cont.properties.first) if(!first) fprintf(f, ", ");
fprintf(f, ", "); first= 0;
fprintf(f, "%s", dparm->prop->identifier); fprintf(f, "%s", dparm->prop->identifier);
} }
@ -1356,7 +1374,7 @@ static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna,
base= srna->base; base= srna->base;
while (base) { while (base) {
for(func= base->functions.first; func; func= func->cont.next) { 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); 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) { 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); rna_generate_parameter_prototypes(brna, srna, func, f);
} }
@ -1380,6 +1398,7 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
FunctionRNA *func; FunctionRNA *func;
PropertyDefRNA *dparm; PropertyDefRNA *dparm;
StructDefRNA *dsrna; StructDefRNA *dsrna;
int first;
dsrna= rna_find_struct_def(srna); dsrna= rna_find_struct_def(srna);
func= dfunc->func; func= dfunc->func;
@ -1402,17 +1421,39 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
fprintf(f, "%s(", dfunc->call); fprintf(f, "%s(", dfunc->call);
first= 1;
if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname); if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
else fprintf(f, "struct %s *_self", srna->identifier); 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) { for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
if(dparm->prop==func->ret) ; if(dparm->prop==func->ret)
else if(dparm->prop->arraylength) continue;
fprintf(f, ", %s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->arraylength);
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) 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 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"); fprintf(f, ");\n");
@ -1628,7 +1669,11 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
} }
case PROP_COLLECTION: { case PROP_COLLECTION: {
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
fprintf(f, "\t%s, %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), rna_function_string(cprop->add)); 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); if(cprop->type) fprintf(f, "&RNA_%s\n", (char*)cprop->type);
else fprintf(f, "NULL\n"); else fprintf(f, "NULL\n");
break; break;
@ -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) for(parm= func->cont.properties.first; parm; parm= parm->next)
rna_generate_property(f, srna, func->identifier, parm); 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, "); 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"); else fprintf(f, "NULL,\n");
parm= func->cont.properties.first; parm= func->cont.properties.first;
@ -1749,11 +1794,11 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
} }
func= srna->functions.first; 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, "); else fprintf(f, "\t{NULL, ");
func= srna->functions.last; 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"); else fprintf(f, "NULL}\n");
fprintf(f, "};\n"); fprintf(f, "};\n");
@ -1763,63 +1808,64 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
typedef struct RNAProcessItem { typedef struct RNAProcessItem {
char *filename; char *filename;
char *api_filename;
void (*define)(BlenderRNA *brna); void (*define)(BlenderRNA *brna);
} RNAProcessItem; } RNAProcessItem;
RNAProcessItem PROCESS_ITEMS[]= { RNAProcessItem PROCESS_ITEMS[]= {
{"rna_rna.c", RNA_def_rna}, {"rna_rna.c", NULL, RNA_def_rna},
{"rna_ID.c", RNA_def_ID}, {"rna_ID.c", NULL, RNA_def_ID},
{"rna_texture.c", RNA_def_texture}, {"rna_texture.c", NULL, RNA_def_texture},
{"rna_action.c", RNA_def_action}, {"rna_action.c", NULL, RNA_def_action},
{"rna_animation.c", RNA_def_animation}, {"rna_animation.c", NULL, RNA_def_animation},
{"rna_actuator.c", RNA_def_actuator}, {"rna_actuator.c", NULL, RNA_def_actuator},
{"rna_armature.c", RNA_def_armature}, {"rna_armature.c", NULL, RNA_def_armature},
{"rna_brush.c", RNA_def_brush}, {"rna_brush.c", NULL, RNA_def_brush},
{"rna_camera.c", RNA_def_camera}, {"rna_camera.c", NULL, RNA_def_camera},
{"rna_cloth.c", RNA_def_cloth}, {"rna_cloth.c", NULL, RNA_def_cloth},
{"rna_color.c", RNA_def_color}, {"rna_color.c", NULL, RNA_def_color},
{"rna_constraint.c", RNA_def_constraint}, {"rna_constraint.c", NULL, RNA_def_constraint},
{"rna_context.c", RNA_def_context}, {"rna_context.c", NULL, RNA_def_context},
{"rna_controller.c", RNA_def_controller}, {"rna_controller.c", NULL, RNA_def_controller},
{"rna_curve.c", RNA_def_curve}, {"rna_curve.c", NULL, RNA_def_curve},
{"rna_fcurve.c", RNA_def_fcurve}, {"rna_fcurve.c", NULL, RNA_def_fcurve},
{"rna_fluidsim.c", RNA_def_fluidsim}, {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
{"rna_group.c", RNA_def_group}, {"rna_group.c", NULL, RNA_def_group},
{"rna_image.c", RNA_def_image}, {"rna_image.c", NULL, RNA_def_image},
{"rna_key.c", RNA_def_key}, {"rna_key.c", NULL, RNA_def_key},
{"rna_lamp.c", RNA_def_lamp}, {"rna_lamp.c", NULL, RNA_def_lamp},
{"rna_lattice.c", RNA_def_lattice}, {"rna_lattice.c", NULL, RNA_def_lattice},
{"rna_main.c", RNA_def_main}, {"rna_main.c", "rna_main_api.c", RNA_def_main},
{"rna_material.c", RNA_def_material}, {"rna_material.c", NULL, RNA_def_material},
{"rna_mesh.c", RNA_def_mesh}, {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
{"rna_meta.c", RNA_def_meta}, {"rna_meta.c", NULL, RNA_def_meta},
{"rna_modifier.c", RNA_def_modifier}, {"rna_modifier.c", NULL, RNA_def_modifier},
{"rna_nodetree.c", RNA_def_nodetree}, {"rna_nodetree.c", NULL, RNA_def_nodetree},
{"rna_object.c", RNA_def_object}, {"rna_object.c", "rna_object_api.c", RNA_def_object},
{"rna_object_force.c", RNA_def_object_force}, {"rna_object_force.c", NULL, RNA_def_object_force},
{"rna_packedfile.c", RNA_def_packedfile}, {"rna_packedfile.c", NULL, RNA_def_packedfile},
{"rna_particle.c", RNA_def_particle}, {"rna_particle.c", NULL, RNA_def_particle},
{"rna_pose.c", RNA_def_pose}, {"rna_pose.c", NULL, RNA_def_pose},
{"rna_property.c", RNA_def_gameproperty}, {"rna_property.c", NULL, RNA_def_gameproperty},
{"rna_radio.c", RNA_def_radio}, {"rna_radio.c", NULL, RNA_def_radio},
{"rna_scene.c", RNA_def_scene}, {"rna_scene.c", NULL, RNA_def_scene},
{"rna_screen.c", RNA_def_screen}, {"rna_screen.c", NULL, RNA_def_screen},
{"rna_scriptlink.c", RNA_def_scriptlink}, {"rna_scriptlink.c", NULL, RNA_def_scriptlink},
{"rna_sensor.c", RNA_def_sensor}, {"rna_sensor.c", NULL, RNA_def_sensor},
{"rna_sequence.c", RNA_def_sequence}, {"rna_sequence.c", NULL, RNA_def_sequence},
{"rna_space.c", RNA_def_space}, {"rna_space.c", NULL, RNA_def_space},
{"rna_text.c", RNA_def_text}, {"rna_text.c", NULL, RNA_def_text},
{"rna_timeline.c", RNA_def_timeline_marker}, {"rna_timeline.c", NULL, RNA_def_timeline_marker},
{"rna_sound.c", RNA_def_sound}, {"rna_sound.c", NULL, RNA_def_sound},
{"rna_ui.c", RNA_def_ui}, {"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
{"rna_userdef.c", RNA_def_userdef}, {"rna_userdef.c", NULL, RNA_def_userdef},
{"rna_vfont.c", RNA_def_vfont}, {"rna_vfont.c", NULL, RNA_def_vfont},
{"rna_vpaint.c", RNA_def_vpaint}, {"rna_vpaint.c", NULL, RNA_def_vpaint},
{"rna_wm.c", RNA_def_wm}, {"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
{"rna_world.c", RNA_def_world}, {"rna_world.c", NULL, RNA_def_world},
{NULL, NULL}}; {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; StructDefRNA *ds;
PropertyDefRNA *dp; 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 \"BLI_blenlib.h\"\n\n");
fprintf(f, "#include \"BKE_context.h\"\n");
fprintf(f, "#include \"BKE_library.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 \"BKE_utildefines.h\"\n\n");
fprintf(f, "#include \"RNA_define.h\"\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); 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"); fprintf(f, "/* Autogenerated Functions */\n\n");
@ -2169,7 +2220,7 @@ static int rna_preprocess(char *outfile)
status = 1; status = 1;
} }
else { else {
rna_generate(brna, file, PROCESS_ITEMS[i].filename); rna_generate(brna, file, PROCESS_ITEMS[i].filename, PROCESS_ITEMS[i].api_filename);
fclose(file); fclose(file);
status= (DefRNA.error != 0); status= (DefRNA.error != 0);

@ -1,42 +0,0 @@
#include <stdlib.h>
#include "DNA_mesh_types.h"
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
#include "BLI_blenlib.h"
#include "BKE_DerivedMesh.h"
#include "BKE_mesh.h"
/*
void RNA_api_mesh_copy(Mesh *me, Mesh *from)
{
copy_mesh_data(me, from);
}
void RNA_api_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);
}
*/
/* copied from init_render_mesh (render code) */
void RNA_api_mesh_make_rendermesh(Mesh *me, Scene *sce, Object *ob)
{
CustomDataMask mask = CD_MASK_BAREMESH|CD_MASK_MTFACE|CD_MASK_MCOL;
DerivedMesh *dm= mesh_create_derived_render(sce, ob, mask);
/* XXX report reason */
if(dm==NULL) return;
DM_to_mesh(dm, me);
dm->release(dm);
}
void RNA_api_mesh_transform(Mesh *me, float **mat)
{
}

@ -246,12 +246,6 @@ static void rna_def_ID(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "lib"); RNA_def_property_pointer_sdna(prop, NULL, "lib");
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Library", "Library file the datablock is linked from."); 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) static void rna_def_library(BlenderRNA *brna)

@ -33,7 +33,9 @@
#include "BLI_blenlib.h" #include "BLI_blenlib.h"
#include "BLI_dynstr.h" #include "BLI_dynstr.h"
#include "BKE_context.h"
#include "BKE_idprop.h" #include "BKE_idprop.h"
#include "BKE_report.h"
#include "BKE_utildefines.h" #include "BKE_utildefines.h"
#include "WM_api.h" #include "WM_api.h"
@ -725,7 +727,7 @@ int RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
return 0; 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); prop= rna_ensure_property(prop);
@ -1321,7 +1323,7 @@ int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr) void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{ {
IDProperty *idprop; IDProperty *idprop;
CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop; //CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
if((idprop=rna_idproperty_check(&prop, ptr))) { if((idprop=rna_idproperty_check(&prop, ptr))) {
IDPropertyTemplate val = {0}; IDPropertyTemplate val = {0};
@ -1347,9 +1349,15 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
MEM_freeN(item); MEM_freeN(item);
} }
} }
#if 0
else if(cprop->add){ else if(cprop->add){
cprop->add(ptr, r_ptr); 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 else
printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier); printf("RNA_property_collection_add %s.%s: not implemented for this property.\n", ptr->type->identifier, prop->identifier);
@ -1369,6 +1377,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA
void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key) void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
{ {
IDProperty *idprop; IDProperty *idprop;
//CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
if((idprop=rna_idproperty_check(&prop, ptr))) { if((idprop=rna_idproperty_check(&prop, ptr))) {
IDProperty tmp, *array; IDProperty tmp, *array;
@ -1389,6 +1398,15 @@ void RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
} }
} }
else if(prop->flag & PROP_IDPROPERTY); 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 else
printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier); printf("RNA_property_collection_remove %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);
} }
@ -1521,13 +1539,6 @@ void rna_iterator_listbase_end(CollectionPropertyIterator *iter)
iter->internal= NULL; iter->internal= NULL;
} }
void *rna_iterator_listbase_add(ListBase *lb, void *item)
{
BLI_addtail(lb, item);
return item;
}
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, IteratorSkipFunc skip) void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, IteratorSkipFunc skip)
{ {
ArrayIterator *internal; ArrayIterator *internal;
@ -1585,21 +1596,6 @@ void rna_iterator_array_end(CollectionPropertyIterator *iter)
iter->internal= NULL; iter->internal= NULL;
} }
void *rna_iterator_array_add(void *ptr, int itemsize, int length, void *item)
{
// alloc new block, copy old data
void *newptr= MEM_callocN(length * itemsize + itemsize, "RNA collection add");
memcpy(newptr, ptr, length * itemsize);
// copy new item
memcpy(((char*)newptr) + length * itemsize, item, itemsize);
// free old block
MEM_freeN(ptr);
return newptr;
}
/* RNA Path - Experiment */ /* RNA Path - Experiment */
static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket) static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket)
@ -2550,10 +2546,10 @@ void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, void
RNA_parameter_set(parms, parm, value); 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) { if(func->call) {
func->call(ptr, parms); func->call(C, reports, ptr, parms);
return 0; return 0;
} }
@ -2561,33 +2557,33 @@ int RNA_function_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
return -1; 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; FunctionRNA *func;
func= RNA_struct_find_function(ptr, identifier); func= RNA_struct_find_function(ptr, identifier);
if(func) if(func)
return RNA_function_call(ptr, func, parms); return RNA_function_call(C, reports, ptr, func, parms);
return -1; 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; va_list args;
int ret; int ret;
va_start(args, format); 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); va_end(args);
return ret; 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; FunctionRNA *func;
@ -2599,7 +2595,7 @@ int RNA_function_call_direct_lookup(PointerRNA *ptr, const char *identifier, con
va_start(args, format); 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); va_end(args);
@ -2741,7 +2737,7 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop
return 0; 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; PointerRNA funcptr;
ParameterList *parms; ParameterList *parms;
@ -2836,7 +2832,7 @@ int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *
} }
if (err==0) 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? */ /* XXX throw error when more parameters than those needed are passed or leave silent? */
if (err==0 && pret && ofs<flen && format[ofs++]=='R') { if (err==0 && pret && ofs<flen && format[ofs++]=='R') {
@ -2896,14 +2892,14 @@ int RNA_function_call_direct_va(PointerRNA *ptr, FunctionRNA *func, const char *
return err; 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; FunctionRNA *func;
func= RNA_struct_find_function(ptr, identifier); func= RNA_struct_find_function(ptr, identifier);
if(func) 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; return 0;
} }

@ -1,68 +0,0 @@
#include <stdlib.h>
#include <stdio.h>
#include "RNA_define.h"
#include "RNA_types.h"
#include "UI_interface.h"
void RNA_api_main(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *prop;
func= RNA_def_function(srna, "add_mesh", "RNA_api_main_add_mesh");
RNA_def_function_ui_description(func, "Add a new mesh.");
prop= RNA_def_string(func, "name", "", 0, "", "New name for the datablock.");
RNA_def_property_flag(prop, PROP_REQUIRED);
prop= RNA_def_pointer(func, "mesh", "Mesh", "", "A new mesh.");
RNA_def_function_return(func, prop);
func= RNA_def_function(srna, "remove_mesh", "RNA_api_main_remove_mesh");
RNA_def_function_ui_description(func, "Remove a mesh if it has only one user.");
prop= RNA_def_pointer(func, "mesh", "Mesh", "", "A mesh to remove.");
RNA_def_property_flag(prop, PROP_REQUIRED);
}
void RNA_api_mesh(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *prop;
/*
func= RNA_def_function(srna, "copy", "RNA_api_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, "make_rendermesh", "RNA_api_mesh_make_rendermesh");
RNA_def_function_ui_description(func, "Copy mesh data from object with all modifiers applied.");
prop= RNA_def_pointer(func, "sce", "Scene", "", "Scene.");
RNA_def_property_flag(prop, PROP_REQUIRED);
prop= RNA_def_pointer(func, "ob", "Object", "", "Object to copy data from.");
RNA_def_property_flag(prop, PROP_REQUIRED);
/*
func= RNA_def_function(srna, "add_geom", "RNA_api_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);
*/
}
void RNA_api_wm(StructRNA *srna)
{
FunctionRNA *func;
PropertyRNA *prop;
func= RNA_def_function(srna, "add_fileselect", "RNA_api_wm_add_fileselect");
RNA_def_function_ui_description(func, "Show up the file selector.");
prop= RNA_def_pointer(func, "context", "Context", "", "Context.");
RNA_def_property_flag(prop, PROP_REQUIRED);
prop= RNA_def_pointer(func, "op", "Operator", "", "Operator to call.");
RNA_def_property_flag(prop, PROP_REQUIRED);
}

@ -31,6 +31,8 @@
#include "rna_internal.h" #include "rna_internal.h"
#include "BKE_cloth.h" #include "BKE_cloth.h"
#include "BKE_modifier.h"
#include "DNA_cloth_types.h" #include "DNA_cloth_types.h"
#ifdef RNA_RUNTIME #ifdef RNA_RUNTIME
@ -129,6 +131,22 @@ static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
sim->gravity[2]= values[2]; sim->gravity[2]= values[2];
} }
static char *rna_ClothSettings_path(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
return BLI_sprintfN("modifiers[%s].settings", md->name);
}
static char *rna_ClothCollisionSettings_path(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth);
return BLI_sprintfN("modifiers[%s].collision_settings", md->name);
}
#else #else
static void rna_def_cloth_sim_settings(BlenderRNA *brna) static void rna_def_cloth_sim_settings(BlenderRNA *brna)
@ -139,6 +157,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ClothSettings", NULL); srna = RNA_def_struct(brna, "ClothSettings", NULL);
RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object."); RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object.");
RNA_def_struct_sdna(srna, "ClothSimSettings"); RNA_def_struct_sdna(srna, "ClothSimSettings");
RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
/* goal */ /* goal */
@ -297,6 +316,7 @@ static void rna_def_cloth_collision_settings(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL); srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL);
RNA_def_struct_ui_text(srna, "Cloth Collision Settings", "Cloth simulation settings for self collision and collision with other objects."); RNA_def_struct_ui_text(srna, "Cloth Collision Settings", "Cloth simulation settings for self collision and collision with other objects.");
RNA_def_struct_sdna(srna, "ClothCollSettings"); RNA_def_struct_sdna(srna, "ClothCollSettings");
RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
/* general collision */ /* general collision */

@ -212,7 +212,7 @@ static void rna_def_curvemapping(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range"); RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE); 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, 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_struct_type(prop, "CurveMap");
RNA_def_property_ui_text(prop, "Curves", ""); RNA_def_property_ui_text(prop, "Curves", "");

@ -102,7 +102,6 @@ void RNA_def_context(BlenderRNA *brna)
{ {
StructRNA *srna; StructRNA *srna;
PropertyRNA *prop; PropertyRNA *prop;
FunctionRNA *func;
srna= RNA_def_struct(brna, "Context", NULL); srna= RNA_def_struct(brna, "Context", NULL);
RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context."); RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context.");

@ -605,7 +605,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna)
prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "bp", NULL); RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
RNA_def_property_struct_type(prop, "CurvePoint"); 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, 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."); 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); prop= RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);

@ -604,7 +604,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
if(DefRNA.preprocess) { if(DefRNA.preprocess) {
RNA_def_property_struct_type(prop, "Property"); 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, 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 { else {
#ifdef RNA_RUNTIME #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, const char *add) 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; StructRNA *srna= DefRNA.laststruct;
@ -1796,7 +1796,8 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
if(length) cprop->length= (PropCollectionLengthFunc)length; if(length) cprop->length= (PropCollectionLengthFunc)length;
if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint; if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint;
if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring; if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring;
if(add) cprop->add= (PropCollectionAddFunc)add; if(add) cprop->add= (FunctionRNA*)add;
if(remove) cprop->remove= (FunctionRNA*)remove;
break; break;
} }
default: default:

@ -61,7 +61,7 @@ void RNA_def_group(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL); RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL);
RNA_def_property_struct_type(prop, "Object"); RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects."); 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, 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); prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);

@ -188,29 +188,11 @@ void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, ch
/* API functions */ /* API functions */
void RNA_api_ui_layout(struct StructRNA *srna); void RNA_api_main(struct StructRNA *srna);
void RNA_api_mesh(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); void RNA_api_wm(struct StructRNA *srna);
void RNA_api_main(StructRNA *srna);
#ifdef RNA_RUNTIME
struct wmWindowManager;
struct bContext;
struct wmOperator;
struct Main;
struct Mesh;
struct Scene;
struct Object;
void RNA_api_wm_add_fileselect(struct wmWindowManager *self, struct bContext *C, struct wmOperator *op);
struct Mesh *RNA_api_main_add_mesh(struct Main *main, char *name);
void RNA_api_main_remove_mesh(struct Main *main, struct Mesh *me);
void RNA_api_mesh_make_rendermesh(struct Mesh *me, struct Scene *sce, struct Object *ob);
#endif
/* ID Properties */ /* ID Properties */
@ -251,9 +233,6 @@ void rna_iterator_listbase_next(struct CollectionPropertyIterator *iter);
void *rna_iterator_listbase_get(struct CollectionPropertyIterator *iter); void *rna_iterator_listbase_get(struct CollectionPropertyIterator *iter);
void rna_iterator_listbase_end(struct CollectionPropertyIterator *iter); void rna_iterator_listbase_end(struct CollectionPropertyIterator *iter);
/* experimental */
void *rna_iterator_listbase_add(ListBase *lb, void *item);
typedef struct ArrayIterator { typedef struct ArrayIterator {
char *ptr; char *ptr;
char *endptr; char *endptr;
@ -267,9 +246,6 @@ void *rna_iterator_array_get(struct CollectionPropertyIterator *iter);
void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter); void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter);
void rna_iterator_array_end(struct CollectionPropertyIterator *iter); void rna_iterator_array_end(struct CollectionPropertyIterator *iter);
/* experimental */
void *rna_iterator_array_add(void *ptr, int itemsize, int length, void *item);
/* Duplicated code since we can't link in blenlib */ /* Duplicated code since we can't link in blenlib */
void rna_addtail(struct ListBase *listbase, void *vlink); void rna_addtail(struct ListBase *listbase, void *vlink);

@ -78,7 +78,6 @@ typedef PointerRNA (*PropCollectionGetFunc)(struct CollectionPropertyIterator *i
typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr); typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr);
typedef PointerRNA (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key); typedef PointerRNA (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key);
typedef PointerRNA (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key); typedef PointerRNA (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key);
typedef void (*PropCollectionAddFunc)(PointerRNA *ptr, PointerRNA *ptr_item);
/* Container - generic abstracted container of RNA properties */ /* Container - generic abstracted container of RNA properties */
typedef struct ContainerRNA { typedef struct ContainerRNA {
@ -246,7 +245,7 @@ typedef struct CollectionPropertyRNA {
PropCollectionLengthFunc length; /* optional */ PropCollectionLengthFunc length; /* optional */
PropCollectionLookupIntFunc lookupint; /* optional */ PropCollectionLookupIntFunc lookupint; /* optional */
PropCollectionLookupStringFunc lookupstring; /* optional */ PropCollectionLookupStringFunc lookupstring; /* optional */
PropCollectionAddFunc add; FunctionRNA *add, *remove;
struct StructRNA *type; struct StructRNA *type;
} CollectionPropertyRNA; } CollectionPropertyRNA;

@ -335,7 +335,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "data", "totelem"); RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
RNA_def_property_struct_type(prop, "UnknownType"); RNA_def_property_struct_type(prop, "UnknownType");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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) static void rna_def_key(BlenderRNA *brna)

@ -99,7 +99,7 @@ static void rna_def_latticepoint(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Deformed Location", ""); RNA_def_property_ui_text(prop, "Deformed Location", "");
prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE); 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, 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_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of."); 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); prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "LatticePoint"); 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, 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."); RNA_def_property_ui_text(prop, "Points", "Points of the lattice.");
} }

@ -219,7 +219,6 @@ void RNA_def_main(BlenderRNA *brna)
{ {
StructRNA *srna; StructRNA *srna;
PropertyRNA *prop; PropertyRNA *prop;
FunctionRNA *func;
const char *lists[][5]= { const char *lists[][5]= {
{"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks."}, {"cameras", "Camera", "rna_Main_camera_begin", "Cameras", "Camera datablocks."},
@ -265,7 +264,7 @@ void RNA_def_main(BlenderRNA *brna)
{ {
prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, lists[i][1]); 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, 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_def_property_ui_text(prop, lists[i][3], lists[i][4]);
} }

@ -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

@ -1143,7 +1143,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
/* mtex */ /* mtex */
prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, structname); 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, 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."); 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); prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);

@ -484,33 +484,6 @@ static void rna_TextureFace_image_set(PointerRNA *ptr, PointerRNA value)
tf->tpage= (struct Image*)id; tf->tpage= (struct Image*)id;
} }
static void rna_Mesh_verts_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Mesh *me= (Mesh*)ptr->data;
rna_iterator_array_begin(iter, me->mvert, sizeof(MVert), me->totvert, NULL);
}
/* 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);
*/
}
/* path construction */ /* path construction */
static char *rna_VertexGroupElement_path(PointerRNA *ptr) static char *rna_VertexGroupElement_path(PointerRNA *ptr)
@ -673,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"); 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); 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, 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_struct_type(prop, "VertexGroupElement");
RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of."); RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of.");
} }
@ -788,7 +761,7 @@ static void rna_def_mtface(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshTextureFace"); RNA_def_property_struct_type(prop, "MeshTextureFace");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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); srna= RNA_def_struct(brna, "MeshTextureFace", NULL);
RNA_def_struct_sdna(srna, "MTFace"); RNA_def_struct_sdna(srna, "MTFace");
@ -925,7 +898,7 @@ static void rna_def_mcol(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshColor"); RNA_def_property_struct_type(prop, "MeshColor");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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); srna= RNA_def_struct(brna, "MeshColor", NULL);
RNA_def_struct_sdna(srna, "MCol"); RNA_def_struct_sdna(srna, "MCol");
@ -971,7 +944,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshFloatProperty"); RNA_def_property_struct_type(prop, "MeshFloatProperty");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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); srna= RNA_def_struct(brna, "MeshFloatProperty", NULL);
RNA_def_struct_sdna(srna, "MFloatProperty"); RNA_def_struct_sdna(srna, "MFloatProperty");
@ -995,7 +968,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshIntProperty"); RNA_def_property_struct_type(prop, "MeshIntProperty");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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); srna= RNA_def_struct(brna, "MeshIntProperty", NULL);
RNA_def_struct_sdna(srna, "MIntProperty"); RNA_def_struct_sdna(srna, "MIntProperty");
@ -1019,7 +992,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "MeshStringProperty"); RNA_def_property_struct_type(prop, "MeshStringProperty");
RNA_def_property_ui_text(prop, "Data", ""); 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, 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); srna= RNA_def_struct(brna, "MeshStringProperty", NULL);
RNA_def_struct_sdna(srna, "MStringProperty"); RNA_def_struct_sdna(srna, "MStringProperty");
@ -1076,7 +1049,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert"); RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
RNA_def_property_struct_type(prop, "MeshVertex"); RNA_def_property_struct_type(prop, "MeshVertex");
RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh."); RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh.");
RNA_def_property_collection_funcs(prop, "rna_Mesh_verts_begin", 0, 0, 0, 0, 0, 0, "rna_Mesh_verts_add"); // 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); prop= RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge"); RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
@ -1095,31 +1068,31 @@ static void rna_def_mesh(BlenderRNA *brna)
prop= RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE); 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_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, 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_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_ui_text(prop, "UV Layers", ""); RNA_def_property_ui_text(prop, "UV Layers", "");
prop= RNA_def_property(srna, "vcol_layers", PROP_COLLECTION, PROP_NONE); 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_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, 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_struct_type(prop, "MeshColorLayer");
RNA_def_property_ui_text(prop, "Vertex Color Layers", ""); RNA_def_property_ui_text(prop, "Vertex Color Layers", "");
prop= RNA_def_property(srna, "float_layers", PROP_COLLECTION, PROP_NONE); 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_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, 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_struct_type(prop, "MeshFloatPropertyLayer");
RNA_def_property_ui_text(prop, "Float Property Layers", ""); RNA_def_property_ui_text(prop, "Float Property Layers", "");
prop= RNA_def_property(srna, "int_layers", PROP_COLLECTION, PROP_NONE); 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_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, 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_struct_type(prop, "MeshIntPropertyLayer");
RNA_def_property_ui_text(prop, "Int Property Layers", ""); RNA_def_property_ui_text(prop, "Int Property Layers", "");
prop= RNA_def_property(srna, "string_layers", PROP_COLLECTION, PROP_NONE); 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_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, 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_struct_type(prop, "MeshStringPropertyLayer");
RNA_def_property_ui_text(prop, "String Property Layers", ""); RNA_def_property_ui_text(prop, "String Property Layers", "");

@ -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

@ -1089,7 +1089,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "Object"); 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, 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", ""); RNA_def_property_ui_text(prop, "Projectors", "");
prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);

@ -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."); 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; StructRNA *srna;
PropertyRNA *prop; PropertyRNA *prop;
@ -739,7 +739,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol"); RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "MaterialSlot"); RNA_def_property_struct_type(prop, "MaterialSlot");
RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 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."); RNA_def_property_ui_text(prop, "Materials", "Material slots in the object.");
prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE); prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
@ -799,11 +799,11 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_array(prop, 3); RNA_def_property_array(prop, 3);
RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface."); RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface.");
/* /* matrix */
// error on compile prop= RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
prop= RNA_def_float_matrix(srna, "mat", 16, NULL, 0.0f, 0.0f, "Matrix", "Transform matrix of the object.", 0.0f, 0.0f);
RNA_def_property_float_sdna(prop, NULL, "obmat"); RNA_def_property_float_sdna(prop, NULL, "obmat");
*/ RNA_def_property_array(prop, 16);
RNA_def_property_ui_text(prop, "Matrix", "Transformation matrix.");
/* collections */ /* collections */
prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
@ -1110,7 +1110,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key index."); 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) void RNA_def_object(BlenderRNA *brna)

@ -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

@ -611,13 +611,13 @@ static void rna_def_struct(BlenderRNA *brna)
prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Property"); 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, 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."); RNA_def_property_ui_text(prop, "Properties", "Properties in the struct.");
prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE); prop= RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Function"); 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, 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", ""); 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); prop= RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
/*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/ /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
RNA_def_property_struct_type(prop, "Property"); 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, 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."); RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function.");
prop= RNA_def_property(srna, "registered", PROP_BOOLEAN, PROP_NONE); 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); prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "EnumPropertyItem"); 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, 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."); RNA_def_property_ui_text(prop, "Items", "Possible values for the property.");
srna= RNA_def_struct(brna, "EnumPropertyItem", NULL); 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); prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Struct"); 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, 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", ""); RNA_def_property_ui_text(prop, "Structs", "");
} }

@ -866,7 +866,7 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
RNA_def_property_struct_type(prop, "Object"); RNA_def_property_struct_type(prop, "Object");
RNA_def_property_ui_text(prop, "Objects", ""); RNA_def_property_ui_text(prop, "Objects", "");
RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 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); prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "lay", 1); RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);

@ -521,7 +521,7 @@ void rna_def_editor(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL); RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
RNA_def_property_struct_type(prop, "Sequence"); 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_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, 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); prop= RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); RNA_def_property_pointer_sdna(prop, NULL, "act_seq");

@ -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

@ -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

@ -1,9 +0,0 @@
#include "WM_api.h"
#include "BKE_context.h"
void RNA_api_wm_add_fileselect(wmWindowManager *self, bContext *C, wmOperator *op)
{
WM_event_add_fileselect(C, op);
}

@ -24,10 +24,12 @@
# ***** END GPL LICENSE BLOCK ***** # ***** END GPL LICENSE BLOCK *****
FILE(GLOB SRC intern/*.c) FILE(GLOB SRC intern/*.c)
FILE(GLOB GENSRC generic/*.c)
SET(INC SET(INC
. ../../../intern/guardedalloc ../blenlib ../makesdna ../makesrna . ../../../intern/guardedalloc ../blenlib ../makesdna ../makesrna
../blenkernel ../editors/include ../windowmanager ${PYTHON_INC} ../blenkernel ../editors/include ../windowmanager ${PYTHON_INC}
../../../extern/glew/include
) )
IF(WITH_OPENEXR) IF(WITH_OPENEXR)
@ -47,3 +49,5 @@ ENDIF(WITH_FFMPEG)
ADD_DEFINITIONS(-DWITH_CCGSUBSURF) ADD_DEFINITIONS(-DWITH_CCGSUBSURF)
BLENDERLIB(bf_python "${SRC}" "${INC}") BLENDERLIB(bf_python "${SRC}" "${INC}")
BLENDERLIB(bf_gen_python "${GENSRC}" "${INC}")

@ -29,6 +29,6 @@
# Bounces make to subdirectories. # Bounces make to subdirectories.
SOURCEDIR = source/blender/python SOURCEDIR = source/blender/python
DIRS = intern DIRS = intern generic
include nan_subdirs.mk include nan_subdirs.mk

@ -5,7 +5,7 @@ sources = env.Glob('intern/*.c')
incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes' incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes'
incs += ' ../imbuf ../blenloader ../render/extern/include ../windowmanager' incs += ' ../imbuf ../blenloader ../render/extern/include ../windowmanager'
incs += ' #intern/guardedalloc #intern/memutil' incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include'
incs += ' ' + env['BF_PYTHON_INC'] incs += ' ' + env['BF_PYTHON_INC']
defs = [] defs = []

@ -41,7 +41,8 @@
#endif #endif
#include <Python.h> #include <Python.h>
#include "BIF_gl.h" #include <GL/glew.h>
#include "../intern/bpy_compat.h"
PyObject *BGL_Init( const char *from ); PyObject *BGL_Init( const char *from );

@ -0,0 +1,66 @@
#
# $Id: Makefile 11904 2007-08-31 16:16:33Z sirdude $
#
# ***** 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) 2001-2002 by NaN Holding BV.
# All rights reserved.
#
# The Original Code is: all of this file.
#
# Contributor(s): none yet.
#
# ***** END GPL LICENSE BLOCK *****
#
#
LIBNAME = gen_python
DIR = $(OCGDIR)/blender/$(LIBNAME)
include nan_compile.mk
CFLAGS += $(LEVEL_1_C_WARNINGS)
# OpenGL and Python
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += $(OGL_CPPFLAGS)
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
# PreProcessor stuff
CPPFLAGS += -I$(NAN_GHOST)/include
CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include $(NAN_SDLCFLAGS)
# modules
CPPFLAGS += -I../../editors/include
CPPFLAGS += -I../../python
CPPFLAGS += -I../../makesdna
CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../nodes
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../windowmanager
CPPFLAGS += -I../../render/extern/include
# path to the guarded memory allocator
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
CPPFLAGS += -I$(NAN_MEMUTIL)/include
# path to our own headerfiles
CPPFLAGS += -I..

@ -32,6 +32,7 @@
#define EXPP_Mathutils_H #define EXPP_Mathutils_H
#include <Python.h> #include <Python.h>
#include "../intern/bpy_compat.h"
#include "vector.h" #include "vector.h"
#include "matrix.h" #include "matrix.h"
#include "quat.h" #include "quat.h"

@ -32,6 +32,7 @@
#define EXPP_bpy_import_h #define EXPP_bpy_import_h
#include <Python.h> #include <Python.h>
#include "../intern/bpy_compat.h"
#include "compile.h" /* for the PyCodeObject */ #include "compile.h" /* for the PyCodeObject */
#include "eval.h" /* for PyEval_EvalCode */ #include "eval.h" /* for PyEval_EvalCode */

@ -32,6 +32,7 @@
#define EXPP_euler_h #define EXPP_euler_h
#include <Python.h> #include <Python.h>
#include "../intern/bpy_compat.h"
extern PyTypeObject euler_Type; extern PyTypeObject euler_Type;

@ -32,6 +32,7 @@
#define EXPP_quat_h #define EXPP_quat_h
#include <Python.h> #include <Python.h>
#include "../intern/bpy_compat.h"
extern PyTypeObject quaternion_Type; extern PyTypeObject quaternion_Type;

@ -31,6 +31,7 @@
#define EXPP_vector_h #define EXPP_vector_h
#include <Python.h> #include <Python.h>
#include "../intern/bpy_compat.h"
extern PyTypeObject vector_Type; extern PyTypeObject vector_Type;

@ -37,6 +37,7 @@ CFLAGS += $(LEVEL_1_C_WARNINGS)
# OpenGL and Python # OpenGL and Python
CPPFLAGS += $(OGL_CPPFLAGS) CPPFLAGS += $(OGL_CPPFLAGS)
CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
# PreProcessor stuff # PreProcessor stuff

@ -88,6 +88,26 @@ typedef Py_ssize_t (*lenfunc)(PyObject *);
#endif #endif
#if PY_VERSION_HEX < 0x03000000
#ifndef ssizeargfunc
#define ssizeargfunc intargfunc
#endif
#ifndef ssizessizeargfunc
#define ssizessizeargfunc intintargfunc
#endif
#ifndef ssizeobjargproc
#define ssizeobjargproc intobjargproc
#endif
#ifndef ssizessizeobjargproc
#define ssizessizeobjargproc intintobjargproc
#endif
#endif
/* defined in bpy_util.c */ /* defined in bpy_util.c */
#if PY_VERSION_HEX < 0x03000000 #if PY_VERSION_HEX < 0x03000000
PyObject *Py_CmpToRich(int op, int cmp); PyObject *Py_CmpToRich(int op, int cmp);

@ -59,6 +59,7 @@ static void bpy_init_modules( void )
PyModule_AddObject( mod, "data", BPY_rna_module() ); PyModule_AddObject( mod, "data", BPY_rna_module() );
/* PyModule_AddObject( mod, "doc", BPY_rna_doc() ); */ /* PyModule_AddObject( mod, "doc", BPY_rna_doc() ); */
PyModule_AddObject( mod, "types", BPY_rna_types() ); PyModule_AddObject( mod, "types", BPY_rna_types() );
PyModule_AddObject( mod, "props", BPY_rna_props() );
PyModule_AddObject( mod, "ops", BPY_operator_module() ); PyModule_AddObject( mod, "ops", BPY_operator_module() );
PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experemental, consider this a test, especially PyCObject is not meant to be perminant PyModule_AddObject( mod, "ui", BPY_ui_module() ); // XXX very experemental, consider this a test, especially PyCObject is not meant to be perminant
@ -103,6 +104,7 @@ static PyObject *CreateGlobalDictionary( bContext *C )
{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, ""},
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
@ -369,24 +371,32 @@ void BPY_run_ui_scripts(bContext *C, int reload)
DIR *dir; DIR *dir;
struct dirent *de; struct dirent *de;
char *file_extension; char *file_extension;
char *dirname;
char path[FILE_MAX]; char path[FILE_MAX];
char *dirname= BLI_gethome_folder("ui"); char *dirs[] = {"io", "ui", NULL};
int filelen; /* filename length */ int a, filelen; /* filename length */
PyGILState_STATE gilstate; PyGILState_STATE gilstate;
PyObject *mod; PyObject *mod;
PyObject *sys_path_orig; PyObject *sys_path_orig;
PyObject *sys_path_new; PyObject *sys_path_new;
gilstate = PyGILState_Ensure();
// XXX - evil, need to access context
BPy_SetContext(C);
bpy_import_main_set(CTX_data_main(C));
for(a=0; dirs[a]; a++) {
dirname= BLI_gethome_folder(dirs[a]);
if(!dirname) if(!dirname)
return; continue;
dir = opendir(dirname); dir = opendir(dirname);
if(!dir) if(!dir)
return; continue;
gilstate = PyGILState_Ensure();
/* backup sys.path */ /* backup sys.path */
sys_path_orig= PySys_GetObject("path"); sys_path_orig= PySys_GetObject("path");
@ -397,10 +407,6 @@ void BPY_run_ui_scripts(bContext *C, int reload)
PySys_SetObject("path", sys_path_new); PySys_SetObject("path", sys_path_new);
Py_DECREF(sys_path_new); Py_DECREF(sys_path_new);
// XXX - evil, need to access context
BPy_SetContext(C);
bpy_import_main_set(CTX_data_main(C));
while((de = readdir(dir)) != NULL) { while((de = readdir(dir)) != NULL) {
/* We could stat the file but easier just to let python /* We could stat the file but easier just to let python
* import it and complain if theres a problem */ * import it and complain if theres a problem */
@ -426,6 +432,7 @@ void BPY_run_ui_scripts(bContext *C, int reload)
BPy_errors_to_report(NULL); // TODO - reports BPy_errors_to_report(NULL); // TODO - reports
fprintf(stderr, "unable to import \"%s\" %s/%s\n", path, dirname, de->d_name); fprintf(stderr, "unable to import \"%s\" %s/%s\n", path, dirname, de->d_name);
} }
} }
} }
@ -433,6 +440,7 @@ void BPY_run_ui_scripts(bContext *C, int reload)
PySys_SetObject("path", sys_path_orig); PySys_SetObject("path", sys_path_orig);
Py_DECREF(sys_path_orig); Py_DECREF(sys_path_orig);
}
bpy_import_main_set(NULL); bpy_import_main_set(NULL);

@ -40,6 +40,8 @@
#include "bpy_compat.h" #include "bpy_compat.h"
#include "bpy_util.h" #include "bpy_util.h"
#include "../generic/bpy_internal_import.h" // our own imports
#define PYOP_ATTR_PROP "__props__" #define PYOP_ATTR_PROP "__props__"
#define PYOP_ATTR_UINAME "__label__" #define PYOP_ATTR_UINAME "__label__"
#define PYOP_ATTR_IDNAME "__name__" /* use pythons class name */ #define PYOP_ATTR_IDNAME "__name__" /* use pythons class name */
@ -182,6 +184,8 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PyGILState_STATE gilstate = PyGILState_Ensure(); PyGILState_STATE gilstate = PyGILState_Ensure();
bpy_import_main_set(CTX_data_main(C));
BPY_update_modules(); // XXX - the RNA pointers can change so update before running, would like a nicer solutuon for this. BPY_update_modules(); // XXX - the RNA pointers can change so update before running, would like a nicer solutuon for this.
args = PyTuple_New(1); args = PyTuple_New(1);
@ -233,7 +237,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
PyTuple_SET_ITEM(args, 2, pyop_dict_from_event(event)); PyTuple_SET_ITEM(args, 2, pyop_dict_from_event(event));
} }
else if (mode==PYOP_EXEC) { else if (mode==PYOP_EXEC) {
item= PyObject_GetAttrString(py_class, "exec"); item= PyObject_GetAttrString(py_class, "execute");
args = PyTuple_New(2); args = PyTuple_New(2);
PyTuple_SET_ITEM(args, 1, pyrna_struct_CreatePyObject(&ptr_context)); PyTuple_SET_ITEM(args, 1, pyrna_struct_CreatePyObject(&ptr_context));
@ -292,7 +296,10 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
while(flag_def->name) { while(flag_def->name) {
if (ret_flag & flag_def->flag) { if (ret_flag & flag_def->flag) {
flag_str[1] ? sprintf(flag_str, "%s | %s", flag_str, flag_def->name) : strcpy(flag_str, flag_def->name); if(flag_str[1])
sprintf(flag_str, "%s | %s", flag_str, flag_def->name);
else
strcpy(flag_str, flag_def->name);
} }
flag_def++; flag_def++;
} }
@ -302,10 +309,11 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
Py_DECREF(item); Py_DECREF(item);
strcpy(class_name, _PyUnicode_AsString(item)); strcpy(class_name, _PyUnicode_AsString(item));
fprintf(stderr, "%s's %s returned %s\n", class_name, mode == PYOP_EXEC ? "exec" : "invoke", flag_str); fprintf(stderr, "%s's %s returned %s\n", class_name, mode == PYOP_EXEC ? "execute" : "invoke", flag_str);
} }
PyGILState_Release(gilstate); PyGILState_Release(gilstate);
bpy_import_main_set(NULL);
return ret_flag; return ret_flag;
} }
@ -355,7 +363,7 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
/* api callbacks, detailed checks dont on adding */ /* api callbacks, detailed checks dont on adding */
if (PyObject_HasAttrString(py_class, "invoke")) if (PyObject_HasAttrString(py_class, "invoke"))
ot->invoke= PYTHON_OT_invoke; ot->invoke= PYTHON_OT_invoke;
if (PyObject_HasAttrString(py_class, "exec")) if (PyObject_HasAttrString(py_class, "execute"))
ot->exec= PYTHON_OT_exec; ot->exec= PYTHON_OT_exec;
if (PyObject_HasAttrString(py_class, "poll")) if (PyObject_HasAttrString(py_class, "poll"))
ot->poll= PYTHON_OT_poll; ot->poll= PYTHON_OT_poll;
@ -408,6 +416,7 @@ void PYTHON_OT_wrapper(wmOperatorType *ot, void *userdata)
PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class) PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
{ {
PyObject *base_class, *item; PyObject *base_class, *item;
wmOperatorType *ot;
char *idname= NULL; char *idname= NULL;
@ -418,7 +427,7 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
{PYOP_ATTR_UINAME, 's', 0, BPY_CLASS_ATTR_OPTIONAL}, {PYOP_ATTR_UINAME, 's', 0, BPY_CLASS_ATTR_OPTIONAL},
{PYOP_ATTR_PROP, 'l', 0, BPY_CLASS_ATTR_OPTIONAL}, {PYOP_ATTR_PROP, 'l', 0, BPY_CLASS_ATTR_OPTIONAL},
{PYOP_ATTR_DESCRIPTION, 's', 0, BPY_CLASS_ATTR_NONE_OK}, {PYOP_ATTR_DESCRIPTION, 's', 0, BPY_CLASS_ATTR_NONE_OK},
{"exec", 'f', 2, BPY_CLASS_ATTR_OPTIONAL}, {"execute", 'f', 2, BPY_CLASS_ATTR_OPTIONAL},
{"invoke", 'f', 3, BPY_CLASS_ATTR_OPTIONAL}, {"invoke", 'f', 3, BPY_CLASS_ATTR_OPTIONAL},
{"poll", 'f', 2, BPY_CLASS_ATTR_OPTIONAL}, {"poll", 'f', 2, BPY_CLASS_ATTR_OPTIONAL},
{NULL, 0, 0, 0} {NULL, 0, 0, 0}
@ -438,9 +447,10 @@ PyObject *PYOP_wrap_add(PyObject *self, PyObject *py_class)
Py_DECREF(item); Py_DECREF(item);
idname = _PyUnicode_AsString(item); idname = _PyUnicode_AsString(item);
if (WM_operatortype_find(idname)) { /* remove if it already exists */
PyErr_Format( PyExc_AttributeError, "Operator alredy exists with this name \"%s\"", idname); if ((ot=WM_operatortype_find(idname))) {
return NULL; Py_XDECREF((PyObject*)ot->pyop_data);
WM_operatortype_remove(idname);
} }
/* If we have properties set, check its a list of dicts */ /* If we have properties set, check its a list of dicts */

@ -38,7 +38,6 @@
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_global.h" /* evil G.* */ #include "BKE_global.h" /* evil G.* */
#include "BKE_report.h" #include "BKE_report.h"
#include "BKE_utildefines.h" /* FILE_MAX */
static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b ) static int pyrna_struct_compare( BPy_StructRNA * a, BPy_StructRNA * b )
{ {
@ -1311,9 +1310,17 @@ static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw)
ret= NULL; ret= NULL;
if (err==0) { if (err==0) {
/* call function */ /* call function */
RNA_function_call(self_ptr, self_func, parms); ReportList reports;
bContext *C= BPy_GetContext();
BKE_reports_init(&reports, RPT_STORE);
RNA_function_call(C, &reports, self_ptr, self_func, parms);
err= (BPy_reports_to_error(&reports))? -1: 0;
BKE_reports_clear(&reports);
/* return value */ /* return value */
if(err==0)
if(pret) if(pret)
ret= pyrna_param_to_py(&funcptr, pret, retdata); ret= pyrna_param_to_py(&funcptr, pret, retdata);
} }
@ -1753,11 +1760,7 @@ PyObject *BPY_rna_types(void)
return (PyObject *)self; return (PyObject *)self;
} }
PyObject *BPY_rna_props( void ) static struct PyMethodDef props_methods[] = {
{
PyObject *dict = PyDict_New( );
PyMethodDef *ml;
static PyMethodDef bpy_prop_meths[] = {
{"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, ""},
{"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""}, {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, ""},
@ -1765,11 +1768,35 @@ PyObject *BPY_rna_props( void )
{NULL, NULL, 0, NULL} {NULL, NULL, 0, NULL}
}; };
for(ml = bpy_prop_meths; ml->ml_name; ml++) { #if PY_VERSION_HEX >= 0x03000000
PyDict_SetItemString( dict, ml->ml_name, PyCFunction_New(ml, NULL)); static struct PyModuleDef props_module = {
} PyModuleDef_HEAD_INIT,
"bpyprops",
"",
-1,/* multiple "initialization" just copies the module dict. */
props_methods,
NULL, NULL, NULL, NULL
};
#endif
return dict; PyObject *BPY_rna_props( void )
{
PyObject *submodule, *mod;
#if PY_VERSION_HEX >= 0x03000000
submodule= PyModule_Create(&props_module);
#else /* Py2.x */
submodule= Py_InitModule3( "bpy.props", props_methods, "" );
#endif
mod = PyModule_New("props");
PyModule_AddObject( submodule, "props", mod );
/* INCREF since its its assumed that all these functions return the
* module with a new ref like PyDict_New, since they are passed to
* PyModule_AddObject which steals a ref */
Py_INCREF(submodule);
return submodule;
} }
/* Orphan functions, not sure where they should go */ /* Orphan functions, not sure where they should go */
@ -1790,7 +1817,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (self) { if (self && PyCObject_Check(self)) {
StructRNA *srna = PyCObject_AsVoidPtr(self); StructRNA *srna = PyCObject_AsVoidPtr(self);
RNA_def_float(srna, id, def, min, max, name, description, soft_min, soft_max); RNA_def_float(srna, id, def, min, max, name, description, soft_min, soft_max);
Py_RETURN_NONE; Py_RETURN_NONE;
@ -1817,7 +1844,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (self) { if (self && PyCObject_Check(self)) {
StructRNA *srna = PyCObject_AsVoidPtr(self); StructRNA *srna = PyCObject_AsVoidPtr(self);
RNA_def_int(srna, id, def, min, max, name, description, soft_min, soft_max); RNA_def_int(srna, id, def, min, max, name, description, soft_min, soft_max);
Py_RETURN_NONE; Py_RETURN_NONE;
@ -1844,7 +1871,7 @@ PyObject *BPy_BoolProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (self) { if (self && PyCObject_Check(self)) {
StructRNA *srna = PyCObject_AsVoidPtr(self); StructRNA *srna = PyCObject_AsVoidPtr(self);
RNA_def_boolean(srna, id, def, name, description); RNA_def_boolean(srna, id, def, name, description);
Py_RETURN_NONE; Py_RETURN_NONE;
@ -1861,7 +1888,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
{ {
static char *kwlist[] = {"attr", "name", "description", "maxlen", "default", NULL}; static char *kwlist[] = {"attr", "name", "description", "maxlen", "default", NULL};
char *id, *name="", *description="", *def=""; char *id, *name="", *description="", *def="";
int maxlen=FILE_MAX; // XXX need greater? int maxlen=0;
if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssis:StringProperty", kwlist, &id, &name, &description, &maxlen, &def)) if (!PyArg_ParseTupleAndKeywords(args, kw, "s|ssis:StringProperty", kwlist, &id, &name, &description, &maxlen, &def))
return NULL; return NULL;
@ -1871,7 +1898,7 @@ PyObject *BPy_StringProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL; return NULL;
} }
if (self) { if (self && PyCObject_Check(self)) {
StructRNA *srna = PyCObject_AsVoidPtr(self); StructRNA *srna = PyCObject_AsVoidPtr(self);
RNA_def_string(srna, id, def, maxlen, name, description); RNA_def_string(srna, id, def, maxlen, name, description);
Py_RETURN_NONE; Py_RETURN_NONE;
@ -2166,7 +2193,7 @@ PyObject *pyrna_basetype_register(PyObject *self, PyObject *args)
C= BPy_GetContext(); C= BPy_GetContext();
/* call the register callback */ /* call the register callback */
BKE_reports_init(&reports, RPT_PRINT); BKE_reports_init(&reports, RPT_STORE);
srna= reg(C, &reports, py_class, bpy_class_validate, bpy_class_call, bpy_class_free); srna= reg(C, &reports, py_class, bpy_class_validate, bpy_class_call, bpy_class_free);
if(!srna) { if(!srna) {

@ -63,6 +63,7 @@ typedef struct {
PyObject *BPY_rna_module( void ); PyObject *BPY_rna_module( void );
/*PyObject *BPY_rna_doc( void );*/ /*PyObject *BPY_rna_doc( void );*/
PyObject *BPY_rna_types( void ); PyObject *BPY_rna_types( void );
PyObject *BPY_rna_props( void );
PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr ); PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr );
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop ); PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );

@ -221,6 +221,7 @@ IF(UNIX)
blender_radiosity blender_radiosity
blender_ONL blender_ONL
bf_python bf_python
bf_gen_python
bf_blenkernel bf_blenkernel
bf_nodes bf_nodes
bf_gpu bf_gpu
@ -269,6 +270,7 @@ IF(UNIX)
extern_qhull extern_qhull
bf_moto bf_moto
bf_python bf_python
bf_gen_python
bf_quicktime bf_quicktime
extern_binreloc extern_binreloc
extern_glew extern_glew

@ -49,6 +49,7 @@ SET(INC
../../../source/blender ../../../source/blender
../../../source/blender/include ../../../source/blender/include
../../../source/blender/makesdna ../../../source/blender/makesdna
../../../source/blender/makesrna
../../../source/gameengine/Rasterizer ../../../source/gameengine/Rasterizer
../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer ../../../source/gameengine/Rasterizer/RAS_OpenGLRasterizer
../../../source/gameengine/GameLogic ../../../source/gameengine/GameLogic

@ -48,6 +48,7 @@ CPPFLAGS += -I../../blender
CPPFLAGS += -I../../blender/windowmanager CPPFLAGS += -I../../blender/windowmanager
CPPFLAGS += -I../../blender/imbuf CPPFLAGS += -I../../blender/imbuf
CPPFLAGS += -I../../blender/makesdna CPPFLAGS += -I../../blender/makesdna
CPPFLAGS += -I../../blender/makesrna
CPPFLAGS += -I../../blender/editors/include CPPFLAGS += -I../../blender/editors/include
CPPFLAGS += -I../../blender/blenlib CPPFLAGS += -I../../blender/blenlib
CPPFLAGS += -I../../blender/blenkernel CPPFLAGS += -I../../blender/blenkernel

@ -18,6 +18,7 @@
#include "StringValue.h" #include "StringValue.h"
#include "VoidValue.h" #include "VoidValue.h"
#include <algorithm> #include <algorithm>
#include <stdint.h>
#include "BoolValue.h" #include "BoolValue.h"
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H

@ -53,7 +53,8 @@ SET(INC
../../../source/gameengine/Ketsji ../../../source/gameengine/Ketsji
../../../source/blender/blenlib ../../../source/blender/blenlib
../../../source/blender/blenkernel ../../../source/blender/blenkernel
../../../source/blender/python/api2_2x ../../../source/blender/python
../../../source/blender/python/generic
../../../source/blender ../../../source/blender
../../../source/blender/include ../../../source/blender/include
../../../source/blender/makesdna ../../../source/blender/makesdna

@ -41,7 +41,7 @@ CPPFLAGS += -I$(NAN_GLEW)/include
CPPFLAGS += -I$(OPENGL_HEADERS) CPPFLAGS += -I$(OPENGL_HEADERS)
CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION) CPPFLAGS += -I$(NAN_PYTHON)/include/python$(NAN_PYTHON_VERSION)
CPPFLAGS += -I../../blender/python CPPFLAGS += -I../../blender/python
CPPFLAGS += -I../../blender/python/api2_2x CPPFLAGS += -I../../blender/python/generic
CPPFLAGS += -I$(NAN_STRING)/include CPPFLAGS += -I$(NAN_STRING)/include
CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include CPPFLAGS += -I$(NAN_SOUNDSYSTEM)/include
CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include CPPFLAGS += -I$(NAN_FUZZICS)/include -I$(NAN_SUMO) -I$(NAN_MOTO)/include