I have exploring the python scripting for UE4,
I couldn’t find any example on how to use python script.
It will be really helpful for me to get started if someone could give an example on script for renaming texture files in UE4 so that materials also get updated.
First of all really thanks bro for looking at this question.
I already know about these APIs.
But my main concern is
unreal.EditorAssetLibrary.rename_loaded_asset(asset, new_path_name)
how do I reference asset.
For example i have some content in /Game/Textures/T_SomeTexturs.uasset
So how do I pass this path as asset in above method.
If you could give hint that will be really great help.
I have finally able to write script to rename script for renaming the assets.
If someone wanted help please ping, I will help. Don’t expect any help from mighty epic engineers. They are useless, they are busy making buggy UE4.
There is a bug with scripting plugin which I m not going to report.
import unreal
asset_path = "/Game/Textures"
all_assets = unreal.EditorAssetLibrary.list_assets(asset_path)
for d in all_assets:
strs = d.split("/") # Split the path
strLen = len(strs) # Length of the splitted string
fileName = strs[strLen - 1] # Get File Name, eg T_Hair_Normal.T_Hair_Normal
temp = fileName.split(".")
nameWithoutExtention = temp[0] # Get file name without extension. you will get -> T_Hair_Normal
nameList = nameWithoutExtention.split("_") # -> ['T','Hair', 'Normal']
nameListLength = len(nameList) # -> array length is 3
textureType = nameList[nameListLength - 1] #Normal, Specular, Roughness, Metallic, etc...
toBeRenamedFileName = "NEW_NAME_HERE" + "_" + textureType
toBeRenamedFileNamePath = asset_path + "/" + toBeRenamedFileName # generating final path, using base path and using new name
actualFilePath = asset_path + "/" + nameWithoutExtention #actual path of the assets which is suppossed to renamed
print (actualFilePath)
print (toBeRenamedFileNamePath)
unreal.EditorAssetLibrary.rename_asset(actualFilePath, toBeRenamedFileNamePath) # finally rename the asset...
Epic morons this is really bad, if you can’t take your criticism then you will delete my post here.
Are you afraid of Donald trump, that you are deleting my answers.
Few weeks back I myself answered this question so that I could help someone else and also I expressed my anguish and highly criticized Epic morons for not getting help.