RNA: C API
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 2 Feb 2009 19:57:57 +0000 (19:57 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Mon, 2 Feb 2009 19:57:57 +0000 (19:57 +0000)
* RNA_blender.h is now generated along with the other files. It is not
  used anywhere yet, and still located quite hidden next to the other
  rna_*_gen.c files. Read only access for now.
* Inherited properties are not copied from the base anymore but
  iterated over. Patch by Vekoon, thanks!
* Array get/set callbacks now do the whole array instead of getting an
  index. This is needed for some layers for example so python can set
  the array as a whole, otherwise the check that one layer has to be
  enabled at all times gets in the way. Also nicer for the C API.
* Also some changes to returning pointers to make the API cleaner, got
  rid of the type() callback and instead let get() return PointerRNA
  with the type included.

The C API looks like this currently:
http://users.pandora.be/blendix/RNA_blender.h

39 files changed:
source/blender/blenkernel/intern/anim_sys.c
source/blender/blenkernel/intern/fcurve.c
source/blender/editors/animation/keyframing.c
source/blender/editors/interface/interface.c
source/blender/editors/space_outliner/outliner.c
source/blender/makesrna/RNA_access.h
source/blender/makesrna/RNA_define.h
source/blender/makesrna/RNA_types.h
source/blender/makesrna/intern/makesrna.c
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_brush.c
source/blender/makesrna/intern/rna_cloth.c
source/blender/makesrna/intern/rna_color.c
source/blender/makesrna/intern/rna_curve.c
source/blender/makesrna/intern/rna_define.c
source/blender/makesrna/intern/rna_group.c
source/blender/makesrna/intern/rna_internal.h
source/blender/makesrna/intern/rna_internal_types.h
source/blender/makesrna/intern/rna_key.c
source/blender/makesrna/intern/rna_lamp.c
source/blender/makesrna/intern/rna_lattice.c
source/blender/makesrna/intern/rna_main.c
source/blender/makesrna/intern/rna_material.c
source/blender/makesrna/intern/rna_mesh.c
source/blender/makesrna/intern/rna_modifier.c
source/blender/makesrna/intern/rna_nodetree.c
source/blender/makesrna/intern/rna_object.c
source/blender/makesrna/intern/rna_rna.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_screen.c
source/blender/makesrna/intern/rna_sequence.c
source/blender/makesrna/intern/rna_sound.c
source/blender/makesrna/intern/rna_space.c
source/blender/makesrna/intern/rna_text.c
source/blender/makesrna/intern/rna_userdef.c
source/blender/makesrna/intern/rna_wm.c
source/blender/makesrna/intern/rna_world.c
source/blender/python/intern/bpy_rna.c

index fa3bb335c4fb158a364a1dc440cd00d3196b727c..8bc914d5be0465b713043057b865220ed46fac91 100644 (file)
@@ -200,19 +200,19 @@ static short animsys_write_rna_setting (PointerRNA *ptr, char *path, int array_i
                        {
                                case PROP_BOOLEAN:
                                        if (RNA_property_array_length(&new_ptr, prop))
-                                               RNA_property_boolean_set_array(&new_ptr, prop, array_index, (int)value);
+                                               RNA_property_boolean_set_index(&new_ptr, prop, array_index, (int)value);
                                        else
                                                RNA_property_boolean_set(&new_ptr, prop, (int)value);
                                        break;
                                case PROP_INT:
                                        if (RNA_property_array_length(&new_ptr, prop))
-                                               RNA_property_int_set_array(&new_ptr, prop, array_index, (int)value);
+                                               RNA_property_int_set_index(&new_ptr, prop, array_index, (int)value);
                                        else
                                                RNA_property_int_set(&new_ptr, prop, (int)value);
                                        break;
                                case PROP_FLOAT:
                                        if (RNA_property_array_length(&new_ptr, prop))
-                                               RNA_property_float_set_array(&new_ptr, prop, array_index, value);
+                                               RNA_property_float_set_index(&new_ptr, prop, array_index, value);
                                        else
                                                RNA_property_float_set(&new_ptr, prop, value);
                                        break;
index 8c36f2b0017120fa67c60079d694e4c15243265c..72e4932e622eb2ac5edfd73084eea3fab6f833d3 100644 (file)
@@ -500,19 +500,19 @@ static float driver_get_driver_value (ChannelDriver *driver, short target)
                switch (RNA_property_type(&ptr, prop)) {
                        case PROP_BOOLEAN:
                                if (RNA_property_array_length(&ptr, prop))
-                                       value= (float)RNA_property_boolean_get_array(&ptr, prop, index);
+                                       value= (float)RNA_property_boolean_get_index(&ptr, prop, index);
                                else
                                        value= (float)RNA_property_boolean_get(&ptr, prop);
                                break;
                        case PROP_INT:
                                if (RNA_property_array_length(&ptr, prop))
-                                       value= (float)RNA_property_int_get_array(&ptr, prop, index);
+                                       value= (float)RNA_property_int_get_index(&ptr, prop, index);
                                else
                                        value= (float)RNA_property_int_get(&ptr, prop);
                                break;
                        case PROP_FLOAT:
                                if (RNA_property_array_length(&ptr, prop))
-                                       value= RNA_property_float_get_array(&ptr, prop, index);
+                                       value= RNA_property_float_get_index(&ptr, prop, index);
                                else
                                        value= RNA_property_float_get(&ptr, prop);
                                break;
index ece982fc259dfa9800ae9d4eed5f4f8eeddb15b8..3b865f4dac109e61f8654233c344e47f3e522f56 100644 (file)
@@ -485,19 +485,19 @@ static float setting_get_rna_value (PointerRNA *ptr, PropertyRNA *prop, int inde
        switch (RNA_property_type(ptr, prop)) {
                case PROP_BOOLEAN:
                        if (RNA_property_array_length(ptr, prop))
-                               value= (float)RNA_property_boolean_get_array(ptr, prop, index);
+                               value= (float)RNA_property_boolean_get_index(ptr, prop, index);
                        else
                                value= (float)RNA_property_boolean_get(ptr, prop);
                        break;
                case PROP_INT:
                        if (RNA_property_array_length(ptr, prop))
-                               value= (float)RNA_property_int_get_array(ptr, prop, index);
+                               value= (float)RNA_property_int_get_index(ptr, prop, index);
                        else
                                value= (float)RNA_property_int_get(ptr, prop);
                        break;
                case PROP_FLOAT:
                        if (RNA_property_array_length(ptr, prop))
-                               value= RNA_property_float_get_array(ptr, prop, index);
+                               value= RNA_property_float_get_index(ptr, prop, index);
                        else
                                value= RNA_property_float_get(ptr, prop);
                        break;
index ff4e1f461450d00aae565d7098302fd03eafb39d..ce842699ce2b0171b26d3274a91d963832904df7 100644 (file)
@@ -1144,7 +1144,7 @@ void ui_get_but_vectorf(uiBut *but, float *vec)
                        tot= MIN2(tot, 3);
 
                        for(a=0; a<tot; a++)
-                               vec[a]= RNA_property_float_get_array(&but->rnapoin, prop, a);
+                               vec[a]= RNA_property_float_get_index(&but->rnapoin, prop, a);
                }
        }
        else if(but->pointype == CHA) {
@@ -1178,7 +1178,7 @@ void ui_set_but_vectorf(uiBut *but, float *vec)
                        tot= MIN2(tot, 3);
 
                        for(a=0; a<tot; a++)
-                               RNA_property_float_set_array(&but->rnapoin, prop, a, vec[a]);
+                               RNA_property_float_set_index(&but->rnapoin, prop, a, vec[a]);
                }
        }
        else if(but->pointype == CHA) {
@@ -1218,19 +1218,19 @@ double ui_get_but_val(uiBut *but)
                switch(RNA_property_type(&but->rnapoin, prop)) {
                        case PROP_BOOLEAN:
                                if(RNA_property_array_length(&but->rnapoin, prop))
-                                       value= RNA_property_boolean_get_array(&but->rnapoin, prop, but->rnaindex);
+                                       value= RNA_property_boolean_get_index(&but->rnapoin, prop, but->rnaindex);
                                else
                                        value= RNA_property_boolean_get(&but->rnapoin, prop);
                                break;
                        case PROP_INT:
                                if(RNA_property_array_length(&but->rnapoin, prop))
-                                       value= RNA_property_int_get_array(&but->rnapoin, prop, but->rnaindex);
+                                       value= RNA_property_int_get_index(&but->rnapoin, prop, but->rnaindex);
                                else
                                        value= RNA_property_int_get(&but->rnapoin, prop);
                                break;
                        case PROP_FLOAT:
                                if(RNA_property_array_length(&but->rnapoin, prop))
-                                       value= RNA_property_float_get_array(&but->rnapoin, prop, but->rnaindex);
+                                       value= RNA_property_float_get_index(&but->rnapoin, prop, but->rnaindex);
                                else
                                        value= RNA_property_float_get(&but->rnapoin, prop);
                                break;
@@ -1282,19 +1282,19 @@ void ui_set_but_val(uiBut *but, double value)
                        switch(RNA_property_type(&but->rnapoin, prop)) {
                                case PROP_BOOLEAN:
                                        if(RNA_property_array_length(&but->rnapoin, prop))
-                                               RNA_property_boolean_set_array(&but->rnapoin, prop, but->rnaindex, value);
+                                               RNA_property_boolean_set_index(&but->rnapoin, prop, but->rnaindex, value);
                                        else
                                                RNA_property_boolean_set(&but->rnapoin, prop, value);
                                        break;
                                case PROP_INT:
                                        if(RNA_property_array_length(&but->rnapoin, prop))
-                                               RNA_property_int_set_array(&but->rnapoin, prop, but->rnaindex, value);
+                                               RNA_property_int_set_index(&but->rnapoin, prop, but->rnaindex, value);
                                        else
                                                RNA_property_int_set(&but->rnapoin, prop, value);
                                        break;
                                case PROP_FLOAT:
                                        if(RNA_property_array_length(&but->rnapoin, prop))
-                                               RNA_property_float_set_array(&but->rnapoin, prop, but->rnaindex, value);
+                                               RNA_property_float_set_index(&but->rnapoin, prop, but->rnaindex, value);
                                        else
                                                RNA_property_float_set(&but->rnapoin, prop, value);
                                        break;
index 431208ad51126b398ae3183bded3265e5fbfa46b..b68895bb6a440674a080bb5d9eb793ce9ff54d39 100644 (file)
@@ -1080,7 +1080,7 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i
                        te->rnaptr= *ptr;
 
                        if(proptype == PROP_POINTER) {
-                               RNA_property_pointer_get(ptr, prop, &pptr);
+                               pptr= RNA_property_pointer_get(ptr, prop);
 
                                if(pptr.data) {
                                        if(!(tselem->flag & TSE_CLOSED))
@@ -4105,7 +4105,7 @@ static uiBut *outliner_draw_rnabut(uiBlock *block, PointerRNA *ptr, PropertyRNA
                        length= RNA_property_array_length(ptr, prop);
 
                        if(length)
-                               value= RNA_property_boolean_get_array(ptr, prop, index);
+                               value= RNA_property_boolean_get_index(ptr, prop, index);
                        else
                                value= RNA_property_boolean_get(ptr, prop);
 
@@ -4133,7 +4133,7 @@ static uiBut *outliner_draw_rnabut(uiBlock *block, PointerRNA *ptr, PropertyRNA
                        char *text, *descr, textbuf[256];
                        int icon;
 
-                       RNA_property_pointer_get(ptr, prop, &pptr);
+                       pptr= RNA_property_pointer_get(ptr, prop);
 
                        if(!pptr.data)
                                return NULL;
index 378d01fec9fdf1cc92b391cc319077d0bdaac3e6..4271dcbe8c574f4ef3097972bf2cbd8446830358 100644 (file)
@@ -341,18 +341,24 @@ void RNA_property_update(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop)
 
 int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value);
-int RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
-void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
+void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values);
+int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
+void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values);
+void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
 
 int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value);
-int RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
-void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
+void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values);
+int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
+void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values);
+void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value);
 
 float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value);
-float RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, int index);
-void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, float value);
+void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values);
+float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index);
+void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values);
+void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value);
 
 void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value);
 char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen);
@@ -362,8 +368,8 @@ void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *val
 int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop);
 void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value);
 
-void RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr);
-void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_value);
+PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop);
+void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value);
 
 void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter);
 void RNA_property_collection_next(CollectionPropertyIterator *iter);
@@ -440,7 +446,7 @@ char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, in
 int RNA_string_length(PointerRNA *ptr, const char *name);
 void RNA_string_set(PointerRNA *ptr, const char *name, const char *value);
 
-void RNA_pointer_get(PointerRNA *ptr, const char *name, PointerRNA *r_value);
+PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name);
 void RNA_pointer_add(PointerRNA *ptr, const char *name);
 
 void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter);
index 270533cb5f734c47d00b28e6b29c56e76386bc77..bac160f4bbcda25b4b00ed79b63dd779347e3527 100644 (file)
@@ -137,8 +137,8 @@ void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *
 void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range);
 void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, 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 *type, const char *set);
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *type, const char *length, const char *lookupint, const char *lookupstring);
+void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set);
+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);
 
 #endif /* RNA_DEFINE_H */
 
index 95e5e4112edb9707a3b46bab19965fad753f9cd6..f914c85340de527b2f6658f019865dbde08230b1 100644 (file)
@@ -105,15 +105,20 @@ typedef enum PropertyFlag {
 } PropertyFlag;
 
 typedef struct CollectionPropertyIterator {
+       /* internal */
        PointerRNA parent;
        struct PropertyRNA *prop;
        void *internal;
        int idprop;
+       int level;
 
+       /* external */
        int valid;
        PointerRNA ptr;
 } CollectionPropertyIterator;
 
+/* Iterator Utility */
+
 typedef struct EnumPropertyItem {
        int value;
        const char *identifier;
index b3dac41efed4a2e42ad065fe2cdff099341f3ad5..e2ef25f178ece25ba8c3b4bcf07c2cf7a8f57d9b 100644 (file)
@@ -46,7 +46,7 @@
 
 /* Sorting */
 
-int cmp_struct(const void *a, const void *b)
+static int cmp_struct(const void *a, const void *b)
 {
        const StructRNA *structa= *(const StructRNA**)a;
        const StructRNA *structb= *(const StructRNA**)b;
@@ -54,7 +54,7 @@ int cmp_struct(const void *a, const void *b)
        return strcmp(structa->identifier, structb->identifier);
 }
 
-int cmp_property(const void *a, const void *b)
+static int cmp_property(const void *a, const void *b)
 {
        const PropertyRNA *propa= *(const PropertyRNA**)a;
        const PropertyRNA *propb= *(const PropertyRNA**)b;
@@ -68,7 +68,23 @@ int cmp_property(const void *a, const void *b)
        return strcmp(propa->name, propb->name);
 }
 
-void rna_sortlist(ListBase *listbase, int(*cmp)(const void*, const void*))
+static int cmp_def_struct(const void *a, const void *b)
+{
+       const StructDefRNA *dsa= *(const StructDefRNA**)a;
+       const StructDefRNA *dsb= *(const StructDefRNA**)b;
+
+       return cmp_struct(&dsa->srna, &dsb->srna);
+}
+
+static int cmp_def_property(const void *a, const void *b)
+{
+       const PropertyDefRNA *dpa= *(const PropertyDefRNA**)a;
+       const PropertyDefRNA *dpb= *(const PropertyDefRNA**)b;
+
+       return cmp_property(&dpa->prop, &dpb->prop);
+}
+
+static void rna_sortlist(ListBase *listbase, int(*cmp)(const void*, const void*))
 {
        Link *link;
        void **array;
@@ -129,7 +145,7 @@ static char *rna_alloc_function_name(const char *structname, const char *propnam
        char buffer[2048];
        char *result;
 
-       snprintf(buffer, sizeof(buffer), "rna_%s_%s_%s", structname, propname, type);
+       snprintf(buffer, sizeof(buffer), "%s_%s_%s", structname, propname, type);
        result= MEM_callocN(sizeof(char)*strlen(buffer)+1, "rna_alloc_function_name");
        strcpy(result, buffer);
 
@@ -152,7 +168,7 @@ static const char *rna_type_type(PropertyRNA *prop)
                case PROP_STRING:
                        return "char*";
                default:
-                       return "void*";
+                       return "PointerRNA";
        }
 }
 
@@ -196,23 +212,26 @@ static void rna_int_print(FILE *f, int num)
        else fprintf(f, "%d", num);
 }
 
