1
$\begingroup$

I am thinking how to store the image which is being used in an image texture node

 bpy.context.object.active_material.node_tree.nodes['Image Texture'].image

I want to store the image used, and then on clicking a button, that image stored will be applied to some other active object's image texture node

I tried using StringProperty but that stores only String type and not images!

I don't get know how to do that......

$\endgroup$
0

1 Answer 1

4
$\begingroup$

Use your StringProperty to save the image.name, then load it by accessing the image through bpy.data.images:

imageNameStringProp = bpy.context.object.active_material.node_tree.nodes['Image Texture'].image.name

someOtherObject.active_material.node_tree.nodes['Image Texture'].image = bpy.data.images[ imageNameStringProp ]
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .