[Bf-blender-cvs] [010e2a2] gooseberry: Add play gismos to collapsed image sequences. When clicking repeatedly on the sequence they are toggled between play-pause.
Antony Riakiotakis
noreply at git.blender.org
Tue Jun 9 13:52:03 CEST 2015
Commit: 010e2a2b364c59bf61753e3062e5cc6f76637a11
Author: Antony Riakiotakis
Date: Tue Jun 9 13:51:54 2015 +0200
Branches: gooseberry
https://developer.blender.org/rB010e2a2b364c59bf61753e3062e5cc6f76637a11
Add play gismos to collapsed image sequences. When clicking repeatedly
on the sequence they are toggled between play-pause.
===================================================================
M source/blender/editors/space_file/file_draw.c
M source/blender/editors/space_file/file_ops.c
M source/blender/makesdna/DNA_space_types.h
===================================================================
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index c89980e..18b7e42 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -336,7 +336,7 @@ void file_calc_previews(const bContext *C, ARegion *ar)
UI_view2d_totRect_set(v2d, sfile->layout->width, sfile->layout->height);
}
-static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, bool is_icon, bool drag)
+static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int sy, ImBuf *imb, FileLayout *layout, bool is_icon, bool drag, bool play)
{
uiBut *but;
float fx, fy;
@@ -412,6 +412,23 @@ static void file_draw_preview(uiBlock *block, struct direntry *file, int sx, int
UI_but_drag_set_image(but, file->path, get_file_icon(file), imb, scale);
}
+ if (play) {
+ glPushMatrix();
+ glTranslatef(xco + ex / 2.0f, yco + ey / 2.0f, 0.0);
+ glColor4f(1.0f, 1.0f, 1.0f, 0.8);
+ glutil_draw_filled_arc(0.0f, 2.0f * M_PI, ey / 4.0f, 32);
+ glColor4f(0.3f, 0.3f, 1.0f, 0.8f);
+ glLineWidth(3.0);
+ glutil_draw_lined_arc(0.0f, 2.0f * M_PI, ey / 4.0f, 32);
+ glLineWidth(1.0);
+ glBegin(GL_TRIANGLES);
+ glVertex2f(-ey / 8.0f, ey / 8.0f);
+ glVertex2f(-ey / 8.0f, -ey / 8.0f);
+ glVertex2f(ey / 8.0f, 0.0f);
+ glEnd();
+ glPopMatrix();
+ }
+
glDisable(GL_BLEND);
}
@@ -509,6 +526,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
bool is_icon;
short align;
bool do_drag;
+ bool do_play;
int column_space = 0.6f * UI_UNIT_X;
numfiles = filelist_numfiles(files);
@@ -566,16 +584,18 @@ void file_draw_list(const bContext *C, ARegion *ar)
do_drag = !(FILENAME_IS_CURRPAR(file->relname));
if (FILE_IMGDISPLAY == params->display) {
- is_icon = 0;
+ is_icon = false;
imb = filelist_getimage(files, i);
if (!imb) {
imb = filelist_geticon(files, i);
- is_icon = 1;
+ is_icon = true;
}
- file_draw_preview(block, file, sx, sy, imb, layout, is_icon, do_drag);
+ do_play = (file->selflag & FILE_SEL_COLLAPSED) && !(file->selflag & FILE_SEL_PLAYING);
+
+ file_draw_preview(block, file, sx, sy, imb, layout, is_icon, do_drag, do_play);
- if ((file->selflag & FILE_SEL_COLLAPSED) && (file->selflag & FILE_SEL_SELECTED)) {
+ if ((file->selflag & FILE_SEL_COLLAPSED) && (file->selflag & FILE_SEL_PLAYING)) {
/* refresh to keep movie playing */
file->collapsed_info.curfra++;
file->collapsed_info.curfra %= file->collapsed_info.totfiles;
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 0eab155..e6d8c55 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -224,7 +224,7 @@ static FileSelect file_select(bContext *C, const rcti *rect, FileSelType select,
/* flag the files as selected in the filelist */
filelist_select(sfile->files, &sel, select, FILE_SEL_SELECTED, check_type);
-
+
/* Don't act on multiple selected files */
if (sel.first != sel.last) select = 0;
@@ -371,7 +371,12 @@ static int file_select_invoke(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
/* single select, deselect all selected first */
- if (!extend) file_deselect_all(sfile, FILE_SEL_SELECTED);
+ if (!(file->type & S_IFDIR) && (file->selflag & FILE_SEL_COLLAPSED)&& (file->selflag & FILE_SEL_SELECTED)) {
+ file->selflag ^= FILE_SEL_PLAYING;
+ }
+ if (!extend) {
+ file_deselect_all(sfile, FILE_SEL_SELECTED);
+ }
}
}
}
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index b352686..ad8b0fe 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -743,6 +743,7 @@ typedef enum eDirEntry_SelectFlag {
FILE_SEL_SELECTED = (1 << 3),
FILE_SEL_EDITING = (1 << 4),
FILE_SEL_COLLAPSED = (1 << 5),
+ FILE_SEL_PLAYING = (1 << 6),
} eDirEntry_SelectFlag;
/* Image/UV Editor ======================================== */
More information about the Bf-blender-cvs
mailing list