问题
I've created an interface for my UE4 project that has an import button. What I want it to do is to access FBX files in the user's desktop and opens the one the user selects.
I've written a c++ code that searches for FBX files in the desktop and returns their names, if found.
I'm kind of confused/stuck at this moment, and don't know exactly how to continue. My question is:
- Shall I open the FBX file using c++ or blueprints? It would be much appreciated if you could elaborate more on the approach you suggest.
Thank you
回答1:
What I want it to do is to access FBX files in the user's desktop and opens the one the user selects.
"Opening something" does not actually tell us what you want to do.
Open the file with The default application for the file type?
Load the mesh somewhere into RAM?
Spawn objects in UE4 with the mesh?
Who knows what opening means. Opening the file in maya will be quite different from opening it with a hex editor.
Specify what your programm should do.
Shall I open the FBX file using c++ or blueprints?
Appart from what you can add to what I said above this questions answer will be purely subjective if BP is actually capable of doing what you want. IF you are doing good in c++ I suggest to stick with it for file operations.
Here Epics documentation on asset references, this should fit for people finding this thread and probably for you.
https://docs.unrealengine.com/latest/INT/Programming/Assets/ReferencingAssets/index.html
Just use UStaticMesh instead of the filetype used in the examples.
Here a UE4 wiki example implementation of what you could mean:
https://wiki.unrealengine.com/Dynamic_Load_Object
回答2:
Shall I open the FBX file using c++ or blueprints? It would be much appreciated if you could elaborate more on the approach you suggest.
Yes, you can use the thirdparty libray to import the FBX, such as assimp
https://github.com/assimp/assimp
In the mean time, instead of use static mesh, you could use precedure mesh instead.
来源:https://stackoverflow.com/questions/35351285/how-to-open-an-fbx-file-from-my-ue4-projects-interface