Blender  V3.3
COM_OutputFileOperation.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
4 #pragma once
5 
7 
8 #include "BLI_path_util.h"
9 #include "BLI_rect.h"
10 
11 #include "DNA_color_types.h"
12 
13 #include "IMB_openexr.h"
14 
15 namespace blender::compositor {
16 
17 /* Writes the image to a single-layer file. */
19  protected:
20  const RenderData *rd_;
21  const bNodeTree *tree_;
22 
24  char path_[FILE_MAX];
25 
29 
30  const char *view_name_;
32 
33  public:
35  const RenderData *rd,
36  const bNodeTree *tree,
37  DataType datatype,
38  const ImageFormatData *format,
39  const char *path,
40  const char *view_name,
41  bool save_as_render);
43 
44  void execute_region(rcti *rect, unsigned int tile_number) override;
45  bool is_output_operation(bool /*rendering*/) const override
46  {
47  return true;
48  }
49  void init_execution() override;
50  void deinit_execution() override;
52  {
54  }
55 
57  const rcti &area,
58  Span<MemoryBuffer *> inputs) override;
59 };
60 
61 /* extra info for OpenEXR layers */
64 
65  char name[EXR_TOT_MAXNAME - 2];
67  bool use_layer;
68 
69  /* internals */
70  float *output_buffer;
72 };
73 
74 /* Writes inputs into OpenEXR multilayer channels. */
76  protected:
77  const Scene *scene_;
78  const RenderData *rd_;
79  const bNodeTree *tree_;
80 
81  char path_[FILE_MAX];
82  char exr_codec_;
85  const char *view_name_;
86 
88 
89  public:
91  const RenderData *rd,
92  const bNodeTree *tree,
93  const char *path,
94  char exr_codec,
95  bool exr_half_float,
96  const char *view_name);
97 
98  void add_layer(const char *name, DataType datatype, bool use_layer);
99 
100  void execute_region(rcti *rect, unsigned int tile_number) override;
101  bool is_output_operation(bool /*rendering*/) const override
102  {
103  return true;
104  }
105  void init_execution() override;
106  void deinit_execution() override;
108  {
110  }
111 
113  const rcti &area,
114  Span<MemoryBuffer *> inputs) override;
115 };
116 
117 void add_exr_channels(void *exrhandle,
118  const char *layer_name,
119  const DataType datatype,
120  const char *view_name,
121  size_t width,
122  bool use_half_float,
123  float *buf);
124 void free_exr_channels(void *exrhandle,
125  const RenderData *rd,
126  const char *layer_name,
127  const DataType datatype);
128 int get_datatype_size(DataType datatype);
129 
130 } // namespace blender::compositor
#define FILE_MAX
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
#define EXR_TOT_MAXNAME
Definition: IMB_openexr.h:17
a MemoryBuffer contains access to the data of a chunk
NodeOperation contains calculation logic.
eCompositorPriority get_render_priority() const override
get the render priority of this node.
OutputOpenExrMultiLayerOperation(const Scene *scene, const RenderData *rd, const bNodeTree *tree, const char *path, char exr_codec, bool exr_half_float, const char *view_name)
void add_layer(const char *name, DataType datatype, bool use_layer)
void execute_region(rcti *rect, unsigned int tile_number) override
when a chunk is executed by a CPUDevice, this method is called
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
bool is_output_operation(bool) const override
is_output_operation determines whether this operation is an output of the ExecutionSystem during rend...
eCompositorPriority get_render_priority() const override
get the render priority of this node.
OutputSingleLayerOperation(const Scene *scene, const RenderData *rd, const bNodeTree *tree, DataType datatype, const ImageFormatData *format, const char *path, const char *view_name, bool save_as_render)
void execute_region(rcti *rect, unsigned int tile_number) override
when a chunk is executed by a CPUDevice, this method is called
bool is_output_operation(bool) const override
is_output_operation determines whether this operation is an output of the ExecutionSystem during rend...
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
Scene scene
void * tree
eCompositorPriority
Possible priority settings.
Definition: COM_Enums.h:32
DataType
possible data types for sockets
Definition: COM_defines.h:30
ccl_global KernelShaderEvalInput ccl_global float * output
format
Definition: logImageCore.h:38
static void area(int d1, int d2, int e1, int e2, float weights[2])
void add_exr_channels(void *exrhandle, const char *layer_name, const DataType datatype, const char *view_name, const size_t width, bool use_half_float, float *buf)
int get_datatype_size(DataType datatype)
void free_exr_channels(void *exrhandle, const RenderData *rd, const char *layer_name, const DataType datatype)
static bNodeSocketTemplate inputs[]
OutputOpenExrLayer(const char *name, DataType datatype, bool use_layer)