[Bf-blender-cvs] [2f22054670d] greasepencil-object: Apply smooth to subdivision modifier
Antonio Vazquez
noreply at git.blender.org
Mon Jul 17 13:40:56 CEST 2017
Commit: 2f22054670d77d33024b00450d14441c9ff5457a
Author: Antonio Vazquez
Date: Mon Jul 17 12:26:56 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2f22054670d77d33024b00450d14441c9ff5457a
Apply smooth to subdivision modifier
===================================================================
M source/blender/blenkernel/intern/gpencil.c
M source/blender/makesrna/intern/rna_modifier.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index d83adefaa31..f497fa0e551 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1703,8 +1703,25 @@ void ED_gpencil_subdiv_modifier(GpencilSubdivModifierData *mmd, bGPDlayer *gpl,
i2 += 2;
}
- /* free temp memory */
MEM_SAFE_FREE(temp_points);
+
+ /* move points to smooth stroke (not simple flag )*/
+ if ((mmd->flag & GP_SUBDIV_SIMPLE) == 0) {
+ /* duplicate points in a temp area with the new subdivide data */
+ temp_points = MEM_dupallocN(gps->points);
+
+ /* extreme points are not changed */
+ for (int i = 0; i < gps->totpoints - 2; i++) {
+ bGPDspoint *pt = &temp_points[i];
+ bGPDspoint *next = &temp_points[i + 1];
+ bGPDspoint *pt_final = &gps->points[i + 1];
+
+ /* move point */
+ interp_v3_v3v3(&pt_final->x, &pt->x, &next->x, 0.5f);
+ }
+ /* free temp memory */
+ MEM_SAFE_FREE(temp_points);
+ }
}
}
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 886d2341237..f0d6a49ffbc 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -4835,7 +4835,7 @@ static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna)
prop = RNA_def_property(srna, "level", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "level");
- RNA_def_property_range(prop, 1, 5);
+ RNA_def_property_range(prop, 0, 5);
RNA_def_property_ui_text(prop, "Level", "Number of subdivisions");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
More information about the Bf-blender-cvs
mailing list