[Bf-blender-cvs] [3e55b3c6d03] blender2.8: Multi-Objects: CURVE_OT_switch_direction

Dalai Felinto noreply at git.blender.org
Fri Nov 2 18:13:02 CET 2018


Commit: 3e55b3c6d0335173567ee32644f83ec06f8d5fdd
Author: Dalai Felinto
Date:   Fri Nov 2 12:49:41 2018 -0300
Branches: blender2.8
https://developer.blender.org/rB3e55b3c6d0335173567ee32644f83ec06f8d5fdd

Multi-Objects: CURVE_OT_switch_direction

===================================================================

M	source/blender/editors/curve/editcurve.c

===================================================================

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index b53773aea52..940a4328487 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -2390,29 +2390,41 @@ static void adduplicateflagNurb(Object *obedit, View3D *v3d, ListBase *newnurb,
 
 static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op))
 {
-	Object *obedit = CTX_data_edit_object(C);
+	ViewLayer *view_layer = CTX_data_view_layer(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	Curve *cu = (Curve *)obedit->data;
-	EditNurb *editnurb = cu->editnurb;
-	Nurb *nu;
-	int i;
 
-	for (nu = editnurb->nurbs.first, i = 0; nu; nu = nu->next, i++) {
-		if (ED_curve_nurb_select_check(v3d, nu)) {
-			BKE_nurb_direction_switch(nu);
-			keyData_switchDirectionNurb(cu, nu);
-			if ((i == cu->actnu) && (cu->actvert != CU_ACT_NONE)) {
-				cu->actvert = (nu->pntsu - 1) - cu->actvert;
-			}
+	uint objects_len;
+	Object **objects = BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, &objects_len);
+	for (uint ob_index = 0; ob_index < objects_len; ob_index++) {
+		Object *obedit = objects[ob_index];
+		Curve *cu = obedit->data;
+
+		if (!ED_curve_select_check(v3d, cu->editnurb)) {
+				continue;
 		}
-	}
 
-	if (ED_curve_updateAnimPaths(obedit->data))
-		WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+		EditNurb *editnurb = cu->editnurb;
+		Nurb *nu;
+		int i;
 
-	DEG_id_tag_update(obedit->data, 0);
-	WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+		for (nu = editnurb->nurbs.first, i = 0; nu; nu = nu->next, i++) {
+			if (ED_curve_nurb_select_check(v3d, nu)) {
+				BKE_nurb_direction_switch(nu);
+				keyData_switchDirectionNurb(cu, nu);
+				if ((i == cu->actnu) && (cu->actvert != CU_ACT_NONE)) {
+					cu->actvert = (nu->pntsu - 1) - cu->actvert;
+				}
+			}
+		}
 
+		if (ED_curve_updateAnimPaths(obedit->data)) {
+			WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit);
+		}
+
+		DEG_id_tag_update(obedit->data, 0);
+		WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data);
+	}
+	MEM_freeN(objects);
 	return OPERATOR_FINISHED;
 }



More information about the Bf-blender-cvs mailing list