Blender V2.61 - r43446

rna_camera_api.c

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version. 
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): Campbell Barton
00019  *
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00028 #include <stdlib.h>
00029 #include <stdio.h>
00030 #include <string.h>
00031 
00032 
00033 #include "RNA_define.h"
00034 #include "BKE_utildefines.h"
00035 
00036 #ifdef RNA_RUNTIME
00037 
00038 #include "DNA_scene_types.h"
00039 
00040 #include "BKE_camera.h"
00041 #include "BKE_context.h"
00042 #include "BKE_object.h"
00043 
00044 void rna_camera_view_frame(struct Camera *camera, struct Scene *scene,
00045                            float vec1_r[3], float vec2_r[3], float vec3_r[3], float vec4_r[3])
00046 {
00047     float vec[4][3];
00048 
00049     camera_view_frame(scene, camera, vec);
00050 
00051     copy_v3_v3(vec1_r, vec[0]);
00052     copy_v3_v3(vec2_r, vec[1]);
00053     copy_v3_v3(vec3_r, vec[2]);
00054     copy_v3_v3(vec4_r, vec[3]);
00055 }
00056 
00057 #else
00058 
00059 void RNA_api_camera(StructRNA *srna)
00060 {
00061     FunctionRNA *func;
00062     PropertyRNA *parm;
00063 
00064     func= RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
00065     RNA_def_function_ui_description(func, "Return 4 points for the cameras frame (before object transformation)");
00066 
00067     RNA_def_pointer(func, "scene", "Scene", "", "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
00068 
00069     /* return location and normal */
00070     parm= RNA_def_float_vector(func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
00071     RNA_def_property_flag(parm, PROP_THICK_WRAP);
00072     RNA_def_function_output(func, parm);
00073 
00074     parm= RNA_def_float_vector(func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
00075     RNA_def_property_flag(parm, PROP_THICK_WRAP);
00076     RNA_def_function_output(func, parm);
00077 
00078     parm= RNA_def_float_vector(func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
00079     RNA_def_property_flag(parm, PROP_THICK_WRAP);
00080     RNA_def_function_output(func, parm);
00081 
00082     parm= RNA_def_float_vector(func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
00083     RNA_def_property_flag(parm, PROP_THICK_WRAP);
00084     RNA_def_function_output(func, parm);
00085 }
00086 
00087 #endif
00088