diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-09-02 22:34:31 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-09-02 22:34:31 +0400 |
commit | f0986beef32ff23dd7c61ebdc531a46958efca16 (patch) | |
tree | 6ac256d46b01f04921030a3c27cdfbf321cea9ad /io_scene_obj | |
parent | 9a9805676b2d39afb5baae6d3c1e9321719b5e51 (diff) |
Update to OBJ exporter: now you can choose wether to export smooth groups IDs as simple values or as bitflags.
Diffstat (limited to 'io_scene_obj')
-rw-r--r-- | io_scene_obj/__init__.py | 6 | ||||
-rw-r--r-- | io_scene_obj/export_obj.py | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py index 9b5e4021..f3ed2b6b 100644 --- a/io_scene_obj/__init__.py +++ b/io_scene_obj/__init__.py @@ -242,6 +242,12 @@ class ExportOBJ(bpy.types.Operator, ExportHelper): description="Write sharp edges as smooth groups", default=False, ) + use_smooth_groups_bitflags = BoolProperty( + name="Bitflag Smooth Groups", + description="Same as 'Smooth Groups', but generate smooth groups IDs as bitflags " + "(produces at most 32 different smooth groups, usually much less)", + default=False, + ) use_normals = BoolProperty( name="Include Normals", description="", diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py index 41843b0f..688773ee 100644 --- a/io_scene_obj/export_obj.py +++ b/io_scene_obj/export_obj.py @@ -246,6 +246,7 @@ def write_file(filepath, objects, scene, EXPORT_TRI=False, EXPORT_EDGES=False, EXPORT_SMOOTH_GROUPS=False, + EXPORT_SMOOTH_GROUPS_BITFLAGS=False, EXPORT_NORMALS=False, EXPORT_UV=True, EXPORT_MTL=True, @@ -402,8 +403,8 @@ def write_file(filepath, objects, scene, if EXPORT_NORMALS and face_index_pairs: me.calc_normals() - if EXPORT_SMOOTH_GROUPS and face_index_pairs: - smooth_groups, smooth_groups_tot = me.calc_smooth_groups() + if (EXPORT_SMOOTH_GROUPS or EXPORT_SMOOTH_GROUPS_BITFLAGS) and face_index_pairs: + smooth_groups, smooth_groups_tot = me.calc_smooth_groups(EXPORT_SMOOTH_GROUPS_BITFLAGS) if smooth_groups_tot <= 1: smooth_groups, smooth_groups_tot = (), 0 else: @@ -690,6 +691,7 @@ def _write(context, filepath, EXPORT_TRI, # ok EXPORT_EDGES, EXPORT_SMOOTH_GROUPS, + EXPORT_SMOOTH_GROUPS_BITFLAGS, EXPORT_NORMALS, # not yet EXPORT_UV, # ok EXPORT_MTL, @@ -742,6 +744,7 @@ def _write(context, filepath, EXPORT_TRI, EXPORT_EDGES, EXPORT_SMOOTH_GROUPS, + EXPORT_SMOOTH_GROUPS_BITFLAGS, EXPORT_NORMALS, EXPORT_UV, EXPORT_MTL, @@ -775,6 +778,7 @@ def save(operator, context, filepath="", use_edges=True, use_normals=False, use_smooth_groups=False, + use_smooth_groups_bitflags=False, use_uvs=True, use_materials=True, use_mesh_modifiers=True, @@ -794,6 +798,7 @@ def save(operator, context, filepath="", EXPORT_TRI=use_triangles, EXPORT_EDGES=use_edges, EXPORT_SMOOTH_GROUPS=use_smooth_groups, + EXPORT_SMOOTH_GROUPS_BITFLAGS=use_smooth_groups_bitflags, EXPORT_NORMALS=use_normals, EXPORT_UV=use_uvs, EXPORT_MTL=use_materials, |