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:
authorJulian Eisel <julian@blender.org>2020-03-06 18:22:28 +0300
committerJulian Eisel <julian@blender.org>2020-03-06 18:27:13 +0300
commitd5572eacc5958db38ac4a4a32eddb3a2cd24bf68 (patch)
tree5252d8f509dae02bf9c137a1710c073d5bbac592 /source/blender/editors/space_image
parentb242cc67928a6858a835c088e4d3ea8822c83168 (diff)
Cleanup: Reduce context usage in UI functions
Part of https://developer.blender.org/T74429. There's a chance that this causes some issues becaue in some cases we change from getting the window from context to getting it from somewhere else.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_ops.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 3126c695a3a..86cb27465c7 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2315,12 +2315,12 @@ static bool image_has_valid_path(Image *ima)
return strchr(ima->name, '\\') || strchr(ima->name, '/');
}
-bool ED_image_should_save_modified(const bContext *C)
+bool ED_image_should_save_modified(const Main *bmain)
{
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- uint modified_images_count = ED_image_save_all_modified_info(C, &reports);
+ uint modified_images_count = ED_image_save_all_modified_info(bmain, &reports);
bool should_save = modified_images_count || !BLI_listbase_is_empty(&reports.list);
BKE_reports_clear(&reports);
@@ -2328,9 +2328,8 @@ bool ED_image_should_save_modified(const bContext *C)
return should_save;
}
-int ED_image_save_all_modified_info(const bContext *C, ReportList *reports)
+int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports)
{
- Main *bmain = CTX_data_main(C);
GSet *unique_paths = BLI_gset_str_new(__func__);
int num_saveable_images = 0;
@@ -2387,9 +2386,10 @@ int ED_image_save_all_modified_info(const bContext *C, ReportList *reports)
bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
{
- ED_image_save_all_modified_info(C, reports);
-
Main *bmain = CTX_data_main(C);
+
+ ED_image_save_all_modified_info(bmain, reports);
+
bool ok = true;
for (Image *ima = bmain->images.first; ima; ima = ima->id.next) {
@@ -2417,7 +2417,7 @@ bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
static bool image_save_all_modified_poll(bContext *C)
{
- int num_files = ED_image_save_all_modified_info(C, NULL);
+ int num_files = ED_image_save_all_modified_info(CTX_data_main(C), NULL);
return num_files > 0;
}