mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-05-10 15:46:54 +02:00
[blender] preview: handle background image not found
This commit is contained in:
parent
349f488fbd
commit
649a45249c
1 changed files with 8 additions and 1 deletions
|
@ -149,10 +149,14 @@ def setupBackground(view, folderUndistorted):
|
|||
if len(matches) == 0:
|
||||
baseImgName = os.path.splitext(os.path.basename(view['path']))[0]
|
||||
matches = glob.glob(folderUndistorted + '/*' + baseImgName + "*") # try with image name
|
||||
if len(matches) == 0:
|
||||
# no background image found
|
||||
return False
|
||||
undistortedImgPath = matches[0]
|
||||
bpy.ops.image.open(filepath=undistortedImgPath)
|
||||
undistortedImgName = os.path.basename(undistortedImgPath)
|
||||
bpy.context.scene.node_tree.nodes["Image"].image = bpy.data.images[undistortedImgName]
|
||||
return True
|
||||
|
||||
|
||||
def loadModel(filename):
|
||||
|
@ -332,7 +336,10 @@ def main():
|
|||
|
||||
print("Rendering view " + view['viewId'])
|
||||
if args.useBackground:
|
||||
setupBackground(view, args.undistortedImages)
|
||||
if not setupBackground(view, args.undistortedImages):
|
||||
# background setup failed
|
||||
# do not render this frame
|
||||
continue
|
||||
setupRender(view, intrinsic, pose, args.output)
|
||||
bpy.ops.render.render(write_still=True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue