Revision: 26613
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26613
Author:   campbellbarton
Date:     2010-02-04 22:48:10 +0100 (Thu, 04 Feb 2010)

Log Message:
-----------
use the camera's lens angle as radians.

Modified Paths:
--------------
    trunk/blender/release/scripts/io/export_fbx.py
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/makesrna/intern/rna_camera.c

Modified: trunk/blender/release/scripts/io/export_fbx.py
===================================================================
--- trunk/blender/release/scripts/io/export_fbx.py      2010-02-04 21:00:16 UTC 
(rev 26612)
+++ trunk/blender/release/scripts/io/export_fbx.py      2010-02-04 21:48:10 UTC 
(rev 26613)
@@ -998,7 +998,7 @@
         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 @@
 
     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 @@
     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)

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c     2010-02-04 
21:00:16 UTC (rev 26612)
+++ trunk/blender/source/blender/blenkernel/intern/action.c     2010-02-04 
21:48:10 UTC (rev 26613)
@@ -1028,7 +1028,7 @@
        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;
        }
 

Modified: trunk/blender/source/blender/makesrna/intern/rna_camera.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_camera.c   2010-02-04 
21:00:16 UTC (rev 26612)
+++ trunk/blender/source/blender/makesrna/intern/rna_camera.c   2010-02-04 
21:48:10 UTC (rev 26613)
@@ -49,7 +49,19 @@
        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
 
 void RNA_def_camera(BlenderRNA *brna)
@@ -82,10 +94,12 @@
        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);


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to