Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Show First 20 Lines • Show All 899 Lines • ▼ Show 20 Lines | case PROP_POINTER: | ||||
| if (prop->flag & PROP_ID_REFCOUNT) { | if (prop->flag & PROP_ID_REFCOUNT) { | ||||
| fprintf(f, "\n if (data->%s)\n", dp->dnaname); | fprintf(f, "\n if (data->%s)\n", dp->dnaname); | ||||
| fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname); | fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname); | ||||
| fprintf(f, " if (value.data)\n"); | fprintf(f, " if (value.data)\n"); | ||||
| fprintf(f, " id_us_plus((ID *)value.data);\n\n"); | fprintf(f, " id_us_plus((ID *)value.data);\n\n"); | ||||
| } | } | ||||
| else { | else { | ||||
| PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; | 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)) { | if (type && (type->flag & STRUCT_ID)) { | ||||
| fprintf(f, " if (value.data)\n"); | fprintf(f, " if (value.data)\n"); | ||||
| fprintf(f, " id_lib_extern((ID *)value.data);\n\n"); | fprintf(f, " id_lib_extern((ID *)value.data);\n\n"); | ||||
| } | } | ||||
| } | } | ||||
| fprintf(f, " data->%s = value.data;\n", dp->dnaname); | fprintf(f, " data->%s = value.data;\n", dp->dnaname); | ||||
| ▲ Show 20 Lines • Show All 1,536 Lines • ▼ Show 20 Lines | |||||
| static void rna_auto_types(void) | static void rna_auto_types(void) | ||||
| { | { | ||||
| StructDefRNA *ds; | StructDefRNA *ds; | ||||
| PropertyDefRNA *dp; | PropertyDefRNA *dp; | ||||
| for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | ||||
| /* DNA name for Screen is patched in 2.5, we do the reverse here .. */ | /* DNA name for Screen is patched in 2.5, we do the reverse here .. */ | ||||
| if (ds->dnaname && STREQ(ds->dnaname, "Screen")) | if (ds->dnaname) { | ||||
| if (STREQ(ds->dnaname, "Screen")) | |||||
| ds->dnaname = "bScreen"; | 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) { | for (dp = ds->cont.properties.first; dp; dp = dp->next) { | ||||
| if (dp->dnastructname && STREQ(dp->dnastructname, "Screen")) | if (dp->dnastructname) { | ||||
| if (STREQ(dp->dnastructname, "Screen")) | |||||
| dp->dnastructname = "bScreen"; | dp->dnastructname = "bScreen"; | ||||
| if (STREQ(dp->dnastructname, "Group")) | |||||
| dp->dnastructname = "Collection"; | |||||
| if (STREQ(dp->dnastructname, "GroupObject")) | |||||
| dp->dnastructname = "CollectionObject"; | |||||
| } | |||||
| if (dp->dnatype) { | if (dp->dnatype) { | ||||
| if (dp->prop->type == PROP_POINTER) { | if (dp->prop->type == PROP_POINTER) { | ||||
| PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; | PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop; | ||||
| StructRNA *type; | StructRNA *type; | ||||
| if (!pprop->type && !pprop->get) | if (!pprop->type && !pprop->get) | ||||
| pprop->type = (StructRNA *)rna_find_type(dp->dnatype); | pprop->type = (StructRNA *)rna_find_type(dp->dnatype); | ||||
| ▲ Show 20 Lines • Show All 888 Lines • ▼ Show 20 Lines | static RNAProcessItem PROCESS_ITEMS[] = { | ||||
| {"rna_color.c", NULL, RNA_def_color}, | {"rna_color.c", NULL, RNA_def_color}, | ||||
| {"rna_constraint.c", NULL, RNA_def_constraint}, | {"rna_constraint.c", NULL, RNA_def_constraint}, | ||||
| {"rna_context.c", NULL, RNA_def_context}, | {"rna_context.c", NULL, RNA_def_context}, | ||||
| {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, | {"rna_curve.c", "rna_curve_api.c", RNA_def_curve}, | ||||
| {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, | {"rna_dynamicpaint.c", NULL, RNA_def_dynamic_paint}, | ||||
| {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, | {"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve}, | ||||
| {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, | {"rna_fluidsim.c", NULL, RNA_def_fluidsim}, | ||||
| {"rna_gpencil.c", NULL, RNA_def_gpencil}, | {"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_image.c", "rna_image_api.c", RNA_def_image}, | ||||
| {"rna_key.c", NULL, RNA_def_key}, | {"rna_key.c", NULL, RNA_def_key}, | ||||
| {"rna_lamp.c", NULL, RNA_def_lamp}, | {"rna_lamp.c", NULL, RNA_def_lamp}, | ||||
| {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice}, | {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice}, | ||||
| {"rna_layer.c", NULL, RNA_def_view_layer}, | {"rna_layer.c", NULL, RNA_def_view_layer}, | ||||
| {"rna_linestyle.c", NULL, RNA_def_linestyle}, | {"rna_linestyle.c", NULL, RNA_def_linestyle}, | ||||
| {"rna_main.c", "rna_main_api.c", RNA_def_main}, | {"rna_main.c", "rna_main_api.c", RNA_def_main}, | ||||
| {"rna_material.c", "rna_material_api.c", RNA_def_material}, | {"rna_material.c", "rna_material_api.c", RNA_def_material}, | ||||
| ▲ Show 20 Lines • Show All 341 Lines • ▼ Show 20 Lines | |||||
| " return found; \\\n" | " return found; \\\n" | ||||
| " } \n" | " } \n" | ||||
| "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, has_lookup_int, has_lookup_string) \\\n" | "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, has_lookup_int, has_lookup_string) \\\n" | ||||
| " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n" | " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n" | ||||
| " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n" | " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n" | ||||
| " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n" | " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n" | ||||
| " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n" | " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n" | ||||
| " COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(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##_next, sname##_##identifier##_end, \\\n" | ||||
| " sname##_##identifier##_length_wrap, \\\n" | " sname##_##identifier##_length_wrap, \\\n" | ||||
| " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n" | " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n" | ||||
| "\n" | "\n" | ||||
| "class Pointer {\n" | "class Pointer {\n" | ||||
| "public:\n" | "public:\n" | ||||
| " Pointer(const PointerRNA &p) : ptr(p) { }\n" | " Pointer(const PointerRNA &p) : ptr(p) { }\n" | ||||
| " operator const PointerRNA&() { return ptr; }\n" | " operator const PointerRNA&() { return ptr; }\n" | ||||
| ▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Lines | |||||
| " CollectionPropertyIterator iter;\n" | " CollectionPropertyIterator iter;\n" | ||||
| " T t;\n" | " T t;\n" | ||||
| " bool init;\n" | " bool init;\n" | ||||
| "};\n" | "};\n" | ||||
| "\n" | "\n" | ||||
| "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n" | "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n" | ||||
| " TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n" | " TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n" | ||||
| " typename Tcollection_funcs>\n" | " typename Tcollection_funcs>\n" | ||||
| "class Collection : public Tcollection_funcs {\n" | "class CollectionRef : public Tcollection_funcs {\n" | ||||
| "public:\n" | "public:\n" | ||||
| " Collection(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n" | " CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n" | ||||
| "\n" | "\n" | ||||
| " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n" | " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n" | ||||
| " { iter.begin(ptr); }\n" | " { iter.begin(ptr); }\n" | ||||
| " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n" | " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n" | ||||
| " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n" | " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n" | ||||
| "" | "" | ||||
| " int length()\n" | " int length()\n" | ||||
| " { return Tlength(&ptr); }\n" | " { return Tlength(&ptr); }\n" | ||||
| ▲ Show 20 Lines • Show All 358 Lines • Show Last 20 Lines | |||||