Cleanup: use nullptr in C++
This commit is contained in:
@@ -45,7 +45,7 @@ static void gpu_node_link_free(GPUNodeLink *link)
|
||||
|
||||
if (link->users == 0) {
|
||||
if (link->output) {
|
||||
link->output->link = NULL;
|
||||
link->output->link = nullptr;
|
||||
}
|
||||
MEM_freeN(link);
|
||||
}
|
||||
@@ -178,7 +178,7 @@ static const char *gpu_uniform_set_function_from_type(eNodeSocketDatatype type)
|
||||
return "set_rgba";
|
||||
default:
|
||||
BLI_assert_msg(0, "No gpu function for non-supported eNodeSocketDatatype");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,15 +201,15 @@ static GPUNodeLink *gpu_uniformbuffer_link(GPUMaterial *mat,
|
||||
socket = static_cast<bNodeSocket *>(BLI_findlink(&node->outputs, index));
|
||||
}
|
||||
|
||||
BLI_assert(socket != NULL);
|
||||
BLI_assert(socket != nullptr);
|
||||
BLI_assert(socket->in_out == in_out);
|
||||
|
||||
if (socket->flag & SOCK_HIDE_VALUE) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!ELEM(socket->type, SOCK_FLOAT, SOCK_VECTOR, SOCK_RGBA)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GPUNodeLink *link = GPU_uniform(stack->vec);
|
||||
@@ -230,8 +230,8 @@ static void gpu_node_input_socket(
|
||||
if (sock->link) {
|
||||
gpu_node_input_link(node, sock->link, sock->type);
|
||||
}
|
||||
else if ((material != NULL) &&
|
||||
(gpu_uniformbuffer_link(material, bnode, sock, index, SOCK_IN) != NULL)) {
|
||||
else if ((material != nullptr) &&
|
||||
(gpu_uniformbuffer_link(material, bnode, sock, index, SOCK_IN) != nullptr)) {
|
||||
gpu_node_input_link(node, sock->link, sock->type);
|
||||
}
|
||||
else {
|
||||
@@ -253,7 +253,7 @@ static void gpu_node_output(GPUNode *node, const eGPUType type, GPUNodeLink **li
|
||||
|
||||
/* NOTE: the caller owns the reference to the link, GPUOutput
|
||||
* merely points to it, and if the node is destroyed it will
|
||||
* set that pointer to NULL */
|
||||
* set that pointer to nullptr */
|
||||
}
|
||||
|
||||
BLI_addtail(&node->outputs, output);
|
||||
@@ -375,7 +375,7 @@ static void attr_input_name(GPUMaterialAttribute *attr)
|
||||
}
|
||||
}
|
||||
|
||||
/** Add a new varying attribute of given type and name. Returns NULL if out of slots. */
|
||||
/** Add a new varying attribute of given type and name. Returns nullptr if out of slots. */
|
||||
static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph,
|
||||
eCustomDataType type,
|
||||
const char *name,
|
||||
@@ -393,7 +393,7 @@ static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph,
|
||||
}
|
||||
|
||||
/* Add new requested attribute if it's within GPU limits. */
|
||||
if (attr == NULL) {
|
||||
if (attr == nullptr) {
|
||||
attr = MEM_cnew<GPUMaterialAttribute>(__func__);
|
||||
attr->is_default_color = is_default_color;
|
||||
attr->type = type;
|
||||
@@ -403,14 +403,14 @@ static GPUMaterialAttribute *gpu_node_graph_add_attribute(GPUNodeGraph *graph,
|
||||
BLI_addtail(&graph->attributes, attr);
|
||||
}
|
||||
|
||||
if (attr != NULL) {
|
||||
if (attr != nullptr) {
|
||||
attr->users++;
|
||||
}
|
||||
|
||||
return attr;
|
||||
}
|
||||
|
||||
/** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */
|
||||
/** Add a new uniform attribute of given type and name. Returns nullptr if out of slots. */
|
||||
static GPUUniformAttr *gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph,
|
||||
const char *name,
|
||||
bool use_dupli)
|
||||
@@ -426,7 +426,7 @@ static GPUUniformAttr *gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph,
|
||||
}
|
||||
|
||||
/* Add new requested attribute if it's within GPU limits. */
|
||||
if (attr == NULL && attrs->count < GPU_MAX_UNIFORM_ATTR) {
|
||||
if (attr == nullptr && attrs->count < GPU_MAX_UNIFORM_ATTR) {
|
||||
attr = MEM_cnew<GPUUniformAttr>(__func__);
|
||||
STRNCPY(attr->name, name);
|
||||
attr->use_dupli = use_dupli;
|
||||
@@ -436,14 +436,14 @@ static GPUUniformAttr *gpu_node_graph_add_uniform_attribute(GPUNodeGraph *graph,
|
||||
attrs->count++;
|
||||
}
|
||||
|
||||
if (attr != NULL) {
|
||||
if (attr != nullptr) {
|
||||
attr->users++;
|
||||
}
|
||||
|
||||
return attr;
|
||||
}
|
||||
|
||||
/** Add a new uniform attribute of given type and name. Returns NULL if out of slots. */
|
||||
/** Add a new uniform attribute of given type and name. Returns nullptr if out of slots. */
|
||||
static GPULayerAttr *gpu_node_graph_add_layer_attribute(GPUNodeGraph *graph, const char *name)
|
||||
{
|
||||
/* Find existing attribute. */
|
||||
@@ -457,14 +457,14 @@ static GPULayerAttr *gpu_node_graph_add_layer_attribute(GPUNodeGraph *graph, con
|
||||
}
|
||||
|
||||
/* Add new requested attribute to the list. */
|
||||
if (attr == NULL) {
|
||||
if (attr == nullptr) {
|
||||
attr = MEM_cnew<GPULayerAttr>(__func__);
|
||||
STRNCPY(attr->name, name);
|
||||
attr->hash_code = BLI_ghashutil_strhash_p(attr->name);
|
||||
BLI_addtail(attrs, attr);
|
||||
}
|
||||
|
||||
if (attr != NULL) {
|
||||
if (attr != nullptr) {
|
||||
attr->users++;
|
||||
}
|
||||
|
||||
@@ -491,10 +491,10 @@ static GPUMaterialTexture *gpu_node_graph_add_texture(GPUNodeGraph *graph,
|
||||
}
|
||||
|
||||
/* Add new requested texture. */
|
||||
if (tex == NULL) {
|
||||
if (tex == nullptr) {
|
||||
tex = MEM_cnew<GPUMaterialTexture>(__func__);
|
||||
tex->ima = ima;
|
||||
if (iuser != NULL) {
|
||||
if (iuser != nullptr) {
|
||||
tex->iuser = *iuser;
|
||||
tex->iuser_available = true;
|
||||
}
|
||||
@@ -527,7 +527,7 @@ GPUNodeLink *GPU_attribute(GPUMaterial *mat, const eCustomDataType type, const c
|
||||
}
|
||||
|
||||
/* Dummy fallback if out of slots. */
|
||||
if (attr == NULL) {
|
||||
if (attr == nullptr) {
|
||||
static const float zero_data[GPU_MAX_CONSTANT_DATA] = {0.0f};
|
||||
return GPU_constant(zero_data);
|
||||
}
|
||||
@@ -542,7 +542,7 @@ GPUNodeLink *GPU_attribute_default_color(GPUMaterial *mat)
|
||||
{
|
||||
GPUNodeGraph *graph = gpu_material_node_graph(mat);
|
||||
GPUMaterialAttribute *attr = gpu_node_graph_add_attribute(graph, CD_AUTO_FROM_NAME, "", true);
|
||||
if (attr == NULL) {
|
||||
if (attr == nullptr) {
|
||||
static const float zero_data[GPU_MAX_CONSTANT_DATA] = {0.0f};
|
||||
return GPU_constant(zero_data);
|
||||
}
|
||||
@@ -574,7 +574,7 @@ GPUNodeLink *GPU_uniform_attribute(GPUMaterial *mat,
|
||||
GPUUniformAttr *attr = gpu_node_graph_add_uniform_attribute(graph, name, use_dupli);
|
||||
|
||||
/* Dummy fallback if out of slots. */
|
||||
if (attr == NULL) {
|
||||
if (attr == nullptr) {
|
||||
*r_hash = 0;
|
||||
static const float zero_data[GPU_MAX_CONSTANT_DATA] = {0.0f};
|
||||
return GPU_constant(zero_data);
|
||||
@@ -631,7 +631,7 @@ GPUNodeLink *GPU_image(GPUMaterial *mat,
|
||||
GPUNodeLink *link = gpu_node_link_create();
|
||||
link->link_type = GPU_NODE_LINK_IMAGE;
|
||||
link->texture = gpu_node_graph_add_texture(
|
||||
graph, ima, iuser, NULL, NULL, link->link_type, sampler_state);
|
||||
graph, ima, iuser, nullptr, nullptr, link->link_type, sampler_state);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -648,7 +648,7 @@ GPUNodeLink *GPU_image_sky(GPUMaterial *mat,
|
||||
GPUNodeLink *link = gpu_node_link_create();
|
||||
link->link_type = GPU_NODE_LINK_IMAGE_SKY;
|
||||
link->texture = gpu_node_graph_add_texture(
|
||||
graph, NULL, NULL, NULL, sky, link->link_type, sampler_state);
|
||||
graph, nullptr, nullptr, nullptr, sky, link->link_type, sampler_state);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -661,7 +661,7 @@ GPUNodeLink *GPU_image_tiled(GPUMaterial *mat,
|
||||
GPUNodeLink *link = gpu_node_link_create();
|
||||
link->link_type = GPU_NODE_LINK_IMAGE_TILED;
|
||||
link->texture = gpu_node_graph_add_texture(
|
||||
graph, ima, iuser, NULL, NULL, link->link_type, sampler_state);
|
||||
graph, ima, iuser, nullptr, nullptr, link->link_type, sampler_state);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -671,7 +671,7 @@ GPUNodeLink *GPU_image_tiled_mapping(GPUMaterial *mat, Image *ima, ImageUser *iu
|
||||
GPUNodeLink *link = gpu_node_link_create();
|
||||
link->link_type = GPU_NODE_LINK_IMAGE_TILED_MAPPING;
|
||||
link->texture = gpu_node_graph_add_texture(
|
||||
graph, ima, iuser, NULL, NULL, link->link_type, GPU_SAMPLER_MAX);
|
||||
graph, ima, iuser, nullptr, nullptr, link->link_type, GPU_SAMPLER_MAX);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -684,7 +684,7 @@ GPUNodeLink *GPU_color_band(GPUMaterial *mat, int size, float *pixels, float *ro
|
||||
GPUNodeLink *link = gpu_node_link_create();
|
||||
link->link_type = GPU_NODE_LINK_COLORBAND;
|
||||
link->texture = gpu_node_graph_add_texture(
|
||||
graph, NULL, NULL, colorband, NULL, link->link_type, GPU_SAMPLER_MAX);
|
||||
graph, nullptr, nullptr, colorband, nullptr, link->link_type, GPU_SAMPLER_MAX);
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ static bool gpu_stack_link_v(GPUMaterial *material,
|
||||
if (totin == 0) {
|
||||
link = va_arg(params, GPUNodeLink *);
|
||||
if (link->socket) {
|
||||
gpu_node_input_socket(NULL, NULL, node, link->socket, -1);
|
||||
gpu_node_input_socket(nullptr, nullptr, node, link->socket, -1);
|
||||
}
|
||||
else {
|
||||
gpu_node_input_link(node, link, function->paramtype[i]);
|
||||
@@ -853,7 +853,7 @@ static void gpu_node_free(GPUNode *node)
|
||||
|
||||
for (output = static_cast<GPUOutput *>(node->outputs.first); output; output = output->next) {
|
||||
if (output->link) {
|
||||
output->link->output = NULL;
|
||||
output->link->output = nullptr;
|
||||
gpu_node_link_free(output->link);
|
||||
}
|
||||
}
|
||||
@@ -870,10 +870,10 @@ void gpu_node_graph_free_nodes(GPUNodeGraph *graph)
|
||||
gpu_node_free(node);
|
||||
}
|
||||
|
||||
graph->outlink_surface = NULL;
|
||||
graph->outlink_volume = NULL;
|
||||
graph->outlink_displacement = NULL;
|
||||
graph->outlink_thickness = NULL;
|
||||
graph->outlink_surface = nullptr;
|
||||
graph->outlink_volume = nullptr;
|
||||
graph->outlink_displacement = nullptr;
|
||||
graph->outlink_thickness = nullptr;
|
||||
}
|
||||
|
||||
void gpu_node_graph_free(GPUNodeGraph *graph)
|
||||
@@ -889,8 +889,8 @@ void gpu_node_graph_free(GPUNodeGraph *graph)
|
||||
BLI_freelistN(&graph->layer_attrs);
|
||||
|
||||
if (graph->used_libraries) {
|
||||
BLI_gset_free(graph->used_libraries, NULL);
|
||||
graph->used_libraries = NULL;
|
||||
BLI_gset_free(graph->used_libraries, nullptr);
|
||||
graph->used_libraries = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -938,7 +938,7 @@ void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
|
||||
gpu_nodes_tag(compositor_link->outlink, GPU_NODE_TAG_COMPOSITOR);
|
||||
}
|
||||
|
||||
for (GPUNode *node = static_cast<GPUNode *>(graph->nodes.first), *next = NULL; node;
|
||||
for (GPUNode *node = static_cast<GPUNode *>(graph->nodes.first), *next = nullptr; node;
|
||||
node = next) {
|
||||
next = node->next;
|
||||
|
||||
@@ -949,7 +949,7 @@ void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
|
||||
}
|
||||
|
||||
for (GPUMaterialAttribute *attr = static_cast<GPUMaterialAttribute *>(graph->attributes.first),
|
||||
*next = NULL;
|
||||
*next = nullptr;
|
||||
attr;
|
||||
attr = next) {
|
||||
next = attr->next;
|
||||
@@ -959,7 +959,7 @@ void gpu_node_graph_prune_unused(GPUNodeGraph *graph)
|
||||
}
|
||||
|
||||
for (GPUMaterialTexture *tex = static_cast<GPUMaterialTexture *>(graph->textures.first),
|
||||
*next = NULL;
|
||||
*next = nullptr;
|
||||
tex;
|
||||
tex = next) {
|
||||
next = tex->next;
|
||||
|
||||
Reference in New Issue
Block a user