I'm working on an addon that requires me to generate and fill UDIM tiles in a texture with the python API, however I am stuck at the point of filling the tile.
The following code creates a new tiled texture and adds a new tile, storing the new tile as a variable:
udim_tex = bpy.data.images.new(name="UDIM Texture", width=1024, height=1024, tiled=True)
new_tile = udim_tex.tiles.new(tile_number=1002)
At this point, I am looking for a method to fill the new_tile
, but this doesn't seem to be possible in the same way that it is possible to fill a normal image texture using the generated_color
method.
An alternative seems to be to use the operator:
bpy.ops.image.tile_fill(color=(0, 0, 0, 0), width=new_width, height=new_height)
But in this case I can't figure out the correct context to use (I have tried, unsuccessfully, using overrides etc.). I always see the following error message from the operator's poll
:
My ultimate goal is basically to be able to create a new UDIM tile that is filled with alpha=0 everywhere, so if there is a better approach to this that would also work!
Thanks in advance.