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
This commit is contained in:
2022-01-24 16:18:30 -06:00
parent 4d799db72f
commit 2bf519d211
25 changed files with 148 additions and 116 deletions

View File

@@ -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);
/** \} */
/* -------------------------------------------------------------------- */

View File

@@ -34,6 +34,7 @@
#include "NOD_node_declaration.hh"
#include "NOD_node_tree_ref.hh"
#include "NOD_texture.h"
#include "DEG_depsgraph_query.h"

View File

@@ -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"

View File

@@ -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"

View File

@@ -42,6 +42,8 @@
#include "BKE_main.h"
#include "BKE_node.h"
#include "NOD_shader.h"
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"

View File

@@ -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"

View File

@@ -22,6 +22,8 @@
#include "BKE_image.h"
#include "BKE_node.h"
#include "NOD_texture.h"
namespace blender::compositor {
TextureBaseOperation::TextureBaseOperation()

View File

@@ -42,6 +42,8 @@
#include "BKE_node.h"
#include "BKE_screen.h"
#include "NOD_composite.h"
#include "RNA_access.h"
#include "UI_interface.h"

View File

@@ -28,6 +28,7 @@ set(INC
../../imbuf
../../makesdna
../../makesrna
../../nodes
../../render
../../sequencer
../../windowmanager

View File

@@ -56,6 +56,8 @@
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "NOD_composite.h"
#include "DEG_depsgraph.h"
#include "WM_api.h"

View File

@@ -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"

View File

@@ -49,6 +49,8 @@
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "NOD_composite.h"
#include "RE_engine.h"
#include "RE_pipeline.h"

View File

@@ -27,6 +27,7 @@ set(INC
../../gpu
../../imbuf
../../makesdna
../../nodes
../../makesrna
../../render
../../windowmanager

View File

@@ -47,6 +47,8 @@
#include "BKE_object.h"
#include "BKE_paint.h"
#include "NOD_texture.h"
#include "WM_api.h"
#include "wm_cursors.h"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -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"