[Bf-blender-cvs] [5c1da8a] multiview: multiview: allow stereo display as a per window settings

Dalai Felinto noreply at git.blender.org
Tue Jul 29 04:51:43 CEST 2014


Commit: 5c1da8a78ab6e0d2e2fa13415a670f1047a2218c
Author: Dalai Felinto
Date:   Sun Jul 27 10:19:09 2014 -0300
Branches: multiview
https://developer.blender.org/rB5c1da8a78ab6e0d2e2fa13415a670f1047a2218c

multiview: allow stereo display as a per window settings

That now means the D operator (stereo_toggle) can also be used to change
the stereo display settings of the current 'window'.

The 'toggle' part is currently not entirely functional because among
other things I still need to integrate the fullscreen editor operator in
the branch, so it can be integrated in this operator too.

This is advanced, but only advanced users should be needing multiple
displays to work in 3d (and those users can add their own shortcuts for
that, if we document it all well).

Same goes for pie-menus, we have approximately ten 3d modes, the mode
switch could very well fit in a pie-menu.

If a new file is loaded with 'Load UI' it will re-set the 'stereo
display' settings to the user preference ones. Otherwise it will keep
the windows to be whatever they were. So although the
wmWindow.stereo_display is saved in the file, it's never used.

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/editors/screen/screen_ops.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesdna/DNA_windowmanager_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/rna_userdef.c
M	source/blender/makesrna/intern/rna_wm.c
M	source/blender/windowmanager/intern/wm_files.c
M	source/blender/windowmanager/intern/wm_operators.c
M	source/blender/windowmanager/intern/wm_stereo.c
M	source/blender/windowmanager/intern/wm_window.c
M	source/blender/windowmanager/wm_stereo.h

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 5d80081..a6fb28c 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -409,21 +409,22 @@ class USERPREF_PT_system(Panel):
         col.separator()
         col.separator()
 
+        s3d = system.stereo_display
         col.label(text="3D Stereo Display:")
-        col.prop(system, "stereo_display", text="")
+        col.prop(s3d, "display_mode", text="")
 
-        if system.stereo_display == 'ANAGLYPH':
-            col.prop(system, "stereo_anaglyph_type", text="Type")
+        if s3d.display_mode == 'ANAGLYPH':
+            col.prop(s3d, "anaglyph_type", text="Type")
 
-        if system.stereo_display == 'EPILEPSY':
-            col.prop(system, "stereo_epilepsy_interval")
+        elif s3d.display_mode == 'EPILEPSY':
+            col.prop(s3d, "epilepsy_interval")
 
-        if system.stereo_display == 'INTERLACE':
-            col.prop(system, "stereo_interlace_type", text="Type")
-            col.prop(system, "use_stereo_interlace_swap")
+        elif s3d.display_mode == 'INTERLACE':
+            col.prop(s3d, "interlace_type", text="Type")
+            col.prop(s3d, "use_interlace_swap")
 
-        if system.stereo_display == 'SIDEBYSIDE':
-            col.prop(system, "use_stereo_sidebyside_crosseyed")
+        elif s3d.display_mode == 'SIDEBYSIDE':
+            col.prop(s3d, "use_sidebyside_crosseyed")
 
         # 2. Column
         column = split.column()
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 7d22990..18bb081 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -929,6 +929,7 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 	rect.ymax = rect.ymin + BLI_rcti_size_y(&rect) / U.pixelsize;
 
 	newwin = WM_window_open(C, &rect);
+	newwin->stereo_display = win->stereo_display;
 	
 	/* allocs new screen and adds to newly created window, using window size */
 	newsc = ED_screen_add(newwin, CTX_data_scene(C), sc->id.name + 2);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index a6673e8..6bbdf58 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -415,6 +415,15 @@ typedef struct WalkNavigation {
 	short pad[3];
 } WalkNavigation;
 
