From 24d1829243c6e41c639c1d0722a13599a7c1927c Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Thu, 31 May 2018 11:07:14 +0200 Subject: Cleanup: nuke G.main out of BKE PackedFile code. --- source/blender/makesrna/intern/rna_image_api.c | 12 ++++++------ source/blender/makesrna/intern/rna_vfont_api.c | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 61f1edc0af5..f5f7ade6390 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -64,9 +64,9 @@ #include "MEM_guardedalloc.h" -static void rna_ImagePackedFile_save(ImagePackedFile *imapf, ReportList *reports) +static void rna_ImagePackedFile_save(ImagePackedFile *imapf, Main *bmain, ReportList *reports) { - if (writePackedFile(reports, imapf->filepath, imapf->packedfile, 0) != RET_OK) { + if (writePackedFile(reports, bmain->name, imapf->filepath, imapf->packedfile, 0) != RET_OK) { BKE_reportf(reports, RPT_ERROR, "Could not save packed file to disk as '%s'", imapf->filepath); } @@ -177,7 +177,7 @@ static void rna_Image_pack( WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image); } -static void rna_Image_unpack(Image *image, ReportList *reports, int method) +static void rna_Image_unpack(Image *image, Main *bmain, ReportList *reports, int method) { if (!BKE_image_has_packedfile(image)) { BKE_report(reports, RPT_ERROR, "Image not packed"); @@ -188,7 +188,7 @@ static void rna_Image_unpack(Image *image, ReportList *reports, int method) } else { /* reports its own error on failure */ - unpackImage(reports, image, method); + unpackImage(bmain, reports, image, method); } } @@ -302,7 +302,7 @@ void RNA_api_image_packed_file(StructRNA *srna) func = RNA_def_function(srna, "save", "rna_ImagePackedFile_save"); RNA_def_function_ui_description(func, "Save the packed file to its filepath"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); } void RNA_api_image(StructRNA *srna) @@ -332,7 +332,7 @@ void RNA_api_image(StructRNA *srna) func = RNA_def_function(srna, "unpack", "rna_Image_unpack"); RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); RNA_def_enum(func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack"); func = RNA_def_function(srna, "reload", "rna_Image_reload"); diff --git a/source/blender/makesrna/intern/rna_vfont_api.c b/source/blender/makesrna/intern/rna_vfont_api.c index 6a2a7f3ffad..b93fc1a0053 100644 --- a/source/blender/makesrna/intern/rna_vfont_api.c +++ b/source/blender/makesrna/intern/rna_vfont_api.c @@ -43,14 +43,14 @@ static void rna_VectorFont_pack(VFont *vfont, Main *bmain, ReportList *reports) vfont->packedfile = newPackedFile(reports, vfont->name, ID_BLEND_PATH(bmain, &vfont->id)); } -static void rna_VectorFont_unpack(VFont *vfont, ReportList *reports, int method) +static void rna_VectorFont_unpack(VFont *vfont, Main *bmain, ReportList *reports, int method) { if (!vfont->packedfile) { BKE_report(reports, RPT_ERROR, "Font not packed"); } else { /* reports its own error on failure */ - unpackVFont(reports, vfont, method); + unpackVFont(bmain, reports, vfont, method); } } @@ -62,11 +62,11 @@ void RNA_api_vfont(StructRNA *srna) func = RNA_def_function(srna, "pack", "rna_VectorFont_pack"); RNA_def_function_ui_description(func, "Pack the font into the current blend file"); - RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); func = RNA_def_function(srna, "unpack", "rna_VectorFont_unpack"); RNA_def_function_ui_description(func, "Unpack the font to the samples filename"); - RNA_def_function_flag(func, FUNC_USE_REPORTS); + RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); RNA_def_enum(func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack"); } -- cgit v1.2.3