[Bf-blender-cvs] [b7c516a121e] functions-experimental-refactor: add more primitive conversions

Jacques Lucke noreply at git.blender.org
Thu Oct 31 14:12:52 CET 2019


Commit: b7c516a121e3acf725e5b65f1fda3085de1e4bdc
Author: Jacques Lucke
Date:   Thu Oct 31 12:55:23 2019 +0100
Branches: functions-experimental-refactor
https://developer.blender.org/rBb7c516a121e3acf725e5b65f1fda3085de1e4bdc

add more primitive conversions

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

M	source/blender/modifiers/intern/MOD_functiondeform_cxx.cc

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

diff --git a/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc b/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
index 2365f4bc253..c06b62bfec2 100644
--- a/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
+++ b/source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
@@ -74,6 +74,9 @@ static MFDataType get_type_by_socket(const VirtualSocket &vsocket)
   else if (idname == "fn_IntegerSocket") {
     return MFDataType::ForSingle<int32_t>();
   }
+  else if (idname == "fn_BooleanSocket") {
+    return MFDataType::ForSingle<bool>();
+  }
   else if (idname == "fn_FloatListSocket") {
     return MFDataType::ForVector<float>();
   }
@@ -83,6 +86,9 @@ static MFDataType get_type_by_socket(const VirtualSocket &vsocket)
   else if (idname == "fn_IntegerListSocket") {
     return MFDataType::ForVector<int32_t>();
   }
+  else if (idname == "fn_BooleanListSocket") {
+    return MFDataType::ForVector<bool>();
+  }
   return MFDataType();
 }
 
@@ -97,6 +103,9 @@ static const CPPType &get_cpp_type_by_name(StringRef name)
   else if (name == "Integer") {
     return BKE::GET_TYPE<int32_t>();
   }
+  else if (name == "Boolean") {
+    return BKE::GET_TYPE<bool>();
+  }
 
   BLI_assert(false);
   return BKE::GET_TYPE<float>();
@@ -610,7 +619,16 @@ static Map<std::pair<std::string, std::string>, InsertImplicitConversionFunction
 get_conversion_inserters()
 {
   Map<std::pair<std::string, std::string>, InsertImplicitConversionFunction> inserters;
+
   inserters.add_new({"fn_IntegerSocket", "fn_FloatSocket"}, INSERT_convert<int, float>);
+  inserters.add_new({"fn_FloatSocket", "fn_IntegerSocket"}, INSERT_convert<float, int>);
+
+  inserters.add_new({"fn_FloatSocket", "fn_BooleanSocket"}, INSERT_convert<float, bool>);
+  inserters.add_new({"fn_BooleanSocket", "fn_FloatSocket"}, INSERT_convert<bool, float>);
+
+  inserters.add_new({"fn_IntegerSocket", "fn_BooleanSocket"}, INSERT_convert<int, bool>);
+  inserters.add_new({"fn_BooleanSocket", "fn_IntegerSocket"}, INSERT_convert<bool, int>);
+
   return inserters;
 }



More information about the Bf-blender-cvs mailing list