[Bf-blender-cvs] [b5a18c1aacd] blender2.8: Multi-Objects: CURVE_OT_reveal

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


Commit: b5a18c1aacd333046479809a6cd66adfb1410d7e
Author: Dalai Felinto
Date:   Fri Nov 2 12:58:57 2018 -0300
Branches: blender2.8
https://developer.blender.org/rBb5a18c1aacd333046479809a6cd66adfb1410d7e

Multi-Objects: CURVE_OT_reveal

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

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

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

diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index bcf7f944ad1..7068882d295 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -3036,44 +3036,57 @@ void CURVE_OT_hide(wmOperatorType *ot)
 
 static int reveal_exec(bContext *C, wmOperator *op)
 {
-	Object *obedit = CTX_data_edit_object(C);
-	ListBase *editnurb = object_editcurve_get(obedit);
-	Nurb *nu;
-	BPoint *bp;
-	BezTriple *bezt;
-	int a;
+	ViewLayer *view_layer = CTX_data_view_layer(C);
 	const bool select = RNA_boolean_get(op->ptr, "select");
+	bool changed_multi = false;
 
-	for (nu = editnurb->first; nu; nu = nu->next) {
-		nu->hide = 0;
-		if (nu->type == CU_BEZIER) {
-			bezt = nu->bezt;
-			a = nu->pntsu;
-			while (a--) {
-				if (bezt->hide) {
-					select_beztriple(bezt, select, SELECT, HIDDEN);
-					bezt->hide = 0;
+	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];
+		ListBase *editnurb = object_editcurve_get(obedit);
+		Nurb *nu;
+		BPoint *bp;
+		BezTriple *bezt;
+		int a;
+		bool changed = false;
+
+		for (nu = editnurb->first; nu; nu = nu->next) {
+			nu->hide = 0;
+			if (nu->type == CU_BEZIER) {
+				bezt = nu->bezt;
+				a = nu->pntsu;
+				while (a--) {
+					if (bezt->hide) {
+						select_beztriple(bezt, select, SELECT, HIDDEN);
+						bezt->hide = 0;
+						changed = true;
+					}
+					bezt++;
 				}
-				bezt++;
 			}
-		}
-		else {
-			bp = nu->bp;
-			a = nu->pntsu * nu->pntsv;
-			while (a--) {
-				if (bp->hide) {
-					select_bpoint(bp, select, SELECT, HIDDEN);
-					bp->hide = 0;
+			else {
+				bp = nu->bp;
+				a = nu->pntsu * nu->pntsv;
+				while (a--) {
+					if (bp->hide) {
+						select_bpoint(bp, select, SELECT, HIDDEN);
+						bp->hide = 0;
+						changed = true;
+					}
+					bp++;
 				}
-				bp++;
 			}
 		}
-	}
-
-	DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
-	WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
 
-	return OPERATOR_FINISHED;
+		if (changed) {
+			DEG_id_tag_update(obedit->data, DEG_TAG_COPY_ON_WRITE | DEG_TAG_SELECT_UPDATE);
+			WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
+			changed_multi = true;
+		}
+	}
+	MEM_freeN(objects);
+	return changed_multi ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
 }
 
 void CURVE_OT_reveal(wmOperatorType *ot)



More information about the Bf-blender-cvs mailing list