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:
authorManuel Castilla <manzanillawork@gmail.com>2021-07-26 23:44:10 +0300
committerManuel Castilla <manzanillawork@gmail.com>2021-07-26 23:44:56 +0300
commit05315af81dec2dd503c73f92680d2d6d72cd2b28 (patch)
treefe8ddd174634ea1c055a52af63ca04c9d104cf68 /source/blender/compositor/operations/COM_ScaleOperation.cc
parent6a903d90887848803decd5242e25df5d24f85970 (diff)
Fix compile error on macos introduced in last commit
std::optional::value() is not available on macos.
Diffstat (limited to 'source/blender/compositor/operations/COM_ScaleOperation.cc')
-rw-r--r--source/blender/compositor/operations/COM_ScaleOperation.cc23
1 files changed, 7 insertions, 16 deletions
diff --git a/source/blender/compositor/operations/COM_ScaleOperation.cc b/source/blender/compositor/operations/COM_ScaleOperation.cc
index 2cb61ae746b..5410b2c832a 100644
--- a/source/blender/compositor/operations/COM_ScaleOperation.cc
+++ b/source/blender/compositor/operations/COM_ScaleOperation.cc
@@ -54,33 +54,24 @@ ScaleOperation::ScaleOperation(DataType data_type) : BaseScaleOperation()
this->m_inputYOperation = nullptr;
}
-static std::optional<float> get_constant_scale(NodeOperation *op)
+float ScaleOperation::get_constant_scale(const int input_op_idx, const float factor)
{
- if (op->get_flags().is_constant_operation) {
- return ((ConstantOperation *)op)->get_constant_elem()[0];
+ const bool is_constant = getInputOperation(input_op_idx)->get_flags().is_constant_operation;
+ if (is_constant) {
+ return ((ConstantOperation *)getInputOperation(input_op_idx))->get_constant_elem()[0] * factor;
}
- return std::optional<float>();
+ return 1.0f;
}
float ScaleOperation::get_constant_scale_x()
{
- std::optional<float> scale_x = get_constant_scale(getInputOperation(1));
- if (scale_x.has_value()) {
- return scale_x.value() * get_relative_scale_x_factor();
- }
-
- return 1.0f;
+ return get_constant_scale(1, get_relative_scale_x_factor());
}
float ScaleOperation::get_constant_scale_y()
{
- std::optional<float> scale_y = get_constant_scale(getInputOperation(2));
- if (scale_y.has_value()) {
- return scale_y.value() * get_relative_scale_y_factor();
- }
-
- return 1.0f;
+ return get_constant_scale(2, get_relative_scale_y_factor());
}
BLI_INLINE float scale_coord(const int coord, const float center, const float relative_scale)