diff options
Diffstat (limited to 'source/blender/makesrna/intern/makesrna.c')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 74 |
1 files changed, 57 insertions, 17 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 85b5e1f7186..fe063a8e335 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -905,7 +905,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"); @@ -2466,12 +2466,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) { @@ -3007,6 +3019,28 @@ 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; } @@ -3022,7 +3056,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); @@ -3037,12 +3071,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"); @@ -3337,7 +3374,6 @@ 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}, @@ -3347,18 +3383,17 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"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_group.c", NULL, RNA_def_collections}, {"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_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}, @@ -3369,17 +3404,17 @@ static RNAProcessItem PROCESS_ITEMS[] = { {"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}, @@ -3392,6 +3427,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_manipulator.c", "rna_wm_manipulator_api.c", RNA_def_wm_manipulator}, + {"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}, @@ -3709,7 +3746,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" @@ -3722,6 +3759,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" @@ -3803,9 +3843,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" |