Skip to content

Commit

Permalink
Support UE 5+ Blender 3+ (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
Viterkim authored May 21, 2022
1 parent ecbb03e commit fbc9448
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 31 deletions.
10 changes: 5 additions & 5 deletions functions/sut_make_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ def make_single_mesh(selected_collection, context):
# For scene / own global variables
sut_tool = context.scene.sut_tool

# Go into object mode (maybe actually check stuff instead of this)
try:
bpy.ops.object.mode_set(mode="OBJECT")
except:
pass
# Avoid "Operator bpy.ops.object.mode_set.poll() Context missing active object"
context.view_layer.objects.active = selected_collection.all_objects[0]

# Go into object mode
bpy.ops.object.mode_set(mode='OBJECT')

# Deselect everything
bpy.ops.object.select_all(action='DESELECT')
Expand Down
8 changes: 5 additions & 3 deletions operator/sut_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ def execute(self, context):

# Every collection gets merged into it's own unique mesh (or all collections is a single big mesh)
greybox_collection = bpy.data.collections[sut_tool.greybox_col_name]
if sut_tool.every_col_is_own_mesh is True:
greybox_col_has_child_col = len(greybox_collection.children) > 0 # Avoid bug + we don't support deeply nested collections
if sut_tool.every_col_is_own_mesh is True and greybox_col_has_child_col is True:
# Get final collection, loop over every child collection and run make_single_mesh
for col in greybox_collection.children:
make_single_mesh(col, context)
else:
if len(col.all_objects) > 0:
make_single_mesh(col, context)
elif len(greybox_collection.all_objects) > 0:
make_single_mesh(greybox_collection, context)

# For every single object in the final collection, set the texel density
Expand Down
6 changes: 3 additions & 3 deletions panel/sut_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

# Add to this list after adding a property to SutProperties
UI_PROPERTIES = [
"sut_island_margin",
"sut_angle_limit",
# "sut_island_margin", # Disabling to cleanup UI
# "sut_angle_limit", # Disabling to cleanup UI
"sut_texture_size",
"sut_texel_density",
"greybox_col_name",
"final_col_name",
# "final_col_name", # Seems to be hardcoded now, so disabled this from the UI
"auto_smooth_angle",
"auto_smooth_enable",
"every_col_is_own_mesh",
Expand Down
8 changes: 4 additions & 4 deletions panel/sut_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class SutProperties(PropertyGroup):
max=5,
step=0.01,
precision=3,
default=0.005
default=0.02
)

sut_angle_limit: FloatProperty(
Expand Down Expand Up @@ -61,7 +61,7 @@ class SutProperties(PropertyGroup):
every_col_is_own_mesh: BoolProperty(
name="Seperate Child Collection Meshes",
description="Check if you want every collection to be their own seperate merged mesh\n(Origin will still be world origin)",
default = False
default = True
)

sut_send_to_unreal: BoolProperty(
Expand All @@ -78,8 +78,8 @@ class SutProperties(PropertyGroup):

final_col_name: StringProperty(
name="Final Coll. Name",
description="Final collection for unreal engine, default is 'Mesh' from the UE Tools addon",
default = "Mesh"
description="Final collection for unreal engine.",
default = "Export" # Seems to be hardcoded now, so disabled this from the UI
)

auto_smooth_angle: StringProperty(
Expand Down
26 changes: 10 additions & 16 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,18 @@ Depends on the following addons:
2. [Send To Unreal Github](https://github.com/EpicGames/BlenderTools) (You need to follow this: https://www.unrealengine.com/en-US/blog/download-our-new-blender-addons)

# Setup
1. Follow the "Send to Unreal" steps (which includes enabling remote execution in unreal & python scripting)
* I recommend going to options and setting "Mesh Folder(Unreal)" to: /Game/Meshes/Dev (or anything you want)
* Go to the export settings tab, and select "Use object origin"
2. Create Greybox colleciton defaulting to "Collection" (or change it).
3. Do the greyboxing / level designing you need to do. Everything gets merged into a single mesh (unless you check Split collection result).
4. Tick "Send to Unreal" and press SUT
5. In Unreal go top left -> Edit -> Project Settings -> Search for "Default Shape Complexity" and select "Use Complex Collision as Simple".
* When you are done greyboxing this should be turned back OFF
6. In Unreal drag the Meshes/Dev/SM_COLLECTION into your scene, and click the yellow little arrow in the transform panel, to reset it to 0,0,0 coordinates.
7. Put on some proper dev texture (cube material or w.e)

1. Follow the "Send to Unreal" steps:
* In unreal:
- Pugins -> "Enable Python Editor Script Plugin"
- Project Settings -> "Enable Remote Execution"
- "Default Shape Complexity" and select "Use Complex Collision as Simple".
* In Blender (Pipeline -> Export -> Seting Dialog):
- Set "Mesh Folder(Unreal)" to: /Game/Meshes/Dev (or anything you want)
- Export -> FXB Export Settings -> Smoothing: Face
2. In Unreal drag the Meshes/Dev/SM_COLLECTION into your scene, and click the yellow little arrow in the transform panel, to reset it to 0,0,0 coordinates.
3. Put on some proper dev texture, you can use 1 color per grouped collection.

Done now you can:
Go into Blender -> Change something -> Press SUT -> Instant Changes in Unreal Engine


![SUT](assets/addon.png)

# Future Features
1. Landscape Synchronization (Rough) (Landscape in unreal -> synchronize to blender and greybox back and forth)
2. Instance Dupliactes in blender to world position in unreal (Make your scene in blender with a modular kit)

0 comments on commit fbc9448

Please sign in to comment.