[Bf-blender-cvs] [07b547ef96f] blender-v3.3-release: Fix T100797: C++ exporters do not remember the path on subsequent exports

Aras Pranckevicius noreply at git.blender.org
Thu Sep 22 09:26:49 CEST 2022


Commit: 07b547ef96f1a607e57202e3badb6ffa651e1c41
Author: Aras Pranckevicius
Date:   Wed Sep 7 11:47:29 2022 +0300
Branches: blender-v3.3-release
https://developer.blender.org/rB07b547ef96f1a607e57202e3badb6ffa651e1c41

Fix T100797: C++ exporters do not remember the path on subsequent exports

Most/all C++ based IO code had a pattern of doing using
RNA_struct_property_is_set to check whether a default path needs to
be set. However, it returns false for properties restored from
"previous operator settings" (property restoration code sets
IDP_FLAG_GHOST flag on them, which "is set" sees and goes
"nope, not set").

The fix here is to apply similar logic as 10 years ago in the
T32855 fix (rBdb250a4): use RNA_struct_property_is_set_ex instead.

Reviewed By: Campbell Barton
Differential Revision: https://developer.blender.org/D15904

===================================================================

M	source/blender/editors/io/io_alembic.c
M	source/blender/editors/io/io_collada.c
M	source/blender/editors/io/io_gpencil_export.c
M	source/blender/editors/io/io_gpencil_import.c
M	source/blender/editors/io/io_obj.c
M	source/blender/editors/io/io_stl_ops.c
M	source/blender/editors/io/io_usd.c

===================================================================

diff --git a/source/blender/editors/io/io_alembic.c b/source/blender/editors/io/io_alembic.c
index 0068586730f..ff69a94b249 100644
--- a/source/blender/editors/io/io_alembic.c
+++ b/source/blender/editors/io/io_alembic.c
@@ -75,7 +75,7 @@ static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *
 
   RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     Main *bmain = CTX_data_main(C);
     char filepath[FILE_MAX];
 
@@ -99,7 +99,7 @@ static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent *
 
 static int wm_alembic_export_exec(bContext *C, wmOperator *op)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
@@ -619,7 +619,7 @@ static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *
 
 static int wm_alembic_import_exec(bContext *C, wmOperator *op)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index c491e7a5815..5ebf76295d7 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -38,7 +38,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *
 {
   Main *bmain = CTX_data_main(C);
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     char filepath[FILE_MAX];
     const char *blendfile_path = BKE_main_blendfile_path(bmain);
 
@@ -98,7 +98,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
   int export_count;
   int sample_animations;
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
@@ -709,7 +709,7 @@ static int wm_collada_import_exec(bContext *C, wmOperator *op)
   int keep_bind_info;
   ImportSettings import_settings;
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/io/io_gpencil_export.c b/source/blender/editors/io/io_gpencil_export.c
index 6db68a26232..0b59d86db4f 100644
--- a/source/blender/editors/io/io_gpencil_export.c
+++ b/source/blender/editors/io/io_gpencil_export.c
@@ -74,7 +74,7 @@ static void gpencil_export_common_props_definition(wmOperatorType *ot)
 
 static void set_export_filepath(bContext *C, wmOperator *op, const char *extension)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     Main *bmain = CTX_data_main(C);
     char filepath[FILE_MAX];
 
@@ -121,7 +121,7 @@ static int wm_gpencil_export_svg_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
   Object *ob = CTX_data_active_object(C);
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
@@ -276,7 +276,7 @@ static int wm_gpencil_export_pdf_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
   Object *ob = CTX_data_active_object(C);
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
diff --git a/source/blender/editors/io/io_gpencil_import.c b/source/blender/editors/io/io_gpencil_import.c
index b6fecfaf94e..eb53f66d8b8 100644
--- a/source/blender/editors/io/io_gpencil_import.c
+++ b/source/blender/editors/io/io_gpencil_import.c
@@ -65,7 +65,7 @@ static int wm_gpencil_import_svg_exec(bContext *C, wmOperator *op)
 {
   Scene *scene = CTX_data_scene(C);
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath") ||
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false) ||
       !(RNA_struct_find_property(op->ptr, "directory"))) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/io/io_obj.c b/source/blender/editors/io/io_obj.c
index aec8467ed70..016754c1ad5 100644
--- a/source/blender/editors/io/io_obj.c
+++ b/source/blender/editors/io/io_obj.c
@@ -58,7 +58,7 @@ static const EnumPropertyItem io_obj_path_mode[] = {
 
 static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     Main *bmain = CTX_data_main(C);
     char filepath[FILE_MAX];
 
@@ -79,7 +79,7 @@ static int wm_obj_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
 
 static int wm_obj_export_exec(bContext *C, wmOperator *op)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
@@ -434,7 +434,7 @@ static int wm_obj_import_exec(bContext *C, wmOperator *op)
       OBJ_import(C, &import_params);
     }
   }
-  else if (RNA_struct_property_is_set(op->ptr, "filepath")) {
+  else if (RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     /* Importing one file. */
     RNA_string_get(op->ptr, "filepath", import_params.filepath);
     OBJ_import(C, &import_params);
diff --git a/source/blender/editors/io/io_stl_ops.c b/source/blender/editors/io/io_stl_ops.c
index ddf1bde0c1d..c98e5beaf3b 100644
--- a/source/blender/editors/io/io_stl_ops.c
+++ b/source/blender/editors/io/io_stl_ops.c
@@ -53,7 +53,7 @@ static int wm_stl_import_execute(bContext *C, wmOperator *op)
       STL_import(C, &params);
     }
   }
-  else if (RNA_struct_property_is_set(op->ptr, "filepath")) {
+  else if (RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     RNA_string_get(op->ptr, "filepath", params.filepath);
     STL_import(C, &params);
   }
diff --git a/source/blender/editors/io/io_usd.c b/source/blender/editors/io/io_usd.c
index a33bd905a29..2546f71c3a7 100644
--- a/source/blender/editors/io/io_usd.c
+++ b/source/blender/editors/io/io_usd.c
@@ -84,7 +84,7 @@ static int wm_usd_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
   options->as_background_job = true;
   op->customdata = options;
 
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     Main *bmain = CTX_data_main(C);
     char filepath[FILE_MAX];
     const char *main_blendfile_path = BKE_main_blendfile_path(bmain);
@@ -107,7 +107,7 @@ static int wm_usd_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUS
 
 static int wm_usd_export_exec(bContext *C, wmOperator *op)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }
@@ -331,7 +331,7 @@ static int wm_usd_import_invoke(bContext *C, wmOperator *op, const wmEvent *even
 
 static int wm_usd_import_exec(bContext *C, wmOperator *op)
 {
-  if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
+  if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
     BKE_report(op->reports, RPT_ERROR, "No filename given");
     return OPERATOR_CANCELLED;
   }



More information about the Bf-blender-cvs mailing list