Blender V5.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
8
9#include <cstdlib>
10#include <cstring>
11
12#include "RNA_define.hh"
13
14#include "rna_internal.hh" /* own include */
15
16#ifdef RNA_RUNTIME
17
18# include "DNA_scene_types.h"
19
20# include "BLI_math_vector_c.hh"
21
22# include "BKE_camera.h"
23# include "BKE_context.hh"
24# include "BKE_object.hh"
25
26namespace blender {
27
28static void rna_camera_view_frame(Camera *camera,
29 Scene *scene,
30 float r_vec1[3],
31 float r_vec2[3],
32 float r_vec3[3],
33 float r_vec4[3])
34{
35 float vec[4][3];
36
37 BKE_camera_view_frame(scene, camera, vec);
38
39 copy_v3_v3(r_vec1, vec[0]);
40 copy_v3_v3(r_vec2, vec[1]);
41 copy_v3_v3(r_vec3, vec[2]);
42 copy_v3_v3(r_vec4, vec[3]);
43}
44
45} // namespace blender
46
47#else
48
49namespace blender {
50
52{
53 FunctionRNA *func;
54 PropertyRNA *parm;
55
56 func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
58 func, "Return 4 points for the cameras frame (before object transformation)");
59
60 RNA_def_pointer(func,
61 "scene",
62 "Scene",
63 "",
64 "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
65
66 /* return location and normal */
68 func, "result_1", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
70 RNA_def_function_output(func, parm);
71
73 func, "result_2", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
75 RNA_def_function_output(func, parm);
76
78 func, "result_3", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
80 RNA_def_function_output(func, parm);
81
83 func, "result_4", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
85 RNA_def_function_output(func, parm);
86}
87
88} // namespace blender
89
90#endif
Camera data-block and utility functions.
General operations, lookup, etc. for blender objects.
#define FLT_MAX
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
BMesh Iterators.
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
void BKE_camera_view_frame(const struct Scene *scene, const struct Camera *camera, float r_vec[4][3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
void RNA_api_camera(StructRNA *srna)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
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_c_str, const char *call)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
@ PROP_THICK_WRAP
Definition RNA_types.hh:493