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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Importing an fbx in c++


I'm trying to import an fbx in c++ in the editor(not runtime). I've been looking at various posts and source files, but to no avail.

My current code is this:

 UnFbx::FFbxImporter* FbxImporter = UnFbx::FFbxImporter::GetInstance();
 if (FbxImporter->ImportFromFile(FBXFiles[Index], TEXT("fbx")))
     TArray<FbxNode*> FbxMeshArray;
     FbxImporter->FillFbxMeshArray(FbxImporter->Scene->GetRootNode(), FbxMeshArray, FbxImporter);
     UFbxStaticMeshImportData* ImportData = NewObject<UFbxStaticMeshImportData>(GetTransientPackage(), NAME_None, RF_NoFlags, NULL);
     for (int i = 0; i < FbxMeshArray.Num(); i++)
         UStaticMesh* ImportedMesh = (UStaticMesh*)FbxImporter->ImportStaticMesh(GetTransientPackage(), FbxMeshArray[i], FbxMeshArray[i]->GetName(), RF_NoFlags, ImportData);
         FString PackageName = TEXT("/Game/");
         PackageName += ImportedMesh->GetName();
         UPackage* Package = CreatePackage(NULL, *PackageName);
         FString PackageFileName = FPackageName::LongPackageNameToFilename(PackageName, FPackageName::GetAssetPackageExtension());
         bool bSaved = UPackage::SavePackage(Package, ImportedMesh, EObjectFlags::RF_Public | EObjectFlags::RF_Standalone, *PackageFileName, GError, nullptr, true, true, SAVE_NoError);

I've also tried adding

 FbxImporter->PostImportStaticMesh(ImportedMesh, FbxMeshArray);
 FbxImporter->UpdateStaticMeshImportData(ImportedMesh, ImportData);

after the ImportStaticMesh function, but then I get a linker error(unresolved symbols). I have included FBX, Engine, Core, UnrealEd, etc in my build file, but that doesn't help. Though I don't even know if that'll fix it.

It does create a file, but with nothing in it. Any ideas?

Also, FbxNode seems to give me an intellisense error no matter what I include.

Product Version: UE 4.20
more ▼

asked Sep 14 '18 at 06:04 PM in C++ Programming

avatar image

82 24 24 28

avatar image FableBen Sep 14 '18 at 06:30 PM

Which symbols specifically are unresolved? What build target are you attempting to build? You probably need to be on one of the *Editor targets since you're using code that resides in editor modules.

avatar image Wrekk Sep 14 '18 at 07:16 PM
 Severity    Code    Description    Project    File    Line    Suppression State
 Error    LNK2019    unresolved external symbol "public: static void __cdecl UnFbx::FFbxImporter::UpdateStaticMeshImportData(class UStaticMesh *,class UFbxStaticMeshImportData *)" (?UpdateStaticMeshImportData@FFbxImporter@UnFbx@@SAXPEAVUStaticMesh@@PEAVUFbxStaticMeshImportData@@@Z) referenced in function "private: virtual void __cdecl AUnityModelImporter::OnConstruction(struct FTransform const &)" (?OnConstruction@AUnityModelImporter@@EEAAXAEBUFTransform@@@Z)    ProjectSoul    C:\ProjectSoul\Intermediate\ProjectFiles\Module.UnityModelImporter.cpp.obj    1    

That's the error I get. :>

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

It seams that function is not externally exposed from UnrealEd module, if you look on header file:


It missing UNREALED_API which adds extern to the deceleration and exposes function in module dll preventing linker to enclose the code, you would modify this file in engine source code (which is not bad idea as long what you working on is plugin) or find other work around.

more ▼

answered Sep 14 '18 at 08:39 PM

avatar image

36.6k 930 169 1111

avatar image Wrekk Sep 14 '18 at 10:07 PM

Do you think adding the functions would solve the empty file problem though?

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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