Commit: e0985ffcc153f0a66f50e013d096009000ca6411
Author: Falk David
Date: Fri Aug 21 14:25:46 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rBe0985ffcc153f0a66f50e013d096009000ca6411
GPencil: Draw transform gizmo curve edit
===================================================================
M source/blender/editors/transform/transform_gizmo_3d.c
===================================================================
diff --git a/source/blender/editors/transform/transform_gizmo_3d.c
b/source/blender/editors/transform/transform_gizmo_3d.c
index 14ef5e87534..51601151b87 100644
--- a/source/blender/editors/transform/transform_gizmo_3d.c
+++ b/source/blender/editors/transform/transform_gizmo_3d.c
@@ -649,6 +649,7 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
Object *ob = OBACT(view_layer);
bGPdata *gpd = CTX_data_gpencil_data(C);
const bool is_gp_edit = GPENCIL_ANY_MODE(gpd);
+ const bool is_curve_edit = GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
int a, totsel = 0;
const int pivot_point = scene->toolsettings->transform_pivot_point;
@@ -707,16 +708,39 @@ int ED_transform_calc_gizmo_stats(const bContext *C,
continue;
}
- /* we're only interested in selected points here... */
- if (gps->flag & GP_STROKE_SELECT) {
- bGPDspoint *pt;
- int i;
+ if (is_curve_edit) {
+ if (gps->editcurve == NULL) {
+ continue;
+ }
- /* Change selection status of all points, then make the stroke
match */
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if (pt->flag & GP_SPOINT_SELECT) {
- calc_tw_center_with_matrix(tbounds, &pt->x, use_mat_local,
diff_mat);
- totsel++;
+ bGPDcurve *gpc = gps->editcurve;
+ if (gpc->flag & GP_CURVE_SELECT) {
+ for (uint32_t i = 0; i < gpc->tot_curve_points; i++) {
+ bGPDcurve_point *gpc_pt = &gpc->curve_points[i];
+ BezTriple *bezt = &gpc_pt->bezt;
+ if (gpc_pt->flag & GP_CURVE_POINT_SELECT) {
+ for (uint32_t j = 0; j < 3; j++) {
+ if (BEZT_ISSEL_IDX(bezt, j)) {
+ calc_tw_center_with_matrix(tbounds, bezt->vec[j],
use_mat_local, diff_mat);
+ totsel++;
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ /* we're only interested in selected points here... */
+ if (gps->flag & GP_STROKE_SELECT) {
+ bGPDspoint *pt;
+ int i;
+
+ /* Change selection status of all points, then make the stroke
match */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (pt->flag & GP_SPOINT_SELECT) {
+ calc_tw_center_with_matrix(tbounds, &pt->x, use_mat_local,
diff_mat);
+ totsel++;
+ }
}
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs