forked from bartvdbraak/blender
fix [#26906] Panorama Button (Camera Data Properties)
- render check for ortho/panorama combination wasn't working since the flags were not initialized at the time of checking. - disable panorama button in ortho mode.
This commit is contained in:
parent
1fc9fabfbf
commit
7f598451fc
@ -78,7 +78,14 @@ class DATA_PT_camera(CameraButtonsPanel, bpy.types.Panel):
|
||||
elif cam.type == 'ORTHO':
|
||||
col.prop(cam, "ortho_scale")
|
||||
|
||||
layout.prop(cam, "use_panorama")
|
||||
col = layout.column()
|
||||
if cam.type == 'ORTHO':
|
||||
if cam.use_panorama:
|
||||
col.alert = True
|
||||
else:
|
||||
col.enabled = False
|
||||
|
||||
col.prop(cam, "use_panorama")
|
||||
|
||||
split = layout.split()
|
||||
|
||||
|
@ -138,6 +138,7 @@ struct KeyBlock *object_insert_shape_key(struct Scene *scene, struct Object *ob,
|
||||
|
||||
int object_is_modified(struct Scene *scene, struct Object *ob);
|
||||
|
||||
void object_camera_mode(struct RenderData *rd, struct Object *camera);
|
||||
void object_camera_matrix(
|
||||
struct RenderData *rd, struct Object *camera, int winx, int winy, short field_second,
|
||||
float winmat[][4], struct rctf *viewplane, float *clipsta, float *clipend, float *lens, float *ycor,
|
||||
|
@ -2818,6 +2818,16 @@ int object_insert_ptcache(Object *ob)
|
||||
return i;
|
||||
}
|
||||
|
||||
void object_camera_mode(RenderData *rd, Object *camera)
|
||||
{
|
||||
rd->mode &= ~(R_ORTHO|R_PANORAMA);
|
||||
if(camera && camera->type==OB_CAMERA) {
|
||||
Camera *cam= camera->data;
|
||||
if(cam->type == CAM_ORTHO) rd->mode |= R_ORTHO;
|
||||
if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
|
||||
}
|
||||
}
|
||||
|
||||
/* 'lens' may be set for envmap only */
|
||||
void object_camera_matrix(
|
||||
RenderData *rd, Object *camera, int winx, int winy, short field_second,
|
||||
@ -2827,8 +2837,7 @@ void object_camera_matrix(
|
||||
Camera *cam=NULL;
|
||||
float pixsize;
|
||||
float shiftx=0.0, shifty=0.0, winside, viewfac;
|
||||
|
||||
rd->mode &= ~(R_ORTHO|R_PANORAMA);
|
||||
short is_ortho= FALSE;
|
||||
|
||||
/* question mark */
|
||||
(*ycor)= rd->yasp / rd->xasp;
|
||||
@ -2838,8 +2847,9 @@ void object_camera_matrix(
|
||||
if(camera->type==OB_CAMERA) {
|
||||
cam= camera->data;
|
||||
|
||||
if(cam->type==CAM_ORTHO) rd->mode |= R_ORTHO;
|
||||
if(cam->flag & CAM_PANORAMA) rd->mode |= R_PANORAMA;
|
||||
if(cam->type == CAM_ORTHO) {
|
||||
is_ortho= TRUE;
|
||||
}
|
||||
|
||||
/* solve this too... all time depending stuff is in convertblender.c?
|
||||
* Need to update the camera early because it's used for projection matrices
|
||||
@ -2879,7 +2889,7 @@ void object_camera_matrix(
|
||||
}
|
||||
|
||||
/* ortho only with camera available */
|
||||
if(cam && rd->mode & R_ORTHO) {
|
||||
if(cam && is_ortho) {
|
||||
if(rd->xasp*winx >= rd->yasp*winy) {
|
||||
viewfac= winx;
|
||||
}
|
||||
@ -2922,7 +2932,7 @@ void object_camera_matrix(
|
||||
(*viewdx)= pixsize;
|
||||
(*viewdy)= (*ycor) * pixsize;
|
||||
|
||||
if(rd->mode & R_ORTHO)
|
||||
if(is_ortho)
|
||||
orthographic_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
|
||||
else
|
||||
perspective_m4(winmat, viewplane->xmin, viewplane->xmax, viewplane->ymin, viewplane->ymax, *clipsta, *clipend);
|
||||
|
@ -2992,6 +2992,7 @@ static void project_paint_begin(ProjPaintState *ps)
|
||||
invert_m4_m4(viewmat, viewinv);
|
||||
|
||||
/* camera winmat */
|
||||
object_camera_mode(&ps->scene->r, camera);
|
||||
object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0,
|
||||
winmat, &_viewplane, &ps->clipsta, &ps->clipend,
|
||||
&_lens, &_ycor, &_viewdx, &_viewdy);
|
||||
|
@ -451,6 +451,8 @@ void make_sample_tables(Render *re)
|
||||
/* per render, there's one persistant viewplane. Parts will set their own viewplanes */
|
||||
void RE_SetCamera(Render *re, Object *camera)
|
||||
{
|
||||
object_camera_mode(&re->r, camera);
|
||||
|
||||
object_camera_matrix(&re->r, camera, re->winx, re->winy, re->flag & R_SEC_FIELD,
|
||||
re->winmat, &re->viewplane, &re->clipsta, &re->clipend,
|
||||
&re->lens, &re->ycor, &re->viewdx, &re->viewdy);
|
||||
|
@ -2705,14 +2705,6 @@ int RE_is_rendering_allowed(Scene *scene, void *erh, void (*error)(void *handle,
|
||||
{
|
||||
SceneRenderLayer *srl;
|
||||
|
||||
/* forbidden combinations */
|
||||
if(scene->r.mode & R_PANORAMA) {
|
||||
if(scene->r.mode & R_ORTHO) {
|
||||
error(erh, "No Ortho render possible for Panorama");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(scene->r.mode & R_BORDER) {
|
||||
if(scene->r.border.xmax <= scene->r.border.xmin ||
|
||||
scene->r.border.ymax <= scene->r.border.ymin) {
|
||||
@ -2775,6 +2767,17 @@ int RE_is_rendering_allowed(Scene *scene, void *erh, void (*error)(void *handle,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* get panorama & ortho, only after camera is set */
|
||||
object_camera_mode(&scene->r, scene->camera);
|
||||
|
||||
/* forbidden combinations */
|
||||
if(scene->r.mode & R_PANORAMA) {
|
||||
if(scene->r.mode & R_ORTHO) {
|
||||
error(erh, "No Ortho render possible for Panorama");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* layer flag tests */
|
||||
if(scene->r.scemode & R_SINGLE_LAYER) {
|
||||
srl= BLI_findlink(&scene->r.layers, scene->r.actlay);
|
||||
|
@ -273,7 +273,7 @@ add_test(export_fbx_cube ${TEST_BLENDER_EXE}
|
||||
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
|
||||
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_cube.fbx',use_selection=False,use_metadata=False\)
|
||||
--md5_source=${TEST_OUT_DIR}/export_fbx_cube.fbx
|
||||
--md5=f06510778487dc5ff24ee6460b8682f4 --md5_method=FILE
|
||||
--md5=b2428e11b9ae650819f8d8b38cd869f7 --md5_method=FILE
|
||||
)
|
||||
|
||||
add_test(export_fbx_nurbs ${TEST_BLENDER_EXE}
|
||||
@ -281,7 +281,7 @@ add_test(export_fbx_nurbs ${TEST_BLENDER_EXE}
|
||||
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
|
||||
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_nurbs.fbx',use_selection=False,use_metadata=False\)
|
||||
--md5_source=${TEST_OUT_DIR}/export_fbx_nurbs.fbx
|
||||
--md5=6d03eea19394db240d92ec35c8eb8cc5 --md5_method=FILE
|
||||
--md5=741b536e98d6b105952766d0f290f270 --md5_method=FILE
|
||||
)
|
||||
|
||||
add_test(export_fbx_all_objects ${TEST_BLENDER_EXE}
|
||||
@ -289,5 +289,5 @@ add_test(export_fbx_all_objects ${TEST_BLENDER_EXE}
|
||||
--python ${CMAKE_CURRENT_LIST_DIR}/bl_test.py --
|
||||
--run={'FINISHED'}&bpy.ops.export_scene.fbx\(filepath='${TEST_OUT_DIR}/export_fbx_all_objects.fbx',use_selection=False,use_metadata=False\)
|
||||
--md5_source=${TEST_OUT_DIR}/export_fbx_all_objects.fbx
|
||||
--md5=8fe9140054eb90b1190809ea8f1c2358 --md5_method=FILE
|
||||
--md5=d6b8b027cd2a0e99d88e5c3d77932748 --md5_method=FILE
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user