Merge with 2.5 -r 21619:21756.
[blender.git] / source / blender / makesrna / intern / makesrna.c
index ded8db61b7ce6cb5391c3d52d0719025ae97ea60..63ce5786ae30e6703b0d63e0e4a63b0b43f0eb3c 100644 (file)
@@ -1205,6 +1205,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
        fprintf(f, "\tchar *_data");
        if(func->ret) fprintf(f, ", *_retdata");
        fprintf(f, ";\n");
+       if(func->ret && (func->ret->flag & PROP_DYNAMIC_ARRAY)) fprintf(f, "\tint _ret_array_length;\n");
        fprintf(f, "\t\n");
 
        /* assign self */
@@ -1259,6 +1260,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
                        fprintf(f, "reports");
                }
 
+               if(func->ret && (func->ret->flag & PROP_DYNAMIC_ARRAY)) {
+                       if(!first) fprintf(f, ", ");
+                       first= 0;
+                       fprintf(f, "&_ret_array_length");
+               }
+
                dparm= dfunc->cont.properties.first;
                for(; dparm; dparm= dparm->next) {
                        if(dparm->prop==func->ret)
@@ -1276,6 +1283,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
                        dparm= rna_find_parameter_def(func->ret);
                        ptrstr= dparm->prop->type == PROP_POINTER || dparm->prop->arraylength > 0 ? "*" : "";
                        fprintf(f, "\t*((%s%s%s*)_retdata)= %s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, func->ret->identifier);
+
+                       if(func->ret && (func->ret->flag & PROP_DYNAMIC_ARRAY)) {
+                               fprintf(f, "\t_parms->func->ret->arraylength= _ret_array_length;\n");
+                       }
                }
        }
 
@@ -1481,9 +1492,9 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
        /* return type */
        for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
                if(dparm->prop==func->ret) {
-                       if(dparm->prop->arraylength)
-                               fprintf(f, "XXX no array return types yet"); /* XXX not supported */
-                       else if(dparm->prop->type == PROP_POINTER)
+                       if(dparm->prop->arraylength && !(dparm->prop->flag & PROP_DYNAMIC_ARRAY))
+                               fprintf(f, "\"XXX array return types only allowed with PROP_DYNAMIC_ARRAY flag.\""); /* XXX not supported */
+                       else if(dparm->prop->type == PROP_POINTER || (dparm->prop->flag & PROP_DYNAMIC_ARRAY))
                                fprintf(f, "%s%s *", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
                        else
                                fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
@@ -1520,6 +1531,13 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
                fprintf(f, "ReportList *reports");
        }
 
+       /* dynamic array length paramter */
+       if(func->ret && (func->ret->flag & PROP_DYNAMIC_ARRAY)) {
+               if(!first) fprintf(f, ", ");
+               first= 0;
+               fprintf(f, "int *array_length");
+       }
+
        /* defined parameters */
        for(dparm= dfunc->cont.properties.first; dparm; dparm= dparm->next) {
                if(dparm->prop==func->ret)
@@ -1902,7 +1920,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_rna.c", NULL, RNA_def_rna},
        {"rna_ID.c", NULL, RNA_def_ID},
        {"rna_texture.c", NULL, RNA_def_texture},
-       {"rna_action.c", NULL, RNA_def_action},
+       {"rna_action.c", "rna_action_api.c", RNA_def_action},
        {"rna_animation.c", NULL, RNA_def_animation},
        {"rna_actuator.c", NULL, RNA_def_actuator},
        {"rna_armature.c", NULL, RNA_def_armature},
@@ -1923,7 +1941,7 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_lamp.c", NULL, RNA_def_lamp},
        {"rna_lattice.c", NULL, RNA_def_lattice},
        {"rna_main.c", "rna_main_api.c", RNA_def_main},
-       {"rna_material.c", NULL, RNA_def_material},
+       {"rna_material.c", "rna_material_api.c", RNA_def_material},
        {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
        {"rna_meta.c", NULL, RNA_def_meta},
        {"rna_modifier.c", NULL, RNA_def_modifier},
@@ -1933,9 +1951,9 @@ RNAProcessItem PROCESS_ITEMS[]= {
        {"rna_object_force.c", NULL, RNA_def_object_force},
        {"rna_packedfile.c", NULL, RNA_def_packedfile},
        {"rna_particle.c", NULL, RNA_def_particle},
-       {"rna_pose.c", NULL, RNA_def_pose},
+       {"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
        {"rna_property.c", NULL, RNA_def_gameproperty},
-       {"rna_scene.c", NULL, RNA_def_scene},
+       {"rna_scene.c", "rna_scene_api.c", RNA_def_scene},
        {"rna_screen.c", NULL, RNA_def_screen},
        {"rna_scriptlink.c", NULL, RNA_def_scriptlink},
        {"rna_sensor.c", NULL, RNA_def_sensor},