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......


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 ]
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.