From 9c5a752c49813ad17ae8123474bf76633ea9054b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Feb 2010 21:48:10 +0000 Subject: [PATCH] use the camera's lens angle as radians. --- release/scripts/io/export_fbx.py | 14 +++++++------- source/blender/blenkernel/intern/action.c | 2 +- source/blender/makesrna/intern/rna_camera.c | 20 +++++++++++++++++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index 97015833331..40548a2703c 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -998,7 +998,7 @@ def write(filename, batch_objects = None, \ loc, rot, scale, matrix, matrix_rot = write_object_props(my_cam.blenObject, None, my_cam.parRelMatrix()) file.write('\n\t\t\tProperty: "Roll", "Roll", "A+",0') - file.write('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % data.angle) + file.write('\n\t\t\tProperty: "FieldOfView", "FieldOfView", "A+",%.6f' % math.degrees(data.angle)) file.write('\n\t\t\tProperty: "FieldOfViewX", "FieldOfView", "A+",1') file.write('\n\t\t\tProperty: "FieldOfViewY", "FieldOfView", "A+",1') file.write('\n\t\t\tProperty: "FocalLength", "Real", "A+",14.0323972702026') @@ -3198,9 +3198,9 @@ def fbx_ui(): Draw.BeginAlign() GLOBALS['_SCALE'] = Draw.Number('Scale:', EVENT_NONE, x+20, y+120, 140, 20, GLOBALS['_SCALE'].val, 0.01, 1000.0, 'Scale all data, (Note! some imports dont support scaled armatures)') - GLOBALS['_XROT90'] = Draw.Toggle('Rot X90', EVENT_NONE, x+160, y+120, 60, 20, GLOBALS['_XROT90'].val, 'Rotate all objects 90 degrese about the X axis') - GLOBALS['_YROT90'] = Draw.Toggle('Rot Y90', EVENT_NONE, x+220, y+120, 60, 20, GLOBALS['_YROT90'].val, 'Rotate all objects 90 degrese about the Y axis') - GLOBALS['_ZROT90'] = Draw.Toggle('Rot Z90', EVENT_NONE, x+280, y+120, 60, 20, GLOBALS['_ZROT90'].val, 'Rotate all objects 90 degrese about the Z axis') + GLOBALS['_XROT90'] = Draw.Toggle('Rot X90', EVENT_NONE, x+160, y+120, 60, 20, GLOBALS['_XROT90'].val, 'Rotate all objects 90 degrees about the X axis') + GLOBALS['_YROT90'] = Draw.Toggle('Rot Y90', EVENT_NONE, x+220, y+120, 60, 20, GLOBALS['_YROT90'].val, 'Rotate all objects 90 degrees about the Y axis') + GLOBALS['_ZROT90'] = Draw.Toggle('Rot Z90', EVENT_NONE, x+280, y+120, 60, 20, GLOBALS['_ZROT90'].val, 'Rotate all objects 90 degrees about the Z axis') Draw.EndAlign() y -= 35 @@ -3368,9 +3368,9 @@ class ExportFBX(bpy.types.Operator): EXP_OBS_SELECTED = BoolProperty(name="Selected Objects", description="Export selected objects on visible layers", default=True) # EXP_OBS_SCENE = BoolProperty(name="Scene Objects", description="Export all objects in this scene", default=True) TX_SCALE = FloatProperty(name="Scale", description="Scale all data, (Note! some imports dont support scaled armatures)", min=0.01, max=1000.0, soft_min=0.01, soft_max=1000.0, default=1.0) - TX_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrese about the X axis", default=True) - TX_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrese about the Y axis", default=False) - TX_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrese about the Z axis", default=False) + TX_XROT90 = BoolProperty(name="Rot X90", description="Rotate all objects 90 degrees about the X axis", default=True) + TX_YROT90 = BoolProperty(name="Rot Y90", description="Rotate all objects 90 degrees about the Y axis", default=False) + TX_ZROT90 = BoolProperty(name="Rot Z90", description="Rotate all objects 90 degrees about the Z axis", default=False) EXP_EMPTY = BoolProperty(name="Empties", description="Export empty objects", default=True) EXP_CAMERA = BoolProperty(name="Cameras", description="Export camera objects", default=True) EXP_LAMP = BoolProperty(name="Lamps", description="Export lamp objects", default=True) diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index a95cc7d1816..e2d1b1dd694 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -1028,7 +1028,7 @@ void copy_pose_result(bPose *to, bPose *from) bPoseChannel *pchanto, *pchanfrom; if(to==NULL || from==NULL) { - printf("pose result copy error\n"); // debug temp + printf("pose result copy error to:%p from:%p\n", to, from); // debug temp return; } diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 12dc790a1e8..3cf86f02d69 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -49,6 +49,18 @@ static void rna_Camera_lens_update(Main *bmain, Scene *scene, PointerRNA *ptr) cam->angle= 360.0f * atan(16.0f/cam->lens) / M_PI; } +/* only for rad/deg conversion! can remove later */ +static float rna_Camera_angle_get(PointerRNA *ptr) +{ + Camera *cam= ptr->id.data; + return cam->angle * (M_PI / 180.0); +} + +static void rna_Camera_angle_set(PointerRNA *ptr, float value) +{ + Camera *cam= ptr->id.data; + cam->angle= value * (180.0 / M_PI); +} #else @@ -82,10 +94,12 @@ void RNA_def_camera(BlenderRNA *brna) 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); - prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "angle"); - RNA_def_property_range(prop, 0.0f, 172.85f); + prop= RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE); + //RNA_def_property_float_sdna(prop, NULL, "angle"); + //RNA_def_property_range(prop, 0.0f, 172.85f); + RNA_def_property_range(prop, 0.0f, M_PI * (172.85/180.0)); RNA_def_property_ui_text(prop, "Angle", "Perspective Camera lend field of view in degrees."); + RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL); /* only for deg/rad conversion */ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Camera_angle_update"); prop= RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_NONE);