[Bf-blender-cvs] [630da3b5e35] functions: Initial builtin simulation node tree type
Jacques Lucke
noreply at git.blender.org
Thu Feb 13 12:04:53 CET 2020
Commit: 630da3b5e3539ca3bda80a8342b899afc6bfd306
Author: Jacques Lucke
Date: Thu Feb 13 12:04:41 2020 +0100
Branches: functions
https://developer.blender.org/rB630da3b5e3539ca3bda80a8342b899afc6bfd306
Initial builtin simulation node tree type
===================================================================
M source/blender/blenkernel/CMakeLists.txt
M source/blender/blenkernel/intern/node.c
M source/blender/editors/space_node/CMakeLists.txt
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/makesrna/intern/rna_nodetree.c
M source/blender/simulations/CMakeLists.txt
A source/blender/simulations/nodes/SIM_node_tree.h
A source/blender/simulations/nodes/simulation_node_tree.cc
===================================================================
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 1eb2e915670..efcf8a892f3 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -37,6 +37,7 @@ set(INC
../nodes
../physics
../shader_fx
+ ../simulations
../render/extern/include
../../../intern/ghost
../../../intern/glew-mx
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 2a8c9f2a40b..7eb548337bc 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -68,6 +68,8 @@
#include "NOD_shader.h"
#include "NOD_texture.h"
+#include "nodes/SIM_node_tree.h"
+
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@@ -4110,6 +4112,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/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index f8c30f9a688..3f12d6309bd 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -30,6 +30,7 @@ set(INC
../../render/extern/include
../../compositor
../../windowmanager
+ ../../simulations/nodes
../../../../intern/glew-mx
../../../../intern/guardedalloc
)
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 121c597c1bb..d7a5e81466f 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -72,6 +72,8 @@
#include "NOD_shader.h"
#include "NOD_texture.h"
+#include "SIM_node_tree.h"
+
/* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */
static void node_socket_button_label(bContext *UNUSED(C),
@@ -3223,6 +3225,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; /* TODO: new icon */
}
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 559048ab8cf..5e0096f05e2 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 063bdc30fd6..adf74057bb3 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -599,6 +599,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/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 7efd01bbef9..b2a1ed4eb89 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -9403,6 +9403,17 @@ static void rna_def_texture_nodetree(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
}
+static void rna_def_simulation_nodetree(BlenderRNA *brna)
+{
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "SimulationNodeTree", "NodeTree");
+ RNA_def_struct_ui_text(
+ srna, "Simulation Node Tree", "Node tree consisting of linked nodes used for simulations");
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, 0 /* TODO */);
+}
+
static StructRNA *define_specific_node(BlenderRNA *brna,
const char *struct_name,
const char *base_name,
@@ -9497,6 +9508,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
rna_def_composite_nodetree(brna);
rna_def_shader_nodetree(brna);
rna_def_texture_nodetree(brna);
+ rna_def_simulation_nodetree(brna);
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
{ \
diff --git a/source/blender/simulations/CMakeLists.txt b/source/blender/simulations/CMakeLists.txt
index 331b0c6f85b..a58bb8ea97c 100644
--- a/source/blender/simulations/CMakeLists.txt
+++ b/source/blender/simulations/CMakeLists.txt
@@ -7,6 +7,8 @@ set(INC
../depsgraph
../functions
../imbuf
+ ../blentranslation
+ ../editors/include
../../../intern/guardedalloc
)
@@ -55,6 +57,9 @@ set(SRC
bparticles/particle_set.cpp
bparticles/force_interface.hpp
bparticles/force_interface.cpp
+
+ nodes/SIM_node_tree.h
+ nodes/simulation_node_tree.cc
)
set(LIB
diff --git a/source/blender/simulations/nodes/SIM_node_tree.h b/source/blender/simulations/nodes/SIM_node_tree.h
new file mode 100644
index 00000000000..ee370dd556d
--- /dev/null
+++ b/source/blender/simulations/nodes/SIM_node_tree.h
@@ -0,0 +1,16 @@
+#ifndef __SIM_NODE_TREE_H__
+#define __SIM_NODE_TREE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern struct bNodeTreeType *ntreeType_Simulation;
+
+void register_node_tree_type_sim(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __SIM_NODE_TREE_H__ */
diff --git a/source/blender/simulations/nodes/simulation_node_tree.cc b/source/blender/simulations/nodes/simulation_node_tree.cc
new file mode 100644
index 00000000000..4f231a509c8
--- /dev/null
+++ b/source/blender/simulations/nodes/simulation_node_tree.cc
@@ -0,0 +1,23 @@
+#include <cstring>
+
+#include "SIM_node_tree.h"
+#include "BKE_node.h"
+#include "MEM_guardedalloc.h"
+#include "BLT_translation.h"
+#include "RNA_access.h"
+
+bNodeTreeType *ntreeType_Simulation;
+
+void register_node_tree_type_sim()
+{
+ 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"));
+ strcpy(tt->ui_description, N_("Simulation nodes"));
+ tt->ui_icon = 0; /* Defined in drawnode.c */
+ tt->ext.srna = &RNA_SimulationNodeTree;
+
+ ntreeTypeAdd(tt);
+}
More information about the Bf-blender-cvs
mailing list