[Bf-blender-cvs] [1a8cf4f] multiview: Change Viewport "stereo 3d" option for Multi-View scene setup

Dalai Felinto noreply at git.blender.org
Wed Sep 24 18:14:31 CEST 2014


Commit: 1a8cf4f8a4a0aecbe3e85584d86bd152fd7a830c
Author: Dalai Felinto
Date:   Wed Sep 24 18:13:56 2014 +0200
Branches: multiview
https://developer.blender.org/rB1a8cf4f8a4a0aecbe3e85584d86bd152fd7a830c

Change Viewport "stereo 3d" option for Multi-View scene setup

This may not be clear enough, and I still want to run this by Francesco Siddi. But basically the idea here is that when using the Multi-View option you should only get the option to see the "Stereo 3D" (when there is a left and right cameras) or the "views" which is the current selected view

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

M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_space.c

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

diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 53c6171..8bb1058 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -3411,6 +3411,13 @@ static bool view3d_stereo3d_active(const bContext *C, Scene *scene, View3D *v3d,
 	if ((v3d->camera == NULL) || rv3d->persp != RV3D_CAMOB)
 		return false;
 
+	if (scene->r.views_setup & SCE_VIEWS_SETUP_MULTIVIEW) {
+		if (v3d->stereo3d_camera == STEREO_MONO_ID)
+			return false;
+
+		return BKE_scene_is_stereo3d(&scene->r);
+	}
+
 	return true;
 }
 
@@ -3453,7 +3460,7 @@ static void view3d_stereo3d_setup(Scene *scene, View3D *v3d, ARegion *ar)
 		data->shiftx = shiftx;
 		BLI_unlock_thread(LOCK_VIEW3D);
 	}
-	else { /* SCE_VIEWS_SETUP_ADVANCED */
+	else { /* SCE_VIEWS_SETUP_MULTIVIEW */
 		float viewmat[4][4];
 		Object *view_ob = v3d->camera;
 		Object *camera = BKE_camera_render(scene, v3d->camera, viewname);
@@ -3480,7 +3487,7 @@ static void view3d_stereo3d_setup_offscreen(Scene *scene, View3D *v3d, ARegion *
 		BKE_camera_view_matrix(&scene->r, v3d->camera, is_left, viewmat);
 		view3d_main_area_setup_view(scene, v3d, ar, viewmat, winmat);
 	}
-	else { /* SCE_VIEWS_SETUP_ADVANCED */
+	else { /* SCE_VIEWS_SETUP_MULTIVIEW */
 		float viewmat[4][4];
 		Object *camera = BKE_camera_render(scene, v3d->camera, viewname);
 
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index eab77d3..0e21db2 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -879,10 +879,10 @@ enum {
 #define STEREO_LEFT_NAME "left"
 
 typedef enum StereoViews {
-	STEREO_MONO_ID = -1,
 	STEREO_LEFT_ID = 0,
 	STEREO_RIGHT_ID = 1,
 	STEREO_3D_ID = 2,
+	STEREO_MONO_ID = 3,
 } StereoViews;
 
 /* Markers */
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index b39b757..7384291 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -88,6 +88,30 @@ EnumPropertyItem space_type_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+#define V3D_S3D_CAMERA_LEFT        {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
+#define V3D_S3D_CAMERA_RIGHT       {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
+#define V3D_S3D_CAMERA_S3D         {STEREO_3D_ID, "S3D", ICON_CAMERA_STEREO, "3D", ""},
+#define V3D_S3D_CAMERA_VIEWS       {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
+
+static EnumPropertyItem stereo3d_camera_items[] = {
+	V3D_S3D_CAMERA_LEFT
+	V3D_S3D_CAMERA_RIGHT
+	V3D_S3D_CAMERA_S3D
+	{0, NULL, 0, NULL, NULL}
+};
+
+static EnumPropertyItem multiview_camera_items[] = {
+	V3D_S3D_CAMERA_VIEWS
+	V3D_S3D_CAMERA_S3D
+	{0, NULL, 0, NULL, NULL}
+};
+
+#undef V3D_S3D_CAMERA_LEFT
+#undef V3D_S3D_CAMERA_RIGHT
+#undef V3D_S3D_CAMERA_S3D
+#undef V3D_S3D_CAMERA_VIEWS
+
+
 static EnumPropertyItem pivot_items_full[] = {
 	{V3D_CENTER, "BOUNDING_BOX_CENTER", ICON_ROTATE, "Bounding Box Center",
 	             "Pivot around bounding box center of selected object(s)"},
@@ -659,6 +683,17 @@ static EnumPropertyItem *rna_SpaceView3D_viewport_shade_itemf(bContext *UNUSED(C
 	return item;
 }
 
+static EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *UNUSED(C), PointerRNA *ptr,
+                                                               PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+{
+	Scene *scene = ((bScreen *)ptr->id.data)->scene;
+
+	if (scene->r.views_setup == SCE_VIEWS_SETUP_MULTIVIEW)
+		return multiview_camera_items;
+	else
+		return stereo3d_camera_items;
+}
+
 /* Space Image Editor */
 
 static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
@@ -1890,13 +1925,6 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 		{0, NULL, 0, NULL, NULL}
 	};
 
-	static EnumPropertyItem stereo3d_camera_items[] = {
-		{STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
-		{STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
-		{STEREO_3D_ID, "3D", ICON_CAMERA_STEREO, "3D", ""},
-		{0, NULL, 0, NULL, NULL}
-	};
-
 	srna = RNA_def_struct(brna, "SpaceView3D", "Space");
 	RNA_def_struct_sdna(srna, "View3D");
 	RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -2236,6 +2264,7 @@ static void rna_def_space_view3d(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "stereo_3d_camera", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "stereo3d_camera");
 	RNA_def_property_enum_items(prop, stereo3d_camera_items);
+	RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
 	RNA_def_property_ui_text(prop, "Camera", "");
 	RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);




More information about the Bf-blender-cvs mailing list