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
path: root/source
diff options
context:
space:
mode:
authorSergey Sharybin <sergey@blender.org>2021-01-14 17:19:24 +0300
committerSergey Sharybin <sergey@blender.org>2021-01-14 17:19:24 +0300
commit87955143845230919326914e5377f76ce231d306 (patch)
treef7da760f9fca58c5432ef9eaf1f44e439ae2bb82 /source
parent8ed7ed02554d9e595c2bdfa7a5bb3e9fda43e202 (diff)
parent53bd58993e2f6d35452242762402c20343d6eef3 (diff)
Merge branch 'blender-v2.92-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/imbuf/intern/openexr/openexr_api.cpp15
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc7
2 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp
index 9726eaeed2c..979e7703e81 100644
--- a/source/blender/imbuf/intern/openexr/openexr_api.cpp
+++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp
@@ -324,6 +324,11 @@ struct _RGBAZ {
using RGBAZ = _RGBAZ;
+static half float_to_half_safe(const float value)
+{
+ return half(clamp_f(value, -HALF_MAX, HALF_MAX));
+}
+
extern "C" {
/**
@@ -472,10 +477,10 @@ static bool imb_save_openexr_half(ImBuf *ibuf, const char *name, const int flags
from = ibuf->rect_float + channels * i * width;
for (int j = ibuf->x; j > 0; j--) {
- to->r = from[0];
- to->g = (channels >= 2) ? from[1] : from[0];
- to->b = (channels >= 3) ? from[2] : from[0];
- to->a = (channels >= 4) ? from[3] : 1.0f;
+ to->r = float_to_half_safe(from[0]);
+ to->g = float_to_half_safe((channels >= 2) ? from[1] : from[0]);
+ to->b = float_to_half_safe((channels >= 3) ? from[2] : from[0]);
+ to->a = float_to_half_safe((channels >= 4) ? from[3] : 1.0f);
to++;
from += channels;
}
@@ -1116,7 +1121,7 @@ void IMB_exr_write_channels(void *handle)
float *rect = echan->rect;
half *cur = current_rect_half;
for (size_t i = 0; i < num_pixels; i++, cur++) {
- *cur = rect[i * echan->xstride];
+ *cur = float_to_half_safe(rect[i * echan->xstride]);
}
half *rect_to_write = current_rect_half + (data->height - 1L) * data->width;
frameBuffer.insert(
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
index 5d126328988..2aca9ed581c 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc
@@ -37,9 +37,10 @@ static void execute_on_component(const GeoNodeExecParams &params, GeometryCompon
const bNode &bnode = params.node();
NodeAttributeColorRamp *node_storage = (NodeAttributeColorRamp *)bnode.storage;
- /* Use the type of the input attribute, but create a color attribute if it doesn't exist yet. */
- const CustomDataType result_type = params.get_input_attribute_data_type(
- "Attribute", component, CD_PROP_COLOR);
+ /* Always output a color attribute for now. We might want to allow users to customize.
+ * Using the type of an existing attribute could work, but does not have a real benefit
+ * currently. */
+ const CustomDataType result_type = CD_PROP_COLOR;
const std::string result_name = params.get_input<std::string>("Result");
/* Once we support more domains at the user level, we have to decide how the result domain is