Merge branch 'blender2.7'
[blender.git] / source / blender / makesrna / intern / makesrna.c
index 2aa6fc9..8bb09ad 100644 (file)
@@ -906,7 +906,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
                                }
                                else {
                                        PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
-                                       StructRNA *type = rna_find_struct((const char *)pprop->type);
+                                       StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
                                        if (type && (type->flag & STRUCT_ID)) {
                                                fprintf(f, "    if (value.data)\n");
                                                fprintf(f, "            id_lib_extern((ID *)value.data);\n\n");
@@ -2482,12 +2482,24 @@ static void rna_auto_types(void)
 
        for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
                /* DNA name for Screen is patched in 2.5, we do the reverse here .. */
-               if (ds->dnaname && STREQ(ds->dnaname, "Screen"))
-                       ds->dnaname = "bScreen";
+               if (ds->dnaname) {
+                       if (STREQ(ds->dnaname, "Screen"))
+                               ds->dnaname = "bScreen";
+                       if (STREQ(ds->dnaname, "Group"))
+                               ds->dnaname = "Collection";
+                       if (STREQ(ds->dnaname, "GroupObject"))
+                               ds->dnaname = "CollectionObject";
+               }
 
                for (dp = ds->cont.properties.first; dp; dp = dp->next) {
-                       if (dp->dnastructname && STREQ(dp->dnastructname, "Screen"))
-                               dp->dnastructname = "bScreen";
+                       if (dp->dnastructname) {
+                               if (STREQ(dp->dnastructname, "Screen"))
+                                       dp->dnastructname = "bScreen";
+                               if (STREQ(dp->dnastructname, "Group"))
+                                       dp->dnastructname = "Collection";
+                               if (STREQ(dp->dnastructname, "GroupObject"))
+                                       dp->dnastructname = "CollectionObject";
+                       }
 
                        if (dp->dnatype) {
                                if (dp->prop->type == PROP_POINTER) {
@@ -2654,7 +2666,7 @@ static void rna_generate_property_prototypes(BlenderRNA *UNUSED(brna), StructRNA
                fprintf(f, "\n");
 
        for (prop = srna->cont.properties.first; prop; prop = prop->next)
-               fprintf(f, "%s%s rna_%s_%s;\n", (prop->flag & PROP_EXPORT) ? "" : "", rna_property_structname(prop->type),
+               fprintf(f, "%s rna_%s_%s;\n", rna_property_structname(prop->type),
                        srna->identifier, prop->identifier);
        fprintf(f, "\n");
 }
@@ -3023,12 +3035,33 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                        }
                        break;
                }
+               case PROP_POINTER:
+               {
+                       PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+
+                       /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
+                       StructRNA *type = rna_find_struct((const char *)pprop->type);
+                       if (type && (type->flag & STRUCT_ID)) {
+                               prop->flag |= PROP_PTR_NO_OWNERSHIP;
+                       }
+                       break;
+               }
+               case PROP_COLLECTION:
+               {
+                       CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+
+                       /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
+                       StructRNA *type = rna_find_struct((const char *)cprop->item_type);
+                       if (type && (type->flag & STRUCT_ID)) {
+                               prop->flag |= PROP_PTR_NO_OWNERSHIP;
+                       }
+                       break;
+               }
                default:
                        break;
        }
 
-       fprintf(f, "%s%s rna_%s%s_%s = {\n",
-               (prop->flag & PROP_EXPORT) ? "" : "",
+       fprintf(f, "%s rna_%s%s_%s = {\n",
                rna_property_structname(prop->type),
                srna->identifier, strnest, prop->identifier);
 
@@ -3038,7 +3071,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
        else fprintf(f, "NULL,\n");
        fprintf(f, "\t%d, ", prop->magic);
        rna_print_c_string(f, prop->identifier);
-       fprintf(f, ", %d, %d, %d, %d, ", prop->flag, prop->flag_parameter, prop->flag_internal, prop->tags);
+       fprintf(f, ", %d, %d, %d, %d, %d, ", prop->flag, prop->flag_override, prop->flag_parameter, prop->flag_internal, prop->tags);
        rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
        rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
        fprintf(f, "%d, ", prop->icon);
@@ -3053,12 +3086,15 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
                prop->arraylength[1],
                prop->arraylength[2],
                prop->totarraylength);
-       fprintf(f, "\t%s%s, %d, %s, %s,\n",
+       fprintf(f, "\t%s%s, %d, %s, %s, %s, %s, %s,\n",
                (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "",
                rna_function_string(prop->update),
                prop->noteflag,
                rna_function_string(prop->editable),
-               rna_function_string(prop->itemeditable));
+               rna_function_string(prop->itemeditable),
+               rna_function_string(prop->override_diff),
+               rna_function_string(prop->override_store),
+               rna_function_string(prop->override_apply));
 
        if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
        else fprintf(f, "\t0, -1");
@@ -3353,49 +3389,49 @@ static RNAProcessItem PROCESS_ITEMS[] = {
        {"rna_action.c", "rna_action_api.c", RNA_def_action},
        {"rna_animation.c", "rna_animation_api.c", RNA_def_animation},
        {"rna_animviz.c", NULL, RNA_def_animviz},
-       {"rna_actuator.c", "rna_actuator_api.c", RNA_def_actuator},
        {"rna_armature.c", "rna_armature_api.c", RNA_def_armature},
        {"rna_boid.c", NULL, RNA_def_boid},
        {"rna_brush.c", NULL, RNA_def_brush},
        {"rna_cachefile.c", NULL, RNA_def_cachefile},
        {"rna_camera.c", "rna_camera_api.c", RNA_def_camera},
        {"rna_cloth.c", NULL, RNA_def_cloth},
+       {"rna_collection.c", NULL, RNA_def_collections},
        {"rna_color.c", NULL, RNA_def_color},
        {"rna_constraint.c", NULL, RNA_def_constraint},
        {"rna_context.c", NULL, RNA_def_context},
-       {"rna_controller.c", "rna_controller_api.c", RNA_def_controller},
        {"rna_curve.c", "rna_curve_api.c", RNA_def_curve},
-       {"rna_depsgraph.c", NULL, RNA_def_depsgraph},
        {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint},
        {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve},
        {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
        {"rna_gpencil.c", NULL, RNA_def_gpencil},
-       {"rna_group.c", NULL, RNA_def_group},
        {"rna_image.c", "rna_image_api.c", RNA_def_image},
        {"rna_key.c", NULL, RNA_def_key},
-       {"rna_lamp.c", NULL, RNA_def_lamp},
+       {"rna_lamp.c", NULL, RNA_def_light},
        {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice},
+       {"rna_layer.c", NULL, RNA_def_view_layer},
        {"rna_linestyle.c", NULL, RNA_def_linestyle},
        {"rna_main.c", "rna_main_api.c", RNA_def_main},
        {"rna_material.c", "rna_material_api.c", RNA_def_material},
        {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
        {"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
        {"rna_modifier.c", NULL, RNA_def_modifier},
+       {"rna_gpencil_modifier.c", NULL, RNA_def_greasepencil_modifier},
+       {"rna_shader_fx.c", NULL, RNA_def_shader_fx },
        {"rna_nla.c", NULL, RNA_def_nla},
        {"rna_nodetree.c", NULL, RNA_def_nodetree},
        {"rna_object.c", "rna_object_api.c", RNA_def_object},
        {"rna_object_force.c", NULL, RNA_def_object_force},
+       {"rna_depsgraph.c", NULL, RNA_def_depsgraph},
        {"rna_packedfile.c", NULL, RNA_def_packedfile},
        {"rna_palette.c", NULL, RNA_def_palette},
        {"rna_particle.c", NULL, RNA_def_particle},
        {"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
-       {"rna_property.c", NULL, RNA_def_gameproperty},
+       {"rna_lightprobe.c", NULL, RNA_def_lightprobe},
        {"rna_render.c", NULL, RNA_def_render},
        {"rna_rigidbody.c", NULL, RNA_def_rigidbody},
        {"rna_scene.c", "rna_scene_api.c", RNA_def_scene},
        {"rna_screen.c", NULL, RNA_def_screen},
        {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint},
-       {"rna_sensor.c", "rna_sensor_api.c", RNA_def_sensor},
        {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer},
        {"rna_smoke.c", NULL, RNA_def_smoke},
        {"rna_space.c", "rna_space_api.c", RNA_def_space},
@@ -3408,6 +3444,8 @@ static RNAProcessItem PROCESS_ITEMS[] = {
        {"rna_userdef.c", NULL, RNA_def_userdef},
        {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont},
        {"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
+       {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo},
+       {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace},
        {"rna_world.c", NULL, RNA_def_world},
        {"rna_movieclip.c", NULL, RNA_def_movieclip},
        {"rna_tracking.c", NULL, RNA_def_tracking},
@@ -3725,7 +3763,7 @@ static const char *cpp_classes = ""
 "      COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
 "      COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
 "      COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
-"      Collection<sname, type, sname##_##identifier##_begin, \\\n"
+"      CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
 "              sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
 "              sname##_##identifier##_length_wrap, \\\n"
 "              sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
@@ -3738,6 +3776,9 @@ static const char *cpp_classes = ""
 "      operator void*() { return ptr.data; }\n"
 "      operator bool() { return ptr.data != NULL; }\n"
 "\n"
+"      bool operator==(const Pointer &other) { return ptr.data == other.ptr.data; }\n"
+"      bool operator!=(const Pointer &other) { return ptr.data != other.ptr.data; }\n"
+"\n"
 "      PointerRNA ptr;\n"
 "};\n"
 "\n"
@@ -3819,9 +3860,9 @@ static const char *cpp_classes = ""
 "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
 "         TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n"
 "         typename Tcollection_funcs>\n"
-"class Collection : public Tcollection_funcs {\n"
+"class CollectionRef : public Tcollection_funcs {\n"
 "public:\n"
-"      Collection(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
+"      CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
 "\n"
 "      void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
 "      { iter.begin(ptr); }\n"