[Bf-blender-cvs] [5f47593f500] temp-test-point-cloud-simulation-depsgraph-integration: separate simulation eval function

Jacques Lucke noreply at git.blender.org
Thu Apr 16 13:04:40 CEST 2020


Commit: 5f47593f50095a0697caff88860bb838b5f26a9e
Author: Jacques Lucke
Date:   Thu Apr 16 12:23:44 2020 +0200
Branches: temp-test-point-cloud-simulation-depsgraph-integration
https://developer.blender.org/rB5f47593f50095a0697caff88860bb838b5f26a9e

separate simulation eval function

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

M	source/blender/blenkernel/BKE_simulation.h
M	source/blender/blenkernel/intern/lib_query.c
M	source/blender/blenkernel/intern/simulation.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc

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

diff --git a/source/blender/blenkernel/BKE_simulation.h b/source/blender/blenkernel/BKE_simulation.h
index aad0ada75a9..d1d3aab7eed 100644
--- a/source/blender/blenkernel/BKE_simulation.h
+++ b/source/blender/blenkernel/BKE_simulation.h
@@ -21,11 +21,14 @@
 extern "C" {
 #endif
 
+struct Depsgraph;
 struct Main;
 struct Simulation;
 
 void *BKE_simulation_add(struct Main *bmain, const char *name);
 
+void BKE_simulation_eval(struct Depsgraph *depsgraph, struct Simulation *simulation);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c
index 88404140406..fb8786dab82 100644
--- a/source/blender/blenkernel/intern/lib_query.c
+++ b/source/blender/blenkernel/intern/lib_query.c
@@ -1298,6 +1298,7 @@ static void library_foreach_ID_link(Main *bmain,
         for (i = 0; i < pointcloud->totcol; i++) {
           CALLBACK_INVOKE(pointcloud->mat[i], IDWALK_CB_USER);
         }
+        CALLBACK_INVOKE(pointcloud->source_simulation, IDWALK_CB_USER);
         break;
       }
       case ID_VO: {
diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc
index d7f8c3e8715..61b2541b5fd 100644
--- a/source/blender/blenkernel/intern/simulation.cc
+++ b/source/blender/blenkernel/intern/simulation.cc
@@ -112,3 +112,8 @@ IDTypeInfo IDType_ID_SIM = {
     /* free_data */ simulation_free_data,
     /* make_local */ simulation_make_local,
 };
+
+void BKE_simulation_eval(Depsgraph *depsgraph, Simulation *simulation)
+{
+  printf("%s %s\n", __func__, simulation->id.name);
+}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 46923721e63..eb0d482c641 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -98,6 +98,7 @@ extern "C" {
 #include "BKE_scene.h"
 #include "BKE_sequencer.h"
 #include "BKE_shader_fx.h"
+#include "BKE_simulation.h"
 #include "BKE_sound.h"
 #include "BKE_tracking.h"
 #include "BKE_volume.h"
@@ -1715,12 +1716,11 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
     return;
   }
 
-  {
-    add_operation_node(&simulation->id,
-                       NodeType::PARAMETERS,
-                       OperationCode::SIMULATION_EVAL,
-                       [](struct ::Depsgraph *depsgraph) { printf("Sim eval %p\n", depsgraph); });
-  }
+  Simulation *simulation_cow = get_cow_datablock(simulation);
+  add_operation_node(&simulation->id,
+                     NodeType::PARAMETERS,
+                     OperationCode::SIMULATION_EVAL,
+                     function_bind(BKE_simulation_eval, _1, simulation_cow));
 
   add_id_node(&simulation->id);
   build_animdata(&simulation->id);



More information about the Bf-blender-cvs mailing list