diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-19 17:33:47 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-06-19 17:37:23 +0300 |
commit | 0116c95d4c9114bc9eae03401c0471fba265cd46 (patch) | |
tree | 19874eadddab1b5349cd092b9ec37e6290d02694 /source/blender/blenkernel/intern/studiolight.c | |
parent | a7e66d89d04662da8a90eab1eb119e8fb8ccaa2b (diff) |
Studiolight: Temp Mutex issue
This is a temp fix for a better system.
Currently the studiolights can be referenced by a WM_job and being freed
via the API. This can happen when removing a studiolight via the
interface.
As the studiolight has no relation with the job, it is hard to detect if
it is still being used. I tried with a Mutex and a Thread Queue but they
were failing.
So the current temp fix is to keep the studiolights in memory until you
close blender. This Must be fixed ASAP! I added this fix so normal cases
can workish.
Diffstat (limited to 'source/blender/blenkernel/intern/studiolight.c')
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 3cdb8da75b5..42a6b96653f 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -115,6 +115,7 @@ static struct StudioLight *studiolight_create(int flag) for (int index = 0 ; index < 6 ; index ++) { sl->radiance_cubemap_buffers[index] = NULL; } + return sl; } @@ -891,7 +892,7 @@ void BKE_studiolight_free(void) struct StudioLight *BKE_studiolight_find_first(int flag) { LISTBASE_FOREACH(StudioLight *, sl, &studiolights) { - if ((sl->flag & flag)) { + if ((sl->flag & flag) && (sl->flag & STUDIOLIGHT_DISABLED) == 0) { return sl; } } @@ -902,7 +903,7 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag) { LISTBASE_FOREACH(StudioLight *, sl, &studiolights) { if (STREQLEN(sl->name, name, FILE_MAXFILE)) { - if ((sl->flag & flag)) { + if ((sl->flag & flag) && (sl->flag & STUDIOLIGHT_DISABLED) == 0) { return sl; } else { @@ -918,7 +919,7 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag) struct StudioLight *BKE_studiolight_findindex(int index, int flag) { LISTBASE_FOREACH(StudioLight *, sl, &studiolights) { - if (sl->index == index) { + if (sl->index == index && (sl->flag & STUDIOLIGHT_DISABLED) == 0) { return sl; } } @@ -994,6 +995,8 @@ void BKE_studiolight_ensure_flag(StudioLight *sl, int flag) void BKE_studiolight_refresh(void) { - BKE_studiolight_free(); + LISTBASE_FOREACH(StudioLight *, sl, &studiolights) { + sl->flag |= STUDIOLIGHT_DISABLED; + } BKE_studiolight_init(); } |