Blender V4.3
rna_camera_api.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cstdio>
10#include <cstdlib>
11#include <cstring>
12
13#include "RNA_define.hh"
14
15#include "rna_internal.hh" /* own include */
16
17#ifdef RNA_RUNTIME
18
19# include "DNA_scene_types.h"
20
21# include "BLI_math_vector.h"
22
23# include "BKE_camera.h"
24# include "BKE_context.hh"
25# include "BKE_object.hh"
26
27static void rna_camera_view_frame(Camera *camera,
28 Scene *scene,
29 float r_vec1[3],
30 float r_vec2[3],
31 float r_vec3[3],
32 float r_vec4[3])
33{
34 float vec[4][3];
35
36 BKE_camera_view_frame(scene, camera, vec);
37
38 copy_v3_v3(r_vec1, vec[0]);
39 copy_v3_v3(r_vec2, vec[1]);
40 copy_v3_v3(r_vec3, vec[2]);
41 copy_v3_v3(r_vec4, vec[3]);
42}
43
44#else
45
47{
48 FunctionRNA *func;
49 PropertyRNA *parm;
50
51 func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
53 func, "Return 4 points for the cameras frame (before object transformation)");
54
55 RNA_def_pointer(func,
56 "scene",
57 "Scene",
58 "",
59 "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
60
61 /* return location and normal */
63 func, "result_1", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
65 RNA_def_function_output(func, parm);
66
68 func, "result_2", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
70 RNA_def_function_output(func, parm);
71
73 func, "result_3", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
75 RNA_def_function_output(func, parm);
76
78 func, "result_4", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
80 RNA_def_function_output(func, parm);
81}
82
83#endif
Camera data-block and utility functions.
void BKE_camera_view_frame(const struct Scene *scene, const struct Camera *camera, float r_vec[4][3])
General operations, lookup, etc. for blender objects.
MINLINE void copy_v3_v3(float r[3], const float a[3])
@ PROP_THICK_WRAP
Definition RNA_types.hh:312
void RNA_api_camera(StructRNA *srna)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
#define FLT_MAX
Definition stdcycles.h:14