[Bf-blender-cvs] [20f935ab5ca] simulation-access-modifier: separate node type

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


Commit: 20f935ab5caf189347b083482d39e535f27e210c
Author: Jacques Lucke
Date:   Wed Apr 22 16:25:40 2020 +0200
Branches: simulation-access-modifier
https://developer.blender.org/rB20f935ab5caf189347b083482d39e535f27e210c

separate node type

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

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/debug/deg_debug_relations_graphviz.cc
M	source/blender/depsgraph/intern/depsgraph_build.cc
M	source/blender/depsgraph/intern/node/deg_node.cc
M	source/blender/depsgraph/intern/node/deg_node.h
M	source/blender/depsgraph/intern/node/deg_node_component.cc
M	source/blender/depsgraph/intern/node/deg_node_component.h
M	source/blender/modifiers/intern/MOD_simulation_access.cc

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 7d0a5106d76..748abf49b53 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -1712,9 +1712,9 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
   build_parameters(&simulation->id);
 
   add_operation_node(&simulation->id,
-                     NodeType::GENERIC_DATABLOCK,
+                     NodeType::SIMULATION,
                      OperationCode::SIMULATION_EVAL,
-                     [](struct ::Depsgraph *UNUSED(depsgraph)) { printf("Hello World\n"); });
+                     [](struct ::Depsgraph *UNUSED(depsgraph)) { printf("Eval Simulation\n"); });
 }
 
 void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index c53ba61ae88..061f48b9903 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::SIMULATION_EVAL);
+      &simulation->id, NodeType::SIMULATION, OperationCode::SIMULATION_EVAL);
   TimeSourceKey time_src_key;
   add_relation(time_src_key, simulation_update_key, "TimeSrc -> Simulation");
 }
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index 7080f8a1a9b..701419d24e1 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -443,7 +443,8 @@ static void deg_debug_graphviz_node(const DebugContext &ctx, const Node *node)
     case NodeType::SYNCHRONIZATION:
     case NodeType::AUDIO:
     case NodeType::ARMATURE:
-    case NodeType::GENERIC_DATABLOCK: {
+    case NodeType::GENERIC_DATABLOCK:
+    case NodeType::SIMULATION: {
       ComponentNode *comp_node = (ComponentNode *)node;
       if (!comp_node->operations.empty()) {
         deg_debug_graphviz_node_cluster_begin(ctx, node);
diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc
index d75378ce7d1..ff65ff5b050 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.cc
+++ b/source/blender/depsgraph/intern/depsgraph_build.cc
@@ -112,7 +112,7 @@ void DEG_add_simulation_relation(DepsNodeHandle *node_handle,
                                  const char *description)
 {
   DEG::OperationKey operation_key(
-      &simulation->id, DEG::NodeType::GENERIC_DATABLOCK, DEG::OperationCode::SIMULATION_EVAL);
+      &simulation->id, DEG::NodeType::SIMULATION, 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);
 }
diff --git a/source/blender/depsgraph/intern/node/deg_node.cc b/source/blender/depsgraph/intern/node/deg_node.cc
index d95e05a6f4f..10760d3170b 100644
--- a/source/blender/depsgraph/intern/node/deg_node.cc
+++ b/source/blender/depsgraph/intern/node/deg_node.cc
@@ -114,6 +114,8 @@ const char *nodeTypeAsString(NodeType type)
       return "ARMATURE";
     case NodeType::GENERIC_DATABLOCK:
       return "GENERIC_DATABLOCK";
+    case NodeType::SIMULATION:
+      return "SIMULATION";
 
     /* Total number of meaningful node types. */
     case NodeType::NUM_TYPES:
@@ -172,6 +174,7 @@ eDepsSceneComponentType nodeTypeToSceneComponent(NodeType type)
     case NodeType::SHADING:
     case NodeType::CACHE:
     case NodeType::PROXY:
+    case NodeType::SIMULATION:
       return DEG_SCENE_COMP_PARAMETERS;
   }
   BLI_assert(!"Unhandled node type, not suppsed to happen.");
@@ -245,6 +248,7 @@ eDepsObjectComponentType nodeTypeToObjectComponent(NodeType type)
     case NodeType::BATCH_CACHE:
     case NodeType::DUPLI:
     case NodeType::SYNCHRONIZATION:
+    case NodeType::SIMULATION:
     case NodeType::UNDEFINED:
     case NodeType::NUM_TYPES:
       return DEG_OB_COMP_PARAMETERS;
diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h
index ffa37341ea6..75a3762192d 100644
--- a/source/blender/depsgraph/intern/node/deg_node.h
+++ b/source/blender/depsgraph/intern/node/deg_node.h
@@ -127,6 +127,8 @@ enum class NodeType {
   DUPLI,
   /* Synchronization back to original datablock. */
   SYNCHRONIZATION,
+  /* Simulation component. */
+  SIMULATION,
 
   /* Total number of meaningful node types. */
   NUM_TYPES,
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index 54796b8965b..f9279f7e363 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -368,6 +368,7 @@ DEG_COMPONENT_NODE_DEFINE(Synchronization, SYNCHRONIZATION, 0);
 DEG_COMPONENT_NODE_DEFINE(Audio, AUDIO, 0);
 DEG_COMPONENT_NODE_DEFINE(Armature, ARMATURE, 0);
 DEG_COMPONENT_NODE_DEFINE(GenericDatablock, GENERIC_DATABLOCK, 0);
+DEG_COMPONENT_NODE_DEFINE(Simulation, SIMULATION, 0);
 
 /* Node Types Register =================================== */
 
@@ -397,6 +398,7 @@ void deg_register_component_depsnodes()
   register_node_typeinfo(&DNTI_AUDIO);
   register_node_typeinfo(&DNTI_ARMATURE);
   register_node_typeinfo(&DNTI_GENERIC_DATABLOCK);
+  register_node_typeinfo(&DNTI_SIMULATION);
 }
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h
index 38ea4005a72..431d29e40a5 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.h
+++ b/source/blender/depsgraph/intern/node/deg_node_component.h
@@ -190,6 +190,7 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Synchronization);
 DEG_COMPONENT_NODE_DECLARE_GENERIC(Audio);
 DEG_COMPONENT_NODE_DECLARE_GENERIC(Armature);
 DEG_COMPONENT_NODE_DECLARE_GENERIC(GenericDatablock);
+DEG_COMPONENT_NODE_DECLARE_GENERIC(Simulation);
 
 /* Bone Component */
 struct BoneComponentNode : public ComponentNode {
diff --git a/source/blender/modifiers/intern/MOD_simulation_access.cc b/source/blender/modifiers/intern/MOD_simulation_access.cc
index 508f056a2bd..220d86e563d 100644
--- a/source/blender/modifiers/intern/MOD_simulation_access.cc
+++ b/source/blender/modifiers/intern/MOD_simulation_access.cc
@@ -21,6 +21,9 @@
  * \ingroup modifiers
  */
 
+#include <iostream>
+#include <string>
+
 #include "MEM_guardedalloc.h"
 
 #include "BLI_utildefines.h"
@@ -72,7 +75,7 @@ static PointCloud *modifyPointCloud(ModifierData *md,
                                     PointCloud *pointcloud)
 {
   Scene *scene = DEG_get_input_scene(ctx->depsgraph);
-  printf("Run modifier in frame: %d\n", scene->r.cfra);
+  std::cout << "Eval Modifier\n";
   SimulationAccessModifierData *samd = (SimulationAccessModifierData *)md;
   UNUSED_VARS(samd);
   return pointcloud;



More information about the Bf-blender-cvs mailing list