Commit: 7df89986a56bf01067649da7b90257bf9792e594
Author: Jacques Lucke
Date:   Sun Feb 17 21:17:11 2019 +0100
Branches: functions
https://developer.blender.org/rB7df89986a56bf01067649da7b90257bf9792e594

Merge branch 'functions-in-train' into functions

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



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

diff --cc source/blender/blenlib/CMakeLists.txt
index a99aabe57cc,ccd17c30d19..0e8f87db992
--- a/source/blender/blenlib/CMakeLists.txt
+++ b/source/blender/blenlib/CMakeLists.txt
@@@ -226,7 -226,8 +226,9 @@@ set(SR
        PIL_time_utildefines.h
  
        BLI_composition.hpp
+       BLI_lazy_init.hpp
 +      BLI_listbase_wrapper.hpp
+       BLI_mempool.hpp
        BLI_shared.hpp
        BLI_small_vector.hpp
        BLI_small_map.hpp
diff --cc source/blender/functions/c_wrapper.cpp
index 6c734b8e0a5,361203c3023..d3b921b1647
--- a/source/blender/functions/c_wrapper.cpp
+++ b/source/blender/functions/c_wrapper.cpp
@@@ -204,26 -206,50 +206,67 @@@ FnFunction FN_get_generated_function(
        return wrap(fn_ref);
  }
  
 -void FN_testing(bNodeTree *bnodetree)
 +FnFunction FN_testing(bNodeTree *bnodetree)
  {
        FN::FunctionNodes::FunctionNodeTree tree(bnodetree);
 -      auto graph = tree.to_data_flow_graph();
 -      std::cout << graph->to_dot() << std::endl;
 +      auto fgraph = tree.to_function_graph();
 +      //std::cout << fgraph.graph()->to_dot() << std::endl;
 +
 +      auto fn = FN::SharedFunction::New("Function from Node Tree", 
fgraph.signature());
 +      fn->add_body(FN::function_graph_to_callable(fgraph));
 +
 +      BLI::RefCounted<FN::Function> *fn_ref = fn.refcounter();
 +      fn_ref->incref();
 +      return wrap(fn_ref);
 +}
 +
 +void FN_function_update_dependencies(
 +      FnFunction fn,
 +      struct DepsNodeHandle *deps_node)
 +{
 +      BLI::RefCounted<FN::Function> *fn_ref = unwrap(fn);
 +      FN::Dependencies dependencies;
 +      fn_ref->ptr()->body<FN::TupleCallBody>()->dependencies(dependencies);
 +      dependencies.update_depsgraph(deps_node);
+ }
+ 
+ void FN_test_inferencer()
+ {
+       FN::SharedType &float_ty = FN::Types::get_float_type();
+       FN::SharedType &int32_ty = FN::Types::get_int32_type();
+       FN::SharedType &fvec3_ty = FN::Types::get_fvec3_type();
+       FN::SharedType &float_list_ty = FN::Types::get_float_list_type();
+ 
+       {
+               FN::Inferencer inferencer;
+               inferencer.insert_final_type(0, float_ty);
+               inferencer.insert_final_type(1, int32_ty);
+               inferencer.insert_final_type(2, fvec3_ty);
+               inferencer.insert_equality_relation({6, 7});
+               inferencer.insert_equality_relation({0, 5, 6});
+               inferencer.insert_equality_relation({1, 4});
+ 
+               BLI_assert(inferencer.inference());
+ 
+               BLI_assert(inferencer.get_final_type(5) == float_ty);
+               BLI_assert(inferencer.get_final_type(6) == float_ty);
+               BLI_assert(inferencer.get_final_type(7) == float_ty);
+               BLI_assert(inferencer.get_final_type(4) == int32_ty);
+       }
+       {
+               FN::Inferencer inferencer;
+               inferencer.insert_final_type(0, float_ty);
+               inferencer.insert_final_type(1, int32_ty);
+               inferencer.insert_equality_relation({0, 2});
+               inferencer.insert_equality_relation({1, 2});
+ 
+               BLI_assert(!inferencer.inference());
+       }
+       {
+               FN::Inferencer inferencer;
+               inferencer.insert_final_type(0, float_ty);
+               inferencer.insert_list_relation({1}, {0});
+ 
+               BLI_assert(inferencer.inference());
+       }
  }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to