Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen Bakker <j.bakker@atmind.nl>2018-06-20 10:29:40 +0300
committerJeroen Bakker <j.bakker@atmind.nl>2018-06-20 10:29:40 +0300
commite3052ecb0d246381558c75219962915140bbe4ca (patch)
treea05e59c7c0b94b18bb45fe884bee6af920e241c2 /source/blender/blenkernel/intern/icons.c
parent91c0f17a475793de7bc6016598ef13221392dbf5 (diff)
Studiolight: removed raise condition
Happened when deleting many studiolights at the same time when the previews were still beging calculated in the background. Added a free function callback that is filled when the preview is being generated. This free function will then kill the preview job This patch also removes icons that are not valid anymore so the user cannot accidentally render an icon where the studiolight is invalid. In the end we should use a add/remove function in the studiolight as currently icons are recalculated too much.
Diffstat (limited to 'source/blender/blenkernel/intern/icons.c')
-rw-r--r--source/blender/blenkernel/intern/icons.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c
index e6afe08e19a..37f53e81236 100644
--- a/source/blender/blenkernel/intern/icons.c
+++ b/source/blender/blenkernel/intern/icons.c
@@ -119,7 +119,7 @@ static void icon_free(void *val)
}
}
-static void icon_free_data(Icon *icon)
+static void icon_free_data(int icon_id, Icon *icon)
{
if (icon->obj_type == ICON_DATA_ID) {
((ID *)(icon->obj))->icon_id = 0;
@@ -130,6 +130,12 @@ static void icon_free_data(Icon *icon)
else if (icon->obj_type == ICON_DATA_GEOM) {
((struct Icon_Geom *)(icon->obj))->icon_id = 0;
}
+ else if (icon->obj_type == ICON_DATA_STUDIOLIGHT) {
+ StudioLight *sl = icon->obj;
+ if (sl != NULL) {
+ BKE_studiolight_unset_icon_id(sl, icon_id);
+ }
+ }
else {
BLI_assert(0);
}
@@ -699,7 +705,7 @@ bool BKE_icon_delete(const int icon_id)
Icon *icon = BLI_ghash_popkey(gIcons, SET_INT_IN_POINTER(icon_id), NULL);
if (icon) {
- icon_free_data(icon);
+ icon_free_data(icon_id, icon);
icon_free(icon);
return true;
}
@@ -722,7 +728,7 @@ bool BKE_icon_delete_unmanaged(const int icon_id)
return false;
}
else {
- icon_free_data(icon);
+ icon_free_data(icon_id, icon);
icon_free(icon);
return true;
}