[Bf-blender-cvs] [1494ad20b9b] master: Particles: add implicit covnersions between Vector and Color

Jacques Lucke noreply at git.blender.org
Thu Jul 16 16:43:52 CEST 2020


Commit: 1494ad20b9b31bb910b802d41bbc12a298d221e5
Author: Jacques Lucke
Date:   Thu Jul 16 16:33:20 2020 +0200
Branches: master
https://developer.blender.org/rB1494ad20b9b31bb910b802d41bbc12a298d221e5

Particles: add implicit covnersions between Vector and Color

Not sure if these conversions are a good idea. However, we have them
in Cycles, so they be available in the simulation node tree for consistency
reasons.

===================================================================

M	source/blender/blenkernel/intern/node_tree_multi_function.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/node_tree_multi_function.cc b/source/blender/blenkernel/intern/node_tree_multi_function.cc
index b4df44eec85..537ec056126 100644
--- a/source/blender/blenkernel/intern/node_tree_multi_function.cc
+++ b/source/blender/blenkernel/intern/node_tree_multi_function.cc
@@ -16,6 +16,7 @@
 
 #include "BKE_node_tree_multi_function.hh"
 
+#include "BLI_color.hh"
 #include "BLI_float3.hh"
 
 namespace blender {
@@ -214,6 +215,10 @@ static ImplicitConversionsMap get_implicit_conversions()
       conversions, "Vector Length", [](float3 a) { return a.length(); });
   add_implicit_conversion<int32_t, float3>(
       conversions, "int32 to float3", [](int32_t a) { return float3((float)a); });
+  add_implicit_conversion<float3, Color4f>(
+      conversions, "float3 to Color4f", [](float3 a) { return Color4f(a.x, a.y, a.z, 1.0f); });
+  add_implicit_conversion<Color4f, float3>(
+      conversions, "Color4f to float3", [](Color4f a) { return float3(a.r, a.g, a.b); });
   return conversions;
 }



More information about the Bf-blender-cvs mailing list