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
This commit is contained in:
parent
ea457d4ab5
commit
9a285d8016
|
@ -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",
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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 _
|
||||
|
||||
|
|
Loading…
Reference in New Issue