Announcement

Collapse
No announcement yet.

Import Asset command line - UE4Editor-Cmd.exe

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

    Import Asset command line - UE4Editor-Cmd.exe

    Hello.

    I have a script where I can import a defined FBX by running the python script inside unreal in the "output log" tab. It works fine and creates the assets etc.

    Now I want to do the same thing but from a command line. I added the folder where the "UE4Editor-Cmd.exe" is located to windows path so I can call the UE4Editor-Cmd from a cmd prompt anywhere.

    And then I just type in something similar to what the documenation says, but obviously my own script.

    Code:
    UE4Editor-Cmd.exe -run=pythonscript -script="c:\my_script.py"
    And the script runs, and it reports the exact same thing as when running it inside UE4 and it takes similar time. However the UAsset does never show up in the content browser (or the explorer) when I run it from the command line. What am I missing here ?
    Last edited by magnus.larsson; 01-16-2019, 09:50 AM.

    #2
    Make sure your script saves the assets as they are being generated. I had a similar problem when i wrote my script.

    Comment


      #3
      Originally posted by cgsquirrel2 View Post
      Make sure your script saves the assets as they are being generated. I had a similar problem when i wrote my script.
      That makes so much sense, and I instantly tried it, but no luck... im using unreal.EditorAssetLibrary.save_asset(assetname, only_if_is_dirty=False) im getting this new message in the log though..

      Code:
      The following assets could not be successfully checked out from source control: assetname
      So perhaps the source control is not working good when running from commandline?

      Comment


        #4
        hmm, that should work..you might be right about it being a commandlet issue. I just looked at my script and i ended up doing something more generalized. I ran the following after everything was generated.
        Code:
        path = '/Game/asset'
        status = unreal.EditorAssetLibrary.save_directory(path,recursive=True)

        Comment


          #5
          Thank you, I will look at this more later for now I end up using commands inside unreal instead since that generally has a tendancy to work smoother.

          Comment

          Working...
          X