diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_studiolight.h | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 17 |
2 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_studiolight.h b/source/blender/blenkernel/BKE_studiolight.h index 9bf9f0ea904..7883f89f33a 100644 --- a/source/blender/blenkernel/BKE_studiolight.h +++ b/source/blender/blenkernel/BKE_studiolight.h @@ -61,6 +61,7 @@ enum StudioLightFlag { STUDIOLIGHT_LIGHT_DIRECTION_CALCULATED = (1 << 1), STUDIOLIGHT_INTERNAL = (1 << 2), STUDIOLIGHT_EXTERNAL_FILE = (1 << 3), + STUDIOLIGHT_USER_DEFINED = (1 << 12), STUDIOLIGHT_ORIENTATION_CAMERA = (1 << 4), STUDIOLIGHT_ORIENTATION_WORLD = (1 << 5), STUDIOLIGHT_ORIENTATION_VIEWNORMAL = (1 << 6), @@ -69,6 +70,7 @@ enum StudioLightFlag { STUDIOLIGHT_EQUIRECTANGULAR_RADIANCE_GPUTEXTURE = (1 << 9), STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE = (1 << 10), STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED = (1 << 11), + STUDIOLIGHT_UI_EXPANDED = (1 << 13), } StudioLightFlag; #define STUDIOLIGHT_FLAG_ALL (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_EXTERNAL_FILE) #define STUDIOLIGHT_FLAG_ORIENTATIONS (STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_ORIENTATION_VIEWNORMAL) @@ -98,7 +100,8 @@ struct StudioLight *BKE_studiolight_find(const char *name, int flag); struct StudioLight *BKE_studiolight_findindex(int index, int flag); struct StudioLight *BKE_studiolight_find_first(int flag); unsigned int *BKE_studiolight_preview(StudioLight *sl, int icon_size, int icon_id_type); -const struct ListBase *BKE_studiolight_listbase(void); +struct ListBase *BKE_studiolight_listbase(void); void BKE_studiolight_ensure_flag(StudioLight *sl, int flag); +void BKE_studiolight_refresh(void); #endif /* __BKE_STUDIOLIGHT_H__ */ diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index 8ebc8f7e082..da3cc97c43f 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -55,7 +55,6 @@ /* Statics */ static ListBase studiolights; -#define STUDIOLIGHT_EXTENSIONS ".jpg", ".hdr" #define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE 8 #define STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT 32 #define STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_WIDTH (STUDIOLIGHT_IRRADIANCE_EQUIRECTANGULAR_HEIGHT * 2) @@ -482,7 +481,7 @@ static void studiolight_add_files_from_datafolder(const int folder_id, const cha if ((dir[i].type & S_IFREG)) { const char *filename = dir[i].relname; const char *path = dir[i].path; - if (BLI_testextensie_n(filename, STUDIOLIGHT_EXTENSIONS, NULL)) { + if (BLI_testextensie_array(filename, imb_ext_image)) { sl = studiolight_create(); sl->flag = STUDIOLIGHT_EXTERNAL_FILE | flag; BLI_strncpy(sl->name, filename, FILE_MAXFILE); @@ -726,11 +725,11 @@ void BKE_studiolight_init(void) BLI_addtail(&studiolights, sl); studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_CAMERA_FOLDER, STUDIOLIGHT_ORIENTATION_CAMERA); - studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_CAMERA_FOLDER, STUDIOLIGHT_ORIENTATION_CAMERA); + studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_CAMERA_FOLDER, STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_USER_DEFINED); studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_WORLD_FOLDER, STUDIOLIGHT_ORIENTATION_WORLD); - studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_WORLD_FOLDER, STUDIOLIGHT_ORIENTATION_WORLD); + studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_WORLD_FOLDER, STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_USER_DEFINED); studiolight_add_files_from_datafolder(BLENDER_SYSTEM_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_ORIENTATION_VIEWNORMAL); - studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_ORIENTATION_VIEWNORMAL); + studiolight_add_files_from_datafolder(BLENDER_USER_DATAFILES, STUDIOLIGHT_MATCAP_FOLDER, STUDIOLIGHT_ORIENTATION_VIEWNORMAL | STUDIOLIGHT_USER_DEFINED); /* sort studio lights on filename. */ BLI_listbase_sort(&studiolights, studiolight_cmp); @@ -782,7 +781,7 @@ struct StudioLight *BKE_studiolight_findindex(int index, int flag) return BKE_studiolight_find_first(flag); } -const struct ListBase *BKE_studiolight_listbase(void) +struct ListBase *BKE_studiolight_listbase(void) { return &studiolights; } @@ -830,3 +829,9 @@ void BKE_studiolight_ensure_flag(StudioLight *sl, int flag) studiolight_calculate_irradiance_equirectangular_image(sl); } } + +void BKE_studiolight_refresh(void) +{ + BKE_studiolight_free(); + BKE_studiolight_init(); +}
\ No newline at end of file |