How to open an FBX file from my UE4 project's interface - c++

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

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

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.

Related

Allegro 5 ALLEGRO_BITMAP to text file

I'm currently working on a video game project in C++ using Allegro 5 as my graphics library. I store my graphic and font assets in subfolders within the root folder of the .exe. To use them in the program, I have an initGraphics() function that loads all the required assets through al_load_bitmap(), and then later free up the memory with al_destroy_bitmap(). This means however that when I eventually distribute my game, it'll be super easy for anyone to go into the install folder and just edit the graphics to be whatever, and I'm having trouble finding any kind of help regarding how to prevent this.
What I was thinking maybe is some kind of program that I'd run on my own computer before distribution that loads the appropriate graphical assets, and somehow converts them into a .txt file, then changing the main game executable's 'initGraphics()' function to load and use those instead of just the raw .png files, but I'm not sure if this is possible. Any information about this type of conversion would be hugely appreciated, or alternatively a more reliable tested method that achieves the same effect. Thank you very much in advance!
While researching the internet I've found interesting solution:
Allegro5 uses PhysicsFS library to handle file archives. It does not support password protected archives, but you can calculate md5 for your assets archive and hardcode it into your program and then compare it on runtime (source - see more here).
See this part of documentation of Allegro5.
Example explanation of md5 implementation is here

c++ what is the *clever* way of creating setup program and handle extraction

I know how to create and code my own setup program but i need to be redirected at some point. This point i'm sure inlight other people too.
I created a setup project. All is done. Except, installation files inside of EXE.
I know 2 different ways of doing this:
Create resource in EXE and embed RAR/ZIP file.
Put compressed archive with files along with EXE. EXE will read contents and data from this protected and compressed ZIP.
But what i want is number 1. I want to embed it. But;
What is the proper way of embedding this? Are other setup creators do the same thing? Embed resource as compressed single zip in EXE? Or do they another trick?
How do you extract files? On the fly by memory? Like read each file one-by-one. Synced. Or first, copy ZIP to temp and extract from it.
Or even embed all files separately to the resources.
I, even think that if i should create simple MSI without dialogs and embed it and run from background but i want to take all control. I want everything belongs to the original setup that i created.
Note:
I want to make my own dialogs, effects, procedures, functions and
steps. Yes, MSI is acceptable but i will stick with its features. Oh,
If im able to extend it, why should i spent more time doing this
instead of making my own? I am so confused... I am talking about very big setup project here. Not just a standard ugly UI with less features. At least, im gonna try :)
Do not give me any sample/code just show me a correct path, please.
Best options here:
Create ZIP compatible EXE that reads itself as ZIP and read the file list and extract.
Create non-zip compatible EXE that has a hidden body somewhere and read that area (seek) and get the list & extract.
The proper way to do it is to use the Windows installer technology, aka MSI. There is a nice, Microsoft blessed toolset called WiX that you can use to greatly simplify the process.
http://wix.codeplex.com/
If you are truly intent on reinventing the wheel, you can look through the source code to WiX on how things are done.
Best options here:
Create ZIP compatible EXE that reads itself as ZIP and read the file list and extract.
Create non-zip compatible EXE that has a hidden body somewhere and read that area (seek) and get the list & extract.
Why write your own? Much easier to use WiX (http://wixtoolset.org/) with optionally a graphical interface like WiXEdit (http://wixedit.sourceforge.net/). Have you thought about additional requirements like uninstall etc...
Good luck!
Would InnoSetup help with your problem? You can personalise the dialogs and extend its functionality quite a lot.

How to choose and open a file during runtime with C++?

At the moment I am creating an Editor for Textures and I want to choose the textures during runtime. Later I would like to choose the save directory for new textures.
I found the
How to: Open Files Using the OpenFileDialog Component. But I think this is not the solution.
(assuming you are on Windows, pas per screenshot)
If you simply want to select a folder, you can use SHBrowseForFolder.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx
M.
You need to look at the Common Dialog Library.
http://msdn.microsoft.com/en-gb/library/windows/desktop/ms645524(v=vs.85).aspx
Or, if you are only interested in Vista/Windows 7 support, you could consider the Common Item Dialogs instead.
http://msdn.microsoft.com/en-gb/library/windows/desktop/bb776913(v=vs.85).aspx
For 'native' C++ you wouldn't be able to easily use the .NET components that your link refers to.
I have solved my problem with using the dirent.h file. I have acknowledge of this file by founding this post How can I get the list of files in a directory using C or C++?
I have write my own fileexplorer by using dirent.h and SFML.
Sorry if i can't illustrate my problem.
but thanks for the replies (:

How to read .scd data files with in a mfc application

I just purchased and installed a application from 3 Cds using registration key in pendrive. After installation, I just got a MFC Application (.exe). When i viewed the files, I found a data folder inside which I found many .scd files. The data is accessible within the application.
Now I would like to extract that scd files and need those data alone
separately.
I tried with FileViewPro, Scribus and many exe reader Software, but not successful.
Please someone help me to read the .scd files to extract the data from it.
Thanks in Advance,
First of all, please clarify what is the MFC application you are referring to? Was it installed? How do you know that it is MFC app?
Secondly, by giving just a file extension you do not provide enough information about a file. it could be MD scheduler, MS system management, TurboTax and many more.
The only way to do what you need is to find an application that does that or learn about a file format from documentation and write your own application.
It may be impossible if the file is proprietary format and there is no documentation released.

Exporting *.png sequence from *.fla with C++

I need an animation in my program. My designer draws animation in Flash and provides me with *.fla file. All I need is to grab 30-40 PNGs from this file and store them within my internal storage.
Is it possible grab resources from *.fla with C++ ? Probably, some Adobe OLE objects can help?
Please, advice.
Thanks in advance.
If I asked an artist to make me an icon I wouldn't expect to need to write code to convert a .3DS model into a usable icon format.
You can save yourself a lot of time and hassle by having your designer use File->Export and give you PNGs of the layers and frames instead of a .FLA file if that's the format you require for your implementation.
If that's not possible for some reason then you can probably find a flash decompiler that has a command line option which you could launch from your program to extract assets as part of your loading sequence but that is generally frowned upon because this is not the intended use of the proprietary format for .swf/.fla anymore than you should design applications to extract source code from a binary executable.
Assuming
You are using CS5
The assets used internally in the FLA are already PNG's as you want them to be.
Then simply get the FLA saved as a XFL file, and you will be able to grab them from the library folder ( but then why not just get them to mail you the pngs ? )
So if for some reason you can only get access to the fla and not the designer, then you can do it programatically by renaming the fla to .zip, extracting.. and you have the XFL format.