Blender V5.3
node_composite_viewer.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BKE_context.hh"
6#include "BKE_image.hh"
7
9
11
13
15{
16 b.add_input<decl::Color>("Image"_ustr)
17 .default_value({0.0f, 0.0f, 0.0f, 1.0f})
18 .structure_type(StructureType::Dynamic)
20}
21
22static void node_init(bNodeTree * /*ntree*/, bNode *node)
23{
24 ImageUser *iuser = MEM_new<ImageUser>(__func__);
25 node->storage = iuser;
26 iuser->sfra = 1;
28}
29
30static void node_init_api(const bContext *C, PointerRNA * /*node_ptr*/)
31{
33}
34
35using namespace blender::compositor;
36
38 public:
40
41 void execute() override
42 {
43 this->context().write_viewer(this->get_input("Image"));
44 }
45};
46
48{
49 return new ViewerOperation(context, node);
50}
51
52static void node_register()
53{
54 static bke::bNodeType ntype;
55
56 cmp_node_type_base(&ntype, "CompositorNodeViewer"_ustr, CMP_NODE_VIEWER);
57 ntype.ui_name = "Viewer";
58 ntype.ui_description =
59 "Visualize data from inside a node graph, in the image editor or as a backdrop";
60 ntype.enum_name_legacy = "VIEWER";
62 ntype.declare = node_declare;
63 ntype.initfunc = node_init;
68
69 ntype.no_muting = true;
70
72}
74
75} // namespace blender::nodes::node_composite_viewer_cc
#define NODE_CLASS_OUTPUT
Definition BKE_node.hh:479
#define CMP_NODE_VIEWER
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define C
Definition RandGen.cpp:29
virtual void write_viewer(Result &viewer_result)=0
NodeOperation(Context &context, const bNode &node)
Context & context() const
Definition operation.cc:57
Result & get_input(StringRef identifier) const
Definition operation.cc:35
const CompositorInputRealizationMode & compositor_realization_mode() const
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:6166
static void node_init(bNodeTree *, bNode *node)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_init_api(const bContext *C, PointerRNA *)
static void node_declare(NodeDeclarationBuilder &b)
Main * CTX_data_main(const bContext *C)
@ NODE_VIEWER_SHORTCUT_NONE
Image * BKE_image_ensure_viewer(Main *bmain, int type, const char *name)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:57
void node_free_standard_storage(bNode *node)
Definition node_util.cc:45
void cmp_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
void(*) initfunc_api(const bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:333
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:379
void(*) initfunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:320
const char * enum_name_legacy
Definition BKE_node.hh:274
NodeDeclareFunction declare
Definition BKE_node.hh:393