[Bf-blender-cvs] [48074c6] temp_localview_split: Make move to layer OP work with new local view data

Julian Eisel noreply at git.blender.org
Wed Jul 27 19:00:04 CEST 2016


Commit: 48074c6522a1d87a3d92e5e5bbf3b43a13bd50ff
Author: Julian Eisel
Date:   Wed Jul 27 18:55:39 2016 +0200
Branches: temp_localview_split
https://developer.blender.org/rB48074c6522a1d87a3d92e5e5bbf3b43a13bd50ff

Make move to layer OP work with new local view data

And fix crash on redo.

Current behavior is the same as in master, which could be improved. If in local view, the move to layer OP just opens a confirmation popup saying "Move out of Local View". Confirming only moves the object out of local view, you have to use the redo panel to move it to a different layer.

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

M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/object/object_relations.c

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

diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6be6964..38db067 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6549,12 +6549,15 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
 							id_us_plus((ID *)bgpic->clip);
 						}
 					}
+
+					/* old localview data */
+					if (v3d->localvd) {
+						v3d->localvd->camera = sc->scene->camera;
+					}
+					/* new localview data */
 					if (v3d->localviewd) {
 						/*Base *base;*/
 
-						/* old localview data */
-						v3d->localvd->camera = sc->scene->camera;
-						/* new localview data */
 						v3d->localviewd->camera = sc->scene->camera;
 
 						/* localview can become invalid during undo/redo steps, so we exit it when no could be found */
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index e28933e..8cd1a9b 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1351,41 +1351,27 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
 	Main *bmain = CTX_data_main(C);
 	Scene *scene = CTX_data_scene(C);
 	View3D *v3d = CTX_wm_view3d(C);
-	unsigned int lay, local;
+	unsigned int lay;
 	/* bool is_lamp = false; */ /* UNUSED */
 
 	lay = move_to_layer_init(C, op);
-	lay &= 0xFFFFFF;
 
 	if (lay == 0) return OPERATOR_CANCELLED;
 
-	if (v3d && v3d->localviewd) {
-		/* now we can move out of localview. */
-		/* note: layers are set in bases, library objects work for this */
-		CTX_DATA_BEGIN (C, Base *, base, selected_bases)
-		{
-			lay = base->lay & ~v3d->lay;
-			base->lay = lay;
-			base->object->lay = lay;
+	/* note: layers are set in bases, library objects work for this */
+	CTX_DATA_BEGIN (C, Base *, base, selected_bases)
+	{
+		/* Move out of local view and deselect */
+		/* TODO maybe this can be done a bit nicer? */
+		if (v3d && v3d->localviewd) {
+			base->object->localview.viewbits &= ~v3d->localviewd->viewbits;
 			base->object->flag &= ~SELECT;
 			base->flag &= ~SELECT;
-			/* if (base->object->type == OB_LAMP) is_lamp = true; */
 		}
-		CTX_DATA_END;
-	}
-	else {
-		/* normal non localview operation */
-		/* note: layers are set in bases, library objects work for this */
-		CTX_DATA_BEGIN (C, Base *, base, selected_bases)
-		{
-			/* upper byte is used for local view */
-			local = base->lay & 0xFF000000;
-			base->lay = lay + local;
-			base->object->lay = lay;
-			/* if (base->object->type == OB_LAMP) is_lamp = true; */
-		}
-		CTX_DATA_END;
+		base->lay = base->object->lay = lay;
+		/* if (base->object->type == OB_LAMP) is_lamp = true; */
 	}
+	CTX_DATA_END;
 
 	/* warning, active object may be hidden now */




More information about the Bf-blender-cvs mailing list