fix [#36176] Connected font Bevel moves inwards for some letter combinations
authorCampbell Barton <ideasman42@gmail.com>
Wed, 17 Jul 2013 14:05:50 +0000 (14:05 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 17 Jul 2013 14:05:50 +0000 (14:05 +0000)
bevel wasn't taking into account overlapping text (bug goes back to 1.8).

source/blender/blenkernel/intern/curve.c
source/blender/makesdna/DNA_curve_types.h

index 3b9fbbb1c4d98948dfbb57ee9ff707250fbc7089..00a479b8b880364073059cd53774ce9df3eea771 100644 (file)
@@ -2323,6 +2323,7 @@ void BKE_curve_bevelList_make(Object *ob)
                        bl = MEM_callocN(sizeof(BevList) + 1 * sizeof(BevPoint), "makeBevelList1");
                        BLI_addtail(&(cu->bev), bl);
                        bl->nr = 0;
+                       bl->charidx = nu->charidx;
                }
                else {
                        if (G.is_rendering && cu->resolu_ren != 0)
@@ -2335,10 +2336,10 @@ void BKE_curve_bevelList_make(Object *ob)
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelList2");
                                BLI_addtail(&(cu->bev), bl);
 
-                               if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                               else bl->poly = -1;
+                               bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
                                bl->nr = len;
                                bl->dupe_nr = 0;
+                               bl->charidx = nu->charidx;
                                bevp = (BevPoint *)(bl + 1);
                                bp = nu->bp;
 
@@ -2358,8 +2359,8 @@ void BKE_curve_bevelList_make(Object *ob)
                                bl = MEM_callocN(sizeof(BevList) + len * sizeof(BevPoint), "makeBevelBPoints");
                                BLI_addtail(&(cu->bev), bl);
 
-                               if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                               else bl->poly = -1;
+                               bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
+                               bl->charidx = nu->charidx;
                                bevp = (BevPoint *)(bl + 1);
 
                                a = nu->pntsu - 1;
@@ -2445,8 +2446,8 @@ void BKE_curve_bevelList_make(Object *ob)
                                        BLI_addtail(&(cu->bev), bl);
                                        bl->nr = len;
                                        bl->dupe_nr = 0;
-                                       if (nu->flagu & CU_NURB_CYCLIC) bl->poly = 0;
-                                       else bl->poly = -1;
+                                       bl->poly = (nu->flagu & CU_NURB_CYCLIC) ? 0 : -1;
+                                       bl->charidx = nu->charidx;
                                        bevp = (BevPoint *)(bl + 1);
 
                                        BKE_nurb_makeCurve(nu, &bevp->vec[0],
@@ -2572,9 +2573,11 @@ void BKE_curve_bevelList_make(Object *ob)
                        bl = sd->bl;     /* is bl a hole? */
                        sd1 = sortdata + (a - 1);
                        for (b = a - 1; b >= 0; b--, sd1--) { /* all polys to the left */
-                               if (bevelinside(sd1->bl, bl)) {
-                                       bl->hole = 1 - sd1->bl->hole;
-                                       break;
+                               if (sd1->bl->charidx == bl->charidx) { /* for text, only check matching char */
+                                       if (bevelinside(sd1->bl, bl)) {
+                                               bl->hole = 1 - sd1->bl->hole;
+                                               break;
+                                       }
                                }
                        }
                }
index 964fa11b0a24a0344d999cf52a894fb17e91e349..7ff8667f90eb5b58caa7a972decbc841a6d01cd5 100644 (file)
@@ -75,6 +75,7 @@ typedef struct BevList {
        struct BevList *next, *prev;
        int nr, dupe_nr;
        int poly, hole;
+       int charidx;
 } BevList;
 
 /* These two Lines with # tell makesdna this struct can be excluded. */