Skip to content

Python script for Unreal Engine 4 that sets the mobility for certain Static Mesh Actors in level.

Notifications You must be signed in to change notification settings

andrewisen/UE4-Datasmith-setMobility

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UE4 Datasmith - Set Mobility

Python script for Unreal Engine 4 (UE4) and Datasmith.
The script changes the mobility of Static Mesh Actors.

Use the Web Helper to generate a Python file.
Simply follow the instructions on the website and click "Download Python Script".

Background

Given an Autodesk Revit model.
Assume one wants to create a game/application in UE4 where users can try interact with the world geometry.
E.g. Try different room layouts by moving the furnitures around.

Autodesk Revit 2020

By using Datasmith, one could import said Revit file to UE4.

Unreal Engine 4.24

A problem occurs when working with the objects in the level.

All imported Revit objects are stationary by defualt.
Their movability should be set to MOVABLE.

Mobility

This scripts sets the mobility from STATIC to MOVABLE for all selected objects.
In summary, one does not have to click on each individual object.

Example

The Collab Viewer Template joins multiple people together in a shared experience of the same 3D content.
It's intended to make it easier and quicker for your team to review and communicate about designs in realtime, so that you can identify problems and iterate on the content more efficiently.

If you want to transform (i.e. move) certain objects, these objects should be set to MOVABLE.
The Python Script might come in handy.

Getting Started

Prerequisite

N.B. Datasmith should be included with 4.24. Read more

Make sure the Python Editor Script Plugin and the Datasmith Importer Plugin are enabled.

Plugins

Usage

  1. Export Datasmith Content from Revit
  2. Import Datasmith Conent into EU4
  3. Enable Python in UE4
  4. Run the script in UE4 via File->Execute Python Script.

Customize

Mobility states

Set the mobily state by changing the variable:

mobility = mobilityStates[state]

where state is one of the following:

  • 0 = STATIC
  • 1 = STATIONARY
  • 2 = MOVABLE

E.g. mobility = mobilityStates[2] sets the mobility to MOVABLE.

Static Mesh Actors

Set which element categories should be affected:

metadataValues = ["Cat1", "Cat2", "Cat3"]

E.g. metadataValues = ["Furniture"] will only affect objects that are categorized as furnitures.

Further Documentation

Further documentation can be found inside each folder.

Built with

Contact

kontakt "at" andrewisen.se

Acknowledgments