Blender V5.0
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.h"
21
22# include "BKE_camera.h"
23# include "BKE_context.hh"
24# include "BKE_object.hh"
25
26static void rna_camera_view_frame(Camera *camera,
27 Scene *scene,
28 float r_vec1[3],
29 float r_vec2[3],
30 float r_vec3[3],
31 float r_vec4[3])
32{
33 float vec[4][3];
34
35 BKE_camera_view_frame(scene, camera, vec);
36
37 copy_v3_v3(r_vec1, vec[0]);
38 copy_v3_v3(r_vec2, vec[1]);
39 copy_v3_v3(r_vec3, vec[2]);
40 copy_v3_v3(r_vec4, vec[3]);
41}
42
43#else
44
46{
47 FunctionRNA *func;
48 PropertyRNA *parm;
49
50 func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
52 func, "Return 4 points for the cameras frame (before object transformation)");
53
54 RNA_def_pointer(func,
55 "scene",
56 "Scene",
57 "",
58 "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
59
60 /* return location and normal */
62 func, "result_1", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
64 RNA_def_function_output(func, parm);
65
67 func, "result_2", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
69 RNA_def_function_output(func, parm);
70
72 func, "result_3", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
74 RNA_def_function_output(func, parm);
75
77 func, "result_4", 3, nullptr, -FLT_MAX, FLT_MAX, "Result", nullptr, -1e4, 1e4);
79 RNA_def_function_output(func, parm);
80}
81
82#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:423
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