-static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp)
+static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
 {
        char *func;
+       int i;
 
        if(prop->flag & PROP_IDPROPERTY)
                return NULL;
+       
+       if(!manualfunc) {
+               if(!dp->dnastructname || !dp->dnaname) {
+                       fprintf(stderr, "rna_def_property_get_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
+                       DefRNA.error= 1;
+                       return NULL;
+               }
 
-       if(!dp->dnastructname || !dp->dnaname) {
-               fprintf(stderr, "rna_def_property_get_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
-               DefRNA.error= 1;
-               return NULL;
-       }
-
-       if(prop->type == PROP_STRING && ((StringPropertyRNA*)prop)->maxlength == 0) {
-               fprintf(stderr, "rna_def_property_get_func: string %s.%s has max length 0.\n", srna->identifier, prop->identifier);
-               DefRNA.error= 1;
-               return NULL;
+               if(prop->type == PROP_STRING && ((StringPropertyRNA*)prop)->maxlength == 0) {
+                       fprintf(stderr, "rna_def_property_get_func: string %s.%s has max length 0.\n", srna->identifier, prop->identifier);
+                       DefRNA.error= 1;
+                       return NULL;
+               }
        }
 
        func= rna_alloc_function_name(srna->identifier, prop->identifier, "get");
@@ -220,55 +239,107 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        switch(prop->type) {
                case PROP_STRING: {
                        StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-                       fprintf(f, "static void %s(PointerRNA *ptr, char *value)\n", func);
+                       fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
                        fprintf(f, "{\n");
-                       rna_print_data_get(f, dp);
-                       fprintf(f, "    BLI_strncpy(value, data->%s, %d);\n", dp->dnaname, sprop->maxlength);
+                       if(manualfunc) {
+                               fprintf(f, "    %s(ptr, value);\n", manualfunc);
+                       }
+                       else {
+                               rna_print_data_get(f, dp);
+                               fprintf(f, "    BLI_strncpy(value, data->%s, %d);\n", dp->dnaname, sprop->maxlength);
+                       }
+                       fprintf(f, "}\n\n");
+                       break;
+               }
+               case PROP_POINTER: {
+                       fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
+                       fprintf(f, "{\n");
+                       if(manualfunc) {
+                               fprintf(f, "    return %s(ptr);\n", manualfunc);
+                       }
+                       else {
+                               PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
+                               rna_print_data_get(f, dp);
+                               if(dp->dnapointerlevel == 0)
+                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n", (char*)pprop->structtype, dp->dnaname);
+                               else
+                                       fprintf(f, "    return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n", (char*)pprop->structtype, dp->dnaname);
+                       }
+                       fprintf(f, "}\n\n");
+                       break;
+               }
+               case PROP_COLLECTION: {
+                       CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
+
+                       fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
+                       fprintf(f, "{\n");
+                       if(manualfunc) {
+                               if(strcmp(manualfunc, "rna_iterator_listbase_get") == 0 ||
+                                  strcmp(manualfunc, "rna_iterator_array_get") == 0 ||
+                                  strcmp(manualfunc, "rna_iterator_array_dereference_get") == 0)
+                                       fprintf(f, "    return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n", (cprop->structtype)? (char*)cprop->structtype: "UnknownType", manualfunc);
+                               else
+                                       fprintf(f, "    return %s(iter);\n", manualfunc);
+                       }
                        fprintf(f, "}\n\n");
                        break;
                }
                default:
                        if(prop->arraylength) {
-                               fprintf(f, "static %s %s(PointerRNA *ptr, int index)\n", rna_type_type(prop), func);
+                               fprintf(f, "void %s(PointerRNA *ptr, %s values[%d])\n", func, rna_type_type(prop), prop->arraylength);
                                fprintf(f, "{\n");
-                               rna_print_data_get(f, dp);
-                               if(dp->dnaarraylength == 1) {
-                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit)
-                                               fprintf(f, "    return (%s(data->%s & (%d<<index)) != 0);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
-                                       else
-                                               fprintf(f, "    return (%s)%s((&data->%s)[index]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+
+                               if(manualfunc) {
+                                       fprintf(f, "    return %s(ptr, values);\n", manualfunc);
                                }
                                else {
-                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                               fprintf(f, "    return (%s(data->%s[index] & ", (dp->booleannegative)? "!": "", dp->dnaname);
-                                               rna_int_print(f, dp->booleanbit);
-                                               fprintf(f, ") != 0);\n");
+                                       rna_print_data_get(f, dp);
+
+                                       for(i=0; i<prop->arraylength; i++) {
+                                               if(dp->dnaarraylength == 1) {
+                                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit)
+                                                               fprintf(f, "    values[%d]= (%s(data->%s & (%d<<%d)) != 0);\n", i, (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit, i);
+                                                       else
+                                                               fprintf(f, "    values[%d]= (%s)%s((&data->%s)[%d]);\n", i, rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname, i);
+                                               }
+                                               else {
+                                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
+                                                               fprintf(f, "    values[%d]= (%s(data->%s[%d] & ", i, (dp->booleannegative)? "!": "", dp->dnaname, i);
+                                                               rna_int_print(f, dp->booleanbit);
+                                                               fprintf(f, ") != 0);\n");
+                                                       }
+                                                       else if(rna_color_quantize(prop, dp))
+                                                               fprintf(f, "    values[%d]= (%s)(data->%s[%d]*(1.0f/255.0f));\n", i, rna_type_type(prop), dp->dnaname, i);
+                                                       else
+                                                               fprintf(f, "    values[%d]= (%s)%s(data->%s[%d]);\n", i, rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname, i);
+                                               }
                                        }
-                                       else if(rna_color_quantize(prop, dp))
-                                               fprintf(f, "    return (%s)(data->%s[index]/255.0f);\n", rna_type_type(prop), dp->dnaname);
-                                       else
-                                               fprintf(f, "    return (%s)%s(data->%s[index]);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
                                }
                                fprintf(f, "}\n\n");
                        }
                        else {
-                               fprintf(f, "static %s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
+                               fprintf(f, "%s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
                                fprintf(f, "{\n");
-                               rna_print_data_get(f, dp);
-                               if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                       fprintf(f, "    return (%s((data->%s) & ", (dp->booleannegative)? "!": "", dp->dnaname);
-                                       rna_int_print(f, dp->booleanbit);
-                                       fprintf(f, ") != 0);\n");
+
+                               if(manualfunc) {
+                                       fprintf(f, "    return %s(ptr);\n", manualfunc);
                                }
-                               else if(prop->type == PROP_ENUM && dp->enumbitflags) {
-                                       fprintf(f, "    return ((data->%s) & ", dp->dnaname);
-                                       rna_int_print(f, rna_enum_bitmask(prop));
-                                       fprintf(f, ");\n");
+                               else {
+                                       rna_print_data_get(f, dp);
+                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
+                                               fprintf(f, "    return (%s((data->%s) & ", (dp->booleannegative)? "!": "", dp->dnaname);
+                                               rna_int_print(f, dp->booleanbit);
+                                               fprintf(f, ") != 0);\n");
+                                       }
+                                       else if(prop->type == PROP_ENUM && dp->enumbitflags) {
+                                               fprintf(f, "    return ((data->%s) & ", dp->dnaname);
+                                               rna_int_print(f, rna_enum_bitmask(prop));
+                                               fprintf(f, ");\n");
+                                       }
+                                       else
+                                               fprintf(f, "    return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
                                }
-                               else if(prop->type == PROP_POINTER && dp->dnapointerlevel == 0)
-                                       fprintf(f, "    return (%s)&(data->%s);\n", rna_type_type(prop), dp->dnaname);
-                               else
-                                       fprintf(f, "    return (%s)%s(data->%s);\n", rna_type_type(prop), (dp->booleannegative)? "!": "", dp->dnaname);
+
                                fprintf(f, "}\n\n");
                        }
                        break;
@@ -277,41 +348,53 @@ static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        return func;
 }
 
-static void rna_clamp_value(FILE *f, PropertyRNA *prop)
+static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array, int i)
 {
        if(prop->type == PROP_INT) {
                IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
 
                if(iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX) {
-                       fprintf(f, "    CLAMP(value, ");
+                       if(array) fprintf(f, "CLAMPIS(values[%d], ", i);
+                       else fprintf(f, "CLAMPIS(value, ");
                        rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
                        rna_int_print(f, iprop->hardmax); fprintf(f, ");\n");
+                       return;
                }
        }
        else if(prop->type == PROP_FLOAT) {
                FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
 
                if(fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX) {
-                       fprintf(f, "    CLAMP(value, ");
+                       if(array) fprintf(f, "CLAMPIS(values[%d], ", i);
+                       else fprintf(f, "CLAMPIS(value, ");
                        rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
                        rna_float_print(f, fprop->hardmax); fprintf(f, ");\n");
+                       return;
                }
        }
+
+       if(array)
+               fprintf(f, "values[%d];\n", i);
+       else
+               fprintf(f, "value;\n");
 }
 
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp)
+static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
 {
        char *func;
+       int i;
 
        if(prop->flag & (PROP_IDPROPERTY|PROP_NOT_EDITABLE))
                return NULL;
 
-       if(!dp->dnastructname || !dp->dnaname) {
-               if(!(prop->flag & PROP_NOT_EDITABLE)) {
-                       fprintf(stderr, "rna_def_property_set_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
-                       DefRNA.error= 1;
+       if(!manualfunc) {
+               if(!dp->dnastructname || !dp->dnaname) {
+                       if(!(prop->flag & PROP_NOT_EDITABLE)) {
+                               fprintf(stderr, "rna_def_property_set_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
+                               DefRNA.error= 1;
+                       }
+                       return NULL;
                }
-               return NULL;
        }
 
        func= rna_alloc_function_name(srna->identifier, prop->identifier, "set");
@@ -319,78 +402,111 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
        switch(prop->type) {
                case PROP_STRING: {
                        StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
-                       fprintf(f, "static void %s(PointerRNA *ptr, const char *value)\n", func);
+                       fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
                        fprintf(f, "{\n");
-                       rna_print_data_get(f, dp);
-                       fprintf(f, "    BLI_strncpy(data->%s, value, %d);\n", dp->dnaname, sprop->maxlength);
+                       if(manualfunc) {
+                               fprintf(f, "    %s(ptr, value);\n", manualfunc);
+                       }
+                       else {
+                               rna_print_data_get(f, dp);
+                               fprintf(f, "    BLI_strncpy(data->%s, value, %d);\n", dp->dnaname, sprop->maxlength);
+                       }
+                       fprintf(f, "}\n\n");
+                       break;
+               }
+               case PROP_POINTER: {
+                       fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
+                       fprintf(f, "{\n");
+                       if(manualfunc) {
+                               fprintf(f, "    %s(ptr, value);\n", manualfunc);
+                       }
+                       else {
+                               rna_print_data_get(f, dp);
+                               fprintf(f, "    data->%s= value.data;\n", dp->dnaname);
+                       }
                        fprintf(f, "}\n\n");
                        break;
                }
                default:
                        if(prop->arraylength) {
-                               fprintf(f, "static void %s(PointerRNA *ptr, int index, %s value)\n", func, rna_type_type(prop));
+                               fprintf(f, "void %s(PointerRNA *ptr, const %s values[%d])\n", func, rna_type_type(prop), prop->arraylength);
                                fprintf(f, "{\n");
-                               rna_print_data_get(f, dp);
-                               if(dp->dnaarraylength == 1) {
-                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                               fprintf(f, "    if(%svalue) data->%s |= (%d<<index);\n", (dp->booleannegative)? "!": "", dp->dnaname, dp->booleanbit);
-                                               fprintf(f, "    else data->%s &= ~(%d<<index);\n", dp->dnaname, dp->booleanbit);
-                                       }
-                                       else {
-                                               rna_clamp_value(f, prop);
-                                               fprintf(f, "    (&data->%s)[index]= %svalue;\n", dp->dnaname, (dp->booleannegative)? "!": "");
+
+                               if(manualfunc) {
+                                       fprintf(f, "    %s(ptr, values);\n", manualfunc);
+                               }
+                               else {
+                                       rna_print_data_get(f, dp);
+
+                                       for(i=0; i<prop->arraylength; i++) {
+                                               if(dp->dnaarraylength == 1) {
+                                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
+                                                               fprintf(f, "    if(%svalues[%d]) data->%s |= (%d<<%d);\n", (dp->booleannegative)? "!": "", i, dp->dnaname, dp->booleanbit, i);
+                                                               fprintf(f, "    else data->%s &= ~(%d<<%d);\n", dp->dnaname, dp->booleanbit, i);
+                                                       }
+                                                       else {
+                                                               fprintf(f, "    (&data->%s)[%d]= %s\n", dp->dnaname, i, (dp->booleannegative)? "!": "");
+                                                               rna_clamp_value(f, prop, 1, i);
+                                                       }
+                                               }
+                                               else {
+                                                       if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
+                                                               fprintf(f, "    if(%svalues[%d]) data->%s[%d] |= ", (dp->booleannegative)? "!": "", i, dp->dnaname, i);
+                                                               rna_int_print(f, dp->booleanbit);
+                                                               fprintf(f, ";\n");
+                                                               fprintf(f, "    else data->%s[%d] &= ~", dp->dnaname, i);
+                                                               rna_int_print(f, dp->booleanbit);
+                                                               fprintf(f, ";\n");
+                                                       }
+                                                       else if(rna_color_quantize(prop, dp)) {
+                                                               fprintf(f, "    data->%s[%d]= FTOCHAR(values[%d]);\n", dp->dnaname, i, i);
+                                                       }
+                                                       else {
+                                                               fprintf(f, "    data->%s[%d]= %s\n", dp->dnaname, i, (dp->booleannegative)? "!": "");
+                                                               rna_clamp_value(f, prop, 1, i);
+                                                       }
+                                               }
                                        }
                                }
+                               fprintf(f, "}\n\n");
+                       }
+                       else {
+                               fprintf(f, "void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
+                               fprintf(f, "{\n");
+
+                               if(manualfunc) {
+                                       fprintf(f, "    %s(ptr, value);\n", manualfunc);
+                               }
                                else {
+                                       rna_print_data_get(f, dp);
                                        if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                               fprintf(f, "    if(%svalue) data->%s[index] |= ", (dp->booleannegative)? "!": "", dp->dnaname);
+                                               fprintf(f, "    if(%svalue) data->%s |= ", (dp->booleannegative)? "!": "", dp->dnaname);
                                                rna_int_print(f, dp->booleanbit);
                                                fprintf(f, ";\n");
-                                               fprintf(f, "    else data->%s[index] &= ~", dp->dnaname);
+                                               fprintf(f, "    else data->%s &= ~", dp->dnaname);
                                                rna_int_print(f, dp->booleanbit);
                                                fprintf(f, ";\n");
                                        }
-                                       else if(rna_color_quantize(prop, dp)) {
-                                               fprintf(f, "    data->%s[index]= FTOCHAR(value);\n", dp->dnaname);
+                                       else if(prop->type == PROP_ENUM && dp->enumbitflags) {
+                                               fprintf(f, "    data->%s &= ~", dp->dnaname);
+                                               rna_int_print(f, rna_enum_bitmask(prop));
+                                               fprintf(f, ";\n");
+                                               fprintf(f, "    data->%s |= value;\n", dp->dnaname);
                                        }
                                        else {
-                                               rna_clamp_value(f, prop);
-                                               fprintf(f, "    data->%s[index]= %svalue;\n", dp->dnaname, (dp->booleannegative)? "!": "");
+                                               fprintf(f, "    data->%s= %s", dp->dnaname, (dp->booleannegative)? "!": "");
+                                               rna_clamp_value(f, prop, 0, 0);
                                        }
                                }
                                fprintf(f, "}\n\n");
                        }
-                       else {
-                               fprintf(f, "static void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
-                               fprintf(f, "{\n");
-                               rna_print_data_get(f, dp);
-                               if(prop->type == PROP_BOOLEAN && dp->booleanbit) {
-                                       fprintf(f, "    if(%svalue) data->%s |= ", (dp->booleannegative)? "!": "", dp->dnaname);
-                                       rna_int_print(f, dp->booleanbit);
-                                       fprintf(f, ";\n");
-                                       fprintf(f, "    else data->%s &= ~", dp->dnaname);
-                                       rna_int_print(f, dp->booleanbit);
-                                       fprintf(f, ";\n");
-                               }
-                               else if(prop->type == PROP_ENUM && dp->enumbitflags) {
-                                       fprintf(f, "    data->%s &= ~", dp->dnaname);
-                                       rna_int_print(f, rna_enum_bitmask(prop));
-                                       fprintf(f, ";\n");
-                                       fprintf(f, "    data->%s |= value;\n", dp->dnaname);
-                               }
-                               else {
-                                       rna_clamp_value(f, prop);
-                                       fprintf(f, "    data->%s= %svalue;\n", dp->dnaname, (dp->booleannegative)? "!": "");
-                               }
-                               fprintf(f, "}\n\n");
-                       }
                        break;
        }
 
        return func;
 }
 
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp)
+static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
 {
        char *func= NULL;
 
@@ -398,75 +514,153 @@ static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA
                return NULL;
 
        if(prop->type == PROP_STRING) {
-               if(!dp->dnastructname || !dp->dnaname) {
-                       fprintf(stderr, "rna_def_property_length_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
-                       DefRNA.error= 1;
-                       return NULL;
+               if(!manualfunc) {
+                       if(!dp->dnastructname || !dp->dnaname) {
+                               fprintf(stderr, "rna_def_property_length_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
+                               DefRNA.error= 1;
+                               return NULL;
+                       }
                }
 
                func= rna_alloc_function_name(srna->identifier, prop->identifier, "length");
 
-               fprintf(f, "static int %s(PointerRNA *ptr)\n", func);
+               fprintf(f, "int %s(PointerRNA *ptr)\n", func);
                fprintf(f, "{\n");
-               rna_print_data_get(f, dp);
-               fprintf(f, "    return strlen(data->%s);\n", dp->dnaname);
+               if(manualfunc) {
+                       fprintf(f, "    return %s(ptr);\n", manualfunc);
+               }
+               else {
+                       rna_print_data_get(f, dp);
+                       fprintf(f, "    return strlen(data->%s);\n", dp->dnaname);
+               }
                fprintf(f, "}\n\n");
        }
        else if(prop->type == PROP_COLLECTION) {
-               if(prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed)|| !dp->dnaname)) {
-                       fprintf(stderr, "rna_def_property_length_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
-                       DefRNA.error= 1;
-                       return NULL;
+               if(!manualfunc) {
+                       if(prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed)|| !dp->dnaname)) {
+                               fprintf(stderr, "rna_def_property_length_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
+                               DefRNA.error= 1;
+                               return NULL;
+                       }
                }
 
                func= rna_alloc_function_name(srna->identifier, prop->identifier, "length");
 
-               fprintf(f, "static int %s(PointerRNA *ptr)\n", func);
+               fprintf(f, "int %s(PointerRNA *ptr)\n", func);
                fprintf(f, "{\n");
-               rna_print_data_get(f, dp);
-               if(dp->dnalengthname)
-                       fprintf(f, "    return (data->%s == NULL)? 0: data->%s;\n", dp->dnaname, dp->dnalengthname);
-               else
-                       fprintf(f, "    return (data->%s == NULL)? 0: %d;\n", dp->dnaname, dp->dnalengthfixed);
+               if(manualfunc) {
+                       fprintf(f, "    return %s(ptr);\n", manualfunc);
+               }
+               else {
+                       rna_print_data_get(f, dp);
+                       if(dp->dnalengthname)
+                               fprintf(f, "    return (data->%s == NULL)? 0: data->%s;\n", dp->dnaname, dp->dnalengthname);
+                       else
+                               fprintf(f, "    return (data->%s == NULL)? 0: %d;\n", dp->dnaname, dp->dnalengthfixed);
+               }
                fprintf(f, "}\n\n");
        }
 
        return func;
 }
 
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp)
+static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
 {
-       char *func;
+       char *func, *getfunc;
 
        if(prop->flag & PROP_IDPROPERTY)
                return NULL;
 
-       if(!dp->dnastructname || !dp->dnaname) {
-               fprintf(stderr, "rna_def_property_begin_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
-               DefRNA.error= 1;
-               return NULL;
+       if(!manualfunc) {
+               if(!dp->dnastructname || !dp->dnaname) {
+                       fprintf(stderr, "rna_def_property_begin_func: %s.%s has no valid dna info.\n", srna->identifier, prop->identifier);
+                       DefRNA.error= 1;
+                       return NULL;
+               }
        }
 
        func= rna_alloc_function_name(srna->identifier, prop->identifier, "begin");
 
-       if(dp->dnalengthname || dp->dnalengthfixed) {
-               fprintf(f, "static void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
-               fprintf(f, "{\n");
+       fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
+       fprintf(f, "{\n");
+
+       if(!manualfunc)
                rna_print_data_get(f, dp);
-               if(dp->dnalengthname)
-                       fprintf(f, "    rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname);
-               else
-                       fprintf(f, "    rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed);
-               fprintf(f, "}\n\n");
+
+       fprintf(f, "\n  memset(iter, 0, sizeof(*iter));\n");
+       fprintf(f, "    iter->parent= *ptr;\n");
+       fprintf(f, "    iter->prop= (PropertyRNA*)&rna_%s_%s;\n", srna->identifier, prop->identifier);
+
+       if(dp->dnalengthname || dp->dnalengthfixed) {
+               if(manualfunc) {
+                       fprintf(f, "\n  %s(iter, ptr);\n", manualfunc);
+               }
+               else {
+                       if(dp->dnalengthname)
+                               fprintf(f, "\n  rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthname);
+                       else
+                               fprintf(f, "\n  rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, NULL);\n", dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+               }
        }
        else {
-               fprintf(f, "static void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
-               fprintf(f, "{\n");
-               rna_print_data_get(f, dp);
-               fprintf(f, "    rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
-               fprintf(f, "}\n\n");
+               if(manualfunc)
+                       fprintf(f, "\n  %s(iter, ptr);\n", manualfunc);
+               else
+                       fprintf(f, "\n  rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
        }
 
+       getfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "get");
+
+       fprintf(f, "\n  if(iter->valid)\n");
+       fprintf(f, "            iter->ptr= %s(iter);\n", getfunc);
+
+       fprintf(f, "}\n\n");
+
+
+       return func;
+}
+
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+{
+       char *func, *getfunc;
+
+       if(prop->flag & PROP_IDPROPERTY)
+               return NULL;
+
+       if(!manualfunc)
+               return NULL;
+
+       func= rna_alloc_function_name(srna->identifier, prop->identifier, "next");
+
+       fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
+       fprintf(f, "{\n");
+       fprintf(f, "    %s(iter);\n", manualfunc);
+
+       getfunc= rna_alloc_function_name(srna->identifier, prop->identifier, "get");
+
+       fprintf(f, "\n  if(iter->valid)\n");
+       fprintf(f, "            iter->ptr= %s(iter);\n", getfunc);
+
+       fprintf(f, "}\n\n");
+
+       return func;
+}
+
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, char *manualfunc)
+{
+       char *func;
+
+       if(prop->flag & PROP_IDPROPERTY)
+               return NULL;
+
+       func= rna_alloc_function_name(srna->identifier, prop->identifier, "end");
+
+       fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
+       fprintf(f, "{\n");
+       if(manualfunc)
+               fprintf(f, "    %s(iter);\n", manualfunc);
+       fprintf(f, "}\n\n");
+
        return func;
 }
 
@@ -483,12 +677,12 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
                        BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
 
                        if(!prop->arraylength) {
-                               if(!bprop->get) bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!bprop->set) bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               bprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->get);
+                               bprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->set);
                        }
                        else {
-                               if(!bprop->getarray) bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!bprop->setarray) bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               bprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)bprop->getarray);
+                               bprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)bprop->setarray);
                        }
                        break;
                }
@@ -496,12 +690,12 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
                        IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
 
                        if(!prop->arraylength) {
-                               if(!iprop->get) iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!iprop->set) iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               iprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->get);
+                               iprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->set);
                        }
                        else {
-                               if(!iprop->getarray) iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!iprop->setarray) iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               iprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)iprop->getarray);
+                               iprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)iprop->setarray);
                        }
                        break;
                }
@@ -509,36 +703,36 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
                        FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
 
                        if(!prop->arraylength) {
-                               if(!fprop->get) fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!fprop->set) fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               fprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->get);
+                               fprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->set);
                        }
                        else {
-                               if(!fprop->getarray) fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                               if(!fprop->setarray) fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                               fprop->getarray= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)fprop->getarray);
+                               fprop->setarray= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)fprop->setarray);
                        }
                        break;
                }
                case PROP_ENUM: {
                        EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
 
-                       if(!eprop->get) eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                       if(!eprop->set) eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                       eprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)eprop->get);
+                       eprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)eprop->set);
                        break;
                }
                case PROP_STRING: {
                        StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
 
-                       if(!sprop->get) sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                       if(!sprop->length) sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp);
-                       if(!sprop->set) sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
+                       sprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)sprop->get);
+                       sprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)sprop->length);
+                       sprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)sprop->set);
                        break;
                }
                case PROP_POINTER: {
                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
 
-                       if(!pprop->get) pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp);
-                       if(!pprop->set) pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp);
-                       if(!pprop->structtype && !pprop->type) {
+                       pprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)pprop->get);
+                       pprop->set= (void*)rna_def_property_set_func(f, srna, prop, dp, (char*)pprop->set);
+                       if(!pprop->structtype && !pprop->get) {
                                fprintf(stderr, "rna_def_property_funcs: %s.%s, pointer must have either type function or fixed type.\n", srna->identifier, prop->identifier);
                                DefRNA.error= 1;
                        }
@@ -547,16 +741,14 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
                case PROP_COLLECTION: {
                        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
 
-                       if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0) {
-                               if(!cprop->begin)
-                                       cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp);
-                       }
-                       else if(dp->dnalengthname || dp->dnalengthfixed) {
-                               if(!cprop->begin)
-                                       cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp);
-                               if(!cprop->length)
-                                       cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp);
-                       }
+                       if(dp->dnatype && strcmp(dp->dnatype, "ListBase")==0);
+                       else if(dp->dnalengthname || dp->dnalengthfixed)
+                               cprop->length= (void*)rna_def_property_length_func(f, srna, prop, dp, (char*)cprop->length);
+
+                       cprop->get= (void*)rna_def_property_get_func(f, srna, prop, dp, (char*)cprop->get);
+                       cprop->begin= (void*)rna_def_property_begin_func(f, srna, prop, dp, (char*)cprop->begin);
+                       cprop->next= (void*)rna_def_property_next_func(f, srna, prop, dp, (char*)cprop->next);
+                       cprop->end= (void*)rna_def_property_end_func(f, srna, prop, dp, (char*)cprop->end);
 
                        if(!(prop->flag & PROP_IDPROPERTY)) {
                                if(!cprop->begin) {
@@ -572,7 +764,7 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
                                        DefRNA.error= 1;
                                }
                        }
-                       if(!cprop->structtype && !cprop->type) {
+                       if(!cprop->structtype && !cprop->get) {
                                fprintf(stderr, "rna_def_property_funcs: %s.%s, collection must have either type function or fixed type.\n", srna->identifier, prop->identifier);
                                DefRNA.error= 1;
                        }
@@ -581,6 +773,88 @@ static void rna_def_property_funcs(FILE *f, PropertyDefRNA *dp)
        }
 }
 
+static void rna_def_property_funcs_header(FILE *f, PropertyDefRNA *dp)
+{
+       PropertyRNA *prop;
+       StructRNA *srna;
+       char *func;
+
+       srna= dp->srna;
+       prop= dp->prop;
+
+       if(prop->flag & (PROP_IDPROPERTY|PROP_BUILTIN))
+               return;
+
+       func= rna_alloc_function_name(srna->identifier, prop->identifier, "");
+
+       switch(prop->type) {
+               case PROP_BOOLEAN:
+               case PROP_INT: {
+                       if(!prop->arraylength) {
+                               fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
+                               //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
+                       }
+                       else {
+                               fprintf(f, "void %sget(PointerRNA *ptr, int values[%d]);\n", func, prop->arraylength);
+                               //fprintf(f, "void %sset(PointerRNA *ptr, const int values[%d]);\n", func, prop->arraylength);
+                       }
+                       break;
+               }
+               case PROP_FLOAT: {
+                       if(!prop->arraylength) {
+                               fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
+                               //fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
+                       }
+                       else {
+                               fprintf(f, "void %sget(PointerRNA *ptr, float values[%d]);\n", func, prop->arraylength);
+                               //fprintf(f, "void %sset(PointerRNA *ptr, const float values[%d]);\n", func, prop->arraylength);
+                       }
+                       break;
+               }
+               case PROP_ENUM: {
+                       EnumPropertyRNA *eprop= (EnumPropertyRNA*)prop;
+                       int i;
+
+                       if(eprop->item) {
+                               fprintf(f, "enum {\n");
+
+                               for(i=0; i<eprop->totitem; i++)
+                                       fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier, eprop->item[i].identifier, eprop->item[i].value);
+
+                               fprintf(f, "};\n\n");
+                       }
+
+                       fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
+                       //fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
+
+                       break;
+               }
+               case PROP_STRING: {
+                       fprintf(f, "void %sget(PointerRNA *ptr, char *value);\n", func);
+                       fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
+                       //fprintf(f, "void %sset(PointerRNA *ptr, const char *value);\n", func);
+
+                       break;
+               }
+               case PROP_POINTER: {
+                       fprintf(f, "PointerRNA %sget(PointerRNA *ptr);\n", func);
+                       //fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func);
+                       break;
+               }
+               case PROP_COLLECTION: {
+                       fprintf(f, "void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func);
+                       fprintf(f, "void %snext(CollectionPropertyIterator *iter);\n", func);
+                       fprintf(f, "void %send(CollectionPropertyIterator *iter);\n", func);
+                       //fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
+                       //fprintf(f, "void %slookup_int(PointerRNA *ptr, int key, StructRNA **type);\n", func);
+                       //fprintf(f, "void %slookup_string(PointerRNA *ptr, const char *key, StructRNA **type);\n", func);
+                       break;
+               }
+       }
+
+       fprintf(f, "\n");
+}
+
 static const char *rna_find_type(const char *type)
 {
        StructDefRNA *ds;
@@ -610,13 +884,13 @@ static void rna_auto_types()
                                if(dp->prop->type == PROP_POINTER) {
                                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)dp->prop;
 
-                                       if(!pprop->structtype && !pprop->type)
+                                       if(!pprop->structtype && !pprop->get)
                                                pprop->structtype= (StructRNA*)rna_find_type(dp->dnatype);
                                }
                                else if(dp->prop->type== PROP_COLLECTION) {
                                        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)dp->prop;
 
-                                       if(!cprop->structtype && !cprop->type && strcmp(dp->dnatype, "ListBase")==0)
+                                       if(!cprop->structtype && !cprop->get && strcmp(dp->dnatype, "ListBase")==0)
                                                cprop->structtype= (StructRNA*)rna_find_type(dp->dnatype);
                                }
                        }
@@ -626,12 +900,17 @@ static void rna_auto_types()
 
 static void rna_sort(BlenderRNA *brna)
 {
+       StructDefRNA *ds;
        StructRNA *srna;
 
        rna_sortlist(&brna->structs, cmp_struct);
+       rna_sortlist(&DefRNA.structs, cmp_def_struct);
 
        for(srna=brna->structs.first; srna; srna=srna->next)
                rna_sortlist(&srna->properties, cmp_property);
+
+       for(ds=DefRNA.structs.first; ds; ds=ds->next)
+               rna_sortlist(&ds->properties, cmp_def_property);
 }
 
 static const char *rna_property_structname(PropertyType type)
@@ -704,18 +983,33 @@ static void rna_generate_blender(BlenderRNA *brna, FILE *f)
        fprintf(f, "};\n\n");
 }
 
-static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
+static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f)
 {
        PropertyRNA *prop;
+       StructRNA *base;
 
-       fprintf(f, "/* %s */\n", srna->name);
+       base= srna->base;
+       while (base) {
+               fprintf(f, "\n");
+               for(prop=base->properties.first; prop; prop=prop->next)
+                       fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type), base->identifier, prop->identifier);
+               base= base->base;
+       }
 
        if(srna->properties.first)
                fprintf(f, "\n");
 
        for(prop=srna->properties.first; prop; prop=prop->next)
-               fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "static ", rna_property_structname(prop->type), srna->identifier, prop->identifier);
+               fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, prop->identifier);
        fprintf(f, "\n");
+}
+
+static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
+{
+       PropertyRNA *prop;
+       StructRNA *base;
+
+       fprintf(f, "/* %s */\n", srna->name);
 
        for(prop=srna->properties.first; prop; prop=prop->next) {
                switch(prop->type) {
@@ -807,7 +1101,7 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
                                break;
                }
 
-               fprintf(f, "%s%s rna_%s_%s = {\n", (prop->flag & PROP_EXPORT)? "": "static ", rna_property_structname(prop->type), srna->identifier, prop->identifier);
+               fprintf(f, "%s%s rna_%s_%s = {\n", (prop->flag & PROP_EXPORT)? "": "", rna_property_structname(prop->type), srna->identifier, prop->identifier);
 
                if(prop->next) fprintf(f, "\t{(PropertyRNA*)&rna_%s_%s, ", srna->identifier, prop->next->identifier);
                else fprintf(f, "\t{NULL, ");
@@ -869,14 +1163,14 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
                        }
                        case PROP_POINTER: {
                                PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-                               fprintf(f, "\t%s, %s, %s, ", rna_function_string(pprop->get), rna_function_string(pprop->set), rna_function_string(pprop->type));
+                               fprintf(f, "\t%s, %s, ", rna_function_string(pprop->get), rna_function_string(pprop->set));
                                if(pprop->structtype) fprintf(f, "&RNA_%s\n", (char*)pprop->structtype);
                                else fprintf(f, "NULL\n");
                                break;
                        }
                        case PROP_COLLECTION: {
                                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->type), rna_function_string(cprop->length), rna_function_string(cprop->lookupint), rna_function_string(cprop->lookupstring));
+                               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->structtype) fprintf(f, "&RNA_%s\n", (char*)cprop->structtype);
                                else fprintf(f, "NULL\n");
                                break;
@@ -902,10 +1196,20 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
        fprintf(f, ",\n");
 
        prop= srna->nameproperty;
-       if(prop) fprintf(f, "\t(PropertyRNA*)&rna_%s_%s, ", srna->identifier, prop->identifier);
+       if(prop) {
+               base= srna;
+               while (base->base && base->base->nameproperty==prop)
+                       base= base->base;
+
+               fprintf(f, "\t(PropertyRNA*)&rna_%s_%s, ", base->identifier, prop->identifier);
+       }
        else fprintf(f, "\tNULL, ");
 
-       fprintf(f, "(PropertyRNA*)&rna_%s_rna_properties,\n", srna->identifier);
+       prop= srna->iteratorproperty;
+       base= srna;
+       while (base->base && base->base->iteratorproperty==prop)
+               base= base->base;
+       fprintf(f, "(PropertyRNA*)&rna_%s_rna_properties,\n", base->identifier);
 
        if(srna->base) fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
        else fprintf(f, "\tNULL,\n");
@@ -987,8 +1291,8 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
        PropertyDefRNA *dp;
        
        fprintf(f, "\n/* Automatically generated struct definitions for the Data API.\n"
-                       "   Do not edit manually, changes will be overwritten */\n\n"
-                       "#define RNA_RUNTIME\n\n");
+                    "   Do not edit manually, changes will be overwritten.           */\n\n"
+                     "#define RNA_RUNTIME\n\n");
 
        fprintf(f, "#include <float.h>\n");
        fprintf(f, "#include <limits.h>\n");
@@ -1008,6 +1312,10 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
 
        fprintf(f, "/* Autogenerated Functions */\n\n");
 
+       for(ds=DefRNA.structs.first; ds; ds=ds->next)
+               if(!filename || ds->filename == filename)
+                       rna_generate_property_prototypes(brna, ds->srna, f);
+
        for(ds=DefRNA.structs.first; ds; ds=ds->next)
                if(!filename || ds->filename == filename)
                        for(dp=ds->properties.first; dp; dp=dp->next)
@@ -1026,6 +1334,44 @@ static void rna_generate(BlenderRNA *brna, FILE *f, char *filename)
        }
 }
 
+static void rna_generate_header(BlenderRNA *brna, FILE *f)
+{
+       StructDefRNA *ds;
+       PropertyDefRNA *dp;
+       StructRNA *srna;
+
+       fprintf(f, "\n/* Automatically generated function declarations for the Data API.\n"
+                    "   Do not edit manually, changes will be overwritten.              */\n\n");
+
+       fprintf(f, "#include \"RNA_types.h\"\n\n");
+
+       fprintf(f, "#define FOREACH_BEGIN(property, ptr, itemptr) \\\n");
+       fprintf(f, "    { \\\n");
+       fprintf(f, "            CollectionPropertyIterator itemptr##_macro_iter; \\\n");
+       fprintf(f, "            for(property##_begin(sptr, propname, &itemptr##_macro_iter); itemptr##_macro_iter.valid; property##_end(&itemptr##_macro_iter)) { \\\n");
+       fprintf(f, "                    PointerRNA itemptr= itemptr##_macro_iter.ptr;\n\n");
+
+       fprintf(f, "#define FOREACH_END \\\n");
+       fprintf(f, "            } \\\n");
+       fprintf(f, "            property##__end(&itemptr##_macro_iter); \\\n");
+       fprintf(f, "    }\n\n");
+
+       for(ds=DefRNA.structs.first; ds; ds=ds->next) {
+               srna= ds->srna;
+
+               fprintf(f, "/**************** %s ****************/\n\n", srna->name);
+
+               while(srna) {
+                       fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
+                       srna= srna->base;
+               }
+               fprintf(f, "\n");
+
+               for(dp=ds->properties.first; dp; dp=dp->next)
+                       rna_def_property_funcs_header(f, dp);
+       }
+}
+
 static void make_bad_file(char *file)
 {
        FILE *fp= fopen(file, "w");
@@ -1039,7 +1385,7 @@ static int rna_preprocess(char *outfile)
        StructDefRNA *ds;
        FILE *file;
        char deffile[4096];
-       int i, status, len;
+       int i, status;
 
        /* define rna */
        brna= RNA_create();
@@ -1059,8 +1405,7 @@ static int rna_preprocess(char *outfile)
 
        status= (DefRNA.error != 0);
 
-       len= strlen(outfile);
-
+       /* create rna_gen_*.c files */
        for(i=0; PROCESS_ITEMS[i].filename; i++) {
                strcpy(deffile, outfile);
                strcat(deffile, PROCESS_ITEMS[i].filename);
@@ -1086,6 +1431,29 @@ static int rna_preprocess(char *outfile)
                }
        }
 
