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:
authorNikhil Shringarpurey <Nikhil.Net>2021-07-05 19:52:10 +0300
committerHans Goudey <h.goudey@me.com>2021-07-05 19:52:10 +0300
commitfd0370acc2129fbc3a07a776bca024ba4512b654 (patch)
tree095660ee6f43f63f6c5e8ba54e1af38cfc53c2bf /source/blender/makesdna
parent08241b313c6dd7b59e51f028ef23a728344b2834 (diff)
Geometry Nodes: Add explicit Float to Int conversion node
This patch adds a very simple node that explicitly converts a float to an int. While this may seem redundant, it would offer 2 benefits to the current requirement to use implicit float conversions: 1. It makes the node tree's intent more clear and self-documenting (especially if changes in the future require integer inputs). 2. It eliminates undefined behavior in current/future nodes from float inputs by guaranteeing that the input is an integer. The node offers a variety of rounding techniques to make it more flexible. Differential Revision: https://developer.blender.org/D11700
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r--source/blender/makesdna/DNA_node_types.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 54bd792294f..f1ad41a4492 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -1688,6 +1688,14 @@ typedef enum FloatCompareOperation {
NODE_FLOAT_COMPARE_NOT_EQUAL = 5,
} FloatCompareOperation;
+/* Float to Int node operations. */
+typedef enum FloatToIntRoundingMode {
+ FN_NODE_FLOAT_TO_INT_ROUND = 0,
+ FN_NODE_FLOAT_TO_INT_FLOOR = 1,
+ FN_NODE_FLOAT_TO_INT_CEIL = 2,
+ FN_NODE_FLOAT_TO_INT_TRUNCATE = 3,
+} FloatToIntRoundingMode;
+
/* Clamp node types. */
enum {
NODE_CLAMP_MINMAX = 0,