Page 1 of 1
Setting up UDIMs in an Image Tile with python
Posted: Thu Dec 03, 2020 6:37 pm
by ymmanuel
Hi Ahmed
What is the proper way to set up UDIMS on an Image Tile via python?
I'm able to set all the parameters like the grid, start, digits etc...
but I'm not able to trigger the "Setup the image tiles" button or replicate the functionality via python?
any idea??
Thanks in advance
Re: Setting up UDIMs in an Image Tile with python
Posted: Thu Dec 03, 2020 9:24 pm
by aoktar
I think you don't need to access it. Only give correct parameters to define udim file format structure. It does same.
Re: Setting up UDIMs in an Image Tile with python
Posted: Fri Dec 04, 2020 1:40 pm
by ymmanuel
aoktar wrote:I think you don't need to access it. Only give correct parameters to define udim file format structure. It does same.
so maybe I'm missing something, here is an script example of how I'm initializing the UDIM tiles, the result is a black image that doesn't work
but if after executing the script I manually click the "Setup image tiles" button it works fine, so the setting seem to be alright
I'm using as guidance the example you showed here
viewtopic.php?f=30&t=70623
PS: of course in the actual code i use a real image filepath
Code: Select all
import c4d
OCT_UNIVERSAL_SHADER = 1029501
OCT_IMAGE_TILES = 1051204
def main():
doc = c4d.documents.GetActiveDocument()
material = c4d.BaseMaterial(OCT_UNIVERSAL_SHADER)
material.SetName("Test")
doc.InsertMaterial(material)
texture = c4d.BaseShader(OCT_IMAGE_TILES)
texture[c4d.ID_BASELIST_NAME] = "Tx_Basecolor"
texture[c4d.IMAGETEXTURE_FILE] = "udim1000.jpg"
texture[c4d.IMAGETEXTURE_GAMMA] = 2.2
texture[c4d.IMAGETILES_GRIDSIZE_X] = 3
texture[c4d.IMAGETILES_GRIDSIZE_Y] = 3
texture[c4d.IMAGETILES_START] = 1001
texture[c4d.IMAGETILES_DIGITS] = 4
texture[c4d.IMAGETILES_FILE_LIST] = "udim1001.jpg, udim1002.jpg, udim1003.jpg\nudim1004.jpg, udim1005.jpg, udim1006.jpg\nudim1007.jpg, udim1008.jpg, udim1009.jpg\n"
material[c4d.OCT_MATERIAL_DIFFUSE_LINK] = texture
material.InsertShader(texture)
material.Update(True,True)
c4d.EventAdd(c4d.EVENT_FORCEREDRAW)
# Execute main()
if __name__=='__main__':
main()