I'm creating an addon for browsing for an image and creating a texture from it.
I could get Image path from the user but I stuck in how to apply the image to the object as a texture.
In original Blender The images disappear from the preview if it's misplaced, renamed, or deleted after texturing the object. See image one. After browsing to that image, Once again its come back in Blender. See image two.
Here is my code:
bpy.types.Scene.MyPath = StringProperty(name="Browse Image:", attr="custompath",# this a variable that will set or get from the scene description="simple file path", maxlen= 1024, subtype='FILE_PATH', default= "")#this set the text class TexturePanel(Panel): . . . . self.layout.prop(context.scene, 'MyPath') # creates Browser in panel . . . .
See the Image two left side of the blender marked in blue color for browsing to the image.
How to apply this? Or how can we texture in Python?