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:
authorCampbell Barton <ideasman42@gmail.com>2011-05-01 18:02:40 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-01 18:02:40 +0400
commit5440b57432b43207e42817fe4dcce1716151ef3c (patch)
tree9c7be6875720b78a38b5b97602a7ac2cfc88ac5b /source/blender/editors/space_image
parent1093f69e506e56e0bf605c44aefc34d6f9bc27fe (diff)
improve image sequence usability, problem was when the image didn't load there was no way to know the frame that blender was attempting to read.
added a label for image sequence images showing the image file's frame, even when not able to load, this also gives realtime feedback to the user while dragging the frame offset/start/duration buttons about so they can better understand how these settings work.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_buttons.c81
1 files changed, 45 insertions, 36 deletions
diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c
index 52b48e1f9fd..fc20e2a744e 100644
--- a/source/blender/editors/space_image/image_buttons.c
+++ b/source/blender/editors/space_image/image_buttons.c
@@ -119,53 +119,62 @@ static void do_image_panel_events(bContext *C, void *UNUSED(arg), int event)
WM_event_add_notifier(C, NC_IMAGE, sima->image);
}
-static void image_info(Image *ima, ImBuf *ibuf, char *str)
+static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, char *str)
{
int ofs= 0;
-
+
str[0]= 0;
if(ima==NULL) return;
+
if(ibuf==NULL) {
- sprintf(str, "Can not get an image");
- return;
- }
-
- if(ima->source==IMA_SRC_MOVIE) {
- ofs= sprintf(str, "Movie");
- if(ima->anim)
- ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
- }
- else
- ofs= sprintf(str, "Image");
-
- ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
-
- if(ibuf->rect_float) {
- if(ibuf->channels!=4) {
- ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
- }
- else if(ibuf->depth==32)
- ofs+= sprintf(str+ofs, " RGBA float");
- else
- ofs+= sprintf(str+ofs, " RGB float");
+ ofs+= sprintf(str, "Can't Load Image");
}
else {
- if(ibuf->depth==32)
- ofs+= sprintf(str+ofs, " RGBA byte");
+ if(ima->source==IMA_SRC_MOVIE) {
+ ofs+= sprintf(str, "Movie");
+ if(ima->anim)
+ ofs+= sprintf(str+ofs, "%d frs", IMB_anim_get_duration(ima->anim));
+ }
else
- ofs+= sprintf(str+ofs, " RGB byte");
+ ofs+= sprintf(str, "Image");
+
+ ofs+= sprintf(str+ofs, ": size %d x %d,", ibuf->x, ibuf->y);
+
+ if(ibuf->rect_float) {
+ if(ibuf->channels!=4) {
+ ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
+ }
+ else if(ibuf->depth==32)
+ ofs+= sprintf(str+ofs, " RGBA float");
+ else
+ ofs+= sprintf(str+ofs, " RGB float");
+ }
+ else {
+ if(ibuf->depth==32)
+ ofs+= sprintf(str+ofs, " RGBA byte");
+ else
+ ofs+= sprintf(str+ofs, " RGB byte");
+ }
+ if(ibuf->zbuf || ibuf->zbuf_float)
+ ofs+= sprintf(str+ofs, " + Z");
+
+ if(ima->source==IMA_SRC_SEQUENCE) {
+ char *file= BLI_last_slash(ibuf->name);
+ if(file==NULL) file= ibuf->name;
+ else file++;
+ ofs+= sprintf(str+ofs, ", %s", file);
+ }
}
- if(ibuf->zbuf || ibuf->zbuf_float)
- ofs+= sprintf(str+ofs, " + Z");
+ /* the frame number, even if we cant */
if(ima->source==IMA_SRC_SEQUENCE) {
- char *file= BLI_last_slash(ibuf->name);
- if(file==NULL) file= ibuf->name;
- else file++;
- sprintf(str+ofs, ", %s", file);
+ /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */
+ const int framenr= BKE_image_user_get_frame(iuser, CFRA, 0);
+ ofs+= sprintf(str+ofs, ", Frame: %d", framenr);
}
-
+
+ (void)ofs;
}
/* gets active viewer user */
@@ -816,7 +825,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
if(ima->source == IMA_SRC_VIEWER) {
ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
- image_info(ima, ibuf, str);
+ image_info(scene, iuser, ima, ibuf, str);
BKE_image_release_ibuf(ima, lock);
uiItemL(layout, ima->id.name+2, ICON_NONE);
@@ -888,7 +897,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char
else if(ima->source != IMA_SRC_GENERATED) {
if(compact == 0) {
ibuf= BKE_image_acquire_ibuf(ima, iuser, &lock);
- image_info(ima, ibuf, str);
+ image_info(scene, iuser, ima, ibuf, str);
BKE_image_release_ibuf(ima, lock);
uiItemL(layout, str, ICON_NONE);
}