[Bf-blender-cvs] [9f54a73] master: WM: add a notifier for camera/viewport options

Campbell Barton noreply at git.blender.org
Mon Jan 19 06:50:27 CET 2015


Commit: 9f54a73b3283177d478110977c907955ef86e77a
Author: Campbell Barton
Date:   Mon Jan 19 15:40:05 2015 +1100
Branches: master
https://developer.blender.org/rB9f54a73b3283177d478110977c907955ef86e77a

WM: add a notifier for camera/viewport options

Added so viewport options only used in a camera view wont cause all 3d-views to redraw.

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

M	source/blender/editors/space_view3d/space_view3d.c
M	source/blender/makesrna/intern/rna_camera.c
M	source/blender/windowmanager/WM_types.h

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

diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 55d5273..d0ba3a9 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -856,6 +856,20 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN
 					break;
 			}
 			break;
+		case NC_CAMERA:
+			switch (wmn->data) {
+				case ND_DRAW_RENDER_VIEWPORT:
+				{
+					if (v3d->camera && (v3d->camera->data == wmn->reference)) {
+						RegionView3D *rv3d = ar->regiondata;
+						if (rv3d->persp == RV3D_CAMOB) {
+							ED_region_tag_redraw(ar);
+						}
+					}
+					break;
+				}
+			}
+			break;
 		case NC_GROUP:
 			/* all group ops for now */
 			ED_region_tag_redraw(ar);
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index be973ab..9f119b3 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -137,7 +137,7 @@ void RNA_def_camera(BlenderRNA *brna)
 	RNA_def_property_enum_items(prop, prop_draw_type_extra_items);
 	RNA_def_property_flag(prop, PROP_ENUM_FLAG);
 	RNA_def_property_ui_text(prop, "Composition Guides",  "Draw overlay");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
@@ -150,7 +150,7 @@ void RNA_def_camera(BlenderRNA *brna)
 	prop = RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
 	RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
 	RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
 	RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
@@ -256,22 +256,22 @@ void RNA_def_camera(BlenderRNA *brna)
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
 	RNA_def_property_ui_text(prop, "Show Passepartout",
 	                         "Show a darkened overlay outside the image area in Camera view");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "show_title_safe", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWTITLESAFE);
 	RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe zones in Camera view");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
 	RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR);
 	RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view");
-	RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+	RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
 
 	prop = RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
 	RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index e64b115..fc1bc48 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -239,6 +239,7 @@ typedef struct wmNotifier {
 #define NC_MASK				(21<<24)
 #define NC_GPENCIL			(22<<24)
 #define NC_LINESTYLE			(23<<24)
+#define NC_CAMERA			(24<<24)
 
 /* data type, 256 entries is enough, it can overlap */
 #define NOTE_DATA			0x00FF0000
@@ -297,6 +298,7 @@ typedef struct wmNotifier {
 #define ND_POINTCACHE		(28<<16)
 #define ND_PARENT			(29<<16)
 #define ND_LOD				(30<<16)
+#define ND_DRAW_RENDER_VIEWPORT	(31<<16)  /* for camera & sequencer viewport update, also /w NC_SCENE */
 
 	/* NC_MATERIAL Material */
 #define	ND_SHADING			(30<<16)




More information about the Bf-blender-cvs mailing list