Blender V5.0
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{
13 b.add_output<decl::Object>("Active Camera")
14 .description("The camera used for rendering the scene");
15}
16
18{
19 const Scene *scene = DEG_get_evaluated_scene(params.depsgraph());
20 Object *camera = DEG_get_evaluated(params.depsgraph(), scene->camera);
21 params.set_output("Active Camera", camera);
22}
23
24static void node_register()
25{
26 static blender::bke::bNodeType ntype;
27 geo_node_type_base(&ntype, "GeometryNodeInputActiveCamera", GEO_NODE_INPUT_ACTIVE_CAMERA);
28 ntype.ui_name = "Active Camera";
29 ntype.ui_description = "Retrieve the scene's active camera";
30 ntype.enum_name_legacy = "INPUT_ACTIVE_CAMERA";
33 ntype.declare = node_declare;
35}
37
38} // namespace blender::nodes::node_geo_input_active_camera_cc
#define NODE_CLASS_INPUT
Definition BKE_node.hh:447
#define GEO_NODE_INPUT_ACTIVE_CAMERA
Scene * DEG_get_evaluated_scene(const Depsgraph *graph)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void geo_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
struct Object * camera
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:354
const char * enum_name_legacy
Definition BKE_node.hh:247
NodeDeclareFunction declare
Definition BKE_node.hh:362