Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/font.c
| Show First 20 Lines • Show All 1,269 Lines • ▼ Show 20 Lines | #endif | ||||
| MEM_freeN(lineinfo); | MEM_freeN(lineinfo); | ||||
| MEM_freeN(i_textbox_array); | MEM_freeN(i_textbox_array); | ||||
| /* TEXT ON CURVE */ | /* TEXT ON CURVE */ | ||||
| /* Note: Only OB_CURVE objects could have a path */ | /* Note: Only OB_CURVE objects could have a path */ | ||||
| if (cu->textoncurve && cu->textoncurve->type == OB_CURVE) { | if (cu->textoncurve && cu->textoncurve->type == OB_CURVE) { | ||||
| BLI_assert(cu->textoncurve->runtime.curve_cache != NULL); | BLI_assert(cu->textoncurve->runtime.curve_cache != NULL); | ||||
| if (cu->textoncurve->runtime.curve_cache != NULL && | if (cu->textoncurve->runtime.curve_cache != NULL && | ||||
| cu->textoncurve->runtime.curve_cache->path != NULL) { | cu->textoncurve->runtime.curve_cache->anim_path_accum_length != NULL) { | ||||
| float distfac, imat[4][4], imat3[3][3], cmat[3][3]; | float distfac, imat[4][4], imat3[3][3], cmat[3][3]; | ||||
| float minx, maxx; | float minx, maxx; | ||||
| float timeofs, sizefac; | float timeofs, sizefac; | ||||
| if (ob != NULL) { | if (ob != NULL) { | ||||
| invert_m4_m4(imat, ob->obmat); | invert_m4_m4(imat, ob->obmat); | ||||
| } | } | ||||
| else { | else { | ||||
| Show All 17 Lines | if (cu->textoncurve->runtime.curve_cache != NULL && | ||||
| } | } | ||||
| } | } | ||||
| /* We put the x-coordinate exact at the curve, the y is rotated. */ | /* We put the x-coordinate exact at the curve, the y is rotated. */ | ||||
| /* length correction */ | /* length correction */ | ||||
| const float chartrans_size_x = maxx - minx; | const float chartrans_size_x = maxx - minx; | ||||
| if (chartrans_size_x != 0.0f) { | if (chartrans_size_x != 0.0f) { | ||||
| const float totdist = cu->textoncurve->runtime.curve_cache->path->totdist; | const CurveCache *cc = cu->textoncurve->runtime.curve_cache; | ||||
| const float totdist = BKE_anim_path_get_length(cc); | |||||
| distfac = (sizefac * totdist) / chartrans_size_x; | distfac = (sizefac * totdist) / chartrans_size_x; | ||||
| distfac = (distfac > 1.0f) ? (1.0f / distfac) : 1.0f; | distfac = (distfac > 1.0f) ? (1.0f / distfac) : 1.0f; | ||||
| } | } | ||||
| else { | else { | ||||
| /* Happens when there are no characters, set this value to place the text cursor. */ | /* Happens when there are no characters, set this value to place the text cursor. */ | ||||
| distfac = 0.0f; | distfac = 0.0f; | ||||
| } | } | ||||
| Show All 37 Lines | if (cu->textoncurve->runtime.curve_cache != NULL && | ||||
| dtime = distfac * 0.5f * twidth; | dtime = distfac * 0.5f * twidth; | ||||
| ctime = timeofs + distfac * (ct->xof - minx); | ctime = timeofs + distfac * (ct->xof - minx); | ||||
| CLAMP(ctime, 0.0f, 1.0f); | CLAMP(ctime, 0.0f, 1.0f); | ||||
| /* calc the right loc AND the right rot separately */ | /* calc the right loc AND the right rot separately */ | ||||
| /* vec, tvec need 4 items */ | /* vec, tvec need 4 items */ | ||||
| where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL); | BKE_where_on_path(cu->textoncurve, ctime, vec, tvec, NULL, NULL, NULL); | ||||
| where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL); | BKE_where_on_path(cu->textoncurve, ctime + dtime, tvec, rotvec, NULL, NULL, NULL); | ||||
| mul_v3_fl(vec, sizefac); | mul_v3_fl(vec, sizefac); | ||||
| ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]); | ct->rot = (float)M_PI - atan2f(rotvec[1], rotvec[0]); | ||||
| si = sinf(ct->rot); | si = sinf(ct->rot); | ||||
| co = cosf(ct->rot); | co = cosf(ct->rot); | ||||
| ▲ Show 20 Lines • Show All 420 Lines • Show Last 20 Lines | |||||