diff options
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_modifier.py | 1 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_modifier_types.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 5 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_remesh.c | 10 |
4 files changed, 17 insertions, 0 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index b46f0fc8923..9919865ca3a 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -838,6 +838,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): if md.mode == 'SHARP': layout.prop(md, "sharpness") + layout.prop(md, "smooth_shading") layout.prop(md, "remove_disconnected_pieces") row = layout.row() row.active = md.remove_disconnected_pieces diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 30280e95646..8e39ded84d5 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -1032,6 +1032,7 @@ typedef struct DynamicPaintModifierData { typedef enum RemeshModifierFlags { MOD_REMESH_FLOOD_FILL = 1, + MOD_REMESH_SMOOTH_SHADING = 2, } RemeshModifierFlags; typedef enum RemeshModifierMode { diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 07ea69fc260..38a0147b07c 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -3000,6 +3000,11 @@ static void rna_def_modifier_remesh(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL); RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", ""); RNA_def_property_update(prop, 0, "rna_Modifier_update"); + + prop = RNA_def_property(srna, "smooth_shading", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_SMOOTH_SHADING); + RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded"); + RNA_def_property_update(prop, 0, "rna_Modifier_update"); } static void rna_def_modifier_ocean(BlenderRNA *brna) diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c index 517791e3e73..57966b5824b 100644 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@ -190,6 +190,16 @@ static DerivedMesh *applyModifier(ModifierData *md, result = output->dm; MEM_freeN(output); + if (rmd->flag & MOD_REMESH_SMOOTH_SHADING) { + MPoly *mpoly = CDDM_get_polys(result); + int i, totpoly = result->getNumPolys(result); + + /* Apply smooth shading to output faces */ + for (i = 0; i < totpoly; i++) { + mpoly[i].flag |= ME_SMOOTH; + } + } + CDDM_calc_edges(result); CDDM_calc_normals(result); return result; |