[Bf-blender-cvs] [57eb4e36d74] temp-gpencil-bezier-stroke-type: GPencil: Fix merge issues
Antonio Vazquez
noreply at git.blender.org
Thu Apr 22 10:05:07 CEST 2021
Commit: 57eb4e36d745aebd5f05c8f2201b864428768874
Author: Antonio Vazquez
Date: Thu Apr 22 10:01:00 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB57eb4e36d745aebd5f05c8f2201b864428768874
GPencil: Fix merge issues
===================================================================
M source/blender/editors/gpencil/gpencil_data.c
M source/blender/editors/gpencil/gpencil_edit.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 9093c924749..4d641c3405d 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1575,11 +1575,7 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op)
(bool)(gps->editcurve->flag & GP_CURVE_SELECT) :
(bool)(gps->flag & GP_STROKE_SELECT);
/* only if selected */
- if (gps->flag & GP_STROKE_SELECT) {
- /* skip strokes that are invalid for current view */
- if (ED_gpencil_stroke_can_use(C, gps) == false) {
- continue;
- }
+ if (is_stroke_selected) {
/* check if the color is editable */
if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) {
continue;
@@ -1610,6 +1606,7 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op)
int prev_index = target_index;
/* Now do the movement of the stroke */
switch (direction) {
+ bGPDstroke *gps = NULL;
/* Bring to Front */
case GP_STROKE_MOVE_TOP:
LISTBASE_FOREACH (LinkData *, link, &selected) {
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index 3d1d9e2c129..25be01423d8 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -4080,7 +4080,6 @@ static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op)
int oldframe = (int)DEG_get_ctime(depsgraph);
const eGP_ReprojectModes mode = RNA_enum_get(op->ptr, "type");
const bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
- const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
/* Init snap context for geometry projection. */
@@ -4103,41 +4102,33 @@ static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op)
continue;
}
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
- /* skip strokes that are invalid for current view */
- if (ED_gpencil_stroke_can_use(C, gps) == false) {
+ bool is_stroke_selected = GPENCIL_STROKE_TYPE_BEZIER(gps) ?
+ (bool)(gps->editcurve->flag & GP_CURVE_SELECT) :
+ (bool)(gps->flag & GP_STROKE_SELECT);
+
+ if (!is_stroke_selected) {
continue;
}
- bool curve_select = false;
- if (is_curve_edit && gps->editcurve != NULL) {
- curve_select = gps->editcurve->flag & GP_CURVE_SELECT;
+ /* update frame to get the new location of objects */
+ if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf->framenum)) {
+ cfra_prv = gpf->framenum;
+ CFRA = gpf->framenum;
+ BKE_scene_graph_update_for_newframe(depsgraph);
}
- if (gps->flag & GP_STROKE_SELECT || curve_select) {
-
- /* update frame to get the new location of objects */
- if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf->framenum)) {
- cfra_prv = gpf->framenum;
- CFRA = gpf->framenum;
- BKE_scene_graph_update_for_newframe(depsgraph);
- }
-
- ED_gpencil_stroke_reproject(depsgraph, &gsc, sctx, gpl, gpf, gps, mode, keep_original);
+ ED_gpencil_stroke_reproject(depsgraph, &gsc, sctx, gpl, gpf, gps, mode, keep_original);
- if (is_curve_edit && gps->editcurve != NULL) {
- BKE_gpencil_stroke_editcurve_update(gpd, gpl, gps);
- /* Update the selection from the stroke to the curve. */
- BKE_gpencil_editcurve_stroke_sync_selection(gpd, gps, gps->editcurve);
+ /* TODO: Reproject curve data and regenerate stroke.
+ * Right now we are using the projected points to regenerate the curve. This will most
+ * likely change the handles which is usually not wanted.*/
+ BKE_gpencil_stroke_geometry_update(gpd, gps, GP_GEO_UPDATE_CURVE_REFIT_ALL);
- gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
- BKE_gpencil_stroke_geometry_update(gpd, gps);
- }
+ changed = true;
+ }
- changed = true;
- /* If not multi-edit, exit loop. */
- if (!is_multiedit) {
- break;
- }
- }
+ /* If not multi-edit, exit loop. */
+ if (!is_multiedit) {
+ break;
}
}
}
More information about the Bf-blender-cvs
mailing list