From 2bf519d211b1c51353b827f994494badfdf2569f Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 24 Jan 2022 16:18:30 -0600 Subject: Cleanup: Correct location of node function declarations Currently there are many function declarations in `BKE_node.h` that don't actually have implementations in blenkernel. This commit moves the declarations to `NOD_composite.h`, `NOD_texture.h`, and `NOD_shader.h` instead. This helps to clarify the purpose of the different modules. Differential Revision: https://developer.blender.org/D13869 --- source/blender/blenkernel/BKE_node.h | 111 --------------------- .../blender/blenkernel/intern/node_tree_update.cc | 1 + source/blender/blenkernel/intern/texture.c | 2 + source/blender/blenloader/intern/versioning_260.c | 1 + .../blender/blenloader/intern/versioning_cycles.c | 2 + .../compositor/nodes/COM_CryptomatteNode.cc | 5 +- .../compositor/operations/COM_TextureOperation.cc | 2 + .../editors/interface/interface_eyedropper_color.c | 2 + source/blender/editors/render/CMakeLists.txt | 1 + source/blender/editors/render/render_internal.cc | 2 + source/blender/editors/render/render_shading.cc | 2 + source/blender/editors/render/render_update.cc | 2 + source/blender/editors/sculpt_paint/CMakeLists.txt | 1 + source/blender/editors/sculpt_paint/paint_cursor.c | 2 + source/blender/editors/sculpt_paint/paint_image.c | 2 + source/blender/editors/sculpt_paint/sculpt.c | 2 + source/blender/gpu/intern/gpu_material.c | 2 + source/blender/makesrna/intern/rna_layer.c | 2 + source/blender/makesrna/intern/rna_nodetree.c | 1 + source/blender/makesrna/intern/rna_scene.c | 2 + source/blender/nodes/NOD_composite.h | 69 +++++++++++++ source/blender/nodes/NOD_shader.h | 22 ++++ source/blender/nodes/NOD_texture.h | 16 +++ source/blender/render/intern/pipeline.c | 2 + source/blender/render/intern/texture_procedural.c | 8 +- 25 files changed, 148 insertions(+), 116 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 2f9034f6438..cd6d58f563a 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -1179,30 +1179,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, i #define SH_NODE_VECTOR_ROTATE 708 #define SH_NODE_CURVE_FLOAT 709 -/* API */ - -struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree); -void ntreeShaderEndExecTree(struct bNodeTreeExec *exec); -/** - Find an output node of the shader tree. - * - * \note it will only return output which is NOT in the group, which isn't how - * render engines works but it's how the GPU shader compilation works. This we - * can change in the future and make it a generic function, but for now it stays - * private here. - */ -struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target); -/** - * This one needs to work on a local tree. - * - * TODO: This is *not* part of `blenkernel`, it's defined under "source/blender/nodes/". - * This declaration should be moved out of BKE. - */ -void ntreeGPUMaterialNodes(struct bNodeTree *localtree, - struct GPUMaterial *mat, - bool *has_surface_output, - bool *has_volume_output); - /** \} */ /* -------------------------------------------------------------------- */ @@ -1352,75 +1328,6 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree, #define CMP_DEFAULT_SMAA_CONTRAST_LIMIT 0.2f #define CMP_DEFAULT_SMAA_CORNER_ROUNDING 0.25f -/* API */ -void ntreeCompositExecTree(struct Scene *scene, - struct bNodeTree *ntree, - struct RenderData *rd, - int rendering, - int do_previews, - const struct ColorManagedViewSettings *view_settings, - const struct ColorManagedDisplaySettings *display_settings, - const char *view_name); - -/** - * Called from render pipeline, to tag render input and output. - * need to do all scenes, to prevent errors when you re-render 1 scene. - */ -void ntreeCompositTagRender(struct Scene *scene); -/** - * Update the outputs of the render layer nodes. - * Since the outputs depend on the render engine, this part is a bit complex: - * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. - * - Each render layer node calls the update function of the - * render engine that's used for its scene. - * - The render engine calls RE_engine_register_pass for each pass. - * - #RE_engine_register_pass calls #node_cmp_rlayers_register_pass. - * - * TODO: This is *not* part of `blenkernel`, it's defined under "source/blender/nodes/". - * This declaration should be moved out of BKE. - */ -void ntreeCompositUpdateRLayers(struct bNodeTree *ntree); -void ntreeCompositClearTags(struct bNodeTree *ntree); - -struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, - struct bNode *node, - const char *name, - struct ImageFormatData *im_format); -int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node); -void ntreeCompositOutputFileSetPath(struct bNode *node, - struct bNodeSocket *sock, - const char *name); -void ntreeCompositOutputFileSetLayer(struct bNode *node, - struct bNodeSocket *sock, - const char *name); -/* needed in do_versions */ -void ntreeCompositOutputFileUniquePath(struct ListBase *list, - struct bNodeSocket *sock, - const char defname[], - char delim); -void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, - struct bNodeSocket *sock, - const char defname[], - char delim); - -void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node); -void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node); - -void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node); -void ntreeCompositCryptomatteSyncFromRemove(bNode *node); -bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node); -int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node); -void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, - const bNode *node, - char *r_prefix, - size_t prefix_len); -/** - * Update the runtime layer names with the crypto-matte layer names of the references render layer - * or image. - */ -void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node); -struct CryptomatteSession *ntreeCompositCryptomatteSession(const Scene *scene, bNode *node); - /** \} */ /* -------------------------------------------------------------------- */ @@ -1457,24 +1364,6 @@ struct TexResult; #define TEX_NODE_PROC 500 #define TEX_NODE_PROC_MAX 600 -/* API */ -void ntreeTexCheckCyclics(struct bNodeTree *ntree); - -struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree); -void ntreeTexEndExecTree(struct bNodeTreeExec *exec); -int ntreeTexExecTree(struct bNodeTree *ntree, - struct TexResult *target, - const float co[3], - float dxt[3], - float dyt[3], - int osatex, - short thread, - const struct Tex *tex, - short which_output, - int cfra, - int preview, - struct MTex *mtex); - /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/intern/node_tree_update.cc b/source/blender/blenkernel/intern/node_tree_update.cc index be9777281cb..0555707b64c 100644 --- a/source/blender/blenkernel/intern/node_tree_update.cc +++ b/source/blender/blenkernel/intern/node_tree_update.cc @@ -34,6 +34,7 @@ #include "NOD_node_declaration.hh" #include "NOD_node_tree_ref.hh" +#include "NOD_texture.h" #include "DEG_depsgraph_query.h" diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index ee9247e6e60..37d5d732a70 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -67,6 +67,8 @@ #include "BKE_scene.h" #include "BKE_texture.h" +#include "NOD_texture.h" + #include "RE_texture.h" #include "BLO_read_write.h" diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 8a22fd07c24..c34b8f735e5 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -78,6 +78,7 @@ #include "IMB_imbuf.h" /* for proxy / time-code versioning stuff. */ #include "NOD_common.h" +#include "NOD_composite.h" #include "NOD_texture.h" #include "BLO_readfile.h" diff --git a/source/blender/blenloader/intern/versioning_cycles.c b/source/blender/blenloader/intern/versioning_cycles.c index f1a2e678b2e..1f18405cdf9 100644 --- a/source/blender/blenloader/intern/versioning_cycles.c +++ b/source/blender/blenloader/intern/versioning_cycles.c @@ -42,6 +42,8 @@ #include "BKE_main.h" #include "BKE_node.h" +#include "NOD_shader.h" + #include "MEM_guardedalloc.h" #include "IMB_colormanagement.h" diff --git a/source/blender/compositor/nodes/COM_CryptomatteNode.cc b/source/blender/compositor/nodes/COM_CryptomatteNode.cc index 605dc1dc84d..c360e519cf8 100644 --- a/source/blender/compositor/nodes/COM_CryptomatteNode.cc +++ b/source/blender/compositor/nodes/COM_CryptomatteNode.cc @@ -16,9 +16,12 @@ * Copyright 2018, Blender Foundation. */ -#include "COM_CryptomatteNode.h" #include "BKE_node.h" + +#include "NOD_composite.h" + #include "COM_ConvertOperation.h" +#include "COM_CryptomatteNode.h" #include "COM_MultilayerImageOperation.h" #include "COM_RenderLayersProg.h" #include "COM_SetAlphaMultiplyOperation.h" diff --git a/source/blender/compositor/operations/COM_TextureOperation.cc b/source/blender/compositor/operations/COM_TextureOperation.cc index f5d47478a8d..a4990993d73 100644 --- a/source/blender/compositor/operations/COM_TextureOperation.cc +++ b/source/blender/compositor/operations/COM_TextureOperation.cc @@ -22,6 +22,8 @@ #include "BKE_image.h" #include "BKE_node.h" +#include "NOD_texture.h" + namespace blender::compositor { TextureBaseOperation::TextureBaseOperation() diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index 52730096b2f..05840175fab 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -42,6 +42,8 @@ #include "BKE_node.h" #include "BKE_screen.h" +#include "NOD_composite.h" + #include "RNA_access.h" #include "UI_interface.h" diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index 31dca83a3ab..1f867c6f1f7 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -28,6 +28,7 @@ set(INC ../../imbuf ../../makesdna ../../makesrna + ../../nodes ../../render ../../sequencer ../../windowmanager diff --git a/source/blender/editors/render/render_internal.cc b/source/blender/editors/render/render_internal.cc index 1d0de322271..a156b9234dc 100644 --- a/source/blender/editors/render/render_internal.cc +++ b/source/blender/editors/render/render_internal.cc @@ -56,6 +56,8 @@ #include "BKE_scene.h" #include "BKE_screen.h" +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "WM_api.h" diff --git a/source/blender/editors/render/render_shading.cc b/source/blender/editors/render/render_shading.cc index 992bba420c1..19ab6841e22 100644 --- a/source/blender/editors/render/render_shading.cc +++ b/source/blender/editors/render/render_shading.cc @@ -64,6 +64,8 @@ #include "BKE_workspace.h" #include "BKE_world.h" +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" diff --git a/source/blender/editors/render/render_update.cc b/source/blender/editors/render/render_update.cc index b2958efde9b..b1e8e3927ef 100644 --- a/source/blender/editors/render/render_update.cc +++ b/source/blender/editors/render/render_update.cc @@ -49,6 +49,8 @@ #include "BKE_paint.h" #include "BKE_scene.h" +#include "NOD_composite.h" + #include "RE_engine.h" #include "RE_pipeline.h" diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 5c8d7a9e9b6..b15b6784d34 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -27,6 +27,7 @@ set(INC ../../gpu ../../imbuf ../../makesdna + ../../nodes ../../makesrna ../../render ../../windowmanager diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 265746e27cd..4010b87a2ed 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -47,6 +47,8 @@ #include "BKE_object.h" #include "BKE_paint.h" +#include "NOD_texture.h" + #include "WM_api.h" #include "wm_cursors.h" diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index dc2eaacca0c..a912bb5cf3b 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -56,6 +56,8 @@ #include "BKE_paint.h" #include "BKE_undo_system.h" +#include "NOD_texture.h" + #include "DEG_depsgraph.h" #include "UI_interface.h" diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 91e44a0b062..2725fc1eae4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -73,6 +73,8 @@ #include "BKE_subdiv_ccg.h" #include "BKE_subsurf.h" +#include "NOD_texture.h" + #include "DEG_depsgraph.h" #include "IMB_colormanagement.h" diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 6451086f5fc..11c61e4cf72 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -44,6 +44,8 @@ #include "BKE_node.h" #include "BKE_scene.h" +#include "NOD_shader.h" + #include "GPU_material.h" #include "GPU_shader.h" #include "GPU_texture.h" diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index ab4cbc429ce..b02a5c8dc1e 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -53,6 +53,8 @@ # include "BKE_node.h" # include "BKE_scene.h" +# include "NOD_composite.h" + # include "BLI_listbase.h" # include "DEG_depsgraph_build.h" diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 4192a9975be..117b9dbd983 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -631,6 +631,7 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_bo # include "NOD_geometry.h" # include "NOD_shader.h" # include "NOD_socket.h" +# include "NOD_texture.h" # include "RE_engine.h" # include "RE_pipeline.h" diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 31b2e2f7023..7f9890e492d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -655,6 +655,8 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { # include "BKE_screen.h" # include "BKE_unit.h" +# include "NOD_composite.h" + # include "ED_image.h" # include "ED_info.h" # include "ED_keyframing.h" diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index c80d0bcdd1e..82faccc2c2d 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -152,6 +152,75 @@ const char *node_cmp_rlayers_sock_to_pass(int sock_index); void register_node_type_cmp_custom_group(bNodeType *ntype); +void ntreeCompositExecTree(struct Scene *scene, + struct bNodeTree *ntree, + struct RenderData *rd, + int rendering, + int do_previews, + const struct ColorManagedViewSettings *view_settings, + const struct ColorManagedDisplaySettings *display_settings, + const char *view_name); + +/** + * Called from render pipeline, to tag render input and output. + * need to do all scenes, to prevent errors when you re-render 1 scene. + */ +void ntreeCompositTagRender(struct Scene *scene); + +/** + * Update the outputs of the render layer nodes. + * Since the outputs depend on the render engine, this part is a bit complex: + * - #ntreeCompositUpdateRLayers is called and loops over all render layer nodes. + * - Each render layer node calls the update function of the + * render engine that's used for its scene. + * - The render engine calls RE_engine_register_pass for each pass. + * - #RE_engine_register_pass calls #node_cmp_rlayers_register_pass. + */ +void ntreeCompositUpdateRLayers(struct bNodeTree *ntree); + +void ntreeCompositClearTags(struct bNodeTree *ntree); + +struct bNodeSocket *ntreeCompositOutputFileAddSocket(struct bNodeTree *ntree, + struct bNode *node, + const char *name, + struct ImageFormatData *im_format); + +int ntreeCompositOutputFileRemoveActiveSocket(struct bNodeTree *ntree, struct bNode *node); +void ntreeCompositOutputFileSetPath(struct bNode *node, + struct bNodeSocket *sock, + const char *name); +void ntreeCompositOutputFileSetLayer(struct bNode *node, + struct bNodeSocket *sock, + const char *name); +/* needed in do_versions */ +void ntreeCompositOutputFileUniquePath(struct ListBase *list, + struct bNodeSocket *sock, + const char defname[], + char delim); +void ntreeCompositOutputFileUniqueLayer(struct ListBase *list, + struct bNodeSocket *sock, + const char defname[], + char delim); + +void ntreeCompositColorBalanceSyncFromLGG(bNodeTree *ntree, bNode *node); +void ntreeCompositColorBalanceSyncFromCDL(bNodeTree *ntree, bNode *node); + +void ntreeCompositCryptomatteSyncFromAdd(const Scene *scene, bNode *node); +void ntreeCompositCryptomatteSyncFromRemove(bNode *node); +bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node); +int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node); +void ntreeCompositCryptomatteLayerPrefix(const Scene *scene, + const bNode *node, + char *r_prefix, + size_t prefix_len); + +/** + * Update the runtime layer names with the crypto-matte layer names of the references render layer + * or image. + */ +void ntreeCompositCryptomatteUpdateLayerNames(const Scene *scene, bNode *node); +struct CryptomatteSession *ntreeCompositCryptomatteSession(const Scene *scene, bNode *node); + #ifdef __cplusplus } #endif diff --git a/source/blender/nodes/NOD_shader.h b/source/blender/nodes/NOD_shader.h index 76c174201e8..65720fc119b 100644 --- a/source/blender/nodes/NOD_shader.h +++ b/source/blender/nodes/NOD_shader.h @@ -143,6 +143,28 @@ void register_node_type_sh_tex_white_noise(void); void register_node_type_sh_custom_group(bNodeType *ntype); +struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree); +void ntreeShaderEndExecTree(struct bNodeTreeExec *exec); + + +/** + * Find an output node of the shader tree. + * + * \note it will only return output which is NOT in the group, which isn't how + * render engines works but it's how the GPU shader compilation works. This we + * can change in the future and make it a generic function, but for now it stays + * private here. + */ +struct bNode *ntreeShaderOutputNode(struct bNodeTree *ntree, int target); + +/** + * This one needs to work on a local tree. + */ +void ntreeGPUMaterialNodes(struct bNodeTree *localtree, + struct GPUMaterial *mat, + bool *has_surface_output, + bool *has_volume_output); + #ifdef __cplusplus } #endif diff --git a/source/blender/nodes/NOD_texture.h b/source/blender/nodes/NOD_texture.h index af59fefd925..c08bc814915 100644 --- a/source/blender/nodes/NOD_texture.h +++ b/source/blender/nodes/NOD_texture.h @@ -74,6 +74,22 @@ void register_node_type_tex_proc_noise(void); void register_node_type_tex_proc_stucci(void); void register_node_type_tex_proc_distnoise(void); +void ntreeTexCheckCyclics(struct bNodeTree *ntree); +struct bNodeTreeExec *ntreeTexBeginExecTree(struct bNodeTree *ntree); +void ntreeTexEndExecTree(struct bNodeTreeExec *exec); +int ntreeTexExecTree(struct bNodeTree *ntree, + struct TexResult *target, + const float co[3], + float dxt[3], + float dyt[3], + int osatex, + short thread, + const struct Tex *tex, + short which_output, + int cfra, + int preview, + struct MTex *mtex); + #ifdef __cplusplus } #endif diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index 721abe45932..739202564af 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -73,6 +73,8 @@ #include "BKE_sound.h" #include "BKE_writeavi.h" /* <------ should be replaced once with generic movie module */ +#include "NOD_composite.h" + #include "DEG_depsgraph.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_debug.h" diff --git a/source/blender/render/intern/texture_procedural.c b/source/blender/render/intern/texture_procedural.c index f563cb9f84a..c894d8d9f48 100644 --- a/source/blender/render/intern/texture_procedural.c +++ b/source/blender/render/intern/texture_procedural.c @@ -43,15 +43,15 @@ #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" -#include "BKE_image.h" -#include "BKE_node.h" - #include "BKE_colorband.h" +#include "BKE_image.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_scene.h" - #include "BKE_texture.h" +#include "NOD_texture.h" + #include "MEM_guardedalloc.h" #include "render_types.h" -- cgit v1.2.3