Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuli Raivio <bqqbarbhg>2021-09-29 18:58:50 +0300
committerBastien Montagne <bastien@blender.org>2021-09-29 19:00:23 +0300
commit9a285d80167fc8c9e8b0c7ab2f2fd3c7487fa01d (patch)
tree16d90e0eead1603cc5d9f1d876d40912b4359909
parentea457d4ab516e0cfa0ea28c5b601c02a87805cf1 (diff)
FBX export / subdivision: Write proper boundary rule
Currently when exporting a subdivision surface (//Geometry / Export Subdivision Surface// enabled) the exporter uses a hard-coded BoundaryRule rule of 2 (CreaseAll, meaning hard corners). The subdivision surface modifier has an option for boundary smoothing mode so this patch propagates that information to the FBX exporter. Example .fbx file with this feature exported from modified Blender 2.93: https://github.com/bqqbarbhg/ufbx/blob/overhaul/data/blender_293x_subsurf_boundary_7400_binary.fbx Reviewed By: mont29 Differential Revision: https://developer.blender.org/D12204
-rw-r--r--io_scene_fbx/__init__.py2
-rw-r--r--io_scene_fbx/export_fbx_bin.py5
-rw-r--r--io_scene_fbx/import_fbx.py5
3 files changed, 10 insertions, 2 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 495e62d2..a9c58915 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (4, 24, 0),
+ "version": (4, 25, 0),
"blender": (2, 90, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/export_fbx_bin.py b/io_scene_fbx/export_fbx_bin.py
index 3950ed5b..09dfaa9f 100644
--- a/io_scene_fbx/export_fbx_bin.py
+++ b/io_scene_fbx/export_fbx_bin.py
@@ -879,7 +879,10 @@ def fbx_data_mesh_elements(root, me_obj, scene_data, done_meshes):
if last_subsurf:
elem_data_single_int32(geom, b"Smoothness", 2) # Display control mesh and smoothed
- elem_data_single_int32(geom, b"BoundaryRule", 2) # Round edges like Blender
+ if last_subsurf.boundary_smooth == "PRESERVE_CORNERS":
+ elem_data_single_int32(geom, b"BoundaryRule", 2) # CreaseAll
+ else:
+ elem_data_single_int32(geom, b"BoundaryRule", 1) # CreaseEdge
elem_data_single_int32(geom, b"PreviewDivisionLevels", last_subsurf.levels)
elem_data_single_int32(geom, b"RenderDivisionLevels", last_subsurf.render_levels)
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index ba11757a..a07e919e 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -2928,6 +2928,11 @@ def load(operator, context, filepath="",
mod = parent.bl_obj.modifiers.new('subsurf', 'SUBSURF')
mod.levels = preview_levels
mod.render_levels = render_levels
+ boundary_rule = elem_prop_first(elem_find_first(fbx_sdata, b'BoundaryRule'), default=1)
+ if boundary_rule == 2:
+ mod.boundary_smooth = "PRESERVE_CORNERS"
+ else:
+ mod.boundary_smooth = "ALL"
_(); del _