Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/idprop.c
| Show All 34 Lines | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_math.h" | #include "BLI_math.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "BLI_strict_flags.h" | #include "BLI_strict_flags.h" | ||||
| /* IDPropertyTemplate is a union in DNA_ID.h */ | /* IDPropertyTemplate is a union in DNA_ID.h */ | ||||
| /** | /** | ||||
| * if the new is 'IDP_ARRAY_REALLOC_LIMIT' items less, | * if the new is 'IDP_ARRAY_REALLOC_LIMIT' items less, | ||||
| * than #IDProperty.totallen, reallocate anyway. | * than #IDProperty.totallen, reallocate anyway. | ||||
| */ | */ | ||||
| #define IDP_ARRAY_REALLOC_LIMIT 200 | #define IDP_ARRAY_REALLOC_LIMIT 200 | ||||
| static CLG_LogRef LOG = {"bke.idprop"}; | |||||
| /*local size table.*/ | /*local size table.*/ | ||||
| static size_t idp_size_table[] = { | static size_t idp_size_table[] = { | ||||
| 1, /*strings*/ | 1, /*strings*/ | ||||
| sizeof(int), | sizeof(int), | ||||
| sizeof(float), | sizeof(float), | ||||
| sizeof(float) * 3, /*Vector type, deprecated*/ | sizeof(float) * 3, /*Vector type, deprecated*/ | ||||
| sizeof(float) * 16, /*Matrix type, deprecated*/ | sizeof(float) * 16, /*Matrix type, deprecated*/ | ||||
| 0, /*arrays don't have a fixed size*/ | 0, /*arrays don't have a fixed size*/ | ||||
| ▲ Show 20 Lines • Show All 918 Lines • ▼ Show 20 Lines | case IDP_ARRAY: | ||||
| prop->subtype = val->array.type; | prop->subtype = val->array.type; | ||||
| if (val->array.len) { | if (val->array.len) { | ||||
| prop->data.pointer = MEM_callocN( | prop->data.pointer = MEM_callocN( | ||||
| idp_size_table[val->array.type] * (size_t)val->array.len, "id property array"); | idp_size_table[val->array.type] * (size_t)val->array.len, "id property array"); | ||||
| } | } | ||||
| prop->len = prop->totallen = val->array.len; | prop->len = prop->totallen = val->array.len; | ||||
| break; | break; | ||||
| } | } | ||||
| printf("%s: bad array type.\n", __func__); | CLOG_ERROR(&LOG, "bad array type."); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| case IDP_STRING: | case IDP_STRING: | ||||
| { | { | ||||
| const char *st = val->string.str; | const char *st = val->string.str; | ||||
| prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); | prop = MEM_callocN(sizeof(IDProperty), "IDProperty string"); | ||||
| if (val->string.subtype == IDP_STRING_SUB_BYTE) { | if (val->string.subtype == IDP_STRING_SUB_BYTE) { | ||||
| ▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines | |||||