It duplicate a lot of same materials, when I Import C4D file with datasmith into ue5.

When I import C4D file with datasmith,it duplicate a lot of same materials.
To find out the problem ,i exported a fbx from c4d to 3ds max.Then use 3ds max export to ue5.1 through datasmith.The problem didn’t show up.
I also tried export fbx from c4d to ue5.1. The problem didn’t show up.
I and my group use c4d a lot,so I want to use c4d datasmith and it’s reimport function.
We want to import a city to ue5,so there will be housands of materials, it’s a nightmare to change every single material.
please help.


c4d file.zip (1.3 MB)

Hello Greatding,

Thank you for reporting this issue.
Here is a temporary workaround while we fix it: If a texture tag has not default values for OffsetU/V and Tiles U/V, it will assume that the object needs its own unique material. You must make sure you have these values set to “0%” and “1” respectively:

I wrote a python script that does this for you. Go to “Scripts”, open a new script, replace the code and press the “Execute” button in the lower right corner:

import c4d

doc: c4d.documents.BaseDocument  # The active document

def GetNext(op): # loops through all objects
    if not op:
        return None   

    down = op.GetDown()
    next = op.GetNext()
    up = op.GetUp()

    op = down
    if not op:
        op = next
    if not op:
        while up and not up.GetNext():
            up = up.GetUp()
        if up:
            op = up.GetNext()            
    return op


op = doc.GetFirstObject()

# set texture tag params to default
while op:  
    tag = op.GetTag(c4d.Ttexture)
    if tag:      
        tag[c4d.TEXTURETAG_OFFSETX] = 0
        tag[c4d.TEXTURETAG_OFFSETY] = 0
        tag[c4d.TEXTURETAG_TILESX] = 1
        tag[c4d.TEXTURETAG_TILESY] = 1
        
    op = GetNext(op)

c4d.EventAdd()

If you import again, it will create only unique materials:

If this does not work, make sure you have the newest importer:
Maxon - Unreal Integration, you will need the version for either UE 5.0.3 or UE 5.1 and Cinema 2023.1.

I hope this helps,
A.Knauer

1 Like

Thank you for solving this problem. You were so kind that you helped me write a script. I will make good use of this script. Thank you again and wish you all the best :laughing: