Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/image_save.cc
| /* SPDX-License-Identifier: GPL-2.0-or-later | /* SPDX-License-Identifier: GPL-2.0-or-later | ||||
| * Copyright 2001-2002 NaN Holding BV. All rights reserved. */ | * Copyright 2001-2002 NaN Holding BV. All rights reserved. */ | ||||
| /** \file | /** \file | ||||
| * \ingroup bke | * \ingroup bke | ||||
| */ | */ | ||||
| #include <cerrno> | #include <cerrno> | ||||
| #include <cstring> | #include <cstring> | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_path_util.h" | #include "BLI_path_util.h" | ||||
| #include "BLI_string.h" | #include "BLI_string.h" | ||||
| #include "BLI_vector.hh" | #include "BLI_vector.hh" | ||||
| #include "BLT_translation.h" | |||||
| #include "DNA_image_types.h" | #include "DNA_image_types.h" | ||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #include "IMB_colormanagement.h" | #include "IMB_colormanagement.h" | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| #include "IMB_imbuf_types.h" | #include "IMB_imbuf_types.h" | ||||
| #include "IMB_openexr.h" | #include "IMB_openexr.h" | ||||
| ▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | if (ibuf) { | ||||
| /* check for empty path */ | /* check for empty path */ | ||||
| if (guess_path && opts->filepath[0] == 0) { | if (guess_path && opts->filepath[0] == 0) { | ||||
| const bool is_prev_save = !STREQ(G.ima, "//"); | const bool is_prev_save = !STREQ(G.ima, "//"); | ||||
| if (opts->save_as_render) { | if (opts->save_as_render) { | ||||
| if (is_prev_save) { | if (is_prev_save) { | ||||
| BLI_strncpy(opts->filepath, G.ima, sizeof(opts->filepath)); | BLI_strncpy(opts->filepath, G.ima, sizeof(opts->filepath)); | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_strncpy(opts->filepath, "//untitled", sizeof(opts->filepath)); | BLI_snprintf(opts->filepath, sizeof(opts->filepath), "//%s", DATA_("untitled")); | ||||
| BLI_path_abs(opts->filepath, BKE_main_blendfile_path(bmain)); | BLI_path_abs(opts->filepath, BKE_main_blendfile_path(bmain)); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| BLI_snprintf(opts->filepath, sizeof(opts->filepath), "//%s", ima->id.name + 2); | BLI_snprintf(opts->filepath, sizeof(opts->filepath), "//%s", ima->id.name + 2); | ||||
| BLI_path_make_safe(opts->filepath); | BLI_path_make_safe(opts->filepath); | ||||
| BLI_path_abs(opts->filepath, is_prev_save ? G.ima : BKE_main_blendfile_path(bmain)); | BLI_path_abs(opts->filepath, is_prev_save ? G.ima : BKE_main_blendfile_path(bmain)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 860 Lines • Show Last 20 Lines | |||||