Page MenuHome

bpy.ops.file.find_missing_files() doesn't update viewport when files are found
Closed, ArchivedPublic

Description

System Information
Operating system: Kubuntu Linux 19.04
Graphics card: Nvidia GeForce GTX 970

Blender Version
Broken: commit 157cc54ed52192ef6994bcc6a975c4399503ac25 (recent commit on master unrelated to report)

Short description of error
When bpy.ops.file.find_missing_files() is used to find missing textures, and the textures are found, the 3D viewport is not updated to display the newly found textures.

Exact steps for others to reproduce the error
Open the attached Missing.blend blender file. Place Missing.png in /tmp, and find it using "File->External Data->Find Missing Files". Note that the cube is still rendered as magenta, even though the filepath is correct in the Texture panel. Remove the filepath, and the cube turns gray. Press Ctrl-Z and the cube turns blue (correctly rendered).

Also note that the correct image is displayed in the "Brush/Texture" preview window after finding the missing file. It seems like calling bpy.data.image["Missing"].reload() should correct the problem, but it does not. Disconnecting and reconnecting the node link between the image texture node and the principled BSDF node will also sometimes update the 3D viewport (in conjunction with some other unidentified change).

Also, since this code is dealing with "missing files", the bpy.path.resolve_ncase() method should probably be used to find the missing file in a case insensitive manner. The current implementation will only find the file if the case matches exactly. This is annoying because it is possible that the file is "missing" because of a change in case. This bug can be recreated by renaming "Missing.png" to "missing.png" in the /tmp directory, and observing that "Find Missing Files" will not longer find it (on Linux at least).