Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_brush.c
| Context not available. | |||||
| mul_v3_v3fl(delta, gso->dvec, inf); | mul_v3_v3fl(delta, gso->dvec, inf); | ||||
| /* apply */ | /* apply */ | ||||
| mul_mat3_m4_v3(gso->object->obmat, delta); /* only rotation component */ | |||||
| add_v3_v3(&pt->x, delta); | add_v3_v3(&pt->x, delta); | ||||
| /* compute lock axis */ | /* compute lock axis */ | ||||
| Context not available. | |||||
| inf = gp_brush_influence_calc(gso, radius, co) / 5.0f; | inf = gp_brush_influence_calc(gso, radius, co) / 5.0f; | ||||
| /* 1) Make this point relative to the cursor/midpoint (dvec) */ | /* 1) Make this point relative to the cursor/midpoint (dvec) */ | ||||
| sub_v3_v3v3(vec, &pt->x, gso->dvec); | float fpt[3]; | ||||
| mul_v3_m4v3(fpt, gso->object->obmat, &pt->x); | |||||
| sub_v3_v3v3(vec, fpt, gso->dvec); | |||||
| /* 2) Shrink the distance by pulling the point towards the midpoint | /* 2) Shrink the distance by pulling the point towards the midpoint | ||||
| * (0.0 = at midpoint, 1 = at edge of brush region) | * (0.0 = at midpoint, 1 = at edge of brush region) | ||||
| Context not available. | |||||
| mul_v3_fl(vec, fac); | mul_v3_fl(vec, fac); | ||||
| /* 3) Translate back to original space, with the shrinkage applied */ | /* 3) Translate back to original space, with the shrinkage applied */ | ||||
| add_v3_v3v3(&pt->x, gso->dvec, vec); | add_v3_v3v3(fpt, gso->dvec, vec); | ||||
| mul_v3_m4v3(&pt->x, gso->object->imat, fpt); | |||||
| /* compute lock axis */ | /* compute lock axis */ | ||||
| gpsculpt_compute_lock_axis(gso, pt, save_pt); | gpsculpt_compute_lock_axis(gso, pt, save_pt); | ||||
| Context not available. | |||||
| axis_angle_normalized_to_mat3(rmat, axis, angle); | axis_angle_normalized_to_mat3(rmat, axis, angle); | ||||
| /* Rotate point (no matrix-space transforms needed, as GP points are in world space) */ | /* Rotate point */ | ||||
| sub_v3_v3v3(vec, &pt->x, gso->dvec); /* make relative to center | float fpt[3]; | ||||
| * (center is stored in dvec) */ | mul_v3_m4v3(fpt, gso->object->obmat, &pt->x); | ||||
| sub_v3_v3v3(vec, fpt, gso->dvec); /* make relative to center | |||||
| * (center is stored in dvec) */ | |||||
| mul_m3_v3(rmat, vec); | mul_m3_v3(rmat, vec); | ||||
| add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */ | add_v3_v3v3(fpt, vec, gso->dvec); /* restore */ | ||||
| mul_v3_m4v3(&pt->x, gso->object->imat, fpt); | |||||
| /* compute lock axis */ | /* compute lock axis */ | ||||
| gpsculpt_compute_lock_axis(gso, pt, save_pt); | gpsculpt_compute_lock_axis(gso, pt, save_pt); | ||||
| Context not available. | |||||
| gp_brush_calc_midpoint(gso); /* this puts the cursor location into gso->dvec */ | gp_brush_calc_midpoint(gso); /* this puts the cursor location into gso->dvec */ | ||||
| sub_v3_v3v3(delta, gso->dvec, data->buffer_midpoint); | sub_v3_v3v3(delta, gso->dvec, data->buffer_midpoint); | ||||
| sub_v3_v3(delta, gso->object->obmat[3]); | |||||
brecht: The reason for this line of code is unclear, why would the object translation affect a… | |||||
antoniovAuthorUnsubmitted Done Inline ActionsThe reason for that is the point is transformed using the delta, so if the original object is rotated, the destination point must be rotated too. I did not created this operator (it's from old 2.73 +/-) and I tested and it was necessary to make it works when clone rotate objects. antoniov: The reason for that is the point is transformed using the delta, so if the original object is… | |||||
| mul_mat3_m4_v3(gso->object->obmat, delta); /* only rotation component */ | |||||
| /* Copy each stroke into the layer */ | /* Copy each stroke into the layer */ | ||||
| for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { | for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { | ||||
| if (ED_gpencil_stroke_can_use(C, gps)) { | if (ED_gpencil_stroke_can_use(C, gps)) { | ||||
| Context not available. | |||||
The reason for this line of code is unclear, why would the object translation affect a direction vector?