Blender  V2.93
COM_CompositorContext.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * Copyright 2011, Blender Foundation.
17  */
18 
19 #pragma once
20 
21 #include "BLI_rect.h"
22 
23 #include "COM_Enums.h"
24 
25 #include "DNA_color_types.h"
26 #include "DNA_node_types.h"
27 #include "DNA_scene_types.h"
28 
29 #include <string>
30 #include <vector>
31 
32 namespace blender::compositor {
33 
38  private:
44  bool m_rendering;
45 
51  eCompositorQuality m_quality;
52 
53  Scene *m_scene;
54 
60  RenderData *m_rd;
61 
67  bNodeTree *m_bnodetree;
68 
73  bNodeInstanceHash *m_previews;
74 
78  bool m_hasActiveOpenCLDevices;
79 
83  bool m_fastCalculation;
84 
85  /* \brief color management settings */
86  const ColorManagedViewSettings *m_viewSettings;
87  const ColorManagedDisplaySettings *m_displaySettings;
88 
92  const char *m_viewName;
93 
94  public:
99 
103  void setRendering(bool rendering)
104  {
105  this->m_rendering = rendering;
106  }
107 
111  bool isRendering() const
112  {
113  return this->m_rendering;
114  }
115 
120  {
121  this->m_rd = rd;
122  }
123 
127  void setbNodeTree(bNodeTree *bnodetree)
128  {
129  this->m_bnodetree = bnodetree;
130  }
131 
135  const bNodeTree *getbNodeTree() const
136  {
137  return this->m_bnodetree;
138  }
139 
143  const RenderData *getRenderData() const
144  {
145  return this->m_rd;
146  }
147 
149  {
150  m_scene = scene;
151  }
152  Scene *getScene() const
153  {
154  return m_scene;
155  }
156 
161  {
162  this->m_previews = previews;
163  }
164 
169  {
170  return this->m_previews;
171  }
172 
176  void setViewSettings(const ColorManagedViewSettings *viewSettings)
177  {
178  this->m_viewSettings = viewSettings;
179  }
180 
185  {
186  return this->m_viewSettings;
187  }
188 
192  void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
193  {
194  this->m_displaySettings = displaySettings;
195  }
196 
201  {
202  return this->m_displaySettings;
203  }
204 
209  {
210  this->m_quality = quality;
211  }
212 
217  {
218  return this->m_quality;
219  }
220 
224  int getFramenumber() const;
225 
230  {
231  return this->m_hasActiveOpenCLDevices;
232  }
233 
237  void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
238  {
239  this->m_hasActiveOpenCLDevices = hasAvtiveOpenCLDevices;
240  }
241 
245  const char *getViewName() const
246  {
247  return this->m_viewName;
248  }
249 
253  void setViewName(const char *viewName)
254  {
255  this->m_viewName = viewName;
256  }
257 
258  int getChunksize() const
259  {
260  return this->getbNodeTree()->chunksize;
261  }
262 
263  void setFastCalculation(bool fastCalculation)
264  {
265  this->m_fastCalculation = fastCalculation;
266  }
267  bool isFastCalculation() const
268  {
269  return this->m_fastCalculation;
270  }
272  {
273  return (this->getbNodeTree()->flag & NTREE_COM_GROUPNODE_BUFFER) != 0;
274  }
275 
281  {
282  return m_rd->size * 0.01f;
283  }
284 };
285 
286 } // namespace blender::compositor
#define NTREE_COM_GROUPNODE_BUFFER
Overall context of the compositor.
bNodeInstanceHash * getPreviewHash() const
get the preview image hash table
void setFastCalculation(bool fastCalculation)
void setViewSettings(const ColorManagedViewSettings *viewSettings)
set view settings of color color management
float getRenderPercentageAsFactor() const
Get the render percentage as a factor. The compositor uses a factor i.o. a percentage.
const char * getViewName() const
get the active rendering view
CompositorContext()
constructor initializes the context with default values.
void setbNodeTree(bNodeTree *bnodetree)
set the bnodetree of the context
void setDisplaySettings(const ColorManagedDisplaySettings *displaySettings)
set display settings of color color management
bool isRendering() const
get the rendering field of the context
bool getHasActiveOpenCLDevices() const
has this system active openclDevices?
const bNodeTree * getbNodeTree() const
get the bnodetree of the context
eCompositorQuality getQuality() const
get the quality
void setHasActiveOpenCLDevices(bool hasAvtiveOpenCLDevices)
set has this system active openclDevices?
void setPreviewHash(bNodeInstanceHash *previews)
set the preview image hash table
const ColorManagedDisplaySettings * getDisplaySettings() const
get display settings of color color management
void setQuality(eCompositorQuality quality)
set the quality
const RenderData * getRenderData() const
get the scene of the context
void setViewName(const char *viewName)
set the active rendering view
const ColorManagedViewSettings * getViewSettings() const
get view settings of color color management
int getFramenumber() const
get the current frame-number of the scene in this context
void setRendering(bool rendering)
set the rendering field of the context
void setRenderData(RenderData *rd)
set the scene of the context
Scene scene
eCompositorQuality
Possible quality settings.
Definition: COM_Enums.h:32