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:
authorBrecht Van Lommel <brecht@blender.org>2022-05-16 14:16:41 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-05-16 14:29:22 +0300
commitadf183eeaeaba4eeeea31353e4a939f7a5c5c9fc (patch)
tree61a937b6290fb49b581a8b93bc2f32b6b1d3f9fb /source/blender/editors/space_image
parent93bcfd19ba9a3647ce371e0e935f6ae8abac725b (diff)
Fix T98153: bpy.ops.image.save_as not working from Python, after recent changes
Make exec and invoke consistent so they both use operator properties if set.
Diffstat (limited to 'source/blender/editors/space_image')
-rw-r--r--source/blender/editors/space_image/image_ops.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 20f6bae3e52..01be2ef22d5 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1734,7 +1734,9 @@ static ImageSaveData *image_save_as_init(bContext *C, wmOperator *op)
return NULL;
}
- RNA_string_set(op->ptr, "filepath", isd->opts.filepath);
+ if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+ RNA_string_set(op->ptr, "filepath", isd->opts.filepath);
+ }
/* Enable save_copy by default for render results. */
if (ELEM(image->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE) &&
@@ -1742,7 +1744,9 @@ static ImageSaveData *image_save_as_init(bContext *C, wmOperator *op)
RNA_boolean_set(op->ptr, "copy", true);
}
- RNA_boolean_set(op->ptr, "save_as_render", isd->opts.save_as_render);
+ if (!RNA_struct_property_is_set(op->ptr, "save_as_render")) {
+ RNA_boolean_set(op->ptr, "save_as_render", isd->opts.save_as_render);
+ }
/* Show multiview save options only if image has multiviews. */
PropertyRNA *prop;
@@ -1774,8 +1778,6 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
if (op->customdata) {
isd = op->customdata;
- image_save_options_from_op(bmain, &isd->opts, op);
- BKE_image_save_options_update(&isd->opts, isd->image);
}
else {
isd = image_save_as_init(C, op);
@@ -1784,6 +1786,9 @@ static int image_save_as_exec(bContext *C, wmOperator *op)
}
}
+ image_save_options_from_op(bmain, &isd->opts, op);
+ BKE_image_save_options_update(&isd->opts, isd->image);
+
save_image_op(bmain, isd->image, isd->iuser, op, &isd->opts);
if (isd->opts.save_copy == false) {
@@ -1911,16 +1916,19 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
- RNA_def_boolean(ot->srna,
- "save_as_render",
- 0,
- "Save As Render",
- "Apply render part of display transform when saving byte image");
- RNA_def_boolean(ot->srna,
- "copy",
- 0,
- "Copy",
- "Create a new image file without modifying the current image in blender");
+ PropertyRNA *prop;
+ prop = RNA_def_boolean(ot->srna,
+ "save_as_render",
+ 0,
+ "Save As Render",
+ "Apply render part of display transform when saving byte image");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ prop = RNA_def_boolean(ot->srna,
+ "copy",
+ 0,
+ "Copy",
+ "Create a new image file without modifying the current image in blender");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
image_operator_prop_allow_tokens(ot);
WM_operator_properties_filesel(ot,