[Bf-python] Compositor - image nodes

James Crowther jamesharrycrowther at gmail.com
Mon Sep 4 12:47:47 CEST 2017


Hi, 
	Ok, so after reading the python api, looking on stack exchange and trying stuff in the console, I am officially out of ideas. I am trying to understand why it is all the passes from a multilayer exr file don’t show up in the outputs collection of a CompositorNodeImage type node.  The code follows below, would appreciate any advice for how I could get all the passes to appear in the outputs collection without having to manually go and hit the refresh button which is tied to the bpy.ops.image.reload operator. The whole idea of this script I am writing is to automate this part.

		bpy.data.images.load(f, check_existing=False)#bpy.ops.image.open(filepath=f)
                img_n = rl_gp_nodes.new('CompositorNodeImage')
                img_n.name = image_name
                image_name = os.path.split(f)[1]
                img_n.image = bpy.data.images[image_name]
                img_n.layer = rl.name
                img_n.image.reload()

Manually reloading the image from the Image node properties panel in the node editor causes the additional passes (defaults seem to be Combined and alpha) to appear in the outputs for the node, but there doesn’t seem to be any other way than manually pressing the reload button. image.reload doesn’t work, it does nothing. running the bpy.ops.imag.reload operator results in it returning cancelled, I suspect context maybe incorrect here. Still if it does the same operation as the image.reload then there is little point. 

I want to try to automatically load a multilayer exr file into blender and have all the passes show up for the user to access. I’m doing this for multiple image tiles of a render coming from another machine so I need a way to automate this step.

Thanks! :D
James



More information about the Bf-python mailing list