Skip to content

Commit d4db22a

Browse files
committed
Preparation for 1.0.3
1 parent 1211987 commit d4db22a

File tree

4 files changed

+33
-22
lines changed

4 files changed

+33
-22
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
All notable changes to this project will be documented in this file.
33
Features marked with `*` require the UE4 plugin to work.
44

5+
## [1.0.3] 2020-08-19
6+
### Added
7+
+ Texture node now supports box projection.
8+
+ Smoothing groups are now written in geometry data.
9+
+ TGA texture support. _Thanks KeyToon9_
10+
11+
### Fixed
12+
* Vertex normals now export correctly (you may need to use the Triangulate modifier). _Thanks KeyToon9_
13+
* Fixed image files names when first char is unvalid. _Thanks KeyToon9_
14+
* Improved light attenuation radius calculation.
15+
* Animation is now correctly exported for non-root objects.
16+
517
## [1.0.2] 2020-07-24
618
### Fixed
719
* Fixed an issue when writing some custom props, that would break the XML structure.

__init__.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
bl_info = {
44
"name": "Unreal Datasmith format",
55
"author": "Andrés Botero",
6-
"version": (1, 0, 2),
6+
"version": (1, 0, 3),
77
"blender": (2, 82, 0),
88
"location": "File > Export > Datasmith (.udatasmith)",
99
"description": "Export scene as Datasmith asset",
@@ -51,7 +51,7 @@ class ExportDatasmith(bpy.types.Operator, ExportHelper):
5151
export_animations: BoolProperty(
5252
name="Export animations",
5353
description="Export object animations (transforms only)",
54-
default=False,
54+
default=True,
5555
)
5656
apply_modifiers: BoolProperty(
5757
name="Apply modifiers",
@@ -65,14 +65,15 @@ class ExportDatasmith(bpy.types.Operator, ExportHelper):
6565
"transforms or shaders",
6666
default=False,
6767
)
68-
experimental_tex_mode: BoolProperty(
69-
name="Use sRGB support (UE4 4.25)",
70-
description="Disables the gamma hack to export masks correctly",
71-
default=True,
68+
use_gamma_hack: BoolProperty(
69+
name="Use sRGB gamma hack (UE 4.24 and below)",
70+
description="Flags sRGB texture to use gamma as sRGB is not supported in old versions",
71+
default=False,
7272
)
73-
prefer_custom_nodes: BoolProperty(
74-
name="Prefer custom nodes",
75-
description="Exports simpler node setups for some nodes, requires having the UE4 plugin",
73+
compatibility_mode: BoolProperty(
74+
name="Compatibility mode",
75+
description="Enable this if you don't have the UE4 plugin, "
76+
"Improves material nodes support, but at a reduced quality",
7677
default=False,
7778
)
7879
use_logging: BoolProperty(

export_datasmith.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ def exp_color_ramp(from_node, exp_list):
739739
level = get_expression(from_node.inputs['Fac'], exp_list)
740740

741741
curve_idx = exp_scalar(idx, exp_list)
742-
prefer_custom_nodes = datasmith_context["prefer_custom_nodes"]
743-
if not prefer_custom_nodes:
742+
compatibility_mode = datasmith_context["compatibility_mode"]
743+
if compatibility_mode:
744744
pixel_offset = exp_scalar(0.5, exp_list)
745745
vertical_res = exp_scalar(1/DATASMITH_TEXTURE_SIZE, exp_list) # curves texture size
746746
n = Node("Add")
@@ -1477,7 +1477,7 @@ def fill_umesh(umesh, bl_mesh):
14771477
loops.foreach_get("normal", normals)
14781478
normals = normals.reshape((num_loops, 3))
14791479
normals = normals @ matrix_normals
1480-
1480+
14811481
m.transform(matrix_datasmith)
14821482

14831483
#finish inline mesh_copy_triangulate
@@ -2080,7 +2080,7 @@ def get_datasmith_curves_image():
20802080
TEXTURE_MODE_BUMP = "6" # this converts textures to normal maps automatically
20812081

20822082
# saves image, and generates node with image description to add to export
2083-
def save_texture(texture, basedir, folder_name, minimal_export = False, experimental_tex_mode=True):
2083+
def save_texture(texture, basedir, folder_name, minimal_export = False, use_gamma_hack=False):
20842084
name, image, img_type = texture
20852085

20862086
log.info("writing texture:"+name)
@@ -2131,8 +2131,7 @@ def save_texture(texture, basedir, folder_name, minimal_export = False, experime
21312131
elif image.colorspace_settings.is_data:
21322132
n['texturemode'] = TEXTURE_MODE_SPECULAR
21332133
n['srgb'] = "2" # only read on 4.25 onwards, but we can still write it
2134-
if not experimental_tex_mode:
2135-
# use this hack if not using experimental mode
2134+
if use_gamma_hack:
21362135
n['rgbcurve'] = "0.454545"
21372136

21382137
n['texturefilter'] = "3"
@@ -2164,7 +2163,7 @@ def collect_and_save(context, args, save_path):
21642163
"materials": [],
21652164
"material_curves": None,
21662165
"metadata": [],
2167-
"prefer_custom_nodes": args["prefer_custom_nodes"],
2166+
"compatibility_mode": args["compatibility_mode"],
21682167
}
21692168

21702169
log.info("collecting objects")
@@ -2348,9 +2347,9 @@ def collect_and_save(context, args, save_path):
23482347
log.info("writing textures")
23492348

23502349
tex_nodes = []
2351-
use_experimental_tex_mode = args["experimental_tex_mode"]
2350+
use_gamma_hack = args["use_gamma_hack"]
23522351
for tex in datasmith_context["textures"]:
2353-
tex_node = save_texture(tex, basedir, folder_name, minimal_export, use_experimental_tex_mode)
2352+
tex_node = save_texture(tex, basedir, folder_name, minimal_export, use_gamma_hack)
23542353
tex_nodes.append(tex_node)
23552354

23562355
log.info("building XML tree")
@@ -2372,7 +2371,6 @@ def collect_and_save(context, args, save_path):
23722371
for mat in material_nodes:
23732372
n.push(mat)
23742373

2375-
print("Using experimental tex mode:%s", use_experimental_tex_mode)
23762374
for tex in tex_nodes:
23772375
n.push(tex)
23782376

testing/test_datasmith_export.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
log.info("Starting automated export")
4949

5050
custom_args = {}
51-
custom_args["experimental_tex_mode"] = True
51+
custom_args["use_gamma_hack"] = False
5252
custom_args["apply_modifiers"] = True
5353
custom_args["export_animations"] = True
54-
custom_args["prefer_custom_nodes"] = True
54+
custom_args["compatibility_mode"] = False
55+
custom_args["minimal_export"] = False
5556
custom_args["use_logging"] = True
5657
custom_args["use_profiling"] = False
57-
# custom_args["minimal_export"] = True
5858

5959
if "-benchmark" in sys.argv:
6060
custom_args["use_logging"] = False

0 commit comments

Comments
 (0)