[Bf-blender-cvs] [b690f4c2e6d] master: Fix T98875: Adding camera background image shows error

Julian Eisel noreply at git.blender.org
Tue Jun 14 17:07:46 CEST 2022


Commit: b690f4c2e6d02af522cebadb71318e14299dc362
Author: Julian Eisel
Date:   Tue Jun 14 17:03:27 2022 +0200
Branches: master
https://developer.blender.org/rBb690f4c2e6d02af522cebadb71318e14299dc362

Fix T98875: Adding camera background image shows error

Don't show an error if no operator property is set at all that can be
used to find an image file or ID for dropping. The caller can decide if
this is an error that needs reporting or a valid case, like it is here.

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

M	source/blender/windowmanager/WM_api.h
M	source/blender/windowmanager/intern/wm_operators.c

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

diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index ac06ababfd4..60cded3b869 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -738,6 +738,7 @@ void WM_operator_last_properties_ensure(struct wmOperatorType *ot, struct Pointe
 wmOperator *WM_operator_last_redo(const struct bContext *C);
 /**
  * Use for drag & drop a path or name with operators invoke() function.
+ * Returns null if no operator property is set to identify the file or ID to use.
  */
 ID *WM_operator_drop_load_path(struct bContext *C, struct wmOperator *op, short idcode);
 
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 7b768bd8c70..9f21e952850 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1308,6 +1308,10 @@ ID *WM_operator_drop_load_path(struct bContext *C, wmOperator *op, const short i
     return id;
   }
 
+  if (!WM_operator_properties_id_lookup_is_set(op->ptr)) {
+    return NULL;
+  }
+
   /* Lookup an already existing ID. */
   id = WM_operator_properties_id_lookup_from_name_or_session_uuid(bmain, op->ptr, idcode);



More information about the Bf-blender-cvs mailing list