Blender  V3.3
COM_CompositorContext.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 
6 #include "COM_Enums.h"
7 
8 #include "DNA_color_types.h"
9 #include "DNA_node_types.h"
10 #include "DNA_scene_types.h"
11 
12 struct bNodeInstanceHash;
13 
14 namespace blender::compositor {
15 
20  private:
26  bool rendering_;
27 
33  eCompositorQuality quality_;
34 
35  Scene *scene_;
36 
42  RenderData *rd_;
43 
49  bNodeTree *bnodetree_;
50 
55  bNodeInstanceHash *previews_;
56 
60  bool hasActiveOpenCLDevices_;
61 
65  bool fast_calculation_;
66 
70  const char *view_name_;
71 
72  public:
77 
81  void set_rendering(bool rendering)
82  {
83  rendering_ = rendering;
84  }
85 
89  bool is_rendering() const
90  {
91  return rendering_;
92  }
93 
98  {
99  rd_ = rd;
100  }
101 
105  void set_bnodetree(bNodeTree *bnodetree)
106  {
107  bnodetree_ = bnodetree;
108  }
109 
113  const bNodeTree *get_bnodetree() const
114  {
115  return bnodetree_;
116  }
117 
122  {
123  return rd_;
124  }
125 
127  {
128  scene_ = scene;
129  }
130  Scene *get_scene() const
131  {
132  return scene_;
133  }
134 
139  {
140  previews_ = previews;
141  }
142 
147  {
148  return previews_;
149  }
150 
155  {
156  quality_ = quality;
157  }
158 
163  {
164  return quality_;
165  }
166 
170  int get_framenumber() const;
171 
176  {
177  return hasActiveOpenCLDevices_;
178  }
179 
183  void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
184  {
185  hasActiveOpenCLDevices_ = hasAvtiveOpenCLDevices;
186  }
187 
189  bool has_explicit_view() const
190  {
191  return view_name_ && view_name_[0] != '\0';
192  }
193 
197  const char *get_view_name() const
198  {
199  return view_name_;
200  }
201 
205  void set_view_name(const char *view_name)
206  {
207  view_name_ = view_name;
208  }
209 
210  int get_chunksize() const
211  {
212  return this->get_bnodetree()->chunksize;
213  }
214 
215  void set_fast_calculation(bool fast_calculation)
216  {
217  fast_calculation_ = fast_calculation;
218  }
219  bool is_fast_calculation() const
220  {
221  return fast_calculation_;
222  }
224  {
225  return (this->get_bnodetree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0;
226  }
227 
233  {
234  return rd_->size * 0.01f;
235  }
236 
237  Size2f get_render_size() const;
238 
243 };
244 
245 } // namespace blender::compositor
#define NTREE_COM_GROUPNODE_BUFFER
Overall context of the compositor.
void set_quality(eCompositorQuality quality)
set the quality
void set_bnodetree(bNodeTree *bnodetree)
set the bnodetree of the context
bNodeInstanceHash * get_preview_hash() const
get the preview image hash table
eCompositorQuality get_quality() const
get the quality
CompositorContext()
constructor initializes the context with default values.
bool get_has_active_opencl_devices() const
has this system active opencl_devices?
const RenderData * get_render_data() const
get the scene of the context
void set_preview_hash(bNodeInstanceHash *previews)
set the preview image hash table
int get_framenumber() const
get the current frame-number of the scene in this context
void set_view_name(const char *view_name)
set the active rendering view
bool is_rendering() const
get the rendering field of the context
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
set has this system active opencl_devices?
float get_render_percentage_as_factor() const
Get the render percentage as a factor. The compositor uses a factor i.o. a percentage.
void set_render_data(RenderData *rd)
set the scene of the context
void set_fast_calculation(bool fast_calculation)
const char * get_view_name() const
get the active rendering view
const bNodeTree * get_bnodetree() const
get the bnodetree of the context
void set_rendering(bool rendering)
set the rendering field of the context
Scene scene
eCompositorQuality
Possible quality settings.
Definition: COM_Enums.h:19