Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-11-06 19:49:09 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-11-06 20:08:25 +0300
commit16732def37c5a66f3ea28dbe247b09cc6bca6677 (patch)
tree5d14f5c920a1411e336bd80b12becbb3f73de19a /source/blender/freestyle/intern/blender_interface
parent88926375a0e4e45f72c87b9e487c060ddd3c9216 (diff)
Cleanup: Clang-Tidy modernize-use-nullptr
Replace `NULL` with `nullptr` in C++ code. No functional changes.
Diffstat (limited to 'source/blender/freestyle/intern/blender_interface')
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp22
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp48
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp32
3 files changed, 51 insertions, 51 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 291a38d23df..930da3ef471 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -33,18 +33,18 @@ BlenderFileLoader::BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgrap
{
_re = re;
_depsgraph = depsgraph;
- _Scene = NULL;
+ _Scene = nullptr;
_numFacesRead = 0;
#if 0
_minEdgeSize = DBL_MAX;
#endif
_smooth = (view_layer->freestyle_config.flags & FREESTYLE_FACE_SMOOTHNESS_FLAG) != 0;
- _pRenderMonitor = NULL;
+ _pRenderMonitor = nullptr;
}
BlenderFileLoader::~BlenderFileLoader()
{
- _Scene = NULL;
+ _Scene = nullptr;
}
NodeGroup *BlenderFileLoader::Load()
@@ -104,7 +104,7 @@ NodeGroup *BlenderFileLoader::Load()
continue;
}
- Mesh *mesh = BKE_object_to_mesh(NULL, ob, false);
+ Mesh *mesh = BKE_object_to_mesh(nullptr, ob, false);
if (mesh) {
insertShapeNode(ob, mesh, ++id);
@@ -422,7 +422,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
// Compute loop normals
BKE_mesh_calc_normals_split(me);
- float(*lnors)[3] = NULL;
+ float(*lnors)[3] = nullptr;
if (CustomData_has_layer(&me->ldata, CD_NORMAL)) {
lnors = (float(*)[3])CustomData_get_layer(&me->ldata, CD_NORMAL);
@@ -633,16 +633,16 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
// We might have several times the same vertex. We want a clean
// shape with no real-vertex. Here, we are making a cleaning pass.
- float *cleanVertices = NULL;
+ float *cleanVertices = nullptr;
unsigned int cvSize;
- unsigned int *cleanVIndices = NULL;
+ unsigned int *cleanVIndices = nullptr;
GeomCleaner::CleanIndexedVertexArray(
vertices, vSize, VIndices, viSize, &cleanVertices, &cvSize, &cleanVIndices);
- float *cleanNormals = NULL;
+ float *cleanNormals = nullptr;
unsigned int cnSize;
- unsigned int *cleanNIndices = NULL;
+ unsigned int *cleanNIndices = nullptr;
GeomCleaner::CleanIndexedVertexArray(
normals, nSize, NIndices, niSize, &cleanNormals, &cnSize, &cleanNIndices);
@@ -777,7 +777,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
cnSize,
marray,
meshFrsMaterials.size(),
- 0,
+ nullptr,
0,
numFaces,
numVertexPerFaces,
@@ -789,7 +789,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
niSize,
MIndices,
viSize,
- 0,
+ nullptr,
0,
0);
// sets the id of the rep
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 92df844d0b3..8aaffd4dde8 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -141,7 +141,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count)
view_layer->layflag = SCE_LAY_SOLID | SCE_LAY_ZTRA;
// Camera
- Object *object_camera = BKE_object_add(freestyle_bmain, view_layer, OB_CAMERA, NULL);
+ Object *object_camera = BKE_object_add(freestyle_bmain, view_layer, OB_CAMERA, nullptr);
Camera *camera = (Camera *)object_camera->data;
camera->type = CAM_ORTHO;
@@ -174,7 +174,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count)
BlenderStrokeRenderer::~BlenderStrokeRenderer()
{
- BLI_ghash_free(_nodetree_hash, NULL, NULL);
+ BLI_ghash_free(_nodetree_hash, nullptr, nullptr);
DEG_graph_free(freestyle_depsgraph);
@@ -213,7 +213,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
{
Material *ma = BKE_material_add(bmain, "stroke_shader");
bNodeTree *ntree;
- bNode *output_linestyle = NULL;
+ bNode *output_linestyle = nullptr;
bNodeSocket *fromsock, *tosock;
PointerRNA fromptr, toptr;
NodeShaderAttribute *storage;
@@ -233,19 +233,19 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
}
}
else {
- ntree = ntreeAddTree(NULL, "stroke_shader", "ShaderNodeTree");
+ ntree = ntreeAddTree(nullptr, "stroke_shader", "ShaderNodeTree");
}
ma->nodetree = ntree;
ma->use_nodes = 1;
ma->blend_method = MA_BM_HASHED;
- bNode *input_attr_color = nodeAddStaticNode(NULL, ntree, SH_NODE_ATTRIBUTE);
+ bNode *input_attr_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_ATTRIBUTE);
input_attr_color->locx = 0.0f;
input_attr_color->locy = -200.0f;
storage = (NodeShaderAttribute *)input_attr_color->storage;
BLI_strncpy(storage->name, "Color", sizeof(storage->name));
- bNode *mix_rgb_color = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_RGB);
+ bNode *mix_rgb_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB);
mix_rgb_color->custom1 = MA_RAMP_BLEND; // Mix
mix_rgb_color->locx = 200.0f;
mix_rgb_color->locy = -200.0f;
@@ -253,13 +253,13 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, tosock, &toptr);
RNA_float_set(&toptr, "default_value", 0.0f);
- bNode *input_attr_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_ATTRIBUTE);
+ bNode *input_attr_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_ATTRIBUTE);
input_attr_alpha->locx = 400.0f;
input_attr_alpha->locy = 300.0f;
storage = (NodeShaderAttribute *)input_attr_alpha->storage;
BLI_strncpy(storage->name, "Alpha", sizeof(storage->name));
- bNode *mix_rgb_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_RGB);
+ bNode *mix_rgb_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_RGB);
mix_rgb_alpha->custom1 = MA_RAMP_BLEND; // Mix
mix_rgb_alpha->locx = 600.0f;
mix_rgb_alpha->locy = 300.0f;
@@ -267,27 +267,27 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, tosock, &toptr);
RNA_float_set(&toptr, "default_value", 0.0f);
- bNode *shader_emission = nodeAddStaticNode(NULL, ntree, SH_NODE_EMISSION);
+ bNode *shader_emission = nodeAddStaticNode(nullptr, ntree, SH_NODE_EMISSION);
shader_emission->locx = 400.0f;
shader_emission->locy = -200.0f;
- bNode *input_light_path = nodeAddStaticNode(NULL, ntree, SH_NODE_LIGHT_PATH);
+ bNode *input_light_path = nodeAddStaticNode(nullptr, ntree, SH_NODE_LIGHT_PATH);
input_light_path->locx = 400.0f;
input_light_path->locy = 100.0f;
- bNode *mix_shader_color = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_SHADER);
+ bNode *mix_shader_color = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_SHADER);
mix_shader_color->locx = 600.0f;
mix_shader_color->locy = -100.0f;
- bNode *shader_transparent = nodeAddStaticNode(NULL, ntree, SH_NODE_BSDF_TRANSPARENT);
+ bNode *shader_transparent = nodeAddStaticNode(nullptr, ntree, SH_NODE_BSDF_TRANSPARENT);
shader_transparent->locx = 600.0f;
shader_transparent->locy = 100.0f;
- bNode *mix_shader_alpha = nodeAddStaticNode(NULL, ntree, SH_NODE_MIX_SHADER);
+ bNode *mix_shader_alpha = nodeAddStaticNode(nullptr, ntree, SH_NODE_MIX_SHADER);
mix_shader_alpha->locx = 800.0f;
mix_shader_alpha->locy = 100.0f;
- bNode *output_material = nodeAddStaticNode(NULL, ntree, SH_NODE_OUTPUT_MATERIAL);
+ bNode *output_material = nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
output_material->locx = 1000.0f;
output_material->locy = 100.0f;
@@ -393,7 +393,7 @@ Material *BlenderStrokeRenderer::GetStrokeShader(Main *bmain,
bNodeSocket *sock = (bNodeSocket *)BLI_findlink(&node->outputs, 0);
// add new UV Map node
- bNode *input_uvmap = nodeAddStaticNode(NULL, ntree, SH_NODE_UVMAP);
+ bNode *input_uvmap = nodeAddStaticNode(nullptr, ntree, SH_NODE_UVMAP);
input_uvmap->locx = node->locx - 200.0f;
input_uvmap->locy = node->locy;
NodeShaderUVMap *storage = (NodeShaderUVMap *)input_uvmap->storage;
@@ -590,31 +590,31 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
mesh->totcol = group->materials.size();
mesh->mvert = (MVert *)CustomData_add_layer(
- &mesh->vdata, CD_MVERT, CD_CALLOC, NULL, mesh->totvert);
+ &mesh->vdata, CD_MVERT, CD_CALLOC, nullptr, mesh->totvert);
mesh->medge = (MEdge *)CustomData_add_layer(
- &mesh->edata, CD_MEDGE, CD_CALLOC, NULL, mesh->totedge);
+ &mesh->edata, CD_MEDGE, CD_CALLOC, nullptr, mesh->totedge);
mesh->mpoly = (MPoly *)CustomData_add_layer(
- &mesh->pdata, CD_MPOLY, CD_CALLOC, NULL, mesh->totpoly);
+ &mesh->pdata, CD_MPOLY, CD_CALLOC, nullptr, mesh->totpoly);
mesh->mloop = (MLoop *)CustomData_add_layer(
- &mesh->ldata, CD_MLOOP, CD_CALLOC, NULL, mesh->totloop);
+ &mesh->ldata, CD_MLOOP, CD_CALLOC, nullptr, mesh->totloop);
MVert *vertices = mesh->mvert;
MEdge *edges = mesh->medge;
MPoly *polys = mesh->mpoly;
MLoop *loops = mesh->mloop;
- MLoopUV *loopsuv[2] = {NULL};
+ MLoopUV *loopsuv[2] = {nullptr};
if (hasTex) {
// First UV layer
CustomData_add_layer_named(
- &mesh->ldata, CD_MLOOPUV, CD_CALLOC, NULL, mesh->totloop, uvNames[0]);
+ &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[0]);
CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 0);
BKE_mesh_update_customdata_pointers(mesh, true);
loopsuv[0] = mesh->mloopuv;
// Second UV layer
CustomData_add_layer_named(
- &mesh->ldata, CD_MLOOPUV, CD_CALLOC, NULL, mesh->totloop, uvNames[1]);
+ &mesh->ldata, CD_MLOOPUV, CD_CALLOC, nullptr, mesh->totloop, uvNames[1]);
CustomData_set_layer_active(&mesh->ldata, CD_MLOOPUV, 1);
BKE_mesh_update_customdata_pointers(mesh, true);
loopsuv[1] = mesh->mloopuv;
@@ -622,9 +622,9 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
// colors and transparency (the latter represented by grayscale colors)
MLoopCol *colors = (MLoopCol *)CustomData_add_layer_named(
- &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, mesh->totloop, "Color");
+ &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Color");
MLoopCol *transp = (MLoopCol *)CustomData_add_layer_named(
- &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, NULL, mesh->totloop, "Alpha");
+ &mesh->ldata, CD_MLOOPCOL, CD_CALLOC, nullptr, mesh->totloop, "Alpha");
mesh->mloopcol = colors;
mesh->mat = (Material **)MEM_mallocN(sizeof(Material *) * mesh->totcol, "MaterialList");
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 9f1a1ecaace..c5184a4ec8d 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -72,9 +72,9 @@ struct FreestyleGlobals g_freestyle;
// Freestyle configuration
static bool freestyle_is_initialized = false;
-static Config::Path *pathconfig = NULL;
-static Controller *controller = NULL;
-static AppView *view = NULL;
+static Config::Path *pathconfig = nullptr;
+static Controller *controller = nullptr;
+static AppView *view = nullptr;
// line set buffer for copy & paste
static FreestyleLineSet lineset_buffer;
@@ -89,10 +89,10 @@ static void load_post_callback(struct Main * /*main*/,
}
static bCallbackFuncStore load_post_callback_funcstore = {
- NULL,
- NULL, /* next, prev */
+ nullptr,
+ nullptr, /* next, prev */
load_post_callback, /* func */
- NULL, /* arg */
+ nullptr, /* arg */
0 /* alloc */
};
@@ -111,7 +111,7 @@ void FRS_init()
view = new AppView;
controller->setView(view);
controller->Clear();
- g_freestyle.scene = NULL;
+ g_freestyle.scene = nullptr;
lineset_copied = false;
BKE_callback_add(&load_post_callback_funcstore, BKE_CB_EVT_LOAD_POST);
@@ -312,7 +312,7 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
// load mesh
re->i.infostr = TIP_("Freestyle: Mesh loading");
re->stats_draw(re->sdh, &re->i);
- re->i.infostr = NULL;
+ re->i.infostr = nullptr;
if (controller->LoadMesh(
re, view_layer, depsgraph)) { // returns if scene cannot be loaded or if empty
return;
@@ -507,7 +507,7 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
// compute view map
re->i.infostr = TIP_("Freestyle: View map creation");
re->stats_draw(re->sdh, &re->i);
- re->i.infostr = NULL;
+ re->i.infostr = nullptr;
controller->ComputeViewMap();
}
@@ -517,7 +517,7 @@ void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_r
float *src, *dest, *pixSrc, *pixDest;
int x, y, rectx, recty;
- if (freestyle_render == NULL || freestyle_render->result == NULL) {
+ if (freestyle_render == nullptr || freestyle_render->result == nullptr) {
return;
}
@@ -676,15 +676,15 @@ void FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer)
// render strokes
re->i.infostr = TIP_("Freestyle: Stroke rendering");
re->stats_draw(re->sdh, &re->i);
- re->i.infostr = NULL;
+ re->i.infostr = nullptr;
g_freestyle.scene = DEG_get_evaluated_scene(depsgraph);
int strokeCount = controller->DrawStrokes();
- Render *freestyle_render = NULL;
+ Render *freestyle_render = nullptr;
if (strokeCount > 0) {
freestyle_render = controller->RenderStrokes(re, true);
}
controller->CloseFile();
- g_freestyle.scene = NULL;
+ g_freestyle.scene = nullptr;
// composite result
if (freestyle_render) {
@@ -762,7 +762,7 @@ void FRS_paste_active_lineset(FreestyleConfig *config)
lineset->exclude_edge_types = lineset_buffer.exclude_edge_types;
if (lineset->group) {
id_us_min(&lineset->group->id);
- lineset->group = NULL;
+ lineset->group = nullptr;
}
if (lineset_buffer.group) {
lineset->group = lineset_buffer.group;
@@ -790,14 +790,14 @@ void FRS_delete_active_lineset(FreestyleConfig *config)
bool FRS_move_active_lineset(FreestyleConfig *config, int direction)
{
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
- return (lineset != NULL) && BLI_listbase_link_move(&config->linesets, lineset, direction);
+ return (lineset != nullptr) && BLI_listbase_link_move(&config->linesets, lineset, direction);
}
// Testing
Material *FRS_create_stroke_material(Main *bmain, struct FreestyleLineStyle *linestyle)
{
- bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : NULL;
+ bNodeTree *nt = (linestyle->use_nodes) ? linestyle->nodetree : nullptr;
Material *ma = BlenderStrokeRenderer::GetStrokeShader(bmain, nt, true);
ma->id.us = 0;
return ma;