+       /* create RNA_blender.h */
+       strcpy(deffile, outfile);
+       strcat(deffile, "RNA_blender.h");
+
+       if(status) {
+               make_bad_file(deffile);
+       }
+       else {
+               file = fopen(deffile, "w");
+
+               if(!file) {
+                       printf ("Unable to open file: %s\n", deffile);
+                       status = 1;
+               }
+               else {
+                       rna_generate_header(brna, file);
+                       fclose(file);
+
+                       status= (DefRNA.error != 0);
+               }
+       }
+
+       /* free RNA */
        RNA_define_free(brna);
        RNA_free(brna);
 
index ce896be58681f9528598610beaca2e9c1de6dc5a..b19faee38b95135c8e8a7f48cf9abff4924d8c90 100644 (file)
@@ -581,30 +581,38 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value)
        }
 }
 
-int RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
+void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
 {
        BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
        IDProperty *idprop;
 
        if((idprop=rna_idproperty_check(&prop, ptr)))
-               return ((int*)IDP_Array(idprop))[index];
+               memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
        else if(bprop->getarray)
-               return bprop->getarray(ptr, index);
+               bprop->getarray(ptr, values);
        else if(bprop->defaultarray)
-               return bprop->defaultarray[index];
+               memcpy(values, bprop->defaultarray, sizeof(int)*prop->arraylength);
        else
-               return 0;
+               memset(values, 0, sizeof(int)*prop->arraylength);
+}
+
+int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
+{
+       int tmp[RNA_MAX_ARRAY];
+
+       RNA_property_boolean_get_array(ptr, prop, tmp);
+       return tmp[index];
 }
 
-void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
+void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
 {
        BooleanPropertyRNA *bprop= (BooleanPropertyRNA*)prop;
        IDProperty *idprop;
 
        if((idprop=rna_idproperty_check(&prop, ptr)))
-               ((int*)IDP_Array(idprop))[index]= value;
+               memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
        else if(bprop->setarray)
-               bprop->setarray(ptr, index, value);
+               bprop->setarray(ptr, values);
        else if(!(prop->flag & PROP_NOT_EDITABLE)) {
                IDPropertyTemplate val;
                IDProperty *group;
@@ -616,15 +624,20 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, int inde
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       if(bprop->defaultarray)
-                               memcpy(idprop->data.pointer, bprop->defaultarray, sizeof(int)*prop->arraylength);
-                       else
-                               memset(idprop->data.pointer, 0, sizeof(int)*prop->arraylength);
-                       ((int*)idprop->data.pointer)[index]= value;
+                       memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
                }
        }
 }
 
+void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
+{
+       int tmp[RNA_MAX_ARRAY];
+
+       RNA_property_boolean_get_array(ptr, prop, tmp);
+       tmp[index]= value;
+       RNA_property_boolean_set_array(ptr, prop, tmp);
+}
+
 int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
 {
        IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
@@ -659,30 +672,38 @@ void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
        }
 }
 
-int RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
+void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
 {
        IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
        IDProperty *idprop;
 
        if((idprop=rna_idproperty_check(&prop, ptr)))
-               return ((int*)IDP_Array(idprop))[index];
+               memcpy(values, IDP_Array(idprop), sizeof(int)*idprop->len);
        else if(iprop->getarray)
-               return iprop->getarray(ptr, index);
+               iprop->getarray(ptr, values);
        else if(iprop->defaultarray)
-               return iprop->defaultarray[index];
+               memcpy(values, iprop->defaultarray, sizeof(int)*prop->arraylength);
        else
-               return 0.0f;
+               memset(values, 0, sizeof(int)*prop->arraylength);
+}
+
+int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
+{
+       int tmp[RNA_MAX_ARRAY];
+
+       RNA_property_int_get_array(ptr, prop, tmp);
+       return tmp[index];
 }
 
-void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
+void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
 {
        IntPropertyRNA *iprop= (IntPropertyRNA*)prop;
        IDProperty *idprop;
 
        if((idprop=rna_idproperty_check(&prop, ptr)))
-               ((int*)IDP_Array(idprop))[index]= value;
+               memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
        else if(iprop->setarray)
-               iprop->setarray(ptr, index, value);
+               iprop->setarray(ptr, values);
        else if(!(prop->flag & PROP_NOT_EDITABLE)) {
                IDPropertyTemplate val;
                IDProperty *group;
@@ -694,15 +715,20 @@ void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, i
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       if(iprop->defaultarray)
-                               memcpy(idprop->data.pointer, iprop->defaultarray, sizeof(int)*prop->arraylength);
-                       else
-                               memset(idprop->data.pointer, 0, sizeof(int)*prop->arraylength);
-                       ((int*)idprop->data.pointer)[index]= value;
+                       memcpy(IDP_Array(idprop), values, sizeof(int)*idprop->len);
                }
        }
 }
 
+void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
+{
+       int tmp[RNA_MAX_ARRAY];
+
+       RNA_property_int_get_array(ptr, prop, tmp);
+       tmp[index]= value;
+       RNA_property_int_set_array(ptr, prop, tmp);
+}
+
 float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
 {
        FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
@@ -746,38 +772,55 @@ void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
        }
 }
 
-float RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, int index)
+void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
 {
        FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
        IDProperty *idprop;
+       int i;
 
        if((idprop=rna_idproperty_check(&prop, ptr))) {
-               if(idprop->subtype == IDP_FLOAT)
-                       return ((float*)IDP_Array(idprop))[index];
-               else
-                       return (float)(((double*)IDP_Array(idprop))[index]);
+               if(idprop->subtype == IDP_FLOAT) {
+                       memcpy(values, IDP_Array(idprop), sizeof(float)*idprop->len);
+               }
+               else {
+                       for(i=0; i<idprop->len; i++)
+                               values[i]=  (float)(((double*)IDP_Array(idprop))[i]);
+               }
        }
        else if(fprop->getarray)
-               return fprop->getarray(ptr, index);
+               fprop->getarray(ptr, values);
        else if(fprop->defaultarray)
-               return fprop->defaultarray[index];
+               memcpy(values, fprop->defaultarray, sizeof(float)*prop->arraylength);
        else
-               return 0.0f;
+               memset(values, 0, sizeof(float)*prop->arraylength);
+
+}
+
+float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
+{
+       float tmp[RNA_MAX_ARRAY];
+
+       RNA_property_float_get_array(ptr, prop, tmp);
+       return tmp[index];
 }
 
-void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
+void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
 {
        FloatPropertyRNA *fprop= (FloatPropertyRNA*)prop;
        IDProperty *idprop;
+       int i;
 
        if((idprop=rna_idproperty_check(&prop, ptr))) {
-               if(idprop->subtype == IDP_FLOAT)
-                       ((float*)IDP_Array(idprop))[index]= value;
-               else
-                       ((double*)IDP_Array(idprop))[index]= value;
+               if(idprop->subtype == IDP_FLOAT) {
+                       memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
+               }
+               else {
+                       for(i=0; i<idprop->len; i++)
+                               ((double*)IDP_Array(idprop))[i]= values[i];
+               }
        }
        else if(fprop->setarray) {
-               fprop->setarray(ptr, index, value);
+               fprop->setarray(ptr, values);
        }
        else if(!(prop->flag & PROP_NOT_EDITABLE)) {
                IDPropertyTemplate val;
@@ -790,15 +833,20 @@ void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, int index,
                if(group) {
                        idprop= IDP_New(IDP_ARRAY, val, (char*)prop->identifier);
                        IDP_AddToGroup(group, idprop);
-                       if(fprop->defaultarray)
-                               memcpy(idprop->data.pointer, fprop->defaultarray, sizeof(float)*prop->arraylength);
-                       else
-                               memset(idprop->data.pointer, 0, sizeof(float)*prop->arraylength);
-                       ((float*)IDP_Array(idprop))[index]= value;
+                       memcpy(IDP_Array(idprop), values, sizeof(float)*idprop->len);
                }
        }
 }
 
+void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
+{
+       float tmp[RNA_MAX_ARRAY];
+
+       RNA_property_float_get_array(ptr, prop, tmp);
+       tmp[index]= value;
+       RNA_property_float_set_array(ptr, prop, tmp);
+}
+
 void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
 {
        StringPropertyRNA *sprop= (StringPropertyRNA*)prop;
@@ -899,49 +947,33 @@ void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
        }
 }
 
-static StructRNA *rna_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
-{
-       PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
-       StructRNA *type;
-
-       if(pprop->type)
-               type= pprop->type(ptr);
-       else
-               type= pprop->structtype;
-       
-       if(type) {
-               rna_pointer_inherit_id(type, ptr, r_ptr);
-
-               if(type->refine)
-                       type= type->refine(r_ptr);
-       }
-       
-       r_ptr->type= type;
-       return type;
-}
-
-void RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
+PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
 {
        PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
        IDProperty *idprop;
 
-       if((idprop=rna_idproperty_check(&prop, ptr)))
-               r_ptr->data= idprop; /* for groups, data is idprop itself */
-       else if(pprop->get)
-               r_ptr->data= pprop->get(ptr);
-       else
-               r_ptr->data= NULL;
+       if((idprop=rna_idproperty_check(&prop, ptr))) {
+               pprop= (PointerPropertyRNA*)prop;
 
-       if(!(r_ptr->data && rna_property_pointer_type(ptr, prop, r_ptr)))
-               memset(r_ptr, 0, sizeof(*r_ptr));
+               /* for groups, data is idprop itself */
+               return rna_pointer_inherit_refine(ptr, pprop->structtype, idprop);
+       }
+       else if(pprop->get) {
+               return pprop->get(ptr);
+       }
+       else {
+               PointerRNA result;
+               memset(&result, 0, sizeof(result));
+               return result;
+       }
 }
 
-void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *ptr_value)
+void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value)
 {
        PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
 
        if(pprop->set)
-               pprop->set(ptr, ptr_value->data);
+               pprop->set(ptr, ptr_value);
 }
 
 void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
@@ -965,37 +997,6 @@ void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
                printf("RNA_property_pointer_add %s.%s: only supported for id properties.\n", ptr->type->identifier, prop->identifier);
 }
 
-static StructRNA *rna_property_collection_type(CollectionPropertyIterator *iter)
-{
-       CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
-       StructRNA *type;
-
-       if(cprop->type)
-               type= cprop->type(iter);
-       else
-               type= cprop->structtype;
-       
-       if(type) {
-               rna_pointer_inherit_id(type, &iter->parent, &iter->ptr);
-
-               if(type->refine)
-                       type= type->refine(&iter->ptr);
-       }
-       
-       iter->ptr.type= type;
-       return type;
-}
-
-static void rna_property_collection_get(CollectionPropertyIterator *iter)
-{
-       CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
-
-       iter->ptr.data= cprop->get(iter);
-
-       if(!(iter->ptr.data && rna_property_collection_type(iter)))
-               memset(&iter->ptr, 0, sizeof(iter->ptr));
-}
-
 static void rna_property_collection_get_idp(CollectionPropertyIterator *iter)
 {
        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)iter->prop;
@@ -1009,6 +1010,8 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio
 {
        IDProperty *idprop;
 
+       memset(iter, 0, sizeof(*iter));
+
        if((idprop=rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
                iter->parent= *ptr;
                iter->prop= prop;
@@ -1020,27 +1023,12 @@ void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, Collectio
 
                if(iter->valid)
                        rna_property_collection_get_idp(iter);
-               else
-                       memset(&iter->ptr, 0, sizeof(iter->ptr));
 
                iter->idprop= 1;
        }
        else {
                CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
-
-               if(cprop->begin) {
-                       iter->parent= *ptr;
-                       iter->prop= prop;
-                       iter->idprop= 0;
-                       cprop->begin(iter, ptr);
-
-                       if(iter->valid)
-                               rna_property_collection_get(iter);
-                       else
-                               memset(&iter->ptr, 0, sizeof(iter->ptr));
-               }
-               else 
-                       memset(iter, 0, sizeof(*iter));
+               cprop->begin(iter, ptr);
        }
 }
 
@@ -1053,17 +1041,9 @@ void RNA_property_collection_next(CollectionPropertyIterator *iter)
 
                if(iter->valid)
                        rna_property_collection_get_idp(iter);
-               else
-                       memset(&iter->ptr, 0, sizeof(iter->ptr));
        }
-       else {
+       else
                cprop->next(iter);
-
-               if(iter->valid)
-                       rna_property_collection_get(iter);
-               else
-                       memset(&iter->ptr, 0, sizeof(iter->ptr));
-       }
 }
 
 void RNA_property_collection_end(CollectionPropertyIterator *iter)
@@ -1072,7 +1052,7 @@ void RNA_property_collection_end(CollectionPropertyIterator *iter)
 
        if(iter->idprop)
                rna_iterator_array_end(iter);
-       else if(cprop->end)
+       else
                cprop->end(iter);
 }
 
@@ -1160,19 +1140,8 @@ int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int k
 
        if(cprop->lookupint) {
                /* we have a callback defined, use it */
-               r_ptr->data= cprop->lookupint(ptr, key, &r_ptr->type);
-
-               if(r_ptr->data) {
-                       if(!r_ptr->type)
-                               r_ptr->type= cprop->structtype;
-                       rna_pointer_inherit_id(r_ptr->type, ptr, r_ptr);
-
-                       return 1;
-               }
-               else {
-                       memset(r_ptr, 0, sizeof(*r_ptr));
-                       return 0;
-               }
+               *r_ptr= cprop->lookupint(ptr, key);
+               return (r_ptr->data != NULL);
        }
        else {
                /* no callback defined, just iterate and find the nth item */
@@ -1201,19 +1170,8 @@ int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, co
 
        if(cprop->lookupstring) {
                /* we have a callback defined, use it */
-               r_ptr->data= cprop->lookupstring(ptr, key, &r_ptr->type);
-
-               if(r_ptr->data) {
-                       if(!r_ptr->type)
-                               r_ptr->type= cprop->structtype;
-                       rna_pointer_inherit_id(r_ptr->type, ptr, r_ptr);
-
-                       return 1;
-               }
-               else {
-                       memset(r_ptr, 0, sizeof(*r_ptr));
-                       return 0;
-               }
+               *r_ptr= cprop->lookupstring(ptr, key);
+               return (r_ptr->data != NULL);
        }
        else {
                /* no callback defined, compare with name properties if they exist */
@@ -1351,6 +1309,26 @@ void rna_iterator_array_end(CollectionPropertyIterator *iter)
        MEM_freeN(iter->internal);
 }
 
+/* Pointer Handling */
+
+PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
+{
+       PointerRNA result;
+
+       if(data) {
+               result.data= data;
+               result.type= type;
+               rna_pointer_inherit_id(type, ptr, &result);
+
+               if(type->refine)
+                       result.type= type->refine(&result);
+       }
+       else
+               memset(&result, 0, sizeof(result));
+       
+       return result;
+}
+
 /* RNA Path - Experiment */
 
 static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket)
@@ -1454,7 +1432,7 @@ int RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prope
                 * collection, otherwise return the property rna so that the
                 * caller can read the value of the property itself */
                if(RNA_property_type(&curptr, prop) == PROP_POINTER) {
-                       RNA_property_pointer_get(&curptr, prop, &nextptr);
+                       nextptr= RNA_property_pointer_get(&curptr, prop);
 
                        if(nextptr.data)
                                curptr= nextptr;
@@ -1624,13 +1602,9 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value)
 void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       values[i]= RNA_property_boolean_get_array(ptr, prop, i);
-       }
+       if(prop)
+               RNA_property_boolean_get_array(ptr, prop, values);
        else
                printf("RNA_boolean_get_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1638,13 +1612,9 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values)
 void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       RNA_property_boolean_set_array(ptr, prop, i, values[i]);
-       }
+       if(prop)
+               RNA_property_boolean_set_array(ptr, prop, values);
        else
                printf("RNA_boolean_set_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1675,13 +1645,9 @@ void RNA_int_set(PointerRNA *ptr, const char *name, int value)
 void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       values[i]= RNA_property_int_get_array(ptr, prop, i);
-       }
+       if(prop)
+               RNA_property_int_get_array(ptr, prop, values);
        else
                printf("RNA_int_get_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1689,13 +1655,9 @@ void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
 void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       RNA_property_int_set_array(ptr, prop, i, values[i]);
-       }
+       if(prop)
+               RNA_property_int_set_array(ptr, prop, values);
        else
                printf("RNA_int_set_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1726,13 +1688,9 @@ void RNA_float_set(PointerRNA *ptr, const char *name, float value)
 void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       values[i]= RNA_property_float_get_array(ptr, prop, i);
-       }
+       if(prop)
+               RNA_property_float_get_array(ptr, prop, values);
        else
                printf("RNA_float_get_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1740,13 +1698,9 @@ void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
 void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
-       int i, length;
 
-       if(prop) {
-               length= RNA_property_array_length(ptr, prop);
-               for(i=0; i<length; i++)
-                       RNA_property_float_set_array(ptr, prop, i, values[i]);
-       }
+       if(prop)
+               RNA_property_float_set_array(ptr, prop, values);
        else
                printf("RNA_float_set_array: %s.%s not found.\n", ptr->type->identifier, name);
 }
