x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

how to load pak (import form fbx file)

hi guys. i load a .pak file which import form .fbx , lost textures and Materials but if i drag to viewport is work fine. so can u get me some ideas?

the setup is:

  1. import the .fbx file ( import success) alt text

  2. drag to viewport ( success)

alt text

3.make a pak file (success)

command is : UnrealPak.exe F:\01.pak D:\PAKProject\Content\testFBX\1*

4.load pak to show (not work,lost textures and other)

alt text

my load code is :

 IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
     FPakPlatformFile* PakPlatformFile = new FPakPlatformFile();
     PakPlatformFile->Initialize(&PlatformFile, TEXT(""));
     FPlatformFileManager::Get().SetPlatformFile(*PakPlatformFile);
 
     const FString PakFilename = TEXT("F:\\01.pak"); 
     FPakFile PakFile(&PlatformFile,*PakFilename, false);
 
     const FString MountPoint(FPaths::EngineContentDir());
     PakFile.SetMountPoint(*MountPoint);
 
     if (!PakPlatformFile->Mount(*PakFilename, 0, *MountPoint))
     {
         UE_LOG(LogClass, Warning, TEXT("Mount failed"));
     return;
     }
 
     TArray<FString> FileList;
     PakFile.FindFilesAtPath(FileList, *PakFile.GetMountPoint(), true, false, true);
     FStreamableManager StreamableManager;
 
     // Static load object
     FString AssetName = FileList[0];
     FString AssetShortName = FPackageName::GetShortName(AssetName);
     FString LeftStr;
     FString RightStr;
     AssetShortName.Split(TEXT("."), &LeftStr, &RightStr);
     AssetName = TEXT("/Engine/") + LeftStr + TEXT(".") + LeftStr;
     FStringAssetReference Reference = AssetName;
 
     for (auto f : FileList)
     {
         AssetShortName = FPackageName::GetShortName(f);
         LeftStr;
         RightStr;
         AssetShortName.Split(TEXT("."), &LeftStr, &RightStr);
         AssetName = TEXT("/Engine/") + LeftStr + TEXT(".") + LeftStr;
         FStringAssetReference r = AssetName;
         if (false == f.Equals(FileList[0]))
         {
             UObject* LoadObject = StreamableManager.LoadSynchronous(r, true);
         }
     }
 
     UStaticMesh *LoadObject = Cast<UStaticMesh>(StreamableManager.LoadSynchronous(Reference, true));
     if (LoadObject != nullptr)
     {
         UE_LOG(LogClass, Warning, TEXT("LoadPakFile Object load Success..."));
     }
     else
     {
         UE_LOG(LogClass, Warning, TEXT("LoadPakFile Can't load asset..."));
     }
 
     if (LoadObject != nullptr)
     {
         UE_LOG(LogTemp, Warning, TEXT("successs---------- "));
         TestActor = GetWorld()->SpawnActor<AStaticMeshActor>(
             AStaticMeshActor::StaticClass(),
             FTransform(
                 FRotator::ZeroRotator, FVector(-600, 360, 170), FVector(1, 1, 1)
             )
             );
 
         if (TestActor != NULL && !TestActor->IsPendingKill() && TestActor->IsValidLowLevel())
         {
             TestActor->GetStaticMeshComponent()->SetStaticMesh(LoadObject);
         }
     }
     else {
         GEngine->AddOnScreenDebugMessage(-1, 50.f, FColor::Red, TEXT("null"));
     }


Product Version: UE 4.17
Tags:
ue4fbx001.png (78.5 kB)
ue4fbx002.png (666.9 kB)
ue4fbx003.png (389.7 kB)
more ▼

asked Jun 01 '18 at 02:21 AM in Using UE4

avatar image

Rect_vv
1 1 3

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Hi guys , I fix the error .

why cannot load success? because the error Mount Point ,the pak command must be like:

UnrealPAK.exe 
D:/A.pak 
-create=D:/A_Paklist.txt 
-encryptionini
-platform=Windows
-installed
-UTF8Output
-multiprocess
-patchpaddingalign=2048
-abslog=D:/A.log

and the Mount Point is can be the PAK file fullPath , and the FStringAssetReference is the reference in UE4 (you can get it at RIGHT MOUSE KEY at UE4 Editor Content Browers)

more ▼

answered Jun 03 '18 at 04:39 PM

avatar image

Rect_vv
1 1 3

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question