From 971fe43d06ddad94933666c89c40ed345338992a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 17 Sep 2020 12:42:07 +1000 Subject: Fix T63651: ImagePreviewCollection.new,load don't work as documented Update doc-strings, add note for why this decision was made. --- release/scripts/modules/bpy/utils/previews.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'release') diff --git a/release/scripts/modules/bpy/utils/previews.py b/release/scripts/modules/bpy/utils/previews.py index 511df853d66..7402dbb6c0c 100644 --- a/release/scripts/modules/bpy/utils/previews.py +++ b/release/scripts/modules/bpy/utils/previews.py @@ -65,6 +65,10 @@ class ImagePreviewCollection(dict): # Internal notes: # - Blender's internal 'PreviewImage' struct uses 'self._uuid' prefix. + # - Blender's preview.new/load return the data if it exists, + # don't do this for the Python API as it allows accidental re-use of names, + # anyone who wants to reuse names can use dict.get() to check if it exists. + # We could use this for the C API too (would need some investigation). def __init__(self): super().__init__() -- cgit v1.2.3