Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/icons.c
| Context not available. | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "DNA_brush_types.h" | #include "DNA_brush_types.h" | ||||
| Context not available. | |||||
| /* GLOBALS */ | /* GLOBALS */ | ||||
| static CLG_LogRef LOG = { "bke.icons" }; | |||||
| static GHash *gIcons = NULL; | static GHash *gIcons = NULL; | ||||
| static int gNextIconId = 1; | static int gNextIconId = 1; | ||||
| Context not available. | |||||
| id->icon_id = get_next_free_id(); | id->icon_id = get_next_free_id(); | ||||
| if (!id->icon_id) { | if (!id->icon_id) { | ||||
| printf("%s: Internal error - not enough IDs\n", __func__); | CLOG_ERROR(&LOG, "not enough IDs"); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| Context not available. | |||||
| gpl->runtime.icon_id = get_next_free_id(); | gpl->runtime.icon_id = get_next_free_id(); | ||||
| if (!gpl->runtime.icon_id) { | if (!gpl->runtime.icon_id) { | ||||
| printf("%s: Internal error - not enough IDs\n", __func__); | CLOG_ERROR(&LOG, "not enough IDs"); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| Context not available. | |||||
| preview->icon_id = get_next_free_id(); | preview->icon_id = get_next_free_id(); | ||||
| if (!preview->icon_id) { | if (!preview->icon_id) { | ||||
| printf("%s: Internal error - not enough IDs\n", __func__); | CLOG_ERROR(&LOG, "not enough IDs"); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| Context not available. | |||||
| icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id)); | icon = BLI_ghash_lookup(gIcons, POINTER_FROM_INT(icon_id)); | ||||
| if (!icon) { | if (!icon) { | ||||
| printf("%s: Internal error, no icon for icon ID: %d\n", __func__, icon_id); | CLOG_ERROR(&LOG, "no icon for icon ID: %d", icon_id); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Context not available. | |||||
| void **val_p; | void **val_p; | ||||
| if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) { | if (BLI_ghash_ensure_p(gIcons, POINTER_FROM_INT(icon_id), &val_p)) { | ||||
| printf("%s: Internal error, icon already set: %d\n", __func__, icon_id); | CLOG_ERROR(&LOG, "icon already set: %d", icon_id); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||