Use render path as initial location when saving renders

This commit is contained in:
Campbell Barton 2016-03-02 12:14:23 +11:00
parent 0658659f74
commit cd6442f7d4
Notes: blender-bot 2023-02-14 09:48:25 +01:00
Referenced by commit 59c47ecf90, Revert "Use render path as initial location when saving renders"
2 changed files with 11 additions and 8 deletions

View File

@ -1528,19 +1528,21 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
/* check for empty path */
if (guess_path && simopts->filepath[0] == 0) {
const bool is_prev_save = !STREQ(G.ima, "//");
const bool is_pref_save = !STREQ(G.ima, "//");
RenderResult *rr = BKE_image_acquire_renderresult(scene, ima);
if (save_as_render) {
if (is_prev_save) {
BLI_strncpy(simopts->filepath, G.ima, sizeof(simopts->filepath));
}
else {
BLI_strncpy(simopts->filepath, "//untitled", sizeof(simopts->filepath));
BLI_path_abs(simopts->filepath, G.main->name);
const int cfra = rr ? rr->framenr : scene->r.cfra;
BKE_image_path_from_imformat(
simopts->filepath, scene->r.pic, G.main->name, cfra,
&simopts->im_format, (scene->r.scemode & R_EXTENSION) != 0, true, NULL);
if (rr) {
BKE_image_release_renderresult(scene, ima);
}
}
else {
BLI_snprintf(simopts->filepath, sizeof(simopts->filepath), "//%s", ima->id.name + 2);
BLI_path_abs(simopts->filepath, is_prev_save ? G.ima : G.main->name);
BLI_path_abs(simopts->filepath, is_pref_save ? G.ima : G.main->name);
}
}

View File

@ -596,6 +596,7 @@ RenderResult *render_result_new(Render *re, rcti *partrct, int crop, int savebuf
rr->renrect.xmin = 0; rr->renrect.xmax = rectx - 2 * crop;
/* crop is one or two extra pixels rendered for filtering, is used for merging and display too */
rr->crop = crop;
rr->framenr = re->r.cfra;
/* tilerect is relative coordinates within render disprect. do not subtract crop yet */
rr->tilerect.xmin = partrct->xmin - re->disprect.xmin;