0
$\begingroup$

I want to create multiple UDIM tiles using the following for loops. They work perfectly fine:

tile_no = "None"
udim_tex = bpy.data.images.new(name="UDIM Texture", width=1024, height=1024, tiled=True)
for ix in range(10):
            for iy in range(10):
                
                tile_no = 1001 + iy*10 + ix
                udim_tex.tiles.new(tile_number=tile_no)

To have all the created tiles saved, they have to be filled.

Fill a UDIM tile with python API

This post talks about just that, but on the first hand, it does not work for me and on the other hand the answering person calls it "not the best solution".

Here, I am trying to use the solution, posted in the link, but as stated, doesnt work for me -.-

bpy.context.area.ui_type = 'IMAGE_EDITOR'
bpy.context.space_data.image = udim_tex
bpy.ops.image.tile_fill(color=(0, 0, 0, 0), width=500, height=500, float=False, alpha=True)

I am looking for a way to fill the tiles. Either by filling them directly after the tiles.new in the double for. Or by filling them afterwards somehow, can be another for if needed.

$\endgroup$

1 Answer 1

0
$\begingroup$
tile_no = "None"
udim_tex = bpy.data.images.new(name="UDIM Texture", width=1024, height=1024, tiled=True)
for ix in range(10):
        for iy in range(10):
            
            tile_no = 1001 + iy*10 + ix
            bpy.context.space_data.image = udim_tex
            bpy.ops.image.tile_add(number = tile_no, generated_type = "UV_GRID")

You can create tiles on two ways. One is, using the image, like my initial post tried, the other one is bpy.ops. This one has the massive advantage that the function of adding the tile includes the generated_type-Parameter which fills our tile on creation.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .