Cleanup: Move node_util.h to C++ #107569

Merged
Hans Goudey merged 2 commits from Hong-Shin/blender:cppify-node-util into main 2023-05-03 14:21:21 +02:00
17 changed files with 108 additions and 116 deletions

View File

@ -76,7 +76,7 @@ set(SRC
NOD_texture.h
intern/node_common.h
intern/node_exec.h
intern/node_util.h
intern/node_util.hh
)
set(LIB

View File

@ -25,7 +25,7 @@
#include "UI_resources.h"
#include "node_common.h"
#include "node_util.h"
#include "node_util.hh"
#include "RNA_access.h"
#include "RNA_prototypes.h"

View File

@ -13,7 +13,7 @@
#include "BLT_translation.h"
#include "node_composite_register.hh"
#include "node_util.h"
#include "node_util.hh"
#include "NOD_composite.h"
#include "NOD_socket.h"

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "node_function_util.hh"
#include "node_util.h"
#include "node_util.hh"
#include "NOD_add_node_search.hh"
#include "NOD_socket_search_link.hh"

View File

@ -19,7 +19,7 @@
#include "NOD_socket_declarations.hh"
#include "node_function_register.hh"
#include "node_util.h"
#include "node_util.hh"
#include "FN_multi_function_builder.hh"

View File

@ -1,7 +1,7 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "node_geometry_util.hh"
#include "node_util.h"
#include "node_util.hh"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"

View File

@ -25,7 +25,7 @@
#include "RNA_access.h"
#include "node_geometry_register.hh"
#include "node_util.h"
#include "node_util.hh"
#ifdef WITH_OPENVDB
# include <openvdb/Types.h>

View File

@ -37,7 +37,7 @@
#include "NOD_socket_declarations.hh"
#include "NOD_socket_declarations_geometry.hh"
#include "node_common.h"
#include "node_util.h"
#include "node_util.hh"
using blender::Map;
using blender::MultiValueMap;

View File

@ -18,7 +18,7 @@
#include "MEM_guardedalloc.h"
#include "node_exec.h"
#include "node_util.h"
#include "node_util.hh"
static int node_exec_socket_use_stack(bNodeSocket *sock)
{

View File

@ -13,7 +13,7 @@
#include "BKE_node.h"
#include "node_util.h"
#include "node_util.hh"
#include "RNA_types.h"

View File

@ -30,7 +30,7 @@
#include "NOD_common.h"
#include "node_util.h"
#include "node_util.hh"
/* -------------------------------------------------------------------- */
/** \name Storage Data

View File

@ -1,101 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2007 Blender Foundation */
/** \file
* \ingroup nodes
*/
#pragma once
#ifdef __cplusplus
extern "C" {
#endif
struct bNode;
struct bNodeTree;
/* data for initializing node execution */
typedef struct bNodeExecContext {
struct bNodeInstanceHash *previews;
} bNodeExecContext;
typedef struct bNodeExecData {
void *data; /* custom data storage */
struct bNodePreview *preview; /* optional preview image */
} bNodeExecData;
/**** Storage Data ****/
void node_free_curves(struct bNode *node);
void node_free_standard_storage(struct bNode *node);
void node_copy_curves(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node);
void node_copy_standard_storage(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node);
void *node_initexec_curves(struct bNodeExecContext *context,
struct bNode *node,
bNodeInstanceKey key);
/**** Updates ****/
void node_sock_label(struct bNodeSocket *sock, const char *name);
void node_sock_label_clear(struct bNodeSocket *sock);
void node_math_update(struct bNodeTree *ntree, struct bNode *node);
/**** Labels ****/
void node_blend_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int maxlen);
void node_image_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int maxlen);
void node_math_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int maxlen);
void node_vector_math_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int maxlen);
void node_filter_label(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int maxlen);
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode);
/*** Link Handling */
/**
* By default there are no links we don't want to connect, when inserting.
*/
bool node_insert_link_default(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
float node_socket_get_float(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
void node_socket_set_float(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
float value);
void node_socket_get_color(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
float *value);
void node_socket_set_color(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
const float *value);
void node_socket_get_vector(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
float *value);
void node_socket_set_vector(struct bNodeTree *ntree,
struct bNode *node,
struct bNodeSocket *sock,
const float *value);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,93 @@
/* SPDX-License-Identifier: GPL-2.0-or-later
* Copyright 2007 Blender Foundation */
/** \file
* \ingroup nodes
*/
#pragma once
struct bNode;
struct bNodeTree;
/* data for initializing node execution */
struct bNodeExecContext {
struct bNodeInstanceHash *previews;
};
struct bNodeExecData {
void *data; /* custom data storage */
bNodePreview *preview; /* optional preview image */
};
/**** Storage Data ****/
void node_free_curves(bNode *node);
void node_free_standard_storage(bNode *node);
void node_copy_curves(bNodeTree *dest_ntree,
bNode *dest_node,
const bNode *src_node);
void node_copy_standard_storage(bNodeTree *dest_ntree,
bNode *dest_node,
const bNode *src_node);
void *node_initexec_curves(bNodeExecContext *context,
bNode *node,
bNodeInstanceKey key);
/**** Updates ****/
void node_sock_label(bNodeSocket *sock, const char *name);
void node_sock_label_clear(bNodeSocket *sock);
void node_math_update(bNodeTree *ntree, bNode *node);
/**** Labels ****/
void node_blend_label(const bNodeTree *ntree,
const bNode *node,
char *label,
int maxlen);
void node_image_label(const bNodeTree *ntree,
const bNode *node,
char *label,
int maxlen);
void node_math_label(const bNodeTree *ntree,
const bNode *node,
char *label,
int maxlen);
void node_vector_math_label(const bNodeTree *ntree,
const bNode *node,
char *label,
int maxlen);
void node_filter_label(const bNodeTree *ntree,
const bNode *node,
char *label,
int maxlen);
void node_combsep_color_label(const ListBase *sockets, NodeCombSepColorMode mode);
/*** Link Handling */
/**
* By default there are no links we don't want to connect, when inserting.
*/
bool node_insert_link_default(bNodeTree *ntree, bNode *node, bNodeLink *link);
float node_socket_get_float(bNodeTree *ntree, bNode *node, bNodeSocket *sock);
void node_socket_set_float(bNodeTree *ntree,
bNode *node,
bNodeSocket *sock,
float value);
void node_socket_get_color(bNodeTree *ntree,
bNode *node,
bNodeSocket *sock,
float *value);
void node_socket_set_color(bNodeTree *ntree,
bNode *node,
bNodeSocket *sock,
const float *value);
void node_socket_get_vector(bNodeTree *ntree,
bNode *node,
bNodeSocket *sock,
float *value);
void node_socket_set_vector(bNodeTree *ntree,
bNode *node,
bNodeSocket *sock,
const float *value);

View File

@ -48,7 +48,7 @@
#include "node_common.h"
#include "node_exec.h"
#include "node_shader_util.hh"
#include "node_util.h"
#include "node_util.hh"
using blender::Array;
using blender::Vector;

View File

@ -56,7 +56,7 @@
#include "NOD_socket_declarations.hh"
#include "node_shader_register.hh"
#include "node_util.h"
#include "node_util.hh"
#include "RE_pipeline.h"
#include "RE_texture.h"

View File

@ -27,7 +27,7 @@
#include "node_common.h"
#include "node_exec.h"
#include "node_texture_util.hh"
#include "node_util.h"
#include "node_util.hh"
#include "DEG_depsgraph.h"

View File

@ -39,7 +39,7 @@
#include "NOD_texture.h"
#include "node_texture_register.hh"
#include "node_util.h"
#include "node_util.hh"
#include "BLT_translation.h"