Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
I want to add a displacement modifier to the active object and set the source image in python when you press a button. How can I do this?
The code is
heightTex = bpy.data.textures.new('Texture name', type = 'IMAGE')
heightTex.image = bpy.data.images['Myimage.jpg']
dispMod = ob.modifiers.new("Displace", type='DISPLACE')
dispMod.texture = heightTex
Required, but never shown