Blender  V3.3
node_geo_input_scene_time.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
3 #include "BKE_scene.h"
4 
5 #include "DEG_depsgraph_query.h"
6 
7 #include "node_geometry_util.hh"
8 
10 
12 {
13  b.add_output<decl::Float>(N_("Seconds"));
14  b.add_output<decl::Float>(N_("Frame"));
15 }
16 
18 {
19  const Scene *scene = DEG_get_input_scene(params.depsgraph());
20  const float scene_ctime = BKE_scene_ctime_get(scene);
21  const double frame_rate = (((double)scene->r.frs_sec) / (double)scene->r.frs_sec_base);
22  params.set_output("Seconds", float(scene_ctime / frame_rate));
23  params.set_output("Frame", scene_ctime);
24 }
25 
26 } // namespace blender::nodes::node_geo_input_scene_time_cc
27 
29 {
30  static bNodeType ntype;
35  nodeRegisterType(&ntype);
36 }
#define GEO_NODE_INPUT_SCENE_TIME
Definition: BKE_node.h:1486
#define NODE_CLASS_INPUT
Definition: BKE_node.h:345
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
float BKE_scene_ctime_get(const struct Scene *scene)
typedef double(DMatrix)[4][4]
struct Scene * DEG_get_input_scene(const Depsgraph *graph)
Scene scene
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
static void node_declare(NodeDeclarationBuilder &b)
static void node_exec(GeoNodeExecParams params)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_geo_input_scene_time()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
float frs_sec_base
struct RenderData r
Defines a node type.
Definition: BKE_node.h:226
NodeGeometryExecFunction geometry_node_execute
Definition: BKE_node.h:316
NodeDeclareFunction declare
Definition: BKE_node.h:324
#define N_(msgid)