How can an Image-Empty be done with Python?
And how to set an image file on it?
None for empties, and there is no
.image property on the object level either.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
An Empty is created like a regular Object, but with
None for its data:
empty = bpy.data.objects.new("My Empty", None)
It can be linked to the current Scene like any other object:
scene = bpy.context.scene scene.objects.link(empty) scene.update()
The origin is set using the standard
.location property (you may also use
empty.location = (1, 2, 3)
To make this Empty an Image-Empty, change its
.empty_draw_type property to
empty.empty_draw_type = 'IMAGE'
An Image datablock is then assigned to the Object's
img = bpy.data.images.load("path/to/image.png") empty.data = img
Other properties available for Image-Empties are (UI / Python):
BTW: You can change the RGB colors (
.color[0:3]) of the object to tint the Image, which is not possible via the interface!