View3D API: rename view3d_camera_get to ED_view3d_camera_data_get

This commit is contained in:
Campbell Barton
2013-12-09 17:03:37 +11:00
parent 793b73edc2
commit 75348e6c13
4 changed files with 19 additions and 22 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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 */

View File

@@ -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) {