Unreal Plugin - Load a model
Execute the project to connect Unreal with 3drepo.io and import models
Requirements
Before you start the process you must download and install the following applications:
Unreal Engine version 4.25+
Visual Studio 2019
Visual Studio Workloads .NET desktop development & Game Development C++
Step 4. Load the demo Unreal project
Clone the 3drepoUnreal project, and enter the
repounreal
directoryRight-click the .uproject file and select
Generate Visual Studio project files
. This will build a Visual Studio solution in the same directoryOpen the Visual Studio solution
In the Solution Explorer right-click on the
repounreal
project. In the pop-up window select the option Set as Startup ProjectNow
Start Debugging
. This will open the Editor with the debugger attached
Step 5. Load a Demo model
Since we already have some models in the Demo account, let's go ahead and load one of them to our Unreal Editor. We'll be using the developer tools and you must do the following:
The sample code registers two command console commands: 3drepoimport & 3drepoconvert.
In the Unreal Editor open the console, press the Tilde
¬
key.
Alternatively, open the Output Log (Window > Developer Tools > Output Log
)We're required to specify the model, so we'll be using the following information:
Teamspace: Repo3DDemo
Model ID: 207de880-d9e6-11eb-9b08-7bd2d03ee2bcIn the console give the following command:
3drepoimport [teamspace] [model id] [revision tag]
*
*revision tag is optional
Here is an example that you can use:
3drepoimport Repo3DDemo 207de880-d9e6-11eb-9b08-7bd2d03ee2bc
The model will be imported as a new Actor in the world. The 3drepoimport command can be given at design-time (in Editor) or in-game (e.g. in Play-In-Editor mode).
Step 6. Load a model from your 3D Repo account
The project will have the demo account web configuration hardcoded in. If you want to load models from your own account you will need to update the URL & API information in the repounreal.cpp:
url points to the server location ie. www.3drepo.io (UK) or ca.3drepo.io (Canada)
apikey is to authenticate your API Request
To load your own models into unreal editor repeat the steps shown in Step 5 using your own information for Model ID & Teamspace.
Units
A couple of points on how units are applied to models in the plugin:
Scaling will be applied to take the model from the source units to the destination units of the Unreal engine
The units of the model in 3D Repo can be seen in the setting panel of the model
Unreal world units are in cm
The scale is applied to the Transform of the top-level ARepoSupermeshActor object
Step 6. Packaging the Plugin
Use the Package Project option in the Editor. By default, support for Mac is disabled via the WhitelistPlatforms property to allow building on a standalone PC. Configure remote-compilation to build for Mac.
The repounreal
project (Solution -> Games) has the plugin (in the Plugins folder) and project code (in the Source folder).
The plugin can be packaged and redistributed. The plugin is registered as a dependency in the project code's repounreal.Build.cs
as it would be in any third-party project.
The code under Source demonstrates how to use the plugin. This is what would be replaced in a real application. The demonstration of the plugin's API is in ImportModel
. The sample registers this method with the Console Manager under the command 3drepoimport
.