python - How to get Blender Compositor Image Node selected image name? -
in way python script can text string name of image, selected in image node? guess right using custom node label, can't find snippet, describes method.
script must work globally, if no node selected, if possible.
hope helps out:
nodes = material_slot.material.node_tree.nodes texture_node = nodes.get('image texture') if texture_node none: texture_node = nodes.new(type='shadernodeteximage') #texture_node.image = image # image name texture_name = texture_node.image.name # set node name / label image name texture_node.name = texture_name texture_node.label = texture_name
if want existing node have multiple texture nodes, iterate trough nodes , find nodes of type "tex_image" , set name
edit: have seen added picture, , not working textures, sorry same principle above goes image nodes though
bpy.data.scenes['scene'].node_tree.nodes['image'].image.name
Comments
Post a Comment