diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-04-09 13:49:45 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-04-09 13:49:45 +0300 |
commit | 216a0993cd9ee871b82db201a336640cd571c556 (patch) | |
tree | c05522346456c8d06bd43f66f531423396784dce /source | |
parent | 6ee460f2997a601db6c315efbf715a068f7c1982 (diff) | |
parent | 8a1c444c937cd1326d9e1b1d3302a1617b3c79f8 (diff) |
Merge branch 'master' into gooseberry
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/sequencer.c | 22 | ||||
-rw-r--r-- | source/blender/blenlib/intern/BLI_filelist.c | 34 | ||||
-rw-r--r-- | source/blender/blenlib/intern/edgehash.c | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/path_util.c | 33 | ||||
-rw-r--r-- | source/blender/editors/render/render_internal.c | 1 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_2d.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_data.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_action/action_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 1 | ||||
-rw-r--r-- | source/blender/render/intern/source/render_result.c | 23 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 70 |
14 files changed, 111 insertions, 85 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index bd0daf36147..80828533a31 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -4533,8 +4533,8 @@ static void image_update_views_format(Image *ima, ImageUser *iuser) } else { iv = iv->prev; + close(file); } - close(file); } /* all good */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index b53a44f1b4b..462f20c2b73 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -868,9 +868,9 @@ void BKE_sequence_reload_new_file(Scene *scene, Sequence *seq, const bool lock_r seq_multiview_name(scene, i, prefix, ext, str, FILE_MAX); anim = openanim(str, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), seq->streamindex, seq->strip->colorspace_settings.name); - seq_anim_add_suffix(scene, anim, i); if (anim) { + seq_anim_add_suffix(scene, anim, i); sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim"); BLI_addtail(&seq->anims, sanim); sanim->anim = anim; @@ -1532,9 +1532,15 @@ static void seq_open_anim_file(Scene *scene, Sequence *seq, bool openfile) seq->streamindex, seq->strip->colorspace_settings.name); } - seq_anim_add_suffix(scene, sanim->anim, i); - - if (sanim->anim == NULL) { + if (sanim->anim) { +#if 0 + seq_anim_add_suffix(scene, sanim->anim, i); +#else + /* we already have the suffix */ + IMB_suffix_anim(sanim->anim, suffix); +#endif + } + else { if (openfile) { sanim->anim = openanim( name, IB_rect | ((seq->flag & SEQ_FILTERY) ? IB_animdeinterlace : 0), @@ -1803,6 +1809,9 @@ static bool seq_proxy_multiview_context_invalid(Sequence *seq, Scene *scene, con BLI_path_abs(path, G.main->name); BKE_scene_multiview_view_prefix_get(scene, path, prefix, &ext); } + else { + prefix[0] = '\0'; + } if (prefix[0] == '\0') return view_id != 0; @@ -2762,6 +2771,9 @@ static ImBuf *seq_render_image_strip(const SeqRenderData *context, Sequence *seq goto monoview_image; } } + else { + prefix[0] = '\0'; + } totviews = BKE_scene_multiview_num_views_get(&context->scene->r); ibufs_arr = MEM_callocN(sizeof(ImBuf *) * totviews, "Sequence Image Views Imbufs"); @@ -5118,9 +5130,9 @@ Sequence *BKE_sequencer_add_movie_strip(bContext *C, ListBase *seqbasep, SeqLoad seq_multiview_name(scene, i, prefix, ext, str, FILE_MAX); anim_arr[j] = openanim(str, IB_rect, 0, colorspace); - seq_anim_add_suffix(scene, anim_arr[j], i); if (anim_arr[j]) { + seq_anim_add_suffix(scene, anim_arr[j], i); j++; } } diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index 81813ce1f62..b934b51375b 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -112,10 +112,40 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) if ((dir = opendir(dirname)) != NULL) { const struct dirent *fname; + bool has_current = false, has_parent = false; + while ((fname = readdir(dir)) != NULL) { struct dirlink * const dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); if (dlink != NULL) { dlink->name = BLI_strdup(fname->d_name); + if (FILENAME_IS_PARENT(dlink->name)) { + has_parent = true; + } + else if (FILENAME_IS_CURRENT(dlink->name)) { + has_current = true; + } + BLI_addhead(&dirbase, dlink); + newnum++; + } + } + + if (!has_parent) { + char pardir[FILE_MAXDIR]; + + BLI_strncpy(pardir, dirname, sizeof(pardir)); + if (BLI_parent_dir(pardir) && (BLI_access(pardir, R_OK) == 0)) { + struct dirlink * const dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); + if (dlink != NULL) { + dlink->name = BLI_strdup(FILENAME_PARENT); + BLI_addhead(&dirbase, dlink); + newnum++; + } + } + } + if (!has_current) { + struct dirlink * const dlink = (struct dirlink *)malloc(sizeof(struct dirlink)); + if (dlink != NULL) { + dlink->name = BLI_strdup(FILENAME_CURRENT); BLI_addhead(&dirbase, dlink); newnum++; } @@ -148,6 +178,10 @@ static void bli_builddir(struct BuildDirCtx *dir_ctx, const char *dirname) if (BLI_stat(fullname, &file->s) != -1) { file->type = file->s.st_mode; } + else if (FILENAME_IS_CURRPAR(file->relname)) { + /* Hack around for UNC paths on windows - does not support stat on '\\SERVER\foo\..', sigh... */ + file->type |= S_IFDIR; + } file->flags = 0; dir_ctx->nrfiles++; file++; diff --git a/source/blender/blenlib/intern/edgehash.c b/source/blender/blenlib/intern/edgehash.c index fd7ad4db44b..edf70a1f188 100644 --- a/source/blender/blenlib/intern/edgehash.c +++ b/source/blender/blenlib/intern/edgehash.c @@ -232,7 +232,6 @@ BLI_INLINE void edgehash_insert_ex_keyonly(EdgeHash *eh, unsigned int v0, unsign EdgeEntry *e = BLI_mempool_alloc(eh->epool); BLI_assert((eh->flag & EDGEHASH_FLAG_ALLOW_DUPES) || (BLI_edgehash_haskey(eh, v0, v1) == 0)); - IS_EDGEHASH_ASSERT(eh); /* this helps to track down errors with bad edge data */ BLI_assert(v0 < v1); diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index 72739018399..58b01f7e140 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -57,6 +57,8 @@ # include <shlobj.h> # include "BLI_winstuff.h" # include "MEM_guardedalloc.h" +#else +# include "unistd.h" #endif /* WIN32 */ /* local */ @@ -743,7 +745,7 @@ bool BLI_parent_dir(char *path) BLI_cleanup_dir(NULL, tmp); /* does all the work of normalizing the path for us */ if (!BLI_testextensie(tmp, parent_dir)) { - BLI_strncpy(path, tmp, sizeof(tmp)); + strcpy(path, tmp); /* We assume pardir is always shorter... */ return true; } else { @@ -1109,33 +1111,18 @@ void BLI_char_switch(char *string, char from, char to) */ void BLI_make_exist(char *dir) { - int a; - char par_path[PATH_MAX + 3]; - - BLI_char_switch(dir, ALTSEP, SEP); + bool valid_path = true; - a = strlen(dir); + /* Loop as long as cur path is not a dir, and we can get a parent path. */ + while ((BLI_access(dir, R_OK) != 0) && (valid_path = BLI_parent_dir(dir))); - for (BLI_join_dirfile(par_path, sizeof(par_path), dir, FILENAME_PARENT); - !(BLI_is_dir(dir) && BLI_exists(par_path)); - BLI_join_dirfile(par_path, sizeof(par_path), dir, FILENAME_PARENT)) - { - a--; - while (dir[a] != SEP) { - a--; - if (a <= 0) break; - } - if (a >= 0) { - dir[a + 1] = '\0'; - } - else { + /* If we could not find an existing dir, use default root... */ + if (!valid_path || !dir[0]) { #ifdef WIN32 - get_default_root(dir); + get_default_root(dir); #else - strcpy(dir, "/"); + strcpy(dir, "/"); #endif - break; - } } } diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index c0f7c52f0a4..a5cd9b85b9c 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -893,6 +893,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, const wmEvent *even rj->write_still = is_write_still && !is_animation; rj->iuser.scene = scene; rj->iuser.ok = 1; + rj->iuser.passtype = SCE_PASS_COMBINED; rj->reports = op->reports; rj->orig_layer = 0; rj->last_layer = 0; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 9d39eea7b96..eff604658d9 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -996,8 +996,8 @@ static ImBuf *paint_2d_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos) static void paint_2d_convert_brushco(ImBuf *ibufb, const float pos[2], int ipos[2]) { - ipos[0] = (int)floorf((pos[0] - ibufb->x / 2) + 1.0f); - ipos[1] = (int)floorf((pos[1] - ibufb->y / 2) + 1.0f); + ipos[0] = (int)floorf((pos[0] - ibufb->x / 2)); + ipos[1] = (int)floorf((pos[1] - ibufb->y / 2)); } static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *curveb, unsigned short *texmaskb, const float lastpos[2], const float pos[2]) diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index a7358172ef5..440201bd93e 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -646,7 +646,7 @@ static NlaTrack *nla_tweak_track_get(AnimData *adt) printf("%s: Active strip (%p, %s) not in NLA track found (%p, %s)\n", __func__, adt->actstrip, (adt->actstrip) ? adt->actstrip->name : "<None>", - nlt, (nlt) ? nlt->name : "<None>"); + nlt, nlt->name); } } } diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index 0f21446cc3d..752863f86e0 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -106,6 +106,7 @@ void ED_operatormacros_action(void) WM_operatortype_macro_define(ot, "ACTION_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); + RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); } /* ************************** registration - keymaps **********************************/ diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index ad4797f7892..1bb76f4d8c2 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -900,7 +900,6 @@ static void filelist_setfiletypes(struct FileList *filelist) file = filelist->filelist; for (num = 0; num < filelist->numfiles; num++, file++) { - file->type = file->s.st_mode; /* restore the mess below */ #ifndef __APPLE__ /* Don't check extensions for directories, allow in OSX cause bundles have extensions*/ if (file->type & S_IFDIR) { diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index e112400a4dd..9cbf8f105f5 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -442,6 +442,7 @@ void ED_operatormacros_graph(void) WM_operatortype_macro_define(ot, "GRAPH_OT_duplicate"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_transform"); RNA_enum_set(otmacro->ptr, "mode", TFM_TIME_DUPLICATE); + RNA_enum_set(otmacro->ptr, "proportional", PROP_EDIT_OFF); } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 1023f9641b3..32584a3a2df 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -157,6 +157,7 @@ static SpaceLink *image_new(const bContext *UNUSED(C)) simage->iuser.fie_ima = 2; simage->iuser.frames = 100; simage->iuser.flag = IMA_SHOW_STEREO; + simage->iuser.passtype = SCE_PASS_COMBINED; scopes_new(&simage->scopes); simage->sample_line_hist.height = 100; diff --git a/source/blender/render/intern/source/render_result.c b/source/blender/render/intern/source/render_result.c index 90f6eab0cc1..9ae394fa675 100644 --- a/source/blender/render/intern/source/render_result.c +++ b/source/blender/render/intern/source/render_result.c @@ -1512,10 +1512,7 @@ void render_result_rect_from_ibuf(RenderResult *rr, RenderData *UNUSED(rd), ImBu /* TSK! Since sequence render doesn't free the *rr render result, the old rect32 * can hang around when sequence render has rendered a 32 bits one before */ - if (rv->rect32) { - MEM_freeN(rv->rect32); - rv->rect32 = NULL; - } + MEM_SAFE_FREE(rv->rect32); } else if (ibuf->rect) { if (!rv->rect32) @@ -1524,24 +1521,12 @@ void render_result_rect_from_ibuf(RenderResult *rr, RenderData *UNUSED(rd), ImBu memcpy(rv->rect32, ibuf->rect, 4 * rr->rectx * rr->recty); /* Same things as above, old rectf can hang around from previous render. */ - if (rv->rectf) { - MEM_freeN(rv->rectf); - rv->rectf = NULL; - } + MEM_SAFE_FREE(rv->rectf); } /* clean up non-view buffers */ - if (rr) { - if (rr->rectf) { - MEM_freeN(rr->rectf); - rr->rectf = NULL; - } - - if (rr->rect32) { - MEM_freeN(rr->rect32); - rr->rect32 = NULL; - } - } + MEM_SAFE_FREE(rr->rect32); + MEM_SAFE_FREE(rr->rectf); } void render_result_rect_fill_zero(RenderResult *rr, const int view_id) diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index fe15688e969..3ee93cf3f13 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2877,30 +2877,45 @@ static void wm_filepath_default(char *filepath) static void save_set_compress(wmOperator *op) { - if (!RNA_struct_property_is_set(op->ptr, "compress")) { - if (G.save_over) /* keep flag for existing file */ - RNA_boolean_set(op->ptr, "compress", (G.fileflags & G_FILE_COMPRESS) != 0); - else /* use userdef for new file */ - RNA_boolean_set(op->ptr, "compress", (U.flag & USER_FILECOMPRESS) != 0); + PropertyRNA *prop; + + prop = RNA_struct_find_property(op->ptr, "compress"); + if (!RNA_property_is_set(op->ptr, prop)) { + if (G.save_over) { /* keep flag for existing file */ + RNA_property_boolean_set(op->ptr, prop, (G.fileflags & G_FILE_COMPRESS) != 0); + } + else { /* use userdef for new file */ + RNA_property_boolean_set(op->ptr, prop, (U.flag & USER_FILECOMPRESS) != 0); + } } } -static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +static void save_set_filepath(wmOperator *op) { + PropertyRNA *prop; char name[FILE_MAX]; - save_set_compress(op); - - /* if not saved before, get the name of the most recently used .blend file */ - if (G.main->name[0] == 0 && G.recent_files.first) { - struct RecentFile *recent = G.recent_files.first; - BLI_strncpy(name, recent->filepath, FILE_MAX); + prop = RNA_struct_find_property(op->ptr, "filepath"); + if (!RNA_property_is_set(op->ptr, prop)) { + /* if not saved before, get the name of the most recently used .blend file */ + if (G.main->name[0] == 0 && G.recent_files.first) { + struct RecentFile *recent = G.recent_files.first; + BLI_strncpy(name, recent->filepath, FILE_MAX); + } + else { + BLI_strncpy(name, G.main->name, FILE_MAX); + } + + wm_filepath_default(name); + RNA_property_string_set(op->ptr, prop, name); } - else - BLI_strncpy(name, G.main->name, FILE_MAX); - - wm_filepath_default(name); - RNA_string_set(op->ptr, "filepath", name); +} + +static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) +{ + + save_set_compress(op); + save_set_filepath(op); WM_event_add_fileselect(C, op); @@ -2999,7 +3014,6 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot) static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { - char name[FILE_MAX]; int ret; /* cancel if no active window */ @@ -3007,18 +3021,7 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U return OPERATOR_CANCELLED; save_set_compress(op); - - /* if not saved before, get the name of the most recently used .blend file */ - if (G.main->name[0] == 0 && G.recent_files.first) { - struct RecentFile *recent = G.recent_files.first; - BLI_strncpy(name, recent->filepath, FILE_MAX); - } - else - BLI_strncpy(name, G.main->name, FILE_MAX); - - wm_filepath_default(name); - - RNA_string_set(op->ptr, "filepath", name); + save_set_filepath(op); /* if we're saving for the first time and prefer relative paths - any existing paths will be absolute, * enable the option to remap paths to avoid confusion [#37240] */ @@ -3030,8 +3033,11 @@ static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *U } if (G.save_over) { - if (BLI_exists(name)) { - ret = WM_operator_confirm_message_ex(C, op, IFACE_("Save Over?"), ICON_QUESTION, name); + char path[FILE_MAX]; + + RNA_string_get(op->ptr, "filepath", path); + if (BLI_exists(path)) { + ret = WM_operator_confirm_message_ex(C, op, IFACE_("Save Over?"), ICON_QUESTION, path); } else { ret = wm_save_as_mainfile_exec(C, op); |