Blender V5.3
node_geo_input_active_camera.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
6
8
10
12
14{
15 b.add_output<decl::Object>("Active Camera"_ustr)
16 .description("The camera used for rendering the scene");
17}
18
19static void node_exec(GeoNodeExecParams params)
20{
21 const Scene *scene = DEG_get_evaluated_scene(params.depsgraph());
22 Object *camera = DEG_get_evaluated(params.depsgraph(), scene->camera);
23 params.set_output("Active Camera"_ustr, camera);
24}
25
26using namespace blender::compositor;
27
29 public:
31
32 void execute() override
33 {
34 Result &output = this->get_result("Active Camera");
35 output.allocate_single_value();
36 output.set_single_value(this->context().get_scene().camera);
37 }
38};
39
41{
42 return new ActiveCameraOperation(context, node);
43}
44
45static void node_register()
46{
47 static bke::bNodeType ntype;
49 &ntype, "GeometryNodeInputActiveCamera"_ustr, GEO_NODE_INPUT_ACTIVE_CAMERA);
50 ntype.ui_name = "Active Camera";
51 ntype.ui_description = "Retrieve the scene's active camera";
52 ntype.enum_name_legacy = "INPUT_ACTIVE_CAMERA";
55 ntype.declare = node_declare;
58}
60
61} // namespace blender::nodes::node_geo_input_active_camera_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:478
#define GEO_NODE_INPUT_ACTIVE_CAMERA
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define output
NodeOperation(Context &context, const bNode &node)
Result & get_result(StringRef identifier)
Definition operation.cc:40
Context & context() const
Definition operation.cc:57
const Depsgraph * depsgraph() const
void set_output(const UString identifier, T &&value)
void camera(KernelGlobals &kg, const ShadingData &sd, float3 &outview, float &outdepth, float &outdist)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
void geo_cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
struct Object * camera
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:379
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:385
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393