[Bf-blender-cvs] [9215b5d8692] master: UI: report when reloading unsaved text

Campbell Barton noreply at git.blender.org
Mon Jun 22 08:04:20 CEST 2020


Commit: 9215b5d8692143f723ce4b37822058bead45efbc
Author: Campbell Barton
Date:   Mon Jun 22 15:59:02 2020 +1000
Branches: master
https://developer.blender.org/rB9215b5d8692143f723ce4b37822058bead45efbc

UI: report when reloading unsaved text

Address confusion from T78114.

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

M	source/blender/editors/space_text/text_ops.c

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

diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index e50b25de412..797459984e7 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -428,6 +428,13 @@ static int text_reload_exec(bContext *C, wmOperator *op)
   const int orig_curl = BLI_findindex(&text->lines, text->curl);
   const int orig_curc = text->curc;
 
+  /* Don't make this part of 'poll', since 'Alt-R' will type 'R',
+   * if poll checks for the filename. */
+  if (text->name == NULL) {
+    BKE_report(op->reports, RPT_ERROR, "This text has not been saved");
+    return OPERATOR_CANCELLED;
+  }
+
   if (!BKE_text_reload(text)) {
     BKE_report(op->reports, RPT_ERROR, "Could not reopen file");
     return OPERATOR_CANCELLED;



More information about the Bf-blender-cvs mailing list