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:
authorJacques Lucke <jacques@blender.org>2021-01-12 23:22:32 +0300
committerJacques Lucke <jacques@blender.org>2021-01-12 23:22:32 +0300
commit1339e7c44f1f9a1c9bc5d6cb0a5702a6fe73515e (patch)
tree219481d8935a75ad6e2b97fe16193af3f763bb32 /source/blender/nodes/geometry/nodes
parentb66fcd83f6cef55a87dc9835129f8956fd6c6742 (diff)
parent719bea0d6d06be579edee2fc3d12a7828bb8e101 (diff)
Merge branch 'master' into experiment-point-distributiontemp-point-distribution-refactor-experiment
Diffstat (limited to 'source/blender/nodes/geometry/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_color_ramp.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc10
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc15
3 files changed, 19 insertions, 12 deletions
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 8a96a6ea866..7d49253c6a3 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,12 +37,14 @@ 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);
+
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
* chosen. */
const AttributeDomain result_domain = ATTR_DOMAIN_POINT;
- const CustomDataType result_type = CD_PROP_COLOR;
-
WriteAttributePtr attribute_result = component.attribute_try_ensure_for_write(
result_name, result_domain, result_type);
if (!attribute_result) {
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
index abfe3b43cb5..5d6e2412a3d 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_compare.cc
@@ -216,14 +216,12 @@ static CustomDataType get_data_type(GeometryComponent &component,
const NodeAttributeCompare &node_storage)
{
if (operation_tests_equality(node_storage)) {
- CustomDataType data_type_a = params.get_input_attribute_data_type(
- "A", component, CD_PROP_FLOAT);
- CustomDataType data_type_b = params.get_input_attribute_data_type(
- "B", component, CD_PROP_FLOAT);
-
/* Convert the input attributes to the same data type for the equality tests. Use the higher
* complexity attribute type, otherwise information necessary to the comparison may be lost. */
- return attribute_domain_highest_complexity({data_type_a, data_type_b});
+ return attribute_data_type_highest_complexity({
+ params.get_input_attribute_data_type("A", component, CD_PROP_FLOAT),
+ params.get_input_attribute_data_type("B", component, CD_PROP_FLOAT),
+ });
}
/* Use float compare for every operation besides equality. */
diff --git a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
index 3d3a72dd910..9a780e1212b 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_attribute_mix.cc
@@ -136,14 +136,21 @@ static void attribute_mix_calc(GeometryComponent &component, const GeoNodeExecPa
const bNode &node = params.node();
const NodeAttributeMix *node_storage = (const NodeAttributeMix *)node.storage;
- CustomDataType result_type = CD_PROP_COLOR;
+ /* Use the highest complexity data type among the inputs and outputs, that way the node will
+ * never "remove information". Use CD_PROP_BOOL as the lowest complexity data type, but in any
+ * real situation it won't be returned. */
+ const CustomDataType result_type = attribute_data_type_highest_complexity({
+ params.get_input_attribute_data_type("A", component, CD_PROP_BOOL),
+ params.get_input_attribute_data_type("B", component, CD_PROP_BOOL),
+ params.get_input_attribute_data_type("Result", component, CD_PROP_BOOL),
+ });
+
+ /* Once we support more domains at the user level, we have to decide how the result domain is
+ * chosen. */
AttributeDomain result_domain = ATTR_DOMAIN_POINT;
-
- /* Use type and domain from the result attribute, if it exists already. */
const std::string result_name = params.get_input<std::string>("Result");
const ReadAttributePtr result_attribute_read = component.attribute_try_get_for_read(result_name);
if (result_attribute_read) {
- result_type = result_attribute_read->custom_data_type();
result_domain = result_attribute_read->domain();
}