Setting up UDIMs in an Image Tile with python

Maxon Cinema 4D (Export script developed by abstrax, Integrated Plugin developed by aoktar)

Moderators: ChrisHekman, aoktar

Post Reply
ymmanuel
Licensed Customer
Posts: 10
Joined: Thu Feb 16, 2017 4:43 am

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
User avatar
aoktar
Octane Plugin Developer
Posts: 16066
Joined: Tue Mar 23, 2010 8:28 pm
Location: Türkiye
Contact:

I think you don't need to access it. Only give correct parameters to define udim file format structure. It does same.
Octane For Cinema 4D developer / 3d generalist

3930k / 16gb / 780ti + 1070/1080 / psu 1600w / numerous hw
ymmanuel
Licensed Customer
Posts: 10
Joined: Thu Feb 16, 2017 4:43 am

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()
Post Reply

Return to “Maxon Cinema 4D”