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:
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r--source/blender/editors/space_image/image_ops.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 2962fa0f961..1dae5aeafa5 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1101,6 +1101,7 @@ static void image_open_cancel(bContext *UNUSED(C), wmOperator *op)
static void image_sequence_get_frame_ranges(PointerRNA *ptr, ListBase *frames_all)
{
char dir[FILE_MAXDIR];
+ const bool do_frame_range = RNA_boolean_get(ptr, "use_sequence_detection");
ImageFrameRange *frame_range = NULL;
RNA_string_get(ptr, "directory", dir);
@@ -1116,7 +1117,8 @@ static void image_sequence_get_frame_ranges(PointerRNA *ptr, ListBase *frames_al
frame->framenr = BLI_stringdec(filename, head, tail, &digits);
/* still in the same sequence */
- if ((frame_range != NULL) &&
+ if (do_frame_range &&
+ (frame_range != NULL) &&
(STREQLEN(base_head, head, FILE_MAX)) &&
(STREQLEN(base_tail, tail, FILE_MAX)))
{
@@ -1170,6 +1172,7 @@ static int image_sequence_get_len(ListBase *frames, int *ofs)
}
return frame_curr - (*ofs);
}
+ *ofs = 0;
return 0;
}
@@ -1328,7 +1331,12 @@ static int image_open_exec(bContext *C, wmOperator *op)
iuser->frames = frame_seq_len;
iuser->sfra = 1;
iuser->framenr = 1;
- iuser->offset = frame_ofs - 1;
+ if (ima->source == IMA_SRC_MOVIE) {
+ iuser->offset = 0;
+ }
+ else {
+ iuser->offset = frame_ofs - 1;
+ }
iuser->fie_ima = 2;
iuser->scene = scene;
BKE_image_init_imageuser(ima, iuser);
@@ -1451,6 +1459,9 @@ void IMAGE_OT_open(wmOperatorType *ot)
ot, FILE_TYPE_FOLDER | FILE_TYPE_IMAGE | FILE_TYPE_MOVIE, FILE_SPECIAL, FILE_OPENFILE,
WM_FILESEL_FILEPATH | WM_FILESEL_DIRECTORY | WM_FILESEL_FILES | WM_FILESEL_RELPATH,
FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
+
+ RNA_def_boolean(ot->srna, "use_sequence_detection", true, "Detect Sequences",
+ "Automatically detect animated sequences in selected images (based on file names)");
}
/******************** Match movie length operator ********************/
@@ -2378,8 +2389,8 @@ static int image_new_exec(bContext *C, wmOperator *op)
Main *bmain;
PointerRNA ptr, idptr;
PropertyRNA *prop;
- char _name[MAX_ID_NAME - 2];
- char *name = _name;
+ char name_buffer[MAX_ID_NAME - 2];
+ const char *name;
float color[4];
int width, height, floatbuf, gen_type, alpha;
int gen_context;
@@ -2392,10 +2403,13 @@ static int image_new_exec(bContext *C, wmOperator *op)
bmain = CTX_data_main(C);
prop = RNA_struct_find_property(op->ptr, "name");
- RNA_property_string_get(op->ptr, prop, name);
+ RNA_property_string_get(op->ptr, prop, name_buffer);
if (!RNA_property_is_set(op->ptr, prop)) {
/* Default value, we can translate! */
- name = (char *)DATA_(name);
+ name = DATA_(name_buffer);
+ }
+ else {
+ name = name_buffer;
}
width = RNA_int_get(op->ptr, "width");
height = RNA_int_get(op->ptr, "height");
@@ -3519,7 +3533,7 @@ static int frame_from_event(bContext *C, const wmEvent *event)
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &viewx, &viewy);
- framenr = iroundf(viewx);
+ framenr = round_fl_to_int(viewx);
}
return framenr;
@@ -3625,7 +3639,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
{
ARegion *ar = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
- Render *re = RE_GetRender(scene->id.name);
+ Render *re = RE_GetSceneRender(scene);
RenderData *rd;
rctf border;