Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/makesrna.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| if (type == NULL || type[0] == '\0') { | if (type == NULL || type[0] == '\0') { | ||||
| snprintf(buffer, size, "%s_%s", structname, propname); | snprintf(buffer, size, "%s_%s", structname, propname); | ||||
| } | } | ||||
| else { | else { | ||||
| snprintf(buffer, size, "%s_%s_%s", structname, propname, type); | snprintf(buffer, size, "%s_%s_%s", structname, propname, type); | ||||
| } | } | ||||
| } | } | ||||
| void *rna_alloc_from_buffer(const char *buffer, int buffer_len) | |||||
| { | |||||
| AllocDefRNA *alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"); | |||||
| alloc->mem = MEM_mallocN(buffer_len, __func__); | |||||
| memcpy(alloc->mem, buffer, buffer_len); | |||||
| rna_addtail(&DefRNA.allocs, alloc); | |||||
| return alloc->mem; | |||||
| } | |||||
| void *rna_calloc(int buffer_len) | |||||
| { | |||||
| AllocDefRNA *alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"); | |||||
| alloc->mem = MEM_callocN(buffer_len, __func__); | |||||
| rna_addtail(&DefRNA.allocs, alloc); | |||||
| return alloc->mem; | |||||
| } | |||||
| static char *rna_alloc_function_name(const char *structname, | static char *rna_alloc_function_name(const char *structname, | ||||
| const char *propname, | const char *propname, | ||||
| const char *type) | const char *type) | ||||
| { | { | ||||
| AllocDefRNA *alloc; | |||||
| char buffer[2048]; | char buffer[2048]; | ||||
| char *result; | |||||
| rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type); | rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type); | ||||
| return rna_alloc_from_buffer(buffer, strlen(buffer) + 1); | result = MEM_callocN(sizeof(char) * strlen(buffer) + 1, "rna_alloc_function_name"); | ||||
| strcpy(result, buffer); | |||||
| alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA"); | |||||
| alloc->mem = result; | |||||
| rna_addtail(&DefRNA.allocs, alloc); | |||||
| return result; | |||||
| } | } | ||||
| static StructRNA *rna_find_struct(const char *identifier) | static StructRNA *rna_find_struct(const char *identifier) | ||||
| { | { | ||||
| StructDefRNA *ds; | StructDefRNA *ds; | ||||
| for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { | ||||
| if (STREQ(ds->srna->identifier, identifier)) { | if (STREQ(ds->srna->identifier, identifier)) { | ||||
| ▲ Show 20 Lines • Show All 184 Lines • ▼ Show 20 Lines | |||||
| {"rna_nodetree.c", NULL, RNA_def_nodetree}, | {"rna_nodetree.c", NULL, RNA_def_nodetree}, | ||||
| {"rna_object.c", "rna_object_api.c", RNA_def_object}, | {"rna_object.c", "rna_object_api.c", RNA_def_object}, | ||||
| {"rna_object_force.c", NULL, RNA_def_object_force}, | {"rna_object_force.c", NULL, RNA_def_object_force}, | ||||
| {"rna_depsgraph.c", NULL, RNA_def_depsgraph}, | {"rna_depsgraph.c", NULL, RNA_def_depsgraph}, | ||||
| {"rna_packedfile.c", NULL, RNA_def_packedfile}, | {"rna_packedfile.c", NULL, RNA_def_packedfile}, | ||||
| {"rna_palette.c", NULL, RNA_def_palette}, | {"rna_palette.c", NULL, RNA_def_palette}, | ||||
| {"rna_particle.c", NULL, RNA_def_particle}, | {"rna_particle.c", NULL, RNA_def_particle}, | ||||
| {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, | {"rna_pose.c", "rna_pose_api.c", RNA_def_pose}, | ||||
| {"rna_profile.c", NULL, RNA_def_profile}, | |||||
| {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, | {"rna_lightprobe.c", NULL, RNA_def_lightprobe}, | ||||
| {"rna_render.c", NULL, RNA_def_render}, | {"rna_render.c", NULL, RNA_def_render}, | ||||
| {"rna_rigidbody.c", NULL, RNA_def_rigidbody}, | {"rna_rigidbody.c", NULL, RNA_def_rigidbody}, | ||||
| {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, | {"rna_scene.c", "rna_scene_api.c", RNA_def_scene}, | ||||
| {"rna_screen.c", NULL, RNA_def_screen}, | {"rna_screen.c", NULL, RNA_def_screen}, | ||||
| {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, | {"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint}, | ||||
| {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer}, | {"rna_sequencer.c", "rna_sequencer_api.c", RNA_def_sequencer}, | ||||
| {"rna_smoke.c", NULL, RNA_def_smoke}, | {"rna_smoke.c", NULL, RNA_def_smoke}, | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||