[Bf-blender-cvs] [6b47b22a33b] simulation-access-modifier: proper operation type

Jacques Lucke noreply at git.blender.org
Wed Apr 22 16:28:54 CEST 2020


Commit: 6b47b22a33b1aca08e6b423e0e8a69c987b46187
Author: Jacques Lucke
Date:   Wed Apr 22 16:04:30 2020 +0200
Branches: simulation-access-modifier
https://developer.blender.org/rB6b47b22a33b1aca08e6b423e0e8a69c987b46187

proper operation type

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

M	source/blender/depsgraph/DEG_depsgraph_build.h
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/node/deg_node_operation.cc
M	source/blender/depsgraph/intern/node/deg_node_operation.h
M	source/blender/modifiers/intern/MOD_simulation_access.cc

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h
index e24fa9e8996..69963ec4393 100644
--- a/source/blender/depsgraph/DEG_depsgraph_build.h
+++ b/source/blender/depsgraph/DEG_depsgraph_build.h
@@ -39,6 +39,7 @@ struct ID;
 struct Main;
 struct Object;
 struct Scene;
+struct Simulation;
 struct ViewLayer;
 struct bNodeTree;
 
@@ -153,6 +154,9 @@ void DEG_add_object_relation(struct DepsNodeHandle *node_handle,
                              struct Object *object,
                              eDepsObjectComponentType component,
                              const char *description);
+void DEG_add_simulation_relation(struct DepsNodeHandle *node_handle,
+                                 struct Simulation *simulation,
+                                 const char *description);
 void DEG_add_bone_relation(struct DepsNodeHandle *handle,
                            struct Object *object,
                            const char *bone_name,
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index eb7006056e1..7d0a5106d76 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1713,7 +1713,7 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
 
   add_operation_node(&simulation->id,
                      NodeType::GENERIC_DATABLOCK,
-                     OperationCode::GENERIC_DATABLOCK_UPDATE,
+                     OperationCode::SIMULATION_EVAL,
                      [](struct ::Depsgraph *UNUSED(depsgraph)) { printf("Hello World\n"); });
 }
 
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 00fdc2b71b4..c53ba61ae88 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2521,7 +2521,7 @@ void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)
   build_parameters(&simulation->id);
 
   OperationKey simulation_update_key(
-      &simulation->id, NodeType::GENERIC_DATABLOCK, OperationCode::GENERIC_DATABLOCK_UPDATE);
+      &simulation->id, NodeType::GENERIC_DATABLOCK, OperationCode::SIMULATION_EVAL);
   TimeSourceKey time_src_key;
   add_relation(time_src_key, simulation_update_key, "TimeSrc -> Simulation");
 }
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index d78bc07ac5e..d75378ce7d1 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -36,6 +36,7 @@ extern "C" {
 #include "DNA_cachefile_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
+#include "DNA_simulation_types.h"
 
 #include "BKE_main.h"
 #include "BKE_scene.h"
@@ -106,6 +107,16 @@ void DEG_add_object_relation(DepsNodeHandle *node_handle,
   deg_node_handle->builder->add_node_handle_relation(comp_key, deg_node_handle, description);
 }
 
+void DEG_add_simulation_relation(DepsNodeHandle *node_handle,
+                                 Simulation *simulation,
+                                 const char *description)
+{
+  DEG::OperationKey operation_key(
+      &simulation->id, DEG::NodeType::GENERIC_DATABLOCK, DEG::OperationCode::SIMULATION_EVAL);
+  DEG::DepsNodeHandle *deg_node_handle = get_node_handle(node_handle);
+  deg_node_handle->builder->add_node_handle_relation(operation_key, deg_node_handle, description);
+}
+
 void DEG_add_object_cache_relation(DepsNodeHandle *node_handle,
                                    CacheFile *cache_file,
                                    eDepsObjectComponentType component,
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.cc b/source/blender/depsgraph/intern/node/deg_node_operation.cc
index 1e03d51f557..c1aa05df987 100644
--- a/source/blender/depsgraph/intern/node/deg_node_operation.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.cc
@@ -195,6 +195,8 @@ const char *operationCodeAsString(OperationCode opcode)
     /* instancing/duplication. */
     case OperationCode::DUPLI:
       return "DUPLI";
+    case OperationCode::SIMULATION_EVAL:
+      return "SIMULATION_EVAL";
   }
   BLI_assert(!"Unhandled operation code, should never happen.");
   return "UNKNOWN";
diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h
index 2faf139ec93..865a25d2124 100644
--- a/source/blender/depsgraph/intern/node/deg_node_operation.h
+++ b/source/blender/depsgraph/intern/node/deg_node_operation.h
@@ -198,6 +198,9 @@ enum class OperationCode {
 
   /* Duplication/instancing system. --------------------------------------- */
   DUPLI,
+
+  /* Simulation. ---------------------------------------------------------- */
+  SIMULATION_EVAL,
 };
 const char *operationCodeAsString(OperationCode opcode);
 
diff --git a/source/blender/modifiers/intern/MOD_simulation_access.cc b/source/blender/modifiers/intern/MOD_simulation_access.cc
index 5acb1e0e480..508f056a2bd 100644
--- a/source/blender/modifiers/intern/MOD_simulation_access.cc
+++ b/source/blender/modifiers/intern/MOD_simulation_access.cc
@@ -47,7 +47,7 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
 {
   SimulationAccessModifierData *samd = (SimulationAccessModifierData *)md;
   if (samd->simulation) {
-    DEG_add_generic_id_relation(ctx->node, &samd->simulation->id, "Accessed Simulation");
+    DEG_add_simulation_relation(ctx->node, samd->simulation, "Accessed Simulation");
   }
 }



More information about the Bf-blender-cvs mailing list