Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/compositor/intern/COM_NodeOperation.h')
-rw-r--r--source/blender/compositor/intern/COM_NodeOperation.h93
1 files changed, 38 insertions, 55 deletions
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index b402dc7f174..368ab6c4602 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -128,7 +128,7 @@ class NodeOperationInput {
SocketReader *getReader();
- void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ bool determine_canvas(const rcti &preferred_area, rcti &r_area);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
@@ -156,12 +156,7 @@ class NodeOperationOutput {
return m_datatype;
}
- /**
- * \brief determine the resolution of this data going through this socket
- * \param resolution: the result of this operation
- * \param preferredResolution: the preferable resolution as no resolution could be determined
- */
- void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]);
+ void determine_canvas(const rcti &preferred_area, rcti &r_area);
#ifdef WITH_CXX_GUARDEDALLOC
MEM_CXX_CLASS_ALLOC_FUNCS("COM:NodeOperation")
@@ -209,9 +204,9 @@ struct NodeOperationFlags {
bool use_viewer_border : 1;
/**
- * Is the resolution of the operation set.
+ * Is the canvas of the operation set.
*/
- bool is_resolution_set : 1;
+ bool is_canvas_set : 1;
/**
* Is this a set operation (value, color, vector).
@@ -255,7 +250,7 @@ struct NodeOperationFlags {
open_cl = false;
use_render_border = false;
use_viewer_border = false;
- is_resolution_set = false;
+ is_canvas_set = false;
is_set_operation = false;
is_read_buffer_operation = false;
is_write_buffer_operation = false;
@@ -283,11 +278,11 @@ class NodeOperation {
Vector<NodeOperationOutput> m_outputs;
/**
- * \brief the index of the input socket that will be used to determine the resolution
+ * \brief the index of the input socket that will be used to determine the canvas
*/
- unsigned int m_resolutionInputSocketIndex;
+ unsigned int canvas_input_index_;
- std::function<void(unsigned int resolution[2])> modify_determined_resolution_fn_;
+ std::function<void(rcti &canvas)> modify_determined_canvas_fn_;
/**
* \brief mutex reference for very special node initializations
@@ -311,15 +306,7 @@ class NodeOperation {
*/
eExecutionModel execution_model_;
- /**
- * Width of the output of this operation.
- */
- unsigned int m_width;
-
- /**
- * Height of the output of this operation.
- */
- unsigned int m_height;
+ rcti canvas_;
/**
* Flags how to evaluate this operation.
@@ -333,10 +320,8 @@ class NodeOperation {
{
}
- void set_execution_model(const eExecutionModel model)
- {
- execution_model_ = model;
- }
+ /* Renturns false when input is not constant */
+ bool get_input_constant(const int input_idx, float *r_constant);
void set_name(const std::string name)
{
@@ -381,14 +366,7 @@ class NodeOperation {
return getInputOperation(index);
}
- /**
- * \brief determine the resolution of this node
- * \note this method will not set the resolution, this is the responsibility of the caller
- * \param resolution: the result of this operation
- * \param preferredResolution: the preferable resolution as no resolution could be determined
- */
- virtual void determineResolution(unsigned int resolution[2],
- unsigned int preferredResolution[2]);
+ virtual void determine_canvas(const rcti &preferred_area, rcti &r_area);
/**
* \brief isOutputOperation determines whether this operation is an output of the
@@ -410,6 +388,11 @@ class NodeOperation {
return false;
}
+ void set_execution_model(const eExecutionModel model)
+ {
+ execution_model_ = model;
+ }
+
void setbNodeTree(const bNodeTree *tree)
{
this->m_btree = tree;
@@ -484,19 +467,19 @@ class NodeOperation {
}
virtual void deinitExecution();
- /**
- * \brief set the resolution
- * \param resolution: the resolution to set
- */
- void setResolution(unsigned int resolution[2])
+ void set_canvas(const rcti &canvas_area)
{
- if (!this->flags.is_resolution_set) {
- this->m_width = resolution[0];
- this->m_height = resolution[1];
- this->flags.is_resolution_set = true;
+ if (!this->flags.is_canvas_set) {
+ canvas_ = canvas_area;
+ flags.is_canvas_set = true;
}
}
+ const rcti &get_canvas() const
+ {
+ return canvas_;
+ }
+
/**
* \brief is this operation the active viewer output
* user can select an ViewerNode to be active
@@ -514,18 +497,18 @@ class NodeOperation {
rcti *output);
/**
- * \brief set the index of the input socket that will determine the resolution of this
+ * \brief set the index of the input socket that will determine the canvas of this
* operation \param index: the index to set
*/
- void setResolutionInputSocketIndex(unsigned int index);
+ void set_canvas_input_index(unsigned int index);
/**
- * Set a custom function to modify determined resolution from main input just before setting it
- * as preferred resolution for the other inputs.
+ * Set a custom function to modify determined canvas from main input just before setting it
+ * as preferred for the other inputs.
*/
- void set_determined_resolution_modifier(std::function<void(unsigned int resolution[2])> fn)
+ void set_determined_canvas_modifier(std::function<void(rcti &canvas)> fn)
{
- modify_determined_resolution_fn_ = fn;
+ modify_determined_canvas_fn_ = fn;
}
/**
@@ -552,12 +535,12 @@ class NodeOperation {
unsigned int getWidth() const
{
- return m_width;
+ return BLI_rcti_size_x(&canvas_);
}
unsigned int getHeight() const
{
- return m_height;
+ return BLI_rcti_size_y(&canvas_);
}
inline void readSampled(float result[4], float x, float y, PixelSampler sampler)
@@ -629,13 +612,13 @@ class NodeOperation {
void setWidth(unsigned int width)
{
- this->m_width = width;
- this->flags.is_resolution_set = true;
+ canvas_.xmax = canvas_.xmin + width;
+ this->flags.is_canvas_set = true;
}
void setHeight(unsigned int height)
{
- this->m_height = height;
- this->flags.is_resolution_set = true;
+ canvas_.ymax = canvas_.ymin + height;
+ this->flags.is_canvas_set = true;
}
SocketReader *getInputSocketReader(unsigned int inputSocketindex);
NodeOperation *getInputOperation(unsigned int inputSocketindex);