[Bf-blender-cvs] [6a66ca53184] soc-2020-greasepencil-curve: GPencil: Remove not needed macros and functions
Falk David
noreply at git.blender.org
Tue Jun 9 18:05:31 CEST 2020
Commit: 6a66ca531848fb9faa44b57a20f0f4ffc76fe7b3
Author: Falk David
Date: Tue Jun 9 18:01:57 2020 +0200
Branches: soc-2020-greasepencil-curve
https://developer.blender.org/rB6a66ca531848fb9faa44b57a20f0f4ffc76fe7b3
GPencil: Remove not needed macros and functions
Remove marco and function that was no longer needed and use
newer BKE function.
===================================================================
M source/blender/editors/gpencil/gpencil_edit_curve.c
M source/blender/editors/gpencil/gpencil_intern.h
M source/blender/editors/gpencil/gpencil_utils.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_edit_curve.c b/source/blender/editors/gpencil/gpencil_edit_curve.c
index a8952f526d3..03b2e5fb0bb 100644
--- a/source/blender/editors/gpencil/gpencil_edit_curve.c
+++ b/source/blender/editors/gpencil/gpencil_edit_curve.c
@@ -56,38 +56,6 @@
/** \name Test Operator for curve editing
* \{ */
-static bGPDcurve *create_example_gp_curve(bGPDstroke *gps)
-{
- if (gps->totpoints < 2) {
- return NULL;
- }
-
- /* create curve with two points, one for each end point of the stroke */
- bGPDcurve *new_gp_curve = BKE_gpencil_stroke_editcurve_new(2);
-
- float offset1[3] = {1.0f, 0.0f, 0.0f};
- float offset2[3] = {-1.0f, 0.0f, 0.0f};
-
- bGPDspoint *first = &gps->points[0];
- bGPDspoint *last = &gps->points[gps->totpoints - 1];
-
- BezTriple *bezt = &new_gp_curve->curve_points[0];
- copy_v3_v3(&bezt->vec[0], &first->x);
- copy_v3_v3(&bezt->vec[1], &first->x);
- copy_v3_v3(&bezt->vec[2], &first->x);
- add_v3_v3(&bezt->vec[0], offset1);
- add_v3_v3(&bezt->vec[2], offset2);
-
- bezt = &new_gp_curve->curve_points[1];
- copy_v3_v3(&bezt->vec[0], &last->x);
- copy_v3_v3(&bezt->vec[1], &last->x);
- copy_v3_v3(&bezt->vec[2], &last->x);
- add_v3_v3(&bezt->vec[0], offset1);
- add_v3_v3(&bezt->vec[2], offset2);
-
- return new_gp_curve;
-}
-
static int gp_write_stroke_curve_data_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
@@ -110,7 +78,8 @@ static int gp_write_stroke_curve_data_exec(bContext *C, wmOperator *op)
if (gps->editcurve != NULL) {
BKE_gpencil_free_stroke_editcurve(gps);
}
- BKE_gpencil_stroke_curve_create(gps);
+ BKE_gpencil_stroke_editcurve_update(gps);
+ gps->flag |= GP_STROKE_CURVE_MODE;
}
}
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 0ad47e4265d..4e101031ed5 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -728,51 +728,6 @@ struct GP_EditableStrokes_Iter {
} \
(void)0
-/**
- * Iterate over all strokes in edit curve mode in the current context,
- * to perform some operations on the stroke.
- *
- * \param gpl: The identifier to use for the layer of the stroke being processed.
- * Choose a suitable value to avoid name clashes.
- * \param gps: The identifier to use for current stroke being processed.
- * Choose a suitable value to avoid name clashes.
- */
-#define GP_CURVE_EDIT_STROKES_BEGIN(gpstroke_iter, C, gpl, gps) \
- { \
- struct GP_EditableStrokes_Iter gpstroke_iter = {{{0}}}; \
- Depsgraph *depsgraph_ = CTX_data_ensure_evaluated_depsgraph(C); \
- Object *obact_ = CTX_data_active_object(C); \
- Object *ob_eval_ = (Object *)DEG_get_evaluated_id(depsgraph_, &obact_->id); \
- bGPdata *gpd_ = (bGPdata *)ob_eval_->data; \
- const bool is_multiedit_ = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd_); \
- LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd_->layers) { \
- if (BKE_gpencil_layer_is_editable(gpl)) { \
- bGPDframe *init_gpf_ = (is_multiedit_) ? gpl->frames.first : gpl->actframe; \
- for (bGPDframe *gpf_ = init_gpf_; gpf_; gpf_ = gpf_->next) { \
- if ((gpf_ == gpl->actframe) || ((gpf_->flag & GP_FRAME_SELECT) && is_multiedit_)) { \
- BKE_gpencil_parent_matrix_get(depsgraph_, obact_, gpl, gpstroke_iter.diff_mat); \
- invert_m4_m4(gpstroke_iter.inverse_diff_mat, gpstroke_iter.diff_mat); \
- /* loop over strokes */ \
- LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_->strokes) { \
- /* skip strokes that are invalid for current view */ \
- if (ED_gpencil_stroke_can_use(C, gps) == false) \
- continue; \
- if (gps->flag & GP_STROKE_CURVE_MODE) \
- continue; \
- /* ... Do Stuff With Strokes ... */
-
-#define GP_CURVE_EDIT_STROKES_END(gpstroke_iter) \
- } \
- } \
- if (!is_multiedit_) { \
- break; \
- } \
- } \
- } \
- } \
- } \
- (void)0
-
/* ****************************************************** */
#endif /* __GPENCIL_INTERN_H__ */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 2fd50aa3c39..2aaa9a1e9c2 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2485,18 +2485,16 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
/* if toggle, check if we need to select or deselect */
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
- GP_CURVE_EDIT_STROKES_BEGIN(gps_iter, C, gpl, gps)
- {
- if (gps->flag & GP_STROKE_SELECT) {
+ GP_EDITABLE_STROKES_BEGIN(gps_iter, C, gpl, gps) {
+ if (gps->editcurve != NULL && gps->flag & GP_STROKE_SELECT) {
action = SEL_DESELECT;
}
}
- GP_CURVE_EDIT_STROKES_END(gps_iter);
+ GP_EDITABLE_STROKES_END(gps_iter);
}
if (action == SEL_DESELECT) {
- GP_CURVE_EDIT_STROKES_BEGIN(gps_iter, C, gpl, gps)
- {
+ GP_EDITABLE_STROKES_BEGIN(gps_iter, C, gpl, gps) {
if (gps->editcurve != NULL) {
bGPDcurve *gpc = gps->editcurve;
for (int i = 0; i < gpc->tot_curve_points; i++) {
@@ -2508,7 +2506,7 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
gps->flag &= ~GP_STROKE_SELECT;
}
}
- GP_CURVE_EDIT_STROKES_END(gps_iter);
+ GP_EDITABLE_STROKES_END(gps_iter);
}
else {
CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) {
@@ -2516,7 +2514,7 @@ void ED_gpencil_select_curve_toggle_all(bContext *C, int action)
/* Make sure stroke has a curve */
if (gps->editcurve == NULL) {
- BKE_gpencil_stroke_curve_create(gps);
+ BKE_gpencil_stroke_editcurve_update(gps);
gps->flag |= GP_STROKE_CURVE_MODE;
}
More information about the Bf-blender-cvs
mailing list