[Bf-blender-cvs] [75348e6] master: View3D API: rename view3d_camera_get to ED_view3d_camera_data_get

Campbell Barton noreply at git.blender.org
Mon Dec 9 11:23:22 CET 2013


Commit: 75348e6c132bca89aa70c2eb7e093ec55c07ad73
Author: Campbell Barton
Date:   Mon Dec 9 17:03:37 2013 +1100
http://developer.blender.org/rB75348e6c132bca89aa70c2eb7e093ec55c07ad73

View3D API: rename view3d_camera_get to ED_view3d_camera_data_get

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

M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/space_view3d/view3d_draw.c
M	source/blender/editors/space_view3d/view3d_view.c
M	source/blender/editors/uvedit/uvedit_unwrap_ops.c

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

diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 0f31067..ae8aeab 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -85,6 +85,8 @@ typedef struct ViewDepths {
 float *ED_view3d_cursor3d_get(struct Scene *scene, struct View3D *v3d);
 void   ED_view3d_cursor3d_position(struct bContext *C, float fp[3], const int mval[2]);
 
+struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d);
+
 void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist);
 void ED_view3d_from_m4(float mat[4][4], float ofs[3], float quat[4], float *dist);
 
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 1932976..9dd6ab8 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2996,12 +2996,12 @@ static void view3d_main_area_draw_engine_info(View3D *v3d, RegionView3D *rv3d, A
 		/* draw darkened background color. no alpha because border render does
 		 * partial redraw and will not redraw the area behind this info bar */
 		float alpha = 1.0f - fill_color[3];
-	
-		if (rv3d->persp == RV3D_CAMOB && v3d->camera && v3d->camera->type == OB_CAMERA) {
-			Camera *ca = v3d->camera->data;
+		Camera *camera = ED_view3d_camera_data_get(v3d, rv3d);
 
-			if (ca && (ca->flag & CAM_SHOWPASSEPARTOUT))
-				alpha *= (1.0f - ca->passepartalpha);
+		if (camera) {
+			if (camera->flag & CAM_SHOWPASSEPARTOUT) {
+				alpha *= (1.0f - camera->passepartalpha);
+			}
 		}
 
 		UI_GetThemeColor3fv(TH_HIGH_GRAD, fill_color);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 12e39f6..475f466 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -110,6 +110,16 @@ float *ED_view3d_cursor3d_get(Scene *scene, View3D *v3d)
 	else return scene->cursor;
 }
 
+Camera *ED_view3d_camera_data_get(View3D *v3d, RegionView3D *rv3d)
+{
+	/* establish the camera object, so we can default to view mapping if anything is wrong with it */
+	if ((rv3d->persp == RV3D_CAMOB) && v3d->camera && (v3d->camera->type == OB_CAMERA)) {
+		return v3d->camera->data;
+	}
+	else {
+		return NULL;
+	}
+}
 
 /* ****************** smooth view operator ****************** */
 /* This operator is one of the 'timer refresh' ones like animation playback */
diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
index d6bd6f4..ebfef08 100644
--- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c
+++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c
@@ -1254,18 +1254,6 @@ void UV_OT_unwrap(wmOperatorType *ot)
 	RNA_def_float_factor(ot->srna, "margin", 0.001f, 0.0f, 1.0f, "Margin", "Space between islands", 0.0f, 1.0f);
 }
 
-/* NOTE: could be generic function */
-static Camera *view3d_camera_get(View3D *v3d, RegionView3D *rv3d)
-{
-	/* establish the camera object, so we can default to view mapping if anything is wrong with it */
-	if ((rv3d->persp == RV3D_CAMOB) && (v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
-		return v3d->camera->data;
-	}
-	else {
-		return NULL;
-	}
-}
-
 /**************** Project From View operator **************/
 static int uv_from_view_exec(bContext *C, wmOperator *op);
 
@@ -1273,7 +1261,7 @@ static int uv_from_view_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
 {
 	View3D *v3d = CTX_wm_view3d(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
-	Camera *camera = view3d_camera_get(v3d, rv3d);
+	Camera *camera = ED_view3d_camera_data_get(v3d, rv3d);
 	PropertyRNA *prop;
 
 	prop = RNA_struct_find_property(op->ptr, "camera_bounds");
@@ -1292,7 +1280,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 	ARegion *ar = CTX_wm_region(C);
 	View3D *v3d = CTX_wm_view3d(C);
 	RegionView3D *rv3d = CTX_wm_region_view3d(C);
-	Camera *camera = view3d_camera_get(v3d, rv3d);
+	Camera *camera = ED_view3d_camera_data_get(v3d, rv3d);
 	BMFace *efa;
 	BMLoop *l;
 	BMIter iter, liter;
@@ -1326,9 +1314,6 @@ static int uv_from_view_exec(bContext *C, wmOperator *op)
 		struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat,
 		                                                       camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f,
 		                                                       camera_bounds ? (scene->r.ysch * scene->r.yasp) : 1.0f);
-		
-
-		// BLI_uvproject_camera_info_scale
 
 		if (uci) {
 			BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {




More information about the Bf-blender-cvs mailing list