@@ -1842,14 +1796,21 @@ void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
                printf("RNA_string_set: %s.%s not found.\n", ptr->type->identifier, name);
 }
 
-void RNA_pointer_get(PointerRNA *ptr, const char *name, PointerRNA *r_value)
+PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
 {
        PropertyRNA *prop= RNA_struct_find_property(ptr, name);
 
-       if(prop)
-               RNA_property_pointer_get(ptr, prop, r_value);
-       else
+       if(prop) {
+               return RNA_property_pointer_get(ptr, prop);
+       }
+       else {
+               PointerRNA result;
+
                printf("RNA_pointer_get: %s.%s not found.\n", ptr->type->identifier, name);
+
+               memset(&result, 0, sizeof(result));
+               return result;
+       }
 }
 
 void RNA_pointer_add(PointerRNA *ptr, const char *name)
@@ -1939,7 +1900,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
                else {
                        BLI_dynstr_append(dynstr, "(");
                        for(i=0; i<len; i++) {
-                               BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_array(ptr, prop, i) ? "True" : "False");
+                               BLI_dynstr_appendf(dynstr, i?", %s":"%s", RNA_property_boolean_get_index(ptr, prop, i) ? "True" : "False");
                        }
                        BLI_dynstr_append(dynstr, ")");
                }
@@ -1951,7 +1912,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
                else {
                        BLI_dynstr_append(dynstr, "(");
                        for(i=0; i<len; i++) {
-                               BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_array(ptr, prop, i));
+                               BLI_dynstr_appendf(dynstr, i?", %d":"%d", RNA_property_int_get_index(ptr, prop, i));
                        }
                        BLI_dynstr_append(dynstr, ")");
                }
@@ -1963,7 +1924,7 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
                else {
                        BLI_dynstr_append(dynstr, "(");
                        for(i=0; i<len; i++) {
-                               BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_array(ptr, prop, i));
+                               BLI_dynstr_appendf(dynstr, i?", %g":"%g", RNA_property_float_get_index(ptr, prop, i));
                        }
                        BLI_dynstr_append(dynstr, ")");
                }
index c378d8becb7bf6bc28da4340d9c933c52f5d1d50..f2b25dd44db3305b8cec5819a00b1f5cb64dd93e 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-
-static void rna_Bone_layer_set(PointerRNA *ptr, int index, int value)
+static void rna_Bone_layer_set(PointerRNA *ptr, const int *values)
 {
        Bone *bone= (Bone*)ptr->data;
+       int i, tot;
+
+       /* ensure we always have some layer selected */
+       for(i=0; i<20; i++)
+               if(values[i])
+                       tot++;
+       
+       if(tot==0)
+               return;
 
-       if(value) bone->layer |= (1<<index);
-       else {
-               bone->layer &= ~(1<<index);
-               if(bone->layer == 0)
-                       bone->layer |= (1<<index);
+       for(i=0; i<20; i++) {
+               if(values[i]) bone->layer |= (1<<i);
+               else bone->layer &= ~(1<<i);
        }
 }
 
-
-static void rna_Armature_layer_set(PointerRNA *ptr, int index, int value)
+static void rna_Armature_layer_set(PointerRNA *ptr, const int *values)
 {
        bArmature *arm= (bArmature*)ptr->data;
+       int i, tot;
+
+       /* ensure we always have some layer selected */
+       for(i=0; i<20; i++)
+               if(values[i])
+                       tot++;
+       
+       if(tot==0)
+               return;
 
-       if(value) arm->layer |= (1<<index);
-       else {
-               arm->layer &= ~(1<<index);
-               if(arm->layer == 0)
-                       arm->layer |= (1<<index);
+       for(i=0; i<20; i++) {
+               if(values[i]) arm->layer |= (1<<i);
+               else arm->layer &= ~(1<<i);
        }
 }
 
index 468a63734c42368b304f9ed6af39df197dfe86a6..69e2cba533133a2007ddd3e8cf8967d428524338 100644 (file)
@@ -40,10 +40,10 @@ static void rna_Brush_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *p
        rna_iterator_array_begin(iter, (void*)brush->mtex, sizeof(MTex*), MAX_MTEX, NULL);
 }
 
-static void *rna_Brush_active_texture_get(PointerRNA *ptr)
+static PointerRNA rna_Brush_active_texture_get(PointerRNA *ptr)
 {
        Brush *brush= (Brush*)ptr->data;
-       return brush->mtex[(int)brush->texact];
+       return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, brush->mtex[(int)brush->texact]);
 }
 
 static float rna_Brush_rotation_get(PointerRNA *ptr)
index aa2643fa48497b37e7e48b01a32acb535083a0ef..bfcdf8ce13d9652290353546707417dacf48c223 100644 (file)
@@ -111,16 +111,22 @@ static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value
        rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
 }
 
-static float rna_ClothSettings_gravity_get(PointerRNA *ptr, int index)
+static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values)
 {
        ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
-       return sim->gravity[index];
+
+       values[0]= sim->gravity[0];
+       values[1]= sim->gravity[1];
+       values[2]= sim->gravity[2];
 }
 
-static void rna_ClothSettings_gravity_set(PointerRNA *ptr, int index, float value)
+static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
 {
        ClothSimSettings *sim= (ClothSimSettings*)ptr->data;
-       sim->gravity[index]= value;
+
+       sim->gravity[0]= values[0];
+       sim->gravity[1]= values[1];
+       sim->gravity[2]= values[2];
 }
 
 #else
index e1be99365fe4533e8c0539e8565584fe3d209d48..1009859798d92725e86395eb0a5a7689ca4a140e 100644 (file)
@@ -63,17 +63,21 @@ static void rna_CurveMapping_clip_set(PointerRNA *ptr, int value)
        curvemapping_changed(cumap, 0);
 }
 
-static void rna_CurveMapping_black_level_set(PointerRNA *ptr, int index, float value)
+static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values)
 {
        CurveMapping *cumap= (CurveMapping*)ptr->data;
-       cumap->black[index]= value;
+       cumap->black[0]= values[0];
+       cumap->black[1]= values[1];
+       cumap->black[2]= values[2];
        curvemapping_set_black_white(cumap, NULL, NULL);
 }
 
-static void rna_CurveMapping_white_level_set(PointerRNA *ptr, int index, float value)
+static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *values)
 {
        CurveMapping *cumap= (CurveMapping*)ptr->data;
-       cumap->white[index]= value;
+       cumap->white[0]= values[0];
+       cumap->white[1]= values[1];
+       cumap->white[2]= values[2];
        curvemapping_set_black_white(cumap, NULL, NULL);
 }
 
@@ -208,7 +212,7 @@ static void rna_def_curvemapping(BlenderRNA *brna)
        RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
 
        prop= RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_CurveMapping_curves_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_CurveMapping_curves_length", 0, 0);
        RNA_def_property_struct_type(prop, "CurveMap");
        RNA_def_property_ui_text(prop, "Curves", "");
 
index 1f51b84a2c1e2abd7d8e9195ca0d09219e7eabda..4a422cecbd7cbd3cb98ac12e5d88e5927112ac98 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-
-static float rna_BezTriple_handle1_get(PointerRNA *ptr, int index)
+static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       return bt->vec[0][index];
+
+       values[0]= bt->vec[0][0];
+       values[1]= bt->vec[0][1];
+       values[2]= bt->vec[0][2];
 }
 
-static void rna_BezTriple_handle1_set(PointerRNA *ptr, int index, float value)
+static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       bt->vec[0][index]= value;
+
+       bt->vec[0][0]= values[0];
+       bt->vec[0][1]= values[1];
+       bt->vec[0][2]= values[2];
 }
 
-static float rna_BezTriple_handle2_get(PointerRNA *ptr, int index)
+static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       return bt->vec[2][index];
+
+       values[0]= bt->vec[2][0];
+       values[1]= bt->vec[2][1];
+       values[2]= bt->vec[2][2];
 }
 
-static void rna_BezTriple_handle2_set(PointerRNA *ptr, int index, float value)
+static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       bt->vec[2][index]= value;
+
+       bt->vec[2][0]= values[0];
+       bt->vec[2][1]= values[1];
+       bt->vec[2][2]= values[2];
 }
 
-static float rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, int index)
+static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       return bt->vec[1][index];
+
+       values[0]= bt->vec[1][0];
+       values[1]= bt->vec[1][1];
+       values[2]= bt->vec[1][2];
 }
 
-static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, int index, float value)
+static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
 {
        BezTriple *bt= (BezTriple*)ptr->data;
-       bt->vec[1][index]= value;
+
+       bt->vec[1][0]= values[0];
+       bt->vec[1][1]= values[1];
+       bt->vec[1][2]= values[2];
 }
 
 static int rna_Curve_texspace_editable(PointerRNA *ptr)
@@ -78,8 +95,7 @@ static int rna_Curve_texspace_editable(PointerRNA *ptr)
 
 #else
 
-
-void rna_def_bpoint(BlenderRNA *brna)
+static void rna_def_bpoint(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
@@ -120,7 +136,7 @@ void rna_def_bpoint(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for bevelling");
 }
 
-void rna_def_beztriple(BlenderRNA *brna)
+static void rna_def_beztriple(BlenderRNA *brna)
 {
        StructRNA *srna;
        PropertyRNA *prop;
index da3bc58426675a029abc59c7fb5d9cf67f3669ad..1393f266734a4c5192ca2bc20e9b5554d9fb9f83 100644 (file)
@@ -316,26 +316,13 @@ static StructDefRNA *rna_find_def_struct(StructRNA *srna)
        return NULL;
 }
 
-static PropertyDefRNA *rna_find_def_property(StructRNA *srna, PropertyRNA *prop)
-{
-       StructDefRNA *ds= rna_find_def_struct(srna);
-       PropertyDefRNA *dp;
-
-       if(ds)
-               for(dp=ds->properties.first; dp; dp=dp->next)
-                       if(dp->prop == prop)
-                               return dp;
-       
-       return NULL;
-}
-
 /* Struct Definition */
 
 StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
 {
        StructRNA *srna, *srnafrom= NULL;
        StructDefRNA *ds= NULL, *dsfrom= NULL;
-       PropertyRNA *prop, *propfrom;
+       PropertyRNA *prop;
        
        if(DefRNA.preprocess) {
                char error[512];
@@ -397,40 +384,8 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
                srna->flag |= STRUCT_RUNTIME;
 
        if(srnafrom) {
-               /* copy from struct to derive stuff, a bit clumsy since we can't
-                * use MEM_dupallocN, data structs may not be alloced but builtin */
-
-               for(propfrom= srnafrom->properties.first; propfrom; propfrom=propfrom->next) {
-                       prop= RNA_def_property(srna, propfrom->identifier, propfrom->type, propfrom->subtype);
-
-                       rna_remlink(&srna->properties, prop);
-                       memcpy(prop, propfrom, rna_property_type_sizeof(propfrom->type));
-
-                       if(!DefRNA.preprocess)
-                               prop->flag |= PROP_RUNTIME;
-
-                       prop->next= prop->prev= NULL;
-                       rna_addtail(&srna->properties, prop);
-
-                       if(propfrom == srnafrom->nameproperty)
-                               srna->nameproperty= prop;
-                       if(propfrom == srnafrom->iteratorproperty)
-                               srna->iteratorproperty= prop;
-
-                       if(DefRNA.preprocess) {
-                               PropertyDefRNA *dp, *dpfrom;
-                               
-                               dp= ds->properties.last;
-                               dpfrom= rna_find_def_property(srnafrom, propfrom);
-
-                               rna_remlink(&ds->properties, dp);
-                               memcpy(dp, dpfrom, sizeof(*dp));
-                               dp->srna= srna;
-                               dp->prop= prop;
-                               dp->next= dp->prev= NULL;
-                               rna_addtail(&ds->properties, dp);
-                       }
-               }
+               srna->nameproperty= srnafrom->nameproperty;
+               srna->iteratorproperty= srnafrom->iteratorproperty;
        }
        else {
                /* define some builtin properties */
@@ -440,14 +395,13 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
 
                if(DefRNA.preprocess) {
                        RNA_def_property_struct_type(prop, "Property");
-                       RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next", "rna_iterator_listbase_end", "rna_builtin_properties_get", 0, 0, 0, 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);
                }
                else {
 #ifdef RNA_RUNTIME
                        CollectionPropertyRNA *cprop= (CollectionPropertyRNA*)prop;
                        cprop->begin= rna_builtin_properties_begin;
                        cprop->next= rna_builtin_properties_next;
-                       cprop->next= rna_iterator_listbase_end;
                        cprop->get= rna_builtin_properties_get;
                        cprop->structtype= &RNA_Property;
 #endif
@@ -459,7 +413,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
 
                if(DefRNA.preprocess) {
                        RNA_def_property_struct_type(prop, "Struct");
-                       RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL);
+                       RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL);
                }
                else {
 #ifdef RNA_RUNTIME
@@ -748,6 +702,12 @@ void RNA_def_property_array(PropertyRNA *prop, int arraylength)
                return;
        }
 
+       if(arraylength>RNA_MAX_ARRAY) {
+               fprintf(stderr, "RNA_def_property_array: %s.%s, array length must be smaller than %d.\n", srna->identifier, prop->identifier, RNA_MAX_ARRAY);
+               DefRNA.error= 1;
+               return;
+       }
+
        switch(prop->type) {
                case PROP_BOOLEAN:
                case PROP_INT:
@@ -1499,7 +1459,7 @@ void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const cha
        }
 }
 
-void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *type, const char *set)
+void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set)
 {
        StructRNA *srna= DefRNA.laststruct;
 
@@ -1513,7 +1473,6 @@ void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const ch
                        PointerPropertyRNA *pprop= (PointerPropertyRNA*)prop;
 
                        if(get) pprop->get= (PropPointerGetFunc)get;
-                       if(type) pprop->type= (PropPointerTypeFunc)type;
                        if(set) pprop->set= (PropPointerSetFunc)set;
                        break;
                }
@@ -1524,7 +1483,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 *type, const char *length, const char *lookupint, const char *lookupstring)
+void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring)
 {
        StructRNA *srna= DefRNA.laststruct;
 
@@ -1541,7 +1500,6 @@ void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, con
                        if(next) cprop->next= (PropCollectionNextFunc)next;
                        if(end) cprop->end= (PropCollectionEndFunc)end;
                        if(get) cprop->get= (PropCollectionGetFunc)get;
-                       if(type) cprop->type= (PropCollectionTypeFunc)type;
                        if(length) cprop->length= (PropCollectionLengthFunc)length;
                        if(lookupint) cprop->lookupint= (PropCollectionLookupIntFunc)lookupint;
                        if(lookupstring) cprop->lookupstring= (PropCollectionLookupStringFunc)lookupstring;
index b4ff94792430c20b50fbc84a8089aeff4a674af5..35dddc122fedffaa14c76634b7800ce1e81ec765 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-void *rna_Group_objects_get(CollectionPropertyIterator *iter)
+PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter)
 {
        ListBaseIterator *internal= iter->internal;
 
        /* we are actually iterating a GroupObject list, so override get */
-       return ((GroupObject *)internal->link)->ob;
+       return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((GroupObject*)internal->link)->ob);
 }
 
 #else
@@ -60,7 +60,7 @@ void RNA_def_group(BlenderRNA *brna)
        RNA_def_property_collection_sdna(prop, NULL, "gobject", NULL);
        RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects.");
-       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0, 0);
+       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Group_objects_get", 0, 0, 0);
        
        prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
index 6ac96f7f4f67b95b3af474c7b317bea88bb3c96a..27ea74d63312cf248401a840be8a317d531272e7 100644 (file)
@@ -181,8 +181,8 @@ struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct Pointe
 
 void rna_builtin_properties_begin(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr);
 void rna_builtin_properties_next(struct CollectionPropertyIterator *iter);
-void *rna_builtin_properties_get(struct CollectionPropertyIterator *iter);
-void *rna_builtin_type_get(struct PointerRNA *ptr);
+PointerRNA rna_builtin_properties_get(struct CollectionPropertyIterator *iter);
+PointerRNA rna_builtin_type_get(struct PointerRNA *ptr);
 
 /* Iterators */
 
@@ -218,6 +218,10 @@ void rna_addtail(struct ListBase *listbase, void *vlink);
 void rna_freelinkN(struct ListBase *listbase, void *vlink);
 void rna_freelistN(struct ListBase *listbase);
 
+/* Pointer Handling */
+
+PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *type, void *data);
+
 #endif /* RNA_INTERNAL_H */
 
 
index 4b7577673b828797fbf25f33ed86c065fd2846be..0eea4ea5d3908379e9f4390f2b6ed4b7d4dd8baa 100644 (file)
@@ -34,6 +34,8 @@ struct PointerRNA;
 struct CollectionPropertyIterator;
 struct bContext;
 
+#define RNA_MAX_ARRAY 32
+
 /* Function Callbacks */
 
 typedef void (*UpdateFunc)(struct bContext *C, struct PointerRNA *ptr);
@@ -42,34 +44,32 @@ typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr);
 
 typedef int (*PropBooleanGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, int value);
-typedef int (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, int index);
-typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, int index, int value);
+typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, int *values);
+typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const int *values);
 typedef int (*PropIntGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value);
-typedef int (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int index);
-typedef void (*PropIntArraySetFunc)(struct PointerRNA *ptr, int index, int value);
+typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values);
+typedef void (*PropIntArraySetFunc)(struct PointerRNA *ptr, const int *values);
 typedef void (*PropIntRangeFunc)(struct PointerRNA *ptr, int *min, int *max);
 typedef float (*PropFloatGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropFloatSetFunc)(struct PointerRNA *ptr, float value);
-typedef float (*PropFloatArrayGetFunc)(struct PointerRNA *ptr, int index);
-typedef void (*PropFloatArraySetFunc)(struct PointerRNA *ptr, int index, float value);
+typedef void (*PropFloatArrayGetFunc)(struct PointerRNA *ptr, float *values);
+typedef void (*PropFloatArraySetFunc)(struct PointerRNA *ptr, const float *values);
 typedef void (*PropFloatRangeFunc)(struct PointerRNA *ptr, float *min, float *max);
 typedef void (*PropStringGetFunc)(struct PointerRNA *ptr, char *value);
 typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
 typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
 typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
 typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef void* (*PropPointerGetFunc)(struct PointerRNA *ptr);
-typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, void *value);
-typedef struct StructRNA* (*PropPointerTypeFunc)(struct PointerRNA *ptr);
+typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
+typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
 typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr);
 typedef void (*PropCollectionNextFunc)(struct CollectionPropertyIterator *iter);
 typedef void (*PropCollectionEndFunc)(struct CollectionPropertyIterator *iter);
-typedef void* (*PropCollectionGetFunc)(struct CollectionPropertyIterator *iter);
-typedef struct StructRNA* (*PropCollectionTypeFunc)(struct CollectionPropertyIterator *iter);
+typedef PointerRNA (*PropCollectionGetFunc)(struct CollectionPropertyIterator *iter);
 typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr);
-typedef void* (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key, struct StructRNA **type);
-typedef void* (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key, struct StructRNA **type);
+typedef PointerRNA (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key);
+typedef PointerRNA (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key);
 
 struct PropertyRNA {
        struct PropertyRNA *next, *prev;
@@ -185,7 +185,6 @@ typedef struct PointerPropertyRNA {
 
        PropPointerGetFunc get;
        PropPointerSetFunc set;
-       PropPointerTypeFunc type;       /* optional */
 
        struct StructRNA *structtype;
 } PointerPropertyRNA;
@@ -197,7 +196,6 @@ typedef struct CollectionPropertyRNA {
        PropCollectionNextFunc next;
        PropCollectionEndFunc end;                                              /* optional */
        PropCollectionGetFunc get;
-       PropCollectionTypeFunc type;                                    /* optional */
        PropCollectionLengthFunc length;                                /* optional */
        PropCollectionLookupIntFunc lookupint;                  /* optional */
        PropCollectionLookupStringFunc lookupstring;    /* optional */
index 2337bb46d6022861c25724f4e8bcc4d81cd8919c..753bd21d7b83b30143e9b9933195f80d66898bf3 100644 (file)
@@ -48,7 +48,7 @@ static Key *rna_ShapeKey_find_key(ID *id)
        }
 }
 
-static void *rna_ShapeKey_relative_key_get(PointerRNA *ptr)
+static PointerRNA rna_ShapeKey_relative_key_get(PointerRNA *ptr)
 {
        Key *key= rna_ShapeKey_find_key(ptr->id.data);
        KeyBlock *kb= (KeyBlock*)ptr->data, *kbrel;
@@ -57,21 +57,27 @@ static void *rna_ShapeKey_relative_key_get(PointerRNA *ptr)
        if(key && kb->relative < key->totkey)
                for(a=0, kbrel=key->block.first; kbrel; kbrel=kbrel->next, a++)
                        if(a == kb->relative)
-                               return kbrel;
+                               return rna_pointer_inherit_refine(ptr, &RNA_ShapeKey, kbrel);
 
-       return NULL;
+       return rna_pointer_inherit_refine(ptr, NULL, NULL);
 }
 
-static float rna_ShapeKeyPoint_co_get(PointerRNA *ptr, int index)
+static void rna_ShapeKeyPoint_co_get(PointerRNA *ptr, float *values)
 {
        float *vec= (float*)ptr->data;
-       return vec[index];
+
+       values[0]= vec[0];
+       values[1]= vec[1];
+       values[2]= vec[2];
 }
 
-static void rna_ShapeKeyPoint_co_set(PointerRNA *ptr, int index, float value)
+static void rna_ShapeKeyPoint_co_set(PointerRNA *ptr, const float *values)
 {
        float *vec= (float*)ptr->data;
-       vec[index]= value;
+
+       vec[0]= values[0];
+       vec[1]= values[1];
+       vec[2]= values[2];
 }
 
 static float rna_ShapeKeyCurvePoint_tilt_get(PointerRNA *ptr)
@@ -86,40 +92,58 @@ static void rna_ShapeKeyCurvePoint_tilt_set(PointerRNA *ptr, float value)
        vec[3]= value;
 }
 
-static float rna_ShapeKeyBezierPoint_co_get(PointerRNA *ptr, int index)
+static void rna_ShapeKeyBezierPoint_co_get(PointerRNA *ptr, float *values)
 {
        float *vec= (float*)ptr->data;
-       return vec[index+3];
+
+       values[0]= vec[0+3];
+       values[1]= vec[1+3];
+       values[2]= vec[2+3];
 }
 
-static void rna_ShapeKeyBezierPoint_co_set(PointerRNA *ptr, int index, float value)
+static void rna_ShapeKeyBezierPoint_co_set(PointerRNA *ptr, const float *values)
 {
        float *vec= (float*)ptr->data;
-       vec[index+3]= value;
+
+       vec[0+3]= values[0];
+       vec[1+3]= values[1];
+       vec[2+3]= values[2];
 }
 
-static float rna_ShapeKeyBezierPoint_handle_1_co_get(PointerRNA *ptr, int index)
+static void rna_ShapeKeyBezierPoint_handle_1_co_get(PointerRNA *ptr, float *values)
 {
        float *vec= (float*)ptr->data;
-       return vec[index];
+
+       values[0]= vec[0];
+       values[1]= vec[1];
+       values[2]= vec[2];
 }
 
-static void rna_ShapeKeyBezierPoint_handle_1_co_set(PointerRNA *ptr, int index, float value)
+static void rna_ShapeKeyBezierPoint_handle_1_co_set(PointerRNA *ptr, const float *values)
 {
        float *vec= (float*)ptr->data;
-       vec[index]= value;
+
+       vec[0]= values[0];
+       vec[1]= values[1];
+       vec[2]= values[2];
 }
 
-static float rna_ShapeKeyBezierPoint_handle_2_co_get(PointerRNA *ptr, int index)
+static void rna_ShapeKeyBezierPoint_handle_2_co_get(PointerRNA *ptr, float *values)
 {
        float *vec= (float*)ptr->data;
-       return vec[6+index];
+
+       values[0]= vec[6+0];
+       values[1]= vec[6+1];
+       values[2]= vec[6+2];
 }
 
-static void rna_ShapeKeyBezierPoint_handle_2_co_set(PointerRNA *ptr, int index, float value)
+static void rna_ShapeKeyBezierPoint_handle_2_co_set(PointerRNA *ptr, const float *values)
 {
        float *vec= (float*)ptr->data;
-       vec[6+index]= value;
+
+       vec[6+0]= values[0];
+       vec[6+1]= values[1];
+       vec[6+2]= values[2];
 }
 
 /*static float rna_ShapeKeyBezierPoint_tilt_get(PointerRNA *ptr)
@@ -174,9 +198,10 @@ static int rna_ShapeKey_data_length(PointerRNA *ptr)
        return tot;
 }
 
-static StructRNA *rna_ShapeKey_data_type(CollectionPropertyIterator *iter)
+static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter)
 {
        Key *key= rna_ShapeKey_find_key(iter->parent.id.data);
+       StructRNA *type;
        Curve *cu;
        Nurb *nu;
 
@@ -185,12 +210,14 @@ static StructRNA *rna_ShapeKey_data_type(CollectionPropertyIterator *iter)
                nu= cu->nurb.first;
 
                if(nu->bezt)
-                       return &RNA_ShapeKeyBezierPoint;
+                       type= &RNA_ShapeKeyBezierPoint;
                else
-                       return &RNA_ShapeKeyCurvePoint;
+                       type= &RNA_ShapeKeyCurvePoint;
        }
        else
-               return &RNA_ShapeKeyPoint;
+               type= &RNA_ShapeKeyPoint;
+       
+       return rna_pointer_inherit_refine(&iter->parent, type, rna_iterator_array_get(iter));
 }
 
 #else
@@ -287,7 +314,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "ShapeKey");
        RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key.");
-       RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get", NULL);
 
        prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
@@ -306,7 +333,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, 0, "rna_ShapeKey_data_type", "rna_ShapeKey_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", 0, 0, "rna_ShapeKey_data_get", "rna_ShapeKey_data_length", 0, 0);
 }
 
 static void rna_def_key(BlenderRNA *brna)
index 0f3612e2049ca945824a2e85a8ee6c5095ff9c09..80b7658c6ef9c794a1b00d3d44824884168aa249 100644 (file)
@@ -46,9 +46,9 @@ static void rna_Lamp_buffer_size_set(PointerRNA *ptr, int value)
        la->bufsize &= (~15); /* round to multiple of 16 */
 }
 
-static void *rna_Lamp_sky_settings_get(PointerRNA *ptr)
+static PointerRNA rna_Lamp_sky_settings_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_LampSkySettings, ptr->id.data);
 }
 
 static void rna_Lamp_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -57,10 +57,10 @@ static void rna_Lamp_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *pt
        rna_iterator_array_begin(iter, (void*)la->mtex, sizeof(MTex*), MAX_MTEX, NULL);
 }
 
-static void *rna_Lamp_active_texture_get(PointerRNA *ptr)
+static PointerRNA rna_Lamp_active_texture_get(PointerRNA *ptr)
 {
        Lamp *la= (Lamp*)ptr->data;
-       return la->mtex[(int)la->texact];
+       return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, la->mtex[(int)la->texact]);
 }
 
 static StructRNA* rna_Lamp_refine(struct PointerRNA *ptr)
@@ -645,7 +645,7 @@ static void rna_def_sun_lamp(BlenderRNA *brna)
        /* sky */
        prop= RNA_def_property(srna, "sky", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "LampSkySettings");
-       RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL);
        RNA_def_property_ui_text(prop, "Sky Settings", "Sky related settings for sun lamps.");
 }
 
index 37414abef885d29e4a26b797c9613334e42fd913..d18142b3fcd6329524eca259bf6ec2a0a4fa2b5d 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-static float rna_LatticePoint_co_get(PointerRNA *ptr, int index)
+static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values)
 {
        Lattice *lt= (Lattice*)ptr->id.data;
        BPoint *bp= (BPoint*)ptr->data;
        int a= bp - lt->def;
+       int x= a % lt->pntsu;
+       int y= (a/lt->pntsu) % lt->pntsv;
+       int z= (a/(lt->pntsu*lt->pntsv));
 
-       if(index == 0) {
-               int x= a % lt->pntsu;
-               return lt->fu + x*lt->du;
-       }
-       else if(index == 1) {
-               int y= (a/lt->pntsu) % lt->pntsv;
-               return lt->fv + y*lt->dv;
-       }
-       else {
-               int z= (a/(lt->pntsu*lt->pntsv));
-               return lt->fw + z*lt->dw;
-       }
+       values[0]= lt->fu + x*lt->du;
+       values[1]= lt->fv + y*lt->dv;
+       values[2]= lt->fw + z*lt->dw;
 }
 
 static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -105,7 +99,7 @@ static void rna_def_latticepoint(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Deformed Location", "");
 
        prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 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);
        RNA_def_property_struct_type(prop, "VertexGroupElement");
        RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of.");
 }
@@ -164,7 +158,7 @@ static void rna_def_lattice(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "LatticePoint");
-       RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 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);
        RNA_def_property_ui_text(prop, "Points", "Points of the lattice.");
 }
 
index a3500cecff99dff9ef26cdcdc7e631fbdfd7b077..6081147694b425dc1f0fd3126c3f376cbaa5d2bc 100644 (file)
@@ -46,11 +46,13 @@ static int rna_Main_filename_length(PointerRNA *ptr)
        return strlen(bmain->name);
 }
 
+#if 0
 static void rna_Main_filename_set(PointerRNA *ptr, const char *value)
 {
        Main *bmain= (Main*)ptr->data;
        BLI_strncpy(bmain->name, value, sizeof(bmain->name));
 }
+#endif
 
 static void rna_Main_scene_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
@@ -257,7 +259,7 @@ void RNA_def_main(BlenderRNA *brna)
        {
                prop= RNA_def_property(srna, lists[i][0], PROP_COLLECTION, PROP_NONE);
                RNA_def_property_struct_type(prop, lists[i][1]);
-               RNA_def_property_collection_funcs(prop, lists[i][2], "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 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);
                RNA_def_property_ui_text(prop, lists[i][3], lists[i][4]);
        }
 }
index e9370012e7257035a25011f063646e42f25135a4..de25be7d22f6f493d25b317da60fdc02afe47507 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-static void *rna_Material_self_get(PointerRNA *ptr)
+static PointerRNA rna_Material_mirror_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceMirror, ptr->id.data);
+}
+
+static PointerRNA rna_Material_transp_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_MaterialRaytraceTransparency, ptr->id.data);
+}
+
+static PointerRNA rna_Material_halo_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_MaterialHalo, ptr->id.data);
+}
+
+static PointerRNA rna_Material_sss_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_MaterialSubsurfaceScattering, ptr->id.data);
+}
+
+static PointerRNA rna_Material_strand_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_MaterialStrand, ptr->id.data);
 }
 
 static void rna_Material_mode_halo_set(PointerRNA *ptr, int value)
@@ -58,10 +78,10 @@ static void rna_Material_mtex_begin(CollectionPropertyIterator *iter, PointerRNA
        rna_iterator_array_begin(iter, (void*)ma->mtex, sizeof(MTex*), MAX_MTEX, NULL);
 }
 
-static void *rna_Material_active_texture_get(PointerRNA *ptr)
+static PointerRNA rna_Material_active_texture_get(PointerRNA *ptr)
 {
        Material *ma= (Material*)ptr->data;
-       return ma->mtex[(int)ma->texact];
+       return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, ma->mtex[(int)ma->texact]);
 }
 
 static void rna_MaterialStrand_start_size_range(PointerRNA *ptr, float *min, float *max)
@@ -762,27 +782,27 @@ void RNA_def_material(BlenderRNA *brna)
        /* nested structs */
        prop= RNA_def_property(srna, "raytrace_mirror", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "MaterialRaytraceMirror");
-       RNA_def_property_pointer_funcs(prop, "rna_Material_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Material_mirror_get", NULL);
        RNA_def_property_ui_text(prop, "Raytrace Mirror", "Raytraced reflection settings for the material.");
 
        prop= RNA_def_property(srna, "raytrace_transparency", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "MaterialRaytraceTransparency");
-       RNA_def_property_pointer_funcs(prop, "rna_Material_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Material_transp_get", NULL);
        RNA_def_property_ui_text(prop, "Raytrace Transparency", "Raytraced reflection settings for the material.");
 
        prop= RNA_def_property(srna, "halo", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "MaterialHalo");
-       RNA_def_property_pointer_funcs(prop, "rna_Material_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Material_halo_get", NULL);
        RNA_def_property_ui_text(prop, "Halo", "Halo settings for the material.");
 
        prop= RNA_def_property(srna, "subsurface_scattering", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "MaterialSubsurfaceScattering");
-       RNA_def_property_pointer_funcs(prop, "rna_Material_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Material_sss_get", NULL);
        RNA_def_property_ui_text(prop, "Subsurface Scattering", "Subsurface scattering settings for the material.");
 
        prop= RNA_def_property(srna, "strand", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "MaterialStrand");
-       RNA_def_property_pointer_funcs(prop, "rna_Material_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Material_strand_get", NULL);
        RNA_def_property_ui_text(prop, "Strand", "Strand settings for the material.");
 
        /* nodetree */
@@ -821,13 +841,13 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
        /* mtex */
        prop= RNA_def_property(srna, "textures", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, structname);
-       RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 0);
+       RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
        RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures.");
 
        prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, structname);
-       RNA_def_property_pointer_funcs(prop, activeget, NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, activeget, NULL);
        RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed.");
 
        prop= RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
index 66239d03dd8a4aaa0c6c10e118299215ff334102..569febd4af13829ee4461c575d4dd42304181fef 100644 (file)
@@ -80,52 +80,76 @@ static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
        medge->crease= (char)(CLAMPIS(value*255.0f, 0, 255));
 }
 
-static float rna_MeshColor_color1_get(PointerRNA *ptr, int index)
+static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       return (&mcol[0].r)[index]/255.0f;
+
+       values[0]= (&mcol[0].r)[0]/255.0f;
+       values[1]= (&mcol[0].r)[1]/255.0f;
+       values[2]= (&mcol[0].r)[2]/255.0f;
 }
 
