Fix: "Twist" GP Sculpt brush in 2D Editors was unusable... now mostly usable, if still slightly offset
This commit is contained in:
parent
9c474b187a
commit
b594b25dad
Notes:
blender-bot
2023-02-14 08:10:09 +01:00
Referenced by issue #47768, Middle mouse becomes disabled in 3d View when using Blendermada
Referenced by issue #47722, FBX export interpolation is not accurate
Referenced by issue #47693, Segfault on selecting objects
Referenced by issue #47681, bump node doesn't work with SSS shader
Referenced by issue #47658, Crashes with rendering extremely huge image
Referenced by issue #47667, Uneven width of colors in ColorRamp with constant selected
Referenced by issue #47642, 2.77 hash 509270e
Crash when Cycles Baking
Referenced by issue #47648, Emission material not working.
Referenced by issue #47649, Point light not working properly inside a volume while rendering with GPU
Referenced by issue #47655, OpenVDB cache files have extra "_00" at end.
Referenced by issue #47626, Blender 2.77 RC OPEN VDB import Failure
Referenced by issue #47610, Texture node in compositing nodes does not update
Referenced by issue #47593, 'Move to layer' will be crash in blender 2.77rc1
|
@ -606,24 +606,32 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso, bGPDstroke *gps, int i,
|
|||
add_v3_v3v3(&pt->x, vec, gso->dvec); /* restore */
|
||||
}
|
||||
else {
|
||||
float tco[2], rco[2], nco[2];
|
||||
float rmat[2][2];
|
||||
const float axis[3] = {0.0f, 0.0f, 1.0f};
|
||||
float vec[3] = {0.0f};
|
||||
float rmat[3][3];
|
||||
|
||||
/* Express position of point relative to cursor, ready to rotate */
|
||||
tco[0] = (float)(co[0] - gso->mval[0]);
|
||||
tco[1] = (float)(co[1] - gso->mval[1]);
|
||||
// XXX: There is still some offset here, but it's close to working as expected...
|
||||
vec[0] = (float)(co[0] - gso->mval[0]);
|
||||
vec[1] = (float)(co[1] - gso->mval[1]);
|
||||
|
||||
/* Rotate point in 2D */
|
||||
angle_to_mat2(rmat, angle);
|
||||
mul_v2_m2v2(rco, rmat, tco);
|
||||
/* rotate point */
|
||||
axis_angle_normalized_to_mat3(rmat, axis, angle);
|
||||
mul_m3_v3(rmat, vec);
|
||||
|
||||
/* Convert back to screen-coordinates */
|
||||
nco[0] = rco[0] + (float)gso->mval[0];
|
||||
nco[1] = rco[1] + (float)gso->mval[1];
|
||||
vec[0] += (float)gso->mval[0];
|
||||
vec[1] += (float)gso->mval[1];
|
||||
|
||||
/* Use coordinates "as-is" */
|
||||
// XXX: v2d scaling/offset?
|
||||
copy_v2_v2(&pt->x, nco);
|
||||
/* Map from screen-coordinates to final coordinate space */
|
||||
if (gps->flag & GP_STROKE_2DSPACE) {
|
||||
View2D *v2d = gso->gsc.v2d;
|
||||
UI_view2d_region_to_view(v2d, vec[0], vec[1], &pt->x, &pt->y);
|
||||
}
|
||||
else {
|
||||
// XXX
|
||||
copy_v2_v2(&pt->x, vec);
|
||||
}
|
||||
}
|
||||
|
||||
/* done */
|
||||
|
|
Loading…
Reference in New Issue