[Bf-blender-cvs] [401ddff4107] temp-test-point-cloud-simulation-depsgraph-integration: get current scene time

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


Commit: 401ddff4107d969ffc471870dd100dafc2ec494a
Author: Jacques Lucke
Date:   Thu Apr 16 12:44:34 2020 +0200
Branches: temp-test-point-cloud-simulation-depsgraph-integration
https://developer.blender.org/rB401ddff4107d969ffc471870dd100dafc2ec494a

get current scene time

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

M	source/blender/blenkernel/BKE_simulation.h
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 d1d3aab7eed..baf08ecf28b 100644
--- a/source/blender/blenkernel/BKE_simulation.h
+++ b/source/blender/blenkernel/BKE_simulation.h
@@ -23,11 +23,14 @@ extern "C" {
 
 struct Depsgraph;
 struct Main;
+struct Scene;
 struct Simulation;
 
 void *BKE_simulation_add(struct Main *bmain, const char *name);
 
-void BKE_simulation_eval(struct Depsgraph *depsgraph, struct Simulation *simulation);
+void BKE_simulation_eval(struct Depsgraph *depsgraph,
+                         struct Simulation *simulation,
+                         struct Scene *scene);
 
 #ifdef __cplusplus
 }
diff --git a/source/blender/blenkernel/intern/simulation.cc b/source/blender/blenkernel/intern/simulation.cc
index 61b2541b5fd..e463c3cb8bb 100644
--- a/source/blender/blenkernel/intern/simulation.cc
+++ b/source/blender/blenkernel/intern/simulation.cc
@@ -44,6 +44,9 @@
 
 #include "BLT_translation.h"
 
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_query.h"
+
 static void simulation_init_data(ID *id)
 {
   Simulation *simulation = (Simulation *)id;
@@ -113,7 +116,9 @@ IDTypeInfo IDType_ID_SIM = {
     /* make_local */ simulation_make_local,
 };
 
-void BKE_simulation_eval(Depsgraph *depsgraph, Simulation *simulation)
+void BKE_simulation_eval(Depsgraph *depsgraph, Simulation *simulation, Scene *scene)
 {
-  printf("%s %s\n", __func__, simulation->id.name);
+  int current_frame = scene->r.cfra;
+  float current_subframe = scene->r.subframe;
+  printf("Output simulation state at frame %d + %f\n", current_frame, current_subframe);
 }
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index eb0d482c641..4cb84de80fe 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1717,10 +1717,11 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
   }
 
   Simulation *simulation_cow = get_cow_datablock(simulation);
+  Scene *scene_cow = get_cow_datablock(scene_);
   add_operation_node(&simulation->id,
                      NodeType::PARAMETERS,
                      OperationCode::SIMULATION_EVAL,
-                     function_bind(BKE_simulation_eval, _1, simulation_cow));
+                     function_bind(BKE_simulation_eval, _1, simulation_cow, scene_cow));
 
   add_id_node(&simulation->id);
   build_animdata(&simulation->id);



More information about the Bf-blender-cvs mailing list