[Bf-blender-cvs] [174ceea93b4] builtin-simulation-nodes: initial simulation tree type

Jacques Lucke noreply at git.blender.org
Mon Mar 2 13:05:52 CET 2020


Commit: 174ceea93b46f64621b461f6eea903bf5d9c8dc6
Author: Jacques Lucke
Date:   Fri Feb 28 14:05:46 2020 +0100
Branches: builtin-simulation-nodes
https://developer.blender.org/rB174ceea93b46f64621b461f6eea903bf5d9c8dc6

initial simulation tree type

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

M	source/blender/blenkernel/intern/node.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_simulation.h
M	source/blender/nodes/simulation/node_sim_tree.cc

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

diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 9e52f7ea939..9c1b095331d 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -67,6 +67,7 @@
 #include "NOD_composite.h"
 #include "NOD_shader.h"
 #include "NOD_texture.h"
+#include "NOD_simulation.h"
 
 #include "DEG_depsgraph.h"
 #include "DEG_depsgraph_build.h"
@@ -4112,6 +4113,7 @@ void init_nodesystem(void)
   register_node_tree_type_cmp();
   register_node_tree_type_sh();
   register_node_tree_type_tex();
+  register_node_tree_type_sim();
 
   register_node_type_frame();
   register_node_type_reroute();
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 8633ebca8d6..5f6a9260671 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -71,6 +71,7 @@
 #include "NOD_composite.h"
 #include "NOD_shader.h"
 #include "NOD_texture.h"
+#include "NOD_simulation.h"
 
 /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
 
@@ -3239,6 +3240,7 @@ void ED_node_init_butfuncs(void)
   ntreeType_Composite->ui_icon = ICON_NODE_COMPOSITING;
   ntreeType_Shader->ui_icon = ICON_NODE_MATERIAL;
   ntreeType_Texture->ui_icon = ICON_NODE_TEXTURE;
+  ntreeType_Simulation->ui_icon = ICON_PARTICLES;
 }
 
 void ED_init_custom_node_type(bNodeType *ntype)
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 44d44b92499..b6308111d68 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -497,6 +497,7 @@ typedef struct bNodeTree {
 #define NTREE_SHADER 0
 #define NTREE_COMPOSIT 1
 #define NTREE_TEXTURE 2
+#define NTREE_SIMULATION 3
 
 /* ntree->init, flag */
 #define NTREE_TYPE_INIT 1
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index f645d3c8b75..bd6f9148d1e 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -547,6 +547,7 @@ extern StructRNA RNA_ShrinkwrapConstraint;
 extern StructRNA RNA_ShrinkwrapModifier;
 extern StructRNA RNA_SimpleDeformModifier;
 extern StructRNA RNA_SimplifyGpencilModifier;
+extern StructRNA RNA_SimulationNodeTree;
 extern StructRNA RNA_SkinModifier;
 extern StructRNA RNA_SmoothGpencilModifier;
 extern StructRNA RNA_SmoothModifier;
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index 41227a14fb3..eb12f1fe871 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -220,6 +220,8 @@ set(SRC
   shader/node_shader_tree.c
   shader/node_shader_util.c
 
+  simulation/node_sim_tree.cc
+
   texture/nodes/node_texture_at.c
   texture/nodes/node_texture_bricks.c
   texture/nodes/node_texture_checker.c
@@ -258,6 +260,7 @@ set(SRC
   NOD_common.h
   NOD_composite.h
   NOD_shader.h
+  NOD_simulation.h
   NOD_socket.h
   NOD_static_types.h
   NOD_texture.h
diff --git a/source/blender/nodes/NOD_simulation.h b/source/blender/nodes/NOD_simulation.h
index 2695f9cfc57..4625c80bbeb 100644
--- a/source/blender/nodes/NOD_simulation.h
+++ b/source/blender/nodes/NOD_simulation.h
@@ -1,8 +1,16 @@
 #ifndef __NOD_SIMULATION_H__
 #define __NOD_SIMULATION_H__
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 extern struct bNodeTreeType *ntreeType_Simulation;
 
 void register_node_tree_type_sim(void);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* __NOD_SIMULATION_H__ */
\ No newline at end of file
diff --git a/source/blender/nodes/simulation/node_sim_tree.cc b/source/blender/nodes/simulation/node_sim_tree.cc
index 8ef4ebb77a3..fd56d6fd0a7 100644
--- a/source/blender/nodes/simulation/node_sim_tree.cc
+++ b/source/blender/nodes/simulation/node_sim_tree.cc
@@ -1,3 +1,30 @@
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "NOD_simulation.h"
+
+#include "BKE_node.h"
+
+#include "BLT_translation.h"
+
+#include "DNA_node_types.h"
+
+#include "RNA_access.h"
+
+bNodeTreeType *ntreeType_Simulation;
+
 void register_node_tree_type_sim(void)
 {
+  bNodeTreeType *tt = ntreeType_Simulation = (bNodeTreeType *)MEM_callocN(
+      sizeof(bNodeTreeType), "simulation node tree type");
+  tt->type = NTREE_SIMULATION;
+  strcpy(tt->idname, "SimulationNodeTree");
+  strcpy(tt->ui_name, N_("Simulation Editor"));
+  tt->ui_icon = 0; /* defined in drawnode.c */
+  strcpy(tt->ui_description, N_("Simulation nodes"));
+  tt->poll = [](const bContext *UNUSED(C), bNodeTreeType *UNUSED(treetype)) { return true; };
+  tt->ext.srna = &RNA_SimulationNodeTree;
+
+  ntreeTypeAdd(tt);
 }
\ No newline at end of file



More information about the Bf-blender-cvs mailing list