Simulations: Add simulation node tree type
This implements a new builtin node tree type called `SimulationNodeTree`. It is not yet embedded in the `Simulation` data block. The node tree will initially be used for the new particle nodes system. When the cmake option `WITH_NEW_SIMULATION_TYPE` is enabled, a new `Simulation Editor` is shown in the editors menu (which is just a node editor). This patch does not add entries to the Add Node menu, so it is empty. Reviewers: brecht Differential Revision: https://developer.blender.org/D7287
This commit is contained in:
@@ -67,6 +67,7 @@
|
|||||||
#include "NOD_common.h"
|
#include "NOD_common.h"
|
||||||
#include "NOD_composite.h"
|
#include "NOD_composite.h"
|
||||||
#include "NOD_shader.h"
|
#include "NOD_shader.h"
|
||||||
|
#include "NOD_simulation.h"
|
||||||
#include "NOD_socket.h"
|
#include "NOD_socket.h"
|
||||||
#include "NOD_texture.h"
|
#include "NOD_texture.h"
|
||||||
|
|
||||||
@@ -4114,6 +4115,11 @@ static void registerTextureNodes(void)
|
|||||||
register_node_type_tex_proc_distnoise();
|
register_node_type_tex_proc_distnoise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void registerSimulationNodes(void)
|
||||||
|
{
|
||||||
|
register_node_type_sim_group();
|
||||||
|
}
|
||||||
|
|
||||||
void init_nodesystem(void)
|
void init_nodesystem(void)
|
||||||
{
|
{
|
||||||
nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh");
|
nodetreetypes_hash = BLI_ghash_str_new("nodetreetypes_hash gh");
|
||||||
@@ -4127,6 +4133,7 @@ void init_nodesystem(void)
|
|||||||
register_node_tree_type_cmp();
|
register_node_tree_type_cmp();
|
||||||
register_node_tree_type_sh();
|
register_node_tree_type_sh();
|
||||||
register_node_tree_type_tex();
|
register_node_tree_type_tex();
|
||||||
|
register_node_tree_type_sim();
|
||||||
|
|
||||||
register_node_type_frame();
|
register_node_type_frame();
|
||||||
register_node_type_reroute();
|
register_node_type_reroute();
|
||||||
@@ -4136,6 +4143,7 @@ void init_nodesystem(void)
|
|||||||
registerCompositNodes();
|
registerCompositNodes();
|
||||||
registerShaderNodes();
|
registerShaderNodes();
|
||||||
registerTextureNodes();
|
registerTextureNodes();
|
||||||
|
registerSimulationNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_nodesystem(void)
|
void free_nodesystem(void)
|
||||||
|
@@ -99,6 +99,7 @@ void ED_node_set_tree_type(struct SpaceNode *snode, struct bNodeTreeType *typein
|
|||||||
bool ED_node_is_compositor(struct SpaceNode *snode);
|
bool ED_node_is_compositor(struct SpaceNode *snode);
|
||||||
bool ED_node_is_shader(struct SpaceNode *snode);
|
bool ED_node_is_shader(struct SpaceNode *snode);
|
||||||
bool ED_node_is_texture(struct SpaceNode *snode);
|
bool ED_node_is_texture(struct SpaceNode *snode);
|
||||||
|
bool ED_node_is_simulation(struct SpaceNode *snode);
|
||||||
|
|
||||||
void ED_node_shader_default(const struct bContext *C, struct ID *id);
|
void ED_node_shader_default(const struct bContext *C, struct ID *id);
|
||||||
void ED_node_composit_default(const struct bContext *C, struct Scene *scene);
|
void ED_node_composit_default(const struct bContext *C, struct Scene *scene);
|
||||||
|
@@ -75,6 +75,10 @@ if(WITH_OPENIMAGEDENOISE)
|
|||||||
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
add_definitions(-DWITH_OPENIMAGEDENOISE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WITH_NEW_SIMULATION_TYPE)
|
||||||
|
add_definitions(-DWITH_NEW_SIMULATION_TYPE)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_definitions(${GL_DEFINITIONS})
|
add_definitions(${GL_DEFINITIONS})
|
||||||
|
|
||||||
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
blender_add_lib(bf_editor_space_node "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||||
|
@@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
#include "NOD_composite.h"
|
#include "NOD_composite.h"
|
||||||
#include "NOD_shader.h"
|
#include "NOD_shader.h"
|
||||||
|
#include "NOD_simulation.h"
|
||||||
#include "NOD_texture.h"
|
#include "NOD_texture.h"
|
||||||
#include "node_intern.h" /* own include */
|
#include "node_intern.h" /* own include */
|
||||||
|
|
||||||
@@ -3122,6 +3123,12 @@ static void node_texture_set_butfunc(bNodeType *ntype)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ****************** BUTTON CALLBACKS FOR SIMULATION NODES ***************** */
|
||||||
|
|
||||||
|
static void node_simulation_set_butfunc(bNodeType *UNUSED(ntype))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/* ****** init draw callbacks for all tree types, only called in usiblender.c, once ************ */
|
/* ****** init draw callbacks for all tree types, only called in usiblender.c, once ************ */
|
||||||
|
|
||||||
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
static void node_property_update_default(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
|
||||||
@@ -3230,6 +3237,7 @@ void ED_node_init_butfuncs(void)
|
|||||||
node_composit_set_butfunc(ntype);
|
node_composit_set_butfunc(ntype);
|
||||||
node_shader_set_butfunc(ntype);
|
node_shader_set_butfunc(ntype);
|
||||||
node_texture_set_butfunc(ntype);
|
node_texture_set_butfunc(ntype);
|
||||||
|
node_simulation_set_butfunc(ntype);
|
||||||
|
|
||||||
/* define update callbacks for socket properties */
|
/* define update callbacks for socket properties */
|
||||||
node_template_properties_update(ntype);
|
node_template_properties_update(ntype);
|
||||||
@@ -3240,6 +3248,7 @@ void ED_node_init_butfuncs(void)
|
|||||||
ntreeType_Composite->ui_icon = ICON_NODE_COMPOSITING;
|
ntreeType_Composite->ui_icon = ICON_NODE_COMPOSITING;
|
||||||
ntreeType_Shader->ui_icon = ICON_NODE_MATERIAL;
|
ntreeType_Shader->ui_icon = ICON_NODE_MATERIAL;
|
||||||
ntreeType_Texture->ui_icon = ICON_NODE_TEXTURE;
|
ntreeType_Texture->ui_icon = ICON_NODE_TEXTURE;
|
||||||
|
ntreeType_Simulation->ui_icon = ICON_PHYSICS; /* TODO: Use correct icon. */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ED_init_custom_node_type(bNodeType *ntype)
|
void ED_init_custom_node_type(bNodeType *ntype)
|
||||||
|
@@ -69,6 +69,7 @@
|
|||||||
|
|
||||||
#include "NOD_composite.h"
|
#include "NOD_composite.h"
|
||||||
#include "NOD_shader.h"
|
#include "NOD_shader.h"
|
||||||
|
#include "NOD_simulation.h"
|
||||||
#include "NOD_texture.h"
|
#include "NOD_texture.h"
|
||||||
#include "node_intern.h" /* own include */
|
#include "node_intern.h" /* own include */
|
||||||
|
|
||||||
@@ -438,6 +439,11 @@ bool ED_node_is_texture(struct SpaceNode *snode)
|
|||||||
return STREQ(snode->tree_idname, ntreeType_Texture->idname);
|
return STREQ(snode->tree_idname, ntreeType_Texture->idname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ED_node_is_simulation(struct SpaceNode *snode)
|
||||||
|
{
|
||||||
|
return STREQ(snode->tree_idname, ntreeType_Simulation->idname);
|
||||||
|
}
|
||||||
|
|
||||||
/* assumes nothing being done in ntree yet, sets the default in/out node */
|
/* assumes nothing being done in ntree yet, sets the default in/out node */
|
||||||
/* called from shading buttons or header */
|
/* called from shading buttons or header */
|
||||||
void ED_node_shader_default(const bContext *C, ID *id)
|
void ED_node_shader_default(const bContext *C, ID *id)
|
||||||
|
@@ -69,7 +69,8 @@ static bool node_group_operator_active(bContext *C)
|
|||||||
*/
|
*/
|
||||||
if (STREQ(snode->tree_idname, "ShaderNodeTree") ||
|
if (STREQ(snode->tree_idname, "ShaderNodeTree") ||
|
||||||
STREQ(snode->tree_idname, "CompositorNodeTree") ||
|
STREQ(snode->tree_idname, "CompositorNodeTree") ||
|
||||||
STREQ(snode->tree_idname, "TextureNodeTree")) {
|
STREQ(snode->tree_idname, "TextureNodeTree") ||
|
||||||
|
STREQ(snode->tree_idname, "SimulationNodeTree")) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,7 +86,8 @@ static bool node_group_operator_editable(bContext *C)
|
|||||||
* Disabled otherwise to allow pynodes define their own operators
|
* Disabled otherwise to allow pynodes define their own operators
|
||||||
* with same keymap.
|
* with same keymap.
|
||||||
*/
|
*/
|
||||||
if (ED_node_is_shader(snode) || ED_node_is_compositor(snode) || ED_node_is_texture(snode)) {
|
if (ED_node_is_shader(snode) || ED_node_is_compositor(snode) || ED_node_is_texture(snode) ||
|
||||||
|
ED_node_is_simulation(snode)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,6 +113,9 @@ static const char *group_node_idname(bContext *C)
|
|||||||
else if (ED_node_is_texture(snode)) {
|
else if (ED_node_is_texture(snode)) {
|
||||||
return "TextureNodeGroup";
|
return "TextureNodeGroup";
|
||||||
}
|
}
|
||||||
|
else if (ED_node_is_simulation(snode)) {
|
||||||
|
return "SimulationNodeGroup";
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@@ -938,6 +938,11 @@ static void node_space_subtype_item_extend(bContext *C, EnumPropertyItem **item,
|
|||||||
bool free;
|
bool free;
|
||||||
const EnumPropertyItem *item_src = RNA_enum_node_tree_types_itemf_impl(C, &free);
|
const EnumPropertyItem *item_src = RNA_enum_node_tree_types_itemf_impl(C, &free);
|
||||||
for (const EnumPropertyItem *item_iter = item_src; item_iter->identifier; item_iter++) {
|
for (const EnumPropertyItem *item_iter = item_src; item_iter->identifier; item_iter++) {
|
||||||
|
#ifndef WITH_NEW_SIMULATION_TYPE
|
||||||
|
if (STREQ(item_iter->identifier, "SimulationNodeTree")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
RNA_enum_item_add(item, totitem, item_iter);
|
RNA_enum_item_add(item, totitem, item_iter);
|
||||||
}
|
}
|
||||||
if (free) {
|
if (free) {
|
||||||
|
@@ -498,6 +498,7 @@ typedef struct bNodeTree {
|
|||||||
#define NTREE_SHADER 0
|
#define NTREE_SHADER 0
|
||||||
#define NTREE_COMPOSIT 1
|
#define NTREE_COMPOSIT 1
|
||||||
#define NTREE_TEXTURE 2
|
#define NTREE_TEXTURE 2
|
||||||
|
#define NTREE_SIMULATION 3
|
||||||
|
|
||||||
/* ntree->init, flag */
|
/* ntree->init, flag */
|
||||||
#define NTREE_TYPE_INIT 1
|
#define NTREE_TYPE_INIT 1
|
||||||
|
@@ -549,6 +549,8 @@ extern StructRNA RNA_ShrinkwrapModifier;
|
|||||||
extern StructRNA RNA_SimpleDeformModifier;
|
extern StructRNA RNA_SimpleDeformModifier;
|
||||||
extern StructRNA RNA_SimplifyGpencilModifier;
|
extern StructRNA RNA_SimplifyGpencilModifier;
|
||||||
extern StructRNA RNA_Simulation;
|
extern StructRNA RNA_Simulation;
|
||||||
|
extern StructRNA RNA_SimulationNode;
|
||||||
|
extern StructRNA RNA_SimulationNodeTree;
|
||||||
extern StructRNA RNA_SkinModifier;
|
extern StructRNA RNA_SkinModifier;
|
||||||
extern StructRNA RNA_SmoothGpencilModifier;
|
extern StructRNA RNA_SmoothGpencilModifier;
|
||||||
extern StructRNA RNA_SmoothModifier;
|
extern StructRNA RNA_SmoothModifier;
|
||||||
|
@@ -669,6 +669,20 @@ static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C),
|
|||||||
# undef DefNode
|
# undef DefNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RNA_struct_is_a(ptr->type, &RNA_SimulationNode)) {
|
||||||
|
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
|
||||||
|
if (STREQ(#Category, "SimulationNode")) { \
|
||||||
|
tmp.value = ID; \
|
||||||
|
tmp.identifier = EnumName; \
|
||||||
|
tmp.name = UIName; \
|
||||||
|
tmp.description = UIDesc; \
|
||||||
|
tmp.icon = ICON_NONE; \
|
||||||
|
RNA_enum_item_add(&item, &totitem, &tmp); \
|
||||||
|
}
|
||||||
|
# include "../../nodes/NOD_static_types.h"
|
||||||
|
# undef DefNode
|
||||||
|
}
|
||||||
|
|
||||||
RNA_enum_item_end(&item, &totitem);
|
RNA_enum_item_end(&item, &totitem);
|
||||||
*r_free = true;
|
*r_free = true;
|
||||||
|
|
||||||
@@ -1785,6 +1799,28 @@ static StructRNA *rna_TextureNode_register(Main *bmain,
|
|||||||
return nt->rna_ext.srna;
|
return nt->rna_ext.srna;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static StructRNA *rna_SimulationNode_register(Main *bmain,
|
||||||
|
ReportList *reports,
|
||||||
|
void *data,
|
||||||
|
const char *identifier,
|
||||||
|
StructValidateFunc validate,
|
||||||
|
StructCallbackFunc call,
|
||||||
|
StructFreeFunc free)
|
||||||
|
{
|
||||||
|
bNodeType *nt = rna_Node_register_base(
|
||||||
|
bmain, reports, &RNA_SimulationNode, data, identifier, validate, call, free);
|
||||||
|
if (!nt) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
nodeRegisterType(nt);
|
||||||
|
|
||||||
|
/* update while blender is running */
|
||||||
|
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
||||||
|
|
||||||
|
return nt->rna_ext.srna;
|
||||||
|
}
|
||||||
|
|
||||||
static IDProperty *rna_Node_idprops(PointerRNA *ptr, bool create)
|
static IDProperty *rna_Node_idprops(PointerRNA *ptr, bool create)
|
||||||
{
|
{
|
||||||
bNode *node = ptr->data;
|
bNode *node = ptr->data;
|
||||||
@@ -7936,6 +7972,16 @@ static void rna_def_texture_node(BlenderRNA *brna)
|
|||||||
RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
|
RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void rna_def_simulation_node(BlenderRNA *brna)
|
||||||
|
{
|
||||||
|
StructRNA *srna;
|
||||||
|
|
||||||
|
srna = RNA_def_struct(brna, "SimulationNode", "NodeInternal");
|
||||||
|
RNA_def_struct_ui_text(srna, "Simulation Node", "");
|
||||||
|
RNA_def_struct_sdna(srna, "bNode");
|
||||||
|
RNA_def_struct_register_funcs(srna, "rna_SimulationNode_register", "rna_Node_unregister", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static void rna_def_node_socket(BlenderRNA *brna)
|
static void rna_def_node_socket(BlenderRNA *brna)
|
||||||
@@ -9251,6 +9297,7 @@ static void rna_def_nodetree(BlenderRNA *brna)
|
|||||||
{NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
|
{NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
|
||||||
{NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
|
{NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
|
||||||
{NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
|
{NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
|
||||||
|
{NTREE_SIMULATION, "SIMULATION", ICON_PHYSICS, "Simulation", "Simulation nodes"},
|
||||||
{0, NULL, 0, NULL, NULL},
|
{0, NULL, 0, NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -9474,6 +9521,17 @@ static void rna_def_texture_nodetree(BlenderRNA *brna)
|
|||||||
RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
|
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, ICON_PHYSICS); /* TODO: Use correct icon. */
|
||||||
|
}
|
||||||
|
|
||||||
static StructRNA *define_specific_node(BlenderRNA *brna,
|
static StructRNA *define_specific_node(BlenderRNA *brna,
|
||||||
const char *struct_name,
|
const char *struct_name,
|
||||||
const char *base_name,
|
const char *base_name,
|
||||||
@@ -9560,6 +9618,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
|
|||||||
rna_def_shader_node(brna);
|
rna_def_shader_node(brna);
|
||||||
rna_def_compositor_node(brna);
|
rna_def_compositor_node(brna);
|
||||||
rna_def_texture_node(brna);
|
rna_def_texture_node(brna);
|
||||||
|
rna_def_simulation_node(brna);
|
||||||
|
|
||||||
rna_def_nodetree(brna);
|
rna_def_nodetree(brna);
|
||||||
|
|
||||||
@@ -9568,6 +9627,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
|
|||||||
rna_def_composite_nodetree(brna);
|
rna_def_composite_nodetree(brna);
|
||||||
rna_def_shader_nodetree(brna);
|
rna_def_shader_nodetree(brna);
|
||||||
rna_def_texture_nodetree(brna);
|
rna_def_texture_nodetree(brna);
|
||||||
|
rna_def_simulation_nodetree(brna);
|
||||||
|
|
||||||
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
|
# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
|
||||||
{ \
|
{ \
|
||||||
@@ -9584,12 +9644,13 @@ void RNA_def_nodetree(BlenderRNA *brna)
|
|||||||
*/
|
*/
|
||||||
# include "../../nodes/NOD_static_types.h"
|
# include "../../nodes/NOD_static_types.h"
|
||||||
|
|
||||||
/* Node group types need to be defined for shader, compositor, texture nodes individually.
|
/* Node group types need to be defined for shader, compositor, texture, simulation nodes
|
||||||
* Cannot use the static types header for this, since they share the same int id.
|
* individually. Cannot use the static types header for this, since they share the same int id.
|
||||||
*/
|
*/
|
||||||
define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
|
define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
|
||||||
define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
|
define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
|
||||||
define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
|
define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
|
||||||
|
define_specific_node(brna, "SimulationNodeGroup", "SimulationNode", "Group", "", def_group);
|
||||||
def_custom_group(brna,
|
def_custom_group(brna,
|
||||||
"ShaderNodeCustomGroup",
|
"ShaderNodeCustomGroup",
|
||||||
"ShaderNode",
|
"ShaderNode",
|
||||||
|
@@ -23,6 +23,7 @@ set(INC
|
|||||||
composite
|
composite
|
||||||
intern
|
intern
|
||||||
shader
|
shader
|
||||||
|
simulation
|
||||||
texture
|
texture
|
||||||
../blenkernel
|
../blenkernel
|
||||||
../blenlib
|
../blenlib
|
||||||
@@ -220,6 +221,10 @@ set(SRC
|
|||||||
shader/node_shader_tree.c
|
shader/node_shader_tree.c
|
||||||
shader/node_shader_util.c
|
shader/node_shader_util.c
|
||||||
|
|
||||||
|
simulation/nodes/node_sim_common.cc
|
||||||
|
simulation/node_simulation_tree.cc
|
||||||
|
simulation/node_simulation_util.cc
|
||||||
|
|
||||||
texture/nodes/node_texture_at.c
|
texture/nodes/node_texture_at.c
|
||||||
texture/nodes/node_texture_bricks.c
|
texture/nodes/node_texture_bricks.c
|
||||||
texture/nodes/node_texture_checker.c
|
texture/nodes/node_texture_checker.c
|
||||||
@@ -253,11 +258,13 @@ set(SRC
|
|||||||
|
|
||||||
composite/node_composite_util.h
|
composite/node_composite_util.h
|
||||||
shader/node_shader_util.h
|
shader/node_shader_util.h
|
||||||
|
simulation/node_simulation_util.h
|
||||||
texture/node_texture_util.h
|
texture/node_texture_util.h
|
||||||
|
|
||||||
NOD_common.h
|
NOD_common.h
|
||||||
NOD_composite.h
|
NOD_composite.h
|
||||||
NOD_shader.h
|
NOD_shader.h
|
||||||
|
NOD_simulation.h
|
||||||
NOD_socket.h
|
NOD_socket.h
|
||||||
NOD_static_types.h
|
NOD_static_types.h
|
||||||
NOD_texture.h
|
NOD_texture.h
|
||||||
|
@@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
#include "BKE_node.h"
|
#include "BKE_node.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
void register_node_type_frame(void);
|
void register_node_type_frame(void);
|
||||||
void register_node_type_reroute(void);
|
void register_node_type_reroute(void);
|
||||||
|
|
||||||
@@ -42,4 +46,8 @@ struct bNodeSocket *node_group_output_find_socket(struct bNode *node, const char
|
|||||||
void node_group_input_update(struct bNodeTree *ntree, struct bNode *node);
|
void node_group_input_update(struct bNodeTree *ntree, struct bNode *node);
|
||||||
void node_group_output_update(struct bNodeTree *ntree, struct bNode *node);
|
void node_group_output_update(struct bNodeTree *ntree, struct bNode *node);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* __NOD_COMMON_H__ */
|
#endif /* __NOD_COMMON_H__ */
|
||||||
|
34
source/blender/nodes/NOD_simulation.h
Normal file
34
source/blender/nodes/NOD_simulation.h
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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);
|
||||||
|
|
||||||
|
void register_node_type_sim_group(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __NOD_SIMULATION_H__ */
|
@@ -26,6 +26,10 @@
|
|||||||
|
|
||||||
#include "DNA_listBase.h"
|
#include "DNA_listBase.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct bNodeTree;
|
struct bNodeTree;
|
||||||
|
|
||||||
void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
|
void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
|
||||||
@@ -33,4 +37,8 @@ bool node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree);
|
|||||||
|
|
||||||
void ntree_update_reroute_nodes(struct bNodeTree *ntree);
|
void ntree_update_reroute_nodes(struct bNodeTree *ntree);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -38,6 +38,10 @@
|
|||||||
|
|
||||||
#include "RNA_access.h"
|
#include "RNA_access.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
struct bNode;
|
struct bNode;
|
||||||
struct bNodeTree;
|
struct bNodeTree;
|
||||||
|
|
||||||
@@ -103,4 +107,8 @@ void node_socket_set_vector(struct bNodeTree *ntree,
|
|||||||
struct bNodeSocket *sock,
|
struct bNodeSocket *sock,
|
||||||
const float *value);
|
const float *value);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
45
source/blender/nodes/simulation/node_simulation_tree.cc
Normal file
45
source/blender/nodes/simulation/node_simulation_tree.cc
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#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->rna_ext.srna = &RNA_SimulationNodeTree;
|
||||||
|
|
||||||
|
ntreeTypeAdd(tt);
|
||||||
|
}
|
29
source/blender/nodes/simulation/node_simulation_util.cc
Normal file
29
source/blender/nodes/simulation/node_simulation_util.cc
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "node_simulation_util.h"
|
||||||
|
#include "node_util.h"
|
||||||
|
|
||||||
|
bool sim_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree)
|
||||||
|
{
|
||||||
|
return STREQ(ntree->idname, "SimulationNodeTree");
|
||||||
|
}
|
||||||
|
|
||||||
|
void sim_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
|
||||||
|
{
|
||||||
|
node_type_base(ntype, type, name, nclass, flag);
|
||||||
|
ntype->poll = sim_node_poll_default;
|
||||||
|
}
|
40
source/blender/nodes/simulation/node_simulation_util.h
Normal file
40
source/blender/nodes/simulation/node_simulation_util.h
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __NODE_SIM_UTIL_H__
|
||||||
|
#define __NODE_SIM_UTIL_H__
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "BLI_utildefines.h"
|
||||||
|
|
||||||
|
#include "MEM_guardedalloc.h"
|
||||||
|
|
||||||
|
#include "DNA_node_types.h"
|
||||||
|
|
||||||
|
#include "BKE_node.h"
|
||||||
|
|
||||||
|
#include "BLT_translation.h"
|
||||||
|
|
||||||
|
#include "NOD_simulation.h"
|
||||||
|
|
||||||
|
#include "node_util.h"
|
||||||
|
|
||||||
|
void sim_node_type_base(
|
||||||
|
struct bNodeType *ntype, int type, const char *name, short nclass, short flag);
|
||||||
|
bool sim_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree);
|
||||||
|
|
||||||
|
#endif /* __NODE_SIM_UTIL_H__ */
|
45
source/blender/nodes/simulation/nodes/node_sim_common.cc
Normal file
45
source/blender/nodes/simulation/nodes/node_sim_common.cc
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "BKE_node.h"
|
||||||
|
|
||||||
|
#include "NOD_simulation.h"
|
||||||
|
|
||||||
|
#include "NOD_common.h"
|
||||||
|
#include "node_common.h"
|
||||||
|
#include "node_simulation_util.h"
|
||||||
|
|
||||||
|
void register_node_type_sim_group(void)
|
||||||
|
{
|
||||||
|
static bNodeType ntype;
|
||||||
|
|
||||||
|
node_type_base_custom(&ntype, "SimulationNodeGroup", "Group", 0, 0);
|
||||||
|
ntype.type = NODE_GROUP;
|
||||||
|
ntype.poll = sim_node_poll_default;
|
||||||
|
ntype.poll_instance = node_group_poll_instance;
|
||||||
|
ntype.insert_link = node_insert_link_default;
|
||||||
|
ntype.update_internal_links = node_update_internal_links_default;
|
||||||
|
ntype.rna_ext.srna = RNA_struct_find("SimulationNodeGroup");
|
||||||
|
BLI_assert(ntype.rna_ext.srna != NULL);
|
||||||
|
RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype);
|
||||||
|
|
||||||
|
node_type_socket_templates(&ntype, NULL, NULL);
|
||||||
|
node_type_size(&ntype, 140, 60, 400);
|
||||||
|
node_type_label(&ntype, node_group_label);
|
||||||
|
node_type_group_update(&ntype, node_group_update);
|
||||||
|
|
||||||
|
nodeRegisterType(&ntype);
|
||||||
|
}
|
Reference in New Issue
Block a user