+typedef struct StereoDisplay {
+	float epilepsy_interval; /* DEPRECATED - preferred interval in seconds for Dr. Epilepsy stereo method */
+	short flag;
+	char display_mode; /* stereo mode for the user display */
+	char anaglyph_type; /* anaglyph scheme for the user display */
+	char interlace_type;  /* interlace type for the user display */
+	char pad[7];
+} StereoDisplay;
+
 typedef struct UserDef {
 	/* UserDef has separate do-version handling, and can be read from other files */
 	int versionfile, subversionfile;
@@ -522,15 +531,7 @@ typedef struct UserDef {
 	float gpencil_new_layer_col[4]; /* default color for newly created Grease Pencil layers */
 
 	short tweak_threshold;
-
-	/* stereoscopy 3D display */
-	short stereo_flag;
-	float stereo_epilepsy_interval; /* preferred interval in seconds for Dr. Epilepsy stereo method */
-	char stereo_display; /* stereo method for the user display */
-	char stereo_anaglyph_type; /* anaglyph scheme for the user display */
-	char stereo_interlace_type;  /* interlace type for the user display */
-
-	char navigation_mode;
+	char navigation_mode, pad;
 
 	char author[80];	/* author name for file formats supporting it */
 
@@ -543,6 +544,7 @@ typedef struct UserDef {
 	float pixelsize;			/* private, set by GHOST, to multiply DPI with */
 
 	struct WalkNavigation walk_navigation;
+	struct StereoDisplay stereo_display;
 } UserDef;
 
 extern UserDef U; /* from blenkernel blender.c */
@@ -852,7 +854,7 @@ typedef enum eImageDrawMethod {
 	IMAGE_DRAW_METHOD_DRAWPIXELS = 3,
 } eImageDrawMethod;
 
-/* UserDef.stereo_display */
+/* StereoDisplay.display_mode */
 typedef enum eStereoDisplayMode {
 	S3D_DISPLAY_ANAGLYPH    = 0,
 	/* S3D_DISPLAY_BLURAY      = 1, */
@@ -863,20 +865,20 @@ typedef enum eStereoDisplayMode {
 	S3D_DISPLAY_TOPBOTTOM   = 6,
 } eStereoDisplayMode;
 
-/* UserDef.stereo_flag */
+/* StereoDisplay.flag */
 typedef enum eStereoFlag {
 	S3D_INTERLACE_SWAP        = (1 << 0),
 	S3D_SIDEBYSIDE_CROSSEYED  = (1 << 1),
 } eStereoFlag;
 
-/* UserDef.stereo_anaglyph_type */
+/* StereoDisplay.anaglyph_type */
 typedef enum eStereoAnaglyphType {
 	S3D_ANAGLYPH_REDCYAN = 0,
 	S3D_ANAGLYPH_GREENMAGENTA = 1,
 	S3D_ANAGLYPH_YELLOWBLUE = 2,
 } eAnaglyphType;
 
-/* UserDef.stereo_interlace_type */
+/* StereoDisplay.interlace_type */
 typedef enum eStereoInterlaceType {
 	S3D_INTERLACE_ROW = 0,
 	S3D_INTERLACE_COLUMN = 1,
diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h
index 8dbbe4b..9860654 100644
--- a/source/blender/makesdna/DNA_windowmanager_types.h
+++ b/source/blender/makesdna/DNA_windowmanager_types.h
@@ -33,6 +33,7 @@
 
 #include "DNA_listBase.h"
 #include "DNA_vec_types.h"
+#include "DNA_userdef_types.h"
 
 #include "DNA_ID.h"
 
@@ -59,6 +60,7 @@ struct PointerRNA;
 struct ReportList;
 struct Report;
 struct uiLayout;
+struct StereoDisplay;
 
 #define OP_MAX_TYPENAME 64
 #define KMAP_MAX_NAME   64
@@ -205,6 +207,8 @@ typedef struct wmWindow {
 
 	ListBase subwindows;          /* opengl stuff for sub windows, see notes in wm_subwindow.c */
 	ListBase gesture;             /* gesture stuff */
+
+	struct StereoDisplay stereo_display; /* properties for stereoscopic displays */
 } wmWindow;
 
 /* These two Lines with # tell makesdna this struct can be excluded. */
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 075a8bf..2a91e29 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -647,6 +647,7 @@ extern StructRNA RNA_UserPreferencesInput;
 extern StructRNA RNA_UserPreferencesSystem;
 extern StructRNA RNA_UserPreferencesView;
 extern StructRNA RNA_UserPreferencesWalkNavigation;
+extern StructRNA RNA_UserPreferencesStereoDisplay;
 extern StructRNA RNA_UserSolidLight;
 extern StructRNA RNA_VectorFont;
 extern StructRNA RNA_VertexGroup;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 3d4ed0d..f5e841c 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -146,6 +146,10 @@ extern EnumPropertyItem viewport_shade_items[];
 
 extern EnumPropertyItem navigation_mode_items[];
 
+extern EnumPropertyItem stereo_display_items[];
+extern EnumPropertyItem stereo_anaglyph_type_items[];
+extern EnumPropertyItem stereo_interlace_type_items[];
+
 int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo);
 int rna_node_tree_idname_to_enum(const char *idname);
 struct bNodeTreeType *rna_node_tree_type_from_enum(int value);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index e8fec97..df20446 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -78,6 +78,31 @@ EnumPropertyItem navigation_mode_items[] = {
 	{0, NULL, 0, NULL, NULL}
 };
 
+EnumPropertyItem stereo_display_items[] = {
+	{S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph", "Render two differently filtered colored images for each eye. Anaglyph glasses are required"},
+	/*		{S3D_DISPLAY_BLURAY, "BLURAY", 0, "Blu-ray", ""}, */
+	{S3D_DISPLAY_EPILEPSY, "EPILEPSY", 0, "Dr. Epilepsy", "Wiggle stereoscopy. Quickly alternate between images for left and right eye"},
+	{S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace", "Render two images for each eye into one interlaced image. 3D-ready monitor is requiered"},
+	{S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential", "Renders alternate eyes (also known as pageflip). It requires Quadbuffer support in the graphic card"},
+	{S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render images for left and right eye side-by-side"},
+	{S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render images for left and right eye one above another"},
+	{0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem stereo_anaglyph_type_items[] = {
+	{S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
+	{S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
+	{S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
+	{0, NULL, 0, NULL, NULL}
+};
+
+EnumPropertyItem stereo_interlace_type_items[] = {
+	{S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
+	{S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
+	{S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
+	{0, NULL, 0, NULL, NULL}
+};
+
 #ifdef RNA_RUNTIME
 
 #include "DNA_object_types.h"
@@ -3134,6 +3159,43 @@ static void rna_def_userdef_walk_navigation(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Reverse Mouse", "Reverse the mouse look");
 }
 
+static void rna_def_userdef_stereo_display(BlenderRNA *brna)
+{
+	StructRNA *srna;
+	PropertyRNA *prop;
+
+	srna = RNA_def_struct(brna, "StereoDisplay", NULL);
+	RNA_def_struct_sdna(srna, "StereoDisplay");
+	RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+	RNA_def_struct_ui_text(srna, "Stereo Display", "Settings for stereo display");
+
+	prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, stereo_display_items);
+	RNA_def_property_ui_text(prop, "Display Mode", "");
+
+	prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, stereo_anaglyph_type_items);
+	RNA_def_property_ui_text(prop, "Anaglyph Type", "");
+
+	prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
+	RNA_def_property_enum_items(prop, stereo_interlace_type_items);
+	RNA_def_property_ui_text(prop, "Interlace Type", "");
+
+	prop = RNA_def_property(srna, "epilepsy_interval", PROP_FLOAT, PROP_TIME);
+	RNA_def_property_

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list