Announcement

Collapse
No announcement yet.

Simple material swap python script not working

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Thanks for the help.

    Unfortunately that doesn't work either.

    There's no error messages, no feedbaack. The script just executes and does nothing like the results here

    https://www.youtube.com/watch?v=iuqTvvd16UQ

    Leave a comment:


  • replied
    Sorry i think i was incorrect with the path, u have "Content/" ... it should be "/Game/" . U can see it in the image above.

    replace_material("/Game/1619_Section_26_CENTRAL6633/Materials/TL1_Wall_Tile", "/Game/Materials2/Ceramic_Enamel_Tiles_MAT")

    Leave a comment:


  • replied
    Thanks, I tried that it but it also doesn't work.

    I'm lost as it's literally cut and pasting the path, so no errors with spelling. Even using the filepath that UE4 is saying...

    Click image for larger version  Name:	ue4.jpg Views:	1 Size:	22.7 KB ID:	1668020

    (Redacted my name though)

    Scripting in Maya so much easier, at least it mentions where is wrong.

    Leave a comment:


  • replied
    i think u paths are incorrect...

    Content/1619_Section_26_CENTRAL6633/Materials/TL1_Wall_Tile should be: /Game/Content/1619_Section_26_CENTRAL6633/Materials/TL1_Wall_Tile

    Leave a comment:


  • started a topic Simple material swap python script not working

    Simple material swap python script not working

    Hi,

    Is there anything wrong with my code? It excutes but no materials replace.

    Code:
    import unreal
    
    def replace_material(original, replacement):
        original_asset =
        unreal.EditorAssetLibrary.load_asset(original)
        replacement_asset =
        unreal.EditorAssetLibrary.load_asset(replacement)
            unreal.EditorAssetLibrary.consolidate_assets(replacement_asset, [original_asset])
    
    #replace_material(original_name, replacement_name)
    replace_material("Content/1619_Section_26_CENTRAL6633/Materials/TL1_Wall_Tile", "Content/Materials2/Ceramic_Enamel_Tiles_MAT")
    I've tried so many variations of the path that I've given up. Is there a way to just wildcard this so TL1_Wall_Tile gets replaced with Ceramic_Enamel_Tiles_MAT?
Working...
X