-static void rna_MeshColor_color1_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshColor_color1_set(PointerRNA *ptr, const float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       (&mcol[0].r)[index]= (char)(CLAMPIS(value*255.0f, 0, 255));
+
+       (&mcol[0].r)[0]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+       (&mcol[0].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+       (&mcol[0].r)[2]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static float rna_MeshColor_color2_get(PointerRNA *ptr, int index)
+static void rna_MeshColor_color2_get(PointerRNA *ptr, float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       return (&mcol[1].r)[index]/255.0f;
+
+       values[0]= (&mcol[1].r)[0]/255.0f;
+       values[1]= (&mcol[1].r)[1]/255.0f;
+       values[2]= (&mcol[1].r)[2]/255.0f;
 }
 
-static void rna_MeshColor_color2_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshColor_color2_set(PointerRNA *ptr, const float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       (&mcol[1].r)[index]= (char)(CLAMPIS(value*255.0f, 0, 255));
+
+       (&mcol[1].r)[0]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+       (&mcol[1].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+       (&mcol[1].r)[2]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static float rna_MeshColor_color3_get(PointerRNA *ptr, int index)
+static void rna_MeshColor_color3_get(PointerRNA *ptr, float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       return (&mcol[2].r)[index]/255.0f;
+
+       values[0]= (&mcol[2].r)[0]/255.0f;
+       values[1]= (&mcol[2].r)[1]/255.0f;
+       values[2]= (&mcol[2].r)[2]/255.0f;
 }
 
-static void rna_MeshColor_color3_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshColor_color3_set(PointerRNA *ptr, const float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       (&mcol[2].r)[index]= (char)(CLAMPIS(value*255.0f, 0, 255));
+
+       (&mcol[2].r)[0]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+       (&mcol[2].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+       (&mcol[2].r)[2]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
-static float rna_MeshColor_color4_get(PointerRNA *ptr, int index)
+static void rna_MeshColor_color4_get(PointerRNA *ptr, float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       return (&mcol[2].r)[index]/255.0f;
+
+       values[0]= (&mcol[3].r)[0]/255.0f;
+       values[1]= (&mcol[3].r)[1]/255.0f;
+       values[2]= (&mcol[3].r)[2]/255.0f;
 }
 
-static void rna_MeshColor_color4_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshColor_color4_set(PointerRNA *ptr, const float *values)
 {
        MCol *mcol= (MCol*)ptr->data;
-       (&mcol[3].r)[index]= (char)(CLAMPIS(value*255.0f, 0, 255));
+
+       (&mcol[3].r)[0]= (char)(CLAMPIS(values[0]*255.0f, 0, 255));
+       (&mcol[3].r)[1]= (char)(CLAMPIS(values[1]*255.0f, 0, 255));
+       (&mcol[3].r)[2]= (char)(CLAMPIS(values[2]*255.0f, 0, 255));
 }
 
 static int rna_Mesh_texspace_editable(PointerRNA *ptr)
@@ -213,52 +237,68 @@ static int rna_Mesh_uv_layers_length(PointerRNA *ptr)
        return rna_CustomDataLayer_length(ptr, CD_MTFACE);
 }
 
-static float rna_MeshTextureFace_uv1_get(PointerRNA *ptr, int index)
+static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       return mtface->uv[0][index];
+       
+       values[0]= mtface->uv[0][0];
+       values[1]= mtface->uv[0][1];
 }
 
-static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshTextureFace_uv1_set(PointerRNA *ptr, const float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       mtface->uv[0][index]= value;
+
+       mtface->uv[0][0]= values[0];
+       mtface->uv[0][1]= values[1];
 }
 
-static float rna_MeshTextureFace_uv2_get(PointerRNA *ptr, int index)
+static void rna_MeshTextureFace_uv2_get(PointerRNA *ptr, float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       return mtface->uv[1][index];
+
+       values[0]= mtface->uv[1][0];
+       values[1]= mtface->uv[1][1];
 }
 
-static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshTextureFace_uv2_set(PointerRNA *ptr, const float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       mtface->uv[1][index]= value;
+
+       mtface->uv[1][0]= values[0];
+       mtface->uv[1][1]= values[1];
 }
 
-static float rna_MeshTextureFace_uv3_get(PointerRNA *ptr, int index)
+static void rna_MeshTextureFace_uv3_get(PointerRNA *ptr, float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       return mtface->uv[2][index];
+
+       values[0]= mtface->uv[2][0];
+       values[1]= mtface->uv[2][1];
 }
 
-static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshTextureFace_uv3_set(PointerRNA *ptr, const float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       mtface->uv[2][index]= value;
+
+       mtface->uv[2][0]= values[0];
+       mtface->uv[2][1]= values[1];
 }
 
-static float rna_MeshTextureFace_uv4_get(PointerRNA *ptr, int index)
+static void rna_MeshTextureFace_uv4_get(PointerRNA *ptr, float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       return mtface->uv[3][index];
+
+       values[0]= mtface->uv[3][0];
+       values[1]= mtface->uv[3][1];
 }
 
-static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, int index, float value)
+static void rna_MeshTextureFace_uv4_set(PointerRNA *ptr, const float *values)
 {
        MTFace *mtface= (MTFace*)ptr->data;
-       mtface->uv[3][index]= value;
+
+       mtface->uv[3][0]= values[0];
+       mtface->uv[3][1]= values[1];
 }
 
 static void rna_MeshTextureFaceLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -487,7 +527,7 @@ static void rna_def_mvert(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
 
        prop= RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
-       RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 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);
        RNA_def_property_struct_type(prop, "VertexGroupElement");
        RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of.");
 }
@@ -597,7 +637,7 @@ static void rna_def_mtface(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "MeshTextureFace");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_MeshTextureFaceLayer_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_MeshTextureFaceLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshTextureFaceLayer_data_length", 0, 0);
 
        srna= RNA_def_struct(brna, "MeshTextureFace", NULL);
        RNA_def_struct_sdna(srna, "MTFace");
@@ -732,7 +772,7 @@ static void rna_def_mcol(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "MeshColor");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_MeshColorLayer_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_MeshColorLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshColorLayer_data_length", 0, 0);
 
        srna= RNA_def_struct(brna, "MeshColor", NULL);
        RNA_def_struct_sdna(srna, "MCol");
@@ -776,7 +816,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "MeshFloatProperty");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_MeshFloatPropertyLayer_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_MeshFloatPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshFloatPropertyLayer_data_length", 0, 0);
 
        srna= RNA_def_struct(brna, "MeshFloatProperty", NULL);
        RNA_def_struct_sdna(srna, "MFloatProperty");
@@ -798,7 +838,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "MeshIntProperty");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_MeshIntPropertyLayer_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_MeshIntPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshIntPropertyLayer_data_length", 0, 0);
 
        srna= RNA_def_struct(brna, "MeshIntProperty", NULL);
        RNA_def_struct_sdna(srna, "MIntProperty");
@@ -820,7 +860,7 @@ static void rna_def_mproperties(BlenderRNA *brna)
        prop= RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "MeshStringProperty");
        RNA_def_property_ui_text(prop, "Data", "");
-       RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, "rna_MeshStringPropertyLayer_data_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_MeshStringPropertyLayer_data_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", "rna_MeshStringPropertyLayer_data_length", 0, 0);
 
        srna= RNA_def_struct(brna, "MeshStringProperty", NULL);
        RNA_def_struct_sdna(srna, "MStringProperty");
@@ -924,31 +964,31 @@ static void rna_def_mesh(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", 0, 0, 0, 0, "rna_Mesh_uv_layers_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", 0, 0, 0, "rna_Mesh_uv_layers_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
        RNA_def_property_ui_text(prop, "UV Layers", "");
 
        prop= RNA_def_property(srna, "vcol_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_vcol_layers_begin", 0, 0, 0, 0, "rna_Mesh_vcol_layers_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_vcol_layers_begin", 0, 0, 0, "rna_Mesh_vcol_layers_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshColorLayer");
        RNA_def_property_ui_text(prop, "Vertex Color Layers", "");
 
        prop= RNA_def_property(srna, "float_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_float_layers_begin", 0, 0, 0, "rna_Mesh_float_layers_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshFloatPropertyLayer");
        RNA_def_property_ui_text(prop, "Float Property Layers", "");
 
        prop= RNA_def_property(srna, "int_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_int_layers_begin", 0, 0, 0, "rna_Mesh_int_layers_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshIntPropertyLayer");
        RNA_def_property_ui_text(prop, "Int Property Layers", "");
 
        prop= RNA_def_property(srna, "string_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "fdata.layers", "fdata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_string_layers_begin", 0, 0, 0, "rna_Mesh_string_layers_length", 0, 0);
        RNA_def_property_struct_type(prop, "MeshStringPropertyLayer");
        RNA_def_property_ui_text(prop, "String Property Layers", "");
 
index 37529caf027b659b695a77fb0fcd1d91016d5374..5259ee41d7359405b7c19208a0aed469cbabec14 100644 (file)
@@ -940,7 +940,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_struct_type(prop, "Object");
-       RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0, 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);
        RNA_def_property_ui_text(prop, "Projectors", "");
 
        prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
index 508b8fd1fef8300bb22787d858d6b27205d6bc92..1588544966a2953c1aef70f68cccde2d714938a5 100644 (file)
@@ -103,7 +103,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
-       RNA_def_property_collection_funcs(prop, "rna_Nodetree_nodes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 0);
+       RNA_def_property_collection_funcs(prop, "rna_Nodetree_nodes_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
        RNA_def_property_struct_type(prop, "Node");
        RNA_def_property_ui_text(prop, "Nodes", "");
        
index a9164e6acee4bce9c6d4d7a3eefea8cbfc9c0028..f97249870a4fef1baf60032db7f4f717fd4c7fc2 100644 (file)
@@ -55,10 +55,10 @@ static int rna_VertexGroup_index_get(PointerRNA *ptr)
        return BLI_findindex(&ob->defbase, ptr->data);
 }
 
-static void *rna_Object_active_vertex_group_get(PointerRNA *ptr)
+static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
 {
        Object *ob= (Object*)ptr->id.data;
-       return BLI_findlink(&ob->defbase, ob->actdef);
+       return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef));
 }
 
 void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
@@ -165,19 +165,18 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in
        *max= ob->totcol-1;
 }
 
-static void *rna_Object_active_material_get(PointerRNA *ptr)
+static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
 {
        Object *ob= (Object*)ptr->id.data;
-
-       return give_current_material(ob, ob->actcol);
+       return rna_pointer_inherit_refine(ptr, &RNA_Material, give_current_material(ob, ob->actcol));
 }
 
 #if 0
-static void rna_Object_active_material_set(PointerRNA *ptr, void *value)
+static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
 {
        Object *ob= (Object*)ptr->id.data;
 
-       assign_material(ob, value, ob->actcol);
+       assign_material(ob, value.data, ob->actcol);
 }
 #endif
 
@@ -197,32 +196,46 @@ static void rna_Object_active_material_link_set(PointerRNA *ptr, int value)
                ob->colbits &= ~(1<<(ob->actcol));
 }
 
-static void *rna_Object_game_settings_get(PointerRNA *ptr)
+static PointerRNA rna_Object_game_settings_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_GameObjectSettings, ptr->id.data);
 }
 
-static void rna_Object_layer_set(PointerRNA *ptr, int index, int value)
+static void rna_Object_layer_set(PointerRNA *ptr, const int *values)
 {
        Object *ob= (Object*)ptr->data;
+       int i, tot;
+
+       /* ensure we always have some layer selected */
+       for(i=0; i<20; i++)
+               if(values[i])
+                       tot++;
+       
+       if(tot==0)
+               return;
 
-       if(value) ob->lay |= (1<<index);
-       else {
-               ob->lay &= ~(1<<index);
-               if(ob->lay == 0)
-                       ob->lay |= (1<<index);
+       for(i=0; i<20; i++) {
+               if(values[i]) ob->lay |= (1<<i);
+               else ob->lay &= ~(1<<i);
        }
 }
 
-static void rna_GameObjectSettings_state_set(PointerRNA *ptr, int index, int value)
+static void rna_GameObjectSettings_state_set(PointerRNA *ptr, const int *values)
 {
        Object *ob= (Object*)ptr->data;
+       int i, tot;
+
+       /* ensure we always have some stateer selected */
+       for(i=0; i<20; i++)
+               if(values[i])
+                       tot++;
+       
+       if(tot==0)
+               return;
 
-       if(value) ob->state |= (1<<index);
-       else {
-               ob->state &= ~(1<<index);
-               if(ob->state == 0)
-                       ob->state |= (1<<index);
+       for(i=0; i<20; i++) {
+               if(values[i]) ob->state |= (1<<i);
+               else ob->state &= ~(1<<i);
        }
 }
 
@@ -539,7 +552,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
        prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Material");
-       RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL);
        RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed.");
 
        prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
@@ -612,7 +625,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "game", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "GameObjectSettings");
-       RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Object_game_settings_get", NULL);
        RNA_def_property_ui_text(prop, "Game Settings", "Game engine related settings for the object.");
 
        /* vertex groups */
@@ -624,7 +637,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
 
        prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
        RNA_def_property_struct_type(prop, "VertexGroup");
-       RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", NULL);
        RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object.");
 
        /* empty */
index 5b0c1372c2d0f7e55795259b1787a39c90c63500..2d19e2c177d887443ac187e5fcb811e65e940023 100644 (file)
@@ -64,26 +64,33 @@ static int rna_Struct_name_length(PointerRNA *ptr)
        return strlen(((StructRNA*)ptr->data)->name);
 }
 
-static void *rna_Struct_base_get(PointerRNA *ptr)
+static PointerRNA rna_Struct_base_get(PointerRNA *ptr)
 {
-       return ((StructRNA*)ptr->data)->base;
+       return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA*)ptr->data)->base);
 }
 
-static void *rna_Struct_nested_get(PointerRNA *ptr)
+static PointerRNA rna_Struct_nested_get(PointerRNA *ptr)
 {
-       return ((StructRNA*)ptr->data)->nested;
+       return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA*)ptr->data)->nested);
 }
 
-static void *rna_Struct_name_property_get(PointerRNA *ptr)
+static PointerRNA rna_Struct_name_property_get(PointerRNA *ptr)
 {
-       return ((StructRNA*)ptr->data)->nameproperty;
+       return rna_pointer_inherit_refine(ptr, &RNA_Property, ((StructRNA*)ptr->data)->nameproperty);
 }
 
+/* Struct property iteration. This is quite complicated, the purpose is to
+ * iterate over properties of all inheritance levels, and for each struct to
+ * also iterator over id properties not known by RNA. */
+
 static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
 {
        IDProperty *idprop= (IDProperty*)data;
        PropertyRNA *prop;
 
+       /* function to skip any id properties that are already known by RNA,
+        * for the second loop where we go over unknown id properties */
+
        for(prop= iter->parent.type->properties.first; prop; prop=prop->next)
                if(strcmp(prop->identifier, idprop->name) == 0)
                        return 1;
@@ -94,9 +101,41 @@ static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
 static int rna_property_builtin(CollectionPropertyIterator *iter, void *data)
 {
        PropertyRNA *prop= (PropertyRNA*)data;
+
+       /* function to skip builtin rna properties */
+
        return (prop->flag & PROP_BUILTIN);
 }
 
+static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter, IteratorSkipFunc skip)
+{
+       /* RNA struct inheritance */
+       while(!iter->valid && iter->level > 0) {
+               StructRNA *srna;
+               int i;
+
+               srna= (StructRNA*)iter->parent.data;
+               iter->level--;
+               for(i=iter->level; i>0; i--)
+                       srna= srna->base;
+
+               rna_iterator_listbase_end(iter);
+               rna_iterator_listbase_begin(iter, &srna->properties, skip);
+       }
+}
+
+static void rna_inheritance_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+{
+       rna_iterator_listbase_begin(iter, lb, skip);
+       rna_inheritance_next_level_restart(iter, skip);
+}
+
+static void rna_inheritance_listbase_next(CollectionPropertyIterator *iter, IteratorSkipFunc skip)
+{
+       rna_iterator_listbase_next(iter);
+       rna_inheritance_next_level_restart(iter, skip);
+}
+
 static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
 {
        ListBaseIterator *internal= iter->internal;
@@ -108,7 +147,7 @@ static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
        }
        else {
                /* regular properties */
-               rna_iterator_listbase_next(iter);
+               rna_inheritance_listbase_next(iter, rna_property_builtin);
 
                /* try id properties */
                if(!iter->valid) {
@@ -126,23 +165,37 @@ static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
 
 static void rna_Struct_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
-       rna_iterator_listbase_begin(iter, &((StructRNA*)ptr->data)->properties, rna_property_builtin);
+       StructRNA *srna;
+
+       /* here ptr->data should always be the same as iter->parent.type */
+       srna= (StructRNA *)ptr->data;
+
+       while(srna->base) {
+               iter->level++;
+               srna= srna->base;
+       }
+
+       rna_inheritance_listbase_begin(iter, &srna->properties, rna_property_builtin);
 }
 
-static void *rna_Struct_properties_get(CollectionPropertyIterator *iter)
+static PointerRNA rna_Struct_properties_get(CollectionPropertyIterator *iter)
 {
        ListBaseIterator *internal= iter->internal;
 
        /* we return either PropertyRNA* or IDProperty*, the rna_access.c
         * functions can handle both as PropertyRNA* with some tricks */
-       return internal->link;
+       return rna_pointer_inherit_refine(&iter->parent, &RNA_Property, internal->link);
 }
 
+/* Builtin properties iterator re-uses the Struct properties iterator, only
+ * difference is that we need to see the ptr data to the type of the struct
+ * whose properties we want to iterate over. */
+
 void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
        PointerRNA newptr;
 
-       /* we create a new with the type as the data */
+       /* we create a new pointer with the type as the data */
        newptr.type= &RNA_Struct;
        newptr.data= ptr->type;
 
@@ -155,6 +208,8 @@ void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *
                newptr.id.data= NULL;
        }
 
+       iter->parent= newptr;
+
        rna_Struct_properties_begin(iter, &newptr);
 }
 
@@ -163,14 +218,14 @@ void rna_builtin_properties_next(CollectionPropertyIterator *iter)
        rna_Struct_properties_next(iter);
 }
 
-void *rna_builtin_properties_get(CollectionPropertyIterator *iter)
+PointerRNA rna_builtin_properties_get(CollectionPropertyIterator *iter)
 {
        return rna_Struct_properties_get(iter);
 }
 
-void *rna_builtin_type_get(PointerRNA *ptr)
+PointerRNA rna_builtin_type_get(PointerRNA *ptr)
 {
-       return ptr->type;
+       return rna_pointer_inherit_refine(ptr, &RNA_Struct, ptr->type);
 }
 
 /* Property */
@@ -382,18 +437,18 @@ static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
        return ((EnumPropertyItem*)ptr->data)->value;
 }
 
-static void *rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
+static PointerRNA rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
 {
        PropertyRNA *prop= (PropertyRNA*)ptr->data;
        rna_idproperty_check(&prop, ptr);
-       return ((PointerPropertyRNA*)prop)->structtype;
+       return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((PointerPropertyRNA*)prop)->structtype);
 }
 
-static void *rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
+static PointerRNA rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
 {
        PropertyRNA *prop= (PropertyRNA*)ptr->data;
        rna_idproperty_check(&prop, ptr);
-       return ((CollectionPropertyRNA*)prop)->structtype;
+       return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA*)prop)->structtype);
 }
 
 /* Blender RNA */
@@ -432,25 +487,25 @@ static void rna_def_struct(BlenderRNA *brna)
        prop= RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Struct");
-       RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL);
        RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from.");
 
        prop= RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Struct");
-       RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL);
        RNA_def_property_ui_text(prop, "Nested", "Struct in which this struct is always nested, and to which it logically belongs.");
 
        prop= RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "StringProperty");
-       RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL);
        RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct.");
 
        prop= RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Property");
-       RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next", "rna_iterator_listbase_end", "rna_Struct_properties_get", 0, 0, 0, 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);
        RNA_def_property_ui_text(prop, "Properties", "Properties in the struct.");
 }
 
@@ -584,7 +639,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
        prop= RNA_def_property(srna, "items", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "EnumPropertyItem");
-       RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_get", 0, 0, 0, 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);
        RNA_def_property_ui_text(prop, "Items", "Possible values for the property.");
 
        srna= RNA_def_struct(brna, "EnumPropertyItem", NULL);
@@ -615,9 +670,9 @@ static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Struct");
        if(type == PROP_POINTER)
-               RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL);
+               RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL);
        else
-               RNA_def_property_pointer_funcs(prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL);
+               RNA_def_property_pointer_funcs(prop, "rna_CollectionProperty_fixed_type_get", NULL);
        RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type.");
 }
 
@@ -674,7 +729,7 @@ void RNA_def_rna(BlenderRNA *brna)
        prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_flag(prop, PROP_NOT_EDITABLE);
        RNA_def_property_struct_type(prop, "Struct");
-       RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0, 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);
        RNA_def_property_ui_text(prop, "Structs", "");
 }
 
index 2b88a53957266256034ef4f3dd270ce5d02dff3a..e383d24632a9a87b29685a7c18395730710dffd1 100644 (file)
 #include "BKE_context.h"
 #include "BKE_global.h"
 
-void *rna_Scene_objects_get(CollectionPropertyIterator *iter)
+PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
 {
        ListBaseIterator *internal= iter->internal;
 
        /* we are actually iterating a Base list, so override get */
-       return ((Base*)internal->link)->object;
+       return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((Base*)internal->link)->object);
 }
 
-static void rna_Scene_layer_set(PointerRNA *ptr, int index, int value)
+static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
 {
        Scene *scene= (Scene*)ptr->data;
+       int i, tot;
 
-       if(value) scene->lay |= (1<<index);
-       else {
-               scene->lay &= ~(1<<index);
-               if(scene->lay == 0)
-                       scene->lay |= (1<<index);
+       /* ensure we always have some layer selected */
+       for(i=0; i<20; i++)
+               if(values[i])
+                       tot++;
+       
+       if(tot==0)
+               return;
+
+       for(i=0; i<20; i++) {
+               if(values[i]) scene->lay |= (1<<i);
+               else scene->lay &= ~(1<<i);
        }
 }
 
@@ -175,7 +182,7 @@ void RNA_def_scene(BlenderRNA *brna)
        RNA_def_property_collection_sdna(prop, NULL, "base", NULL);
        RNA_def_property_struct_type(prop, "Object");
        RNA_def_property_ui_text(prop, "Objects", "");
-       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0, 0);
+       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_Scene_objects_get", 0, 0, 0);
 
        prop= RNA_def_property(srna, "visible_layers", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "lay", 1);
index f67c36427b702325b79c615bd29cc8b9456531d0..9508357233c2af8be4c14831c5a69fc21cfaea9a 100644 (file)
@@ -75,7 +75,7 @@ static void rna_def_region(BlenderRNA *brna)
        StructRNA *srna;
        
        srna= RNA_def_struct(brna, "Region", NULL);
-       RNA_def_struct_ui_text(srna, "Region", "Region in a subdivid screen area.");
+       RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area.");
        RNA_def_struct_sdna(srna, "ARegion");
 }
 
index 19b832deb7dcf9a2e1996890cf4299d947a91b38..18af7913456b763c3b96269e6fd1974f8b41dbee 100644 (file)
@@ -98,12 +98,12 @@ static StructRNA* rna_Sequence_refine(struct PointerRNA *ptr)
        }
 }
 
-static void *rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter)
+static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter)
 {
        ListBaseIterator *internal= iter->internal;
        MetaStack *ms= (MetaStack*)internal->link;
 
-       return (Sequence*)ms->parseq;
+       return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
 }
 
 #else
@@ -154,7 +154,7 @@ static void rna_def_strip_transform(BlenderRNA *brna)
        PropertyRNA *prop;
        
        srna = RNA_def_struct(brna, "SequenceTransform", NULL);
-       RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform paramaters for a sequence strip.");
+       RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip.");
        RNA_def_struct_sdna(srna, "StripTransform");
 
        prop= RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
@@ -188,7 +188,7 @@ static void rna_def_strip_color_balance(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna = RNA_def_struct(brna, "SequenceColorBalance", NULL);
-       RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance paramaters for a sequence strip.");
+       RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip.");
        RNA_def_struct_sdna(srna, "StripColorBalance");
 
        prop= RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR);
@@ -384,7 +384,7 @@ void rna_def_editor(BlenderRNA *brna)
        RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
        RNA_def_property_struct_type(prop, "Sequence");
        RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip.");
-       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0, 0);
+       RNA_def_property_collection_funcs(prop, 0, 0, 0, "rna_SequenceEdtior_meta_stack_get", 0, 0, 0);
 }
 
 static void rna_def_filter_video(StructRNA *srna)
index 953a2de8b90b21665682d92cc0bf1798a2c31df3..2aeb1b984fb07b54f910344defbb061335058aab 100644 (file)
@@ -98,7 +98,7 @@ static void rna_def_soundlistener(BlenderRNA *brna)
 
        srna= RNA_def_struct(brna, "SoundListener", "ID");
        RNA_def_struct_sdna(srna, "bSoundListener");
-       RNA_def_struct_ui_text(srna, "Sound Listener", "Sound listener defining paramaters about how sounds are played.");
+       RNA_def_struct_ui_text(srna, "Sound Listener", "Sound listener defining parameters about how sounds are played.");
 
        prop= RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
        RNA_def_property_ui_text(prop, "Gain", "Overall volume for Game Engine sound.");
index 37deb252fbe4a7f52205c032a2813520a90894cc..33f386fd35a4caa17cd260747999619f048eec5a 100644 (file)
@@ -75,9 +75,9 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
        }
 }
 
-static void *rna_SpaceImage_self_get(PointerRNA *ptr)
+static PointerRNA rna_SpaceImage_uvedit_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
 }
 
 #else
@@ -264,7 +264,7 @@ static void rna_def_space_image(BlenderRNA *brna)
        /* uv */
        prop= RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "SpaceUVEditor");
-       RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_SpaceImage_uvedit_get", NULL);
        RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings.");
        
        /* paint */
index 07f904fed2dd108c676d279454c28c701ba10e96..80b9e56eff55ce6f6a0b89b4bb72564cb974dd8c 100644 (file)
@@ -83,6 +83,7 @@ static int rna_TextLine_line_length(PointerRNA *ptr)
        return line->len;
 }
 
+#if 0
 static void rna_TextLine_line_set(PointerRNA *ptr, const char *value)
 {
        TextLine *line= (TextLine*)ptr->data;
@@ -99,6 +100,7 @@ static void rna_TextLine_line_set(PointerRNA *ptr, const char *value)
                line->len= 0;
        }
 }
+#endif
 
 #else
 
index 0f6a5361277626a2e6af6a23523e7d3a9a792eec..112ac8af042af25d666186cea006a07f7fa34b4d 100644 (file)
@@ -86,11 +86,35 @@ static void rna_userdef_autokeymode_set(struct PointerRNA *ptr,int value)
        }
 }
 
-static void *rna_UserDef_self_get(PointerRNA *ptr)
+static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
 {
-       return ptr->data;
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesView, ptr->data);
 }
 
+static PointerRNA rna_UserDef_edit_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesEdit, ptr->data);
+}
+
+static PointerRNA rna_UserDef_autosave_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesAutosave, ptr->data);
+}
+
+static PointerRNA rna_UserDef_language_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesLanguage, ptr->data);
+}
+
+static PointerRNA rna_UserDef_filepaths_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesFilePaths, ptr->data);
+}
+
+static PointerRNA rna_UserDef_system_get(PointerRNA *ptr)
+{
+       return rna_pointer_inherit_refine(ptr, &RNA_UserPreferencesSystem, ptr->data);
+}
 
 #else
 
@@ -1753,34 +1777,34 @@ void RNA_def_userdef(BlenderRNA *brna)
        RNA_def_property_ui_text(prop, "Themes", "");
        
        /* nested structs */
-       prop= RNA_def_property(srna, "userpreferences_view", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "view", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesView");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_view_get", NULL);
        RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data.");
 
-       prop= RNA_def_property(srna, "userpreferences_edit", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "edit", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesEdit");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL);
        RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data.");
        
-       prop= RNA_def_property(srna, "userpreferences_autosave", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "autosave", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesAutosave");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_autosave_get", NULL);
        RNA_def_property_ui_text(prop, "Auto Save", "Automatic backup file settings.");
 
-       prop= RNA_def_property(srna, "userpreferences_language", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "language", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesLanguage");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_language_get", NULL);
        RNA_def_property_ui_text(prop, "Language & Font", "User interface translation settings.");
        
-       prop= RNA_def_property(srna, "userpreferences_filepaths", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesFilePaths");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_filepaths_get", NULL);
        RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files.");
        
-       prop= RNA_def_property(srna, "userpreferences_system", PROP_POINTER, PROP_NEVER_NULL);
+       prop= RNA_def_property(srna, "system", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "UserPreferencesSystem");
-       RNA_def_property_pointer_funcs(prop, "rna_UserDef_self_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_UserDef_system_get", NULL);
        RNA_def_property_ui_text(prop, "System & OpenGL", "Graphics driver and operating system settings.");
        
        rna_def_userdef_view(brna);
index 632c3a2f96ca5cf23f07b491491655ba2c597c9f..69e7578da1af204c552f8a887c8841cec4626269 100644 (file)
@@ -69,10 +69,10 @@ static int rna_Operator_name_length(PointerRNA *ptr)
        return strlen(op->type->name);
 }
 
-static void *rna_Operator_properties_get(PointerRNA *ptr)
+static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
 {
        wmOperator *op= (wmOperator*)ptr->data;
-       return op->properties;
+       return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties);
 }
 
 #else
@@ -83,7 +83,7 @@ static void rna_def_operator(BlenderRNA *brna)
        PropertyRNA *prop;
 
        srna= RNA_def_struct(brna, "Operator", NULL);
-       RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being or executed, or registered after execution.");
+       RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being executed, or registered after execution.");
        RNA_def_struct_sdna(srna, "wmOperator");
 
        prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
@@ -95,7 +95,7 @@ static void rna_def_operator(BlenderRNA *brna)
        prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "OperatorProperties");
        RNA_def_property_ui_text(prop, "Properties", "");
-       RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL);
 
        srna= RNA_def_struct(brna, "OperatorProperties", NULL);
        RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator.");
index 918e2191588ada831019be22342012d110bb99cd..0296361da56ec3d5b852957a8a580499d73638dd 100644 (file)
 
 #ifdef RNA_RUNTIME
 
-static void *rna_World_ambient_occlusion_get(PointerRNA *ptr)
+static PointerRNA rna_World_ambient_occlusion_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_WorldAmbientOcclusion, ptr->id.data);
 }
 
-static void *rna_World_stars_get(PointerRNA *ptr)
+static PointerRNA rna_World_stars_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_WorldStarsSettings, ptr->id.data);
 }
 
-static void *rna_World_mist_get(PointerRNA *ptr)
+static PointerRNA rna_World_mist_get(PointerRNA *ptr)
 {
-       return ptr->id.data;
+       return rna_pointer_inherit_refine(ptr, &RNA_WorldMistSettings, ptr->id.data);
 }
 
 static void rna_World_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -57,11 +57,11 @@ static void rna_World_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *p
        rna_iterator_array_begin(iter, (void*)wo->mtex, sizeof(MTex*), MAX_MTEX, NULL);
 }
 
-static void *rna_World_active_texture_get(PointerRNA *ptr)
+static PointerRNA rna_World_active_texture_get(PointerRNA *ptr)
 {
        World *wo= (World*)ptr->data;
 
-       return wo->mtex[(int)wo->texact];
+       return rna_pointer_inherit_refine(ptr, &RNA_TextureSlot, wo->mtex[(int)wo->texact]);
 }
 
 #else
@@ -137,7 +137,7 @@ static void rna_def_ambient_occlusion(BlenderRNA *brna)
        static EnumPropertyItem prop_sample_method_items[] = {
                {WO_AOSAMP_CONSTANT, "CONSTANT_JITTERED", "Constant Jittered", ""},
                {WO_AOSAMP_HALTON, "ADAPTIVE_QMC", "Adaptive QMC", "Fast in high-contrast areas."},
-               {WO_AOSAMP_HAMMERSLEY, "ADAPTIVE_QMC", "Constant QMC", "Best quality."},
+               {WO_AOSAMP_HAMMERSLEY, "CONSTANT_QMC", "Constant QMC", "Best quality."},
                {0, NULL, NULL, NULL}};
 
        static EnumPropertyItem prop_gather_method_items[] = {
@@ -396,17 +396,17 @@ void RNA_def_world(BlenderRNA *brna)
        /* nested structs */
        prop= RNA_def_property(srna, "ambient_occlusion", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "WorldAmbientOcclusion");
-       RNA_def_property_pointer_funcs(prop, "rna_World_ambient_occlusion_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_World_ambient_occlusion_get", NULL);
        RNA_def_property_ui_text(prop, "Ambient Occlusion", "World ambient occlusion settings.");
 
        prop= RNA_def_property(srna, "mist", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "WorldMistSettings");
-       RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL);
        RNA_def_property_ui_text(prop, "Mist", "World mist settings.");
 
        prop= RNA_def_property(srna, "stars", PROP_POINTER, PROP_NEVER_NULL);
        RNA_def_property_struct_type(prop, "WorldStarsSettings");
-       RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_World_stars_get", NULL);
        RNA_def_property_ui_text(prop, "Stars", "World stars settings.");
 
        prop= RNA_def_property(srna, "script_link", PROP_POINTER, PROP_NEVER_NULL);
index 4156db21507b59e0d2f87bbfd3ef591d2d28b962..35febecfe157e2391d02afe951b025a64f98cc24 100644 (file)
@@ -163,7 +163,7 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
        case PROP_POINTER:
        {
                PointerRNA newptr;
-               RNA_property_pointer_get(ptr, prop, &newptr);
+               newptr= RNA_property_pointer_get(ptr, prop);
                if (newptr.data) {
                        ret = pyrna_struct_CreatePyObject(&newptr);
                } else {
@@ -209,7 +209,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                switch (type) {
                case PROP_BOOLEAN:
                {
-                       signed char *param_arr = MEM_mallocN(sizeof(char) * len, "pyrna bool array");
+                       int *param_arr = MEM_mallocN(sizeof(char) * len, "pyrna bool array");
                        
                        /* collect the variables before assigning, incase one of them is incorrect */
                        for (i=0; i<len; i++) {
@@ -224,9 +224,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                }
                        }
                        
-                       for (i=0; i<len; i++) {
-                               RNA_property_boolean_set_array(ptr, prop, i, param_arr[i]);
-                       }
+                       RNA_property_boolean_set_array(ptr, prop, param_arr);
                        
                        MEM_freeN(param_arr);
                        break;
@@ -248,9 +246,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                return -1;
                        }
                        
-                       for (i=0; i<len; i++) {
-                               RNA_property_int_set_array(ptr, prop, i, param_arr[i]);
-                       }
+                       RNA_property_int_set_array(ptr, prop, param_arr);
                        
                        MEM_freeN(param_arr);
                        break;
@@ -272,9 +268,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, PyObject *value)
                                return -1;
                        }
                        
-                       for (i=0; i<len; i++) {
-                               RNA_property_float_set_array(ptr, prop, i, param_arr[i]);
-                       }
+                       RNA_property_float_set_array(ptr, prop, param_arr);
                        
                        MEM_freeN(param_arr);
                        break;
@@ -385,13 +379,13 @@ static PyObject * pyrna_prop_to_py_index(PointerRNA *ptr, PropertyRNA *prop, int
        /* see if we can coorce into a python type - PropertyType */
        switch (type) {
        case PROP_BOOLEAN:
-               ret = PyBool_FromLong( RNA_property_boolean_get_array(ptr, prop, index) );
+               ret = PyBool_FromLong( RNA_property_boolean_get_index(ptr, prop, index) );
                break;
        case PROP_INT:
-               ret = PyLong_FromSize_t( (size_t)RNA_property_int_get_array(ptr, prop, index) );
+               ret = PyLong_FromSize_t( (size_t)RNA_property_int_get_index(ptr, prop, index) );
                break;
        case PROP_FLOAT:
-               ret = PyFloat_FromDouble( RNA_property_float_get_array(ptr, prop, index) );
+               ret = PyFloat_FromDouble( RNA_property_float_get_index(ptr, prop, index) );
                break;
        default:
                PyErr_SetString(PyExc_AttributeError, "not an array type");
@@ -419,7 +413,7 @@ static int pyrna_py_to_prop_index(PointerRNA *ptr, PropertyRNA *prop, int index,
                        PyErr_SetString(PyExc_TypeError, "expected True/False or 0/1");
                        ret = -1;
                } else {
-                       RNA_property_boolean_set_array(ptr, prop, index, param);
+                       RNA_property_boolean_set_index(ptr, prop, index, param);
                }
                break;
        }
@@ -430,7 +424,7 @@ static int pyrna_py_to_prop_index(PointerRNA *ptr, PropertyRNA *prop, int index,
                        PyErr_SetString(PyExc_TypeError, "expected an int type");
                        ret = -1;
                } else {
-                       RNA_property_int_set_array(ptr, prop, index, param);
+                       RNA_property_int_set_index(ptr, prop, index, param);
                }
                break;
        }
@@ -441,7 +435,7 @@ static int pyrna_py_to_prop_index(PointerRNA *ptr, PropertyRNA *prop, int index,
                        PyErr_SetString(PyExc_TypeError, "expected a float type");
                        ret = -1;
                } else {
-                       RNA_property_float_set_array(ptr, prop, index, param);
+                       RNA_property_float_set_index(ptr, prop, index, param);
                }
                break;
        }
@@ -679,7 +673,7 @@ PyObject *pyrna_struct_to_docstring(BPy_StructRNA *self)
                                
                                // TODO - why does this crash sometimes
                                // PointerRNA newptr;
-                               // RNA_property_pointer_get(&iter.ptr, prop, &newptr);
+                               // newptr= RNA_property_pointer_get(&iter.ptr, prop);
                                
                                // Use this instead, its not that useful
                                BLI_dynstr_appendf(dynstr, "@type %s: PyRNA %s\n", identifier, RNA_struct_identifier(&iter.ptr));