[Bf-blender-cvs] [e6120eaa344] simulation-tree: work towards defining a node in one file
Jacques Lucke
noreply at git.blender.org
Wed Feb 19 16:12:02 CET 2020
Commit: e6120eaa34432ea4bae674a94afbe571e5d4b5d8
Author: Jacques Lucke
Date: Wed Feb 19 10:51:18 2020 +0100
Branches: simulation-tree
https://developer.blender.org/rBe6120eaa34432ea4bae674a94afbe571e5d4b5d8
work towards defining a node in one file
===================================================================
M source/blender/blenkernel/intern/node.c
M source/blender/editors/space_node/drawnode.c
M source/blender/editors/space_node/node_intern.h
M source/blender/simulations/nodes/my_test_node.cc
M source/blender/simulations/nodes/simulation_node_tree.cc
M source/blender/windowmanager/CMakeLists.txt
M source/blender/windowmanager/intern/wm_init_exit.c
===================================================================
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index c8b1007b8c0..e06cd7665f8 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -68,8 +68,6 @@
#include "NOD_shader.h"
#include "NOD_texture.h"
-#include "nodes/SIM_node_tree.h"
-
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@@ -4116,7 +4114,6 @@ 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 a61c2e72664..781c95967d1 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -273,7 +273,7 @@ static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *pt
uiItemR(layout, ptr, "use_clamp", 0, NULL, ICON_NONE);
}
-static int node_resize_area_default(bNode *node, int x, int y)
+int node_resize_area_default(bNode *node, int x, int y)
{
if (node->flag & NODE_HIDDEN) {
rctf totr = node->totr;
@@ -3223,7 +3223,7 @@ void ED_node_init_butfuncs(void)
ntype->draw_nodetype_prepare = node_update_default;
ntype->select_area_func = node_select_area_default;
ntype->tweak_area_func = node_tweak_area_default;
- // ntype->draw_buttons = NULL; /* TODO */
+ ntype->draw_buttons = NULL;
ntype->draw_buttons_ex = NULL;
ntype->resize_area_func = node_resize_area_default;
@@ -3242,7 +3242,6 @@ 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/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h
index 1825396805c..615b49a5c65 100644
--- a/source/blender/editors/space_node/node_intern.h
+++ b/source/blender/editors/space_node/node_intern.h
@@ -28,6 +28,10 @@
#include "BKE_node.h"
#include "UI_interface.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* internal exports only */
struct ARegion;
@@ -77,6 +81,7 @@ void node_draw_sockets(struct View2D *v2d,
void node_update_default(const struct bContext *C, struct bNodeTree *ntree, struct bNode *node);
int node_select_area_default(struct bNode *node, int x, int y);
int node_tweak_area_default(struct bNode *node, int x, int y);
+int node_resize_area_default(bNode *node, int x, int y);
void node_update_nodetree(const struct bContext *C, struct bNodeTree *ntree);
void node_draw_nodetree(const struct bContext *C,
struct ARegion *ar,
@@ -296,4 +301,8 @@ enum eNodeSpace_ButEvents {
B_NODE_SETIMAGE,
};
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __NODE_INTERN_H__ */
diff --git a/source/blender/simulations/nodes/my_test_node.cc b/source/blender/simulations/nodes/my_test_node.cc
index 5339e5dff57..dbfd53aade0 100644
--- a/source/blender/simulations/nodes/my_test_node.cc
+++ b/source/blender/simulations/nodes/my_test_node.cc
@@ -20,6 +20,8 @@
#include "UI_interface.h"
+#include "../space_node/node_intern.h"
+
using BLI::Array;
using BLI::ArrayRef;
using BLI::LinearAllocator;
@@ -325,6 +327,13 @@ void register_node_type_my_test_node()
ntype.poll = [](bNodeType *UNUSED(ntype), bNodeTree *UNUSED(ntree)) { return true; };
ntype.userdata = (void *)declare_test_node;
+ ntype.draw_nodetype = node_draw_default;
+ ntype.draw_nodetype_prepare = node_update_default;
+ ntype.select_area_func = node_select_area_default;
+ ntype.tweak_area_func = node_tweak_area_default;
+ ntype.draw_buttons_ex = nullptr;
+ ntype.resize_area_func = node_resize_area_default;
+
ntype.draw_buttons = [](uiLayout *layout, struct bContext *UNUSED(C), struct PointerRNA *ptr) {
bNode *node = (bNode *)ptr->data;
MyTestNodeStorage *storage = (MyTestNodeStorage *)node->storage;
diff --git a/source/blender/simulations/nodes/simulation_node_tree.cc b/source/blender/simulations/nodes/simulation_node_tree.cc
index e3a03219b5f..c6409e5f3ca 100644
--- a/source/blender/simulations/nodes/simulation_node_tree.cc
+++ b/source/blender/simulations/nodes/simulation_node_tree.cc
@@ -16,7 +16,7 @@ void register_node_tree_type_sim()
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->ui_icon = 0; /* TODO */
tt->ext.srna = &RNA_SimulationNodeTree;
tt->update = update_sim_node_tree;
diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt
index b256e3e6010..19e71179ae7 100644
--- a/source/blender/windowmanager/CMakeLists.txt
+++ b/source/blender/windowmanager/CMakeLists.txt
@@ -37,6 +37,7 @@ set(INC
../makesrna
../nodes
../functions
+ ../simulations
../render/extern/include
../../../intern/clog
../../../intern/ghost
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 8eb27b21ba9..997b865b8e3 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -132,6 +132,8 @@
#include "FN_initialize.h"
+#include "nodes/SIM_node_tree.h"
+
#ifdef WITH_OPENSUBDIV
# include "BKE_subsurf.h"
#endif
@@ -264,6 +266,7 @@ void WM_init(bContext *C, int argc, const char **argv)
ED_spacetypes_init(); /* editors/space_api/spacetype.c */
ED_node_init_butfuncs();
+ register_node_tree_type_sim();
BLF_init();
More information about the Bf-blender-cvs
mailing list