[Bf-blender-cvs] [27cd60017fe] temp-udim-images: Cleanup: minor style and naming changes.
Brecht Van Lommel
noreply at git.blender.org
Thu Jun 14 19:00:18 CEST 2018
Commit: 27cd60017fe82be66a2993853efb2a2d1e0ab919
Author: Brecht Van Lommel
Date: Thu Jun 14 15:26:45 2018 +0200
Branches: temp-udim-images
https://developer.blender.org/rB27cd60017fe82be66a2993853efb2a2d1e0ab919
Cleanup: minor style and naming changes.
===================================================================
M source/blender/blenkernel/BKE_image.h
M source/blender/blenkernel/intern/image.c
M source/blender/blenkernel/intern/packedFile.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/makesrna/intern/rna_image_api.c
M source/blender/makesrna/intern/rna_space.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index aacea3851b2..d320e5feae0 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -287,7 +287,7 @@ bool BKE_image_generate_tile(struct Image *ima, int tile, const float color[4],
struct GPUTexture *BKE_image_get_gpu_texture(struct Image *ima, int tile, int type);
void BKE_image_set_gpu_texture(struct Image *ima, int tile, int type, struct GPUTexture *tex);
-int BKE_image_get_tile_from_pos(struct Image *ima, float uv[2], float new_uv[2], float ofs[2]);
+int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float new_uv[2], float ofs[2]);
void BKE_image_get_size(struct Image *image, struct ImageUser *iuser, int *width, int *height);
void BKE_image_get_size_fl(struct Image *image, struct ImageUser *iuser, float size[2]);
@@ -307,7 +307,7 @@ int BKE_image_sequence_guess_offset(struct Image *image);
bool BKE_image_has_anim(struct Image *image);
bool BKE_image_has_packedfile(struct Image *image);
bool BKE_image_is_animated(struct Image *image);
-bool BKE_image_has_multiple(struct Image *image);
+bool BKE_image_has_multiple_ibufs(struct Image *image);
bool BKE_image_is_dirty(struct Image *image);
void BKE_image_file_format_set(struct Image *image, int ftype, const struct ImbFormatOptions *options);
bool BKE_image_has_loaded_ibuf(struct Image *image);
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 03ebd2e5397..25b5adfc6d6 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -574,11 +574,12 @@ bool BKE_image_has_opengl_texture(Image *ima)
return false;
}
-int BKE_image_get_tile_from_pos(struct Image *ima, float uv[2], float new_uv[2], float ofs[2])
+int BKE_image_get_tile_from_pos(struct Image *ima, const float uv[2], float new_uv[2], float ofs[2])
{
float local_ofs[2];
- if (!ofs)
+ if (!ofs) {
ofs = local_ofs;
+ }
copy_v2_v2(new_uv, uv);
zero_v2(ofs);
@@ -1086,7 +1087,6 @@ void BKE_image_free_all_textures(Main *bmain)
#endif
}
-/* TODO(lukas): What does this do? */
static bool imagecache_check_free_anim(ImBuf *ibuf, void *UNUSED(userkey), void *userdata)
{
int except_frame = *(int *)userdata;
@@ -1107,6 +1107,8 @@ void BKE_image_free_anim_ibufs(Image *ima, int except_frame)
void BKE_image_all_free_anim_ibufs(Main *bmain, int cfra)
{
+ /* Free all image buffers from frames other than cfra, for movies
+ * and image sequences. */
Image *ima;
for (ima = bmain->image.first; ima; ima = ima->id.next)
@@ -2763,7 +2765,9 @@ static void image_free_tile(Image *ima, int tile)
image_remove_ibuf(ima, i, tile);
}
}
- else image_remove_ibuf(ima, 0, tile);
+ else {
+ image_remove_ibuf(ima, 0, tile);
+ }
}
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
@@ -4051,7 +4055,7 @@ static int image_get_multiview_index(Image *ima, ImageUser *iuser)
{
const bool is_multilayer = BKE_image_is_multilayer(ima);
const bool is_backdrop = (ima->source == IMA_SRC_VIEWER) && (ima->type == IMA_TYPE_COMPOSITE) && (iuser == NULL);
- int index = BKE_image_has_multiple(ima) ? 0 : IMA_NO_INDEX;
+ int index = BKE_image_has_multiple_ibufs(ima) ? 0 : IMA_NO_INDEX;
if (is_multilayer) {
return iuser ? iuser->multi_index : index;
@@ -4765,7 +4769,7 @@ bool BKE_image_is_animated(Image *image)
}
/* Checks whether the image consists of multiple buffers. */
-bool BKE_image_has_multiple(Image *image)
+bool BKE_image_has_multiple_ibufs(Image *image)
{
return ELEM(image->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE, IMA_SRC_TILED);
}
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 1ea4b844c71..4ce0983f31a 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -237,7 +237,7 @@ void packAll(Main *bmain, ReportList *reports, bool verbose)
BKE_image_packfiles(reports, ima, ID_BLEND_PATH(bmain, &ima->id));
tot ++;
}
- else if (BKE_image_has_multiple(ima) && verbose) {
+ else if (BKE_image_has_multiple_ibufs(ima) && verbose) {
BKE_reportf(reports, RPT_WARNING, "Image '%s' skipped, movies and image sequences not supported",
ima->id.name + 2);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 1acdd278dae..5603f54e3d0 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -1634,7 +1634,6 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
{
Image *ima = oldmain->image.first;
Scene *sce = oldmain->scene.first;
- int a, b;
fd->imamap = oldnewmap_new();
@@ -1643,11 +1642,11 @@ void blo_make_image_pointer_map(FileData *fd, Main *oldmain)
oldnewmap_insert(fd->imamap, ima->cache, ima->cache, 0);
if (ima->rr)
oldnewmap_insert(fd->imamap, ima->rr, ima->rr, 0);
- for (a=0; a < IMA_MAX_RENDER_SLOT; a++)
+ for (int a = 0; a < IMA_MAX_RENDER_SLOT; a++)
if (ima->renders[a])
oldnewmap_insert(fd->imamap, ima->renders[a], ima->renders[a], 0);
- for (a = 0; a < ima->num_tiles; a++) {
- for (b = 0; b < TEXTARGET_COUNT; b++) {
+ for (int a = 0; a < ima->num_tiles; a++) {
+ for (int b = 0; b < TEXTARGET_COUNT; b++) {
if (ima->tiles[a].gputexture[b]) {
oldnewmap_insert(fd->imamap, ima->tiles[a].gputexture[b], ima->tiles[a].gputexture[b], 0);
}
@@ -1672,10 +1671,9 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
OldNew *entry = fd->imamap->entries;
Image *ima = oldmain->image.first;
Scene *sce = oldmain->scene.first;
- int i;
/* used entries were restored, so we put them to zero */
- for (i = 0; i < fd->imamap->nentries; i++, entry++) {
+ for (int i = 0; i < fd->imamap->nentries; i++, entry++) {
if (entry->nr > 0)
entry->newp = NULL;
}
@@ -1685,15 +1683,17 @@ void blo_end_image_pointer_map(FileData *fd, Main *oldmain)
if (ima->cache == NULL) {
ima->tpageflag &= ~IMA_GLBIND_IS_DATA;
ima->rr = NULL;
- for (i = 0; i < ima->num_tiles; i++) {
+ for (int i = 0; i < ima->num_tiles; i++) {
for (int j = 0; j < TEXTARGET_COUNT; j++) {
ima->tiles[i].gputexture[j] = NULL;
}
}
}
- for (i = 0; i < IMA_MAX_RENDER_SLOT; i++)
+
+ for (int i = 0; i < IMA_MAX_RENDER_SLOT; i++)
ima->renders[i] = newimaadr(fd, ima->renders[i]);
- for (i = 0; i < ima->num_tiles; i++) {
+
+ for (int i = 0; i < ima->num_tiles; i++) {
for (int j = 0; j < TEXTARGET_COUNT; j++) {
ima->tiles[i].gputexture[j] = newimaadr(fd, ima->tiles[i].gputexture[j]);
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index fb960c583bd..258efda071c 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -1586,6 +1586,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
if (!DNA_struct_elem_find(fd->filesdna, "Image", "short", "num_tiles")) {
for (Image *ima = bmain->image.first; ima; ima = ima->id.next) {
ima->num_tiles = 1;
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 4ce6dac0a8d..b735488ab7e 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -179,8 +179,8 @@ static void rna_Image_unpack(Image *image, Main *bmain, ReportList *reports, int
if (!BKE_image_has_packedfile(image)) {
BKE_report(reports, RPT_ERROR, "Image not packed");
}
- else if (BKE_image_has_multiple(image)) {
- BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
+ else if (BKE_image_has_multiple_ibufs(image)) {
+ BKE_report(reports, RPT_ERROR, "Unpacking movies, image sequences and tiled images not supported");
return;
}
else {
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 3fb1b79a4e9..ab0a6e52b12 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -1086,6 +1086,9 @@ static void rna_SpaceImageEditor_current_tile_range(PointerRNA *ptr, int *min, i
else {
*max = 0;
}
+
+ *softmin = *min;
+ *softmax = *max;
}
/* Space Text Editor */
More information about the Bf-blender-cvs
mailing list