diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-15 14:09:34 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-12-15 14:09:34 +0300 |
commit | 4858f9faab95d080fc595e56f620aa91750e7f5d (patch) | |
tree | 2093b4453308a968251d0dcc767c3f0ec9b4ed84 /source/blender | |
parent | e3812b525f409d6f243c7ac6b1a52007148ad3e2 (diff) |
FIx merge issues, move preview resolution setting from RNA to BKE, do not clear preview when setting same resolution as current one.multi_previews_id
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_icons.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/icons.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 31 |
3 files changed, 32 insertions, 20 deletions
diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index c81dfbd3cad..d312b4b4a60 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -101,6 +101,8 @@ struct PreviewImage *BKE_previewimg_copy(struct PreviewImage *prv); size_t BKE_previewimg_get_rect_size(struct PreviewImage *prv, const int size); +void BKE_previewimg_resolution_set(struct PreviewImage *prv, const int size, const int width, const int height); + void BKE_previewimg_num_frames_set(struct PreviewImage *prv, const short num_frames); void BKE_previewimg_frame_delete(struct PreviewImage *prv, const short frame_idx); diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index 838a732e387..26a3034f0c7 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -239,6 +239,25 @@ size_t BKE_previewimg_get_rect_size(struct PreviewImage *prv, const int size) } } +void BKE_previewimg_resolution_set(PreviewImage *prv, const int size, const int width, const int height) +{ + if (width == prv->w[size] && height == prv->h[size]) { + /* Same size, do nothing. */ + return; + } + + BKE_previewimg_clear_single(prv, size); + + if (width && height) { + prv->w[size] = width; + prv->h[size] = height; + + prv->rect[size] = MEM_callocN(BKE_previewimg_get_rect_size(prv, size), __func__); + } + + prv->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED); +} + void BKE_previewimg_num_frames_set(struct PreviewImage *prv, const short num_frames) { BLI_assert(prv != NULL); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index fcb8d6d296c..9bc8dbea86d 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -511,16 +511,7 @@ static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum e BLI_assert(prv_img == BKE_previewimg_id_ensure(id)); } - BKE_previewimg_clear_single(prv_img, size); - - if (values[0] && values[1]) { - prv_img->w[size] = values[0]; - prv_img->h[size] = values[1]; - - prv_img->rect[size] = MEM_callocN(BKE_previewimg_get_rect_size(prv_img, size), __func__); - } - - prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED); + BKE_previewimg_resolution_set(prv_img, size, values[0], values[1]); } @@ -1174,7 +1165,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)"); RNA_def_function_output(func, parm); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); @@ -1187,7 +1178,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED); RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame"); @@ -1198,7 +1189,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)"); RNA_def_function_output(func, parm); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); @@ -1211,7 +1202,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED); RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the preview frame"); @@ -1221,7 +1212,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_function_ui_description(func, "Set a frame data and meta-data for this preview"); RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "image", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_property_struct_type(parm, "Image"); RNA_def_property_ui_text(parm, "", "Image whose pixels to copy and use for this preview"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); @@ -1233,7 +1224,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)"); RNA_def_function_output(func, parm); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); @@ -1246,7 +1237,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_INT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED); RNA_def_property_ui_text(parm, "", "Array of integers, one per pixel (RGBA concatenated values)"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame"); @@ -1257,7 +1248,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to get", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0); RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)"); RNA_def_function_output(func, parm); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); @@ -1270,7 +1261,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "data", PROP_FLOAT, PROP_NONE); RNA_def_property_array(parm, 1); - RNA_def_property_flag(parm, PROP_DYNAMIC | PROP_REQUIRED); + RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED); RNA_def_property_ui_text(parm, "", "Array of floats, one per pixel component (RGBA values)"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); RNA_def_property_ui_text(parm, "", "Meta-data integer associated to the icon frame"); @@ -1280,7 +1271,7 @@ static void rna_def_image_preview(BlenderRNA *brna) RNA_def_function_ui_description(func, "Set a frame data and meta-data for this icon"); RNA_def_int(func, "index", 0, 0, USHRT_MAX, "", "Index of frame to set", 0, USHRT_MAX); parm = RNA_def_property(func, "image", PROP_POINTER, PROP_NONE); - RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL); + RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED); RNA_def_property_struct_type(parm, "Image"); RNA_def_property_ui_text(parm, "", "Image whose pixels to copy and use for this preview"); parm = RNA_def_property(func, "meta", PROP_INT, PROP_NONE); |