Cleanup: replace NULL with nullptr for C++ files
This commit is contained in:
parent
7269ee4dbb
commit
28750bcf7e
|
@ -516,7 +516,7 @@ CatalogFilePath AssetCatalogService::find_suitable_cdf_path_for_writing(
|
|||
sizeof(asset_lib_cdf_path),
|
||||
suitable_root_path,
|
||||
DEFAULT_CATALOG_FILENAME.c_str(),
|
||||
NULL);
|
||||
nullptr);
|
||||
return asset_lib_cdf_path;
|
||||
}
|
||||
|
||||
|
|
|
@ -1248,7 +1248,7 @@ Image *BKE_image_add_generated(Main *bmain,
|
|||
|
||||
static void image_colorspace_from_imbuf(Image *image, const ImBuf *ibuf)
|
||||
{
|
||||
const char *colorspace_name = NULL;
|
||||
const char *colorspace_name = nullptr;
|
||||
|
||||
if (ibuf->rect_float) {
|
||||
if (ibuf->float_colorspace) {
|
||||
|
|
|
@ -250,10 +250,10 @@ MetaElem *BKE_mball_element_add(MetaBall *mb, const int type)
|
|||
BoundBox *BKE_mball_boundbox_get(Object *ob)
|
||||
{
|
||||
BLI_assert(ob->type == OB_MBALL);
|
||||
if (ob->runtime.bb != NULL && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
|
||||
if (ob->runtime.bb != nullptr && (ob->runtime.bb->flag & BOUNDBOX_DIRTY) == 0) {
|
||||
return ob->runtime.bb;
|
||||
}
|
||||
if (ob->runtime.bb == NULL) {
|
||||
if (ob->runtime.bb == nullptr) {
|
||||
ob->runtime.bb = MEM_cnew<BoundBox>(__func__);
|
||||
}
|
||||
|
||||
|
@ -682,7 +682,7 @@ void BKE_mball_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
|||
}
|
||||
|
||||
Mesh *mesh = BKE_mball_polygonize(depsgraph, scene, ob);
|
||||
if (mesh == NULL) {
|
||||
if (mesh == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -693,14 +693,14 @@ void BKE_mball_data_update(Depsgraph *depsgraph, Scene *scene, Object *ob)
|
|||
if (ob->parent && ob->parent->type == OB_LATTICE && ob->partype == PARSKEL) {
|
||||
int verts_num;
|
||||
float(*positions)[3] = BKE_mesh_vert_coords_alloc(mesh, &verts_num);
|
||||
BKE_lattice_deform_coords(ob->parent, ob, positions, verts_num, 0, NULL, 1.0f);
|
||||
BKE_lattice_deform_coords(ob->parent, ob, positions, verts_num, 0, nullptr, 1.0f);
|
||||
BKE_mesh_vert_coords_apply(mesh, positions);
|
||||
MEM_freeN(positions);
|
||||
}
|
||||
|
||||
ob->runtime.geometry_set_eval = new GeometrySet(GeometrySet::create_with_mesh(mesh));
|
||||
|
||||
if (ob->runtime.bb == NULL) {
|
||||
if (ob->runtime.bb == nullptr) {
|
||||
ob->runtime.bb = MEM_cnew<BoundBox>(__func__);
|
||||
}
|
||||
blender::float3 min(std::numeric_limits<float>::max());
|
||||
|
|
|
@ -343,7 +343,7 @@ static Mesh *mesh_wrapper_ensure_subdivision(Mesh *me)
|
|||
if (use_clnors) {
|
||||
float(*lnors)[3] = static_cast<float(*)[3]>(
|
||||
CustomData_get_layer(&subdiv_mesh->ldata, CD_NORMAL));
|
||||
BLI_assert(lnors != NULL);
|
||||
BLI_assert(lnors != nullptr);
|
||||
BKE_mesh_set_custom_normals(subdiv_mesh, lnors);
|
||||
CustomData_set_layer_flag(&me->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
CustomData_set_layer_flag(&subdiv_mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
|
||||
|
|
|
@ -710,7 +710,7 @@ bool IMesh::erase_face_positions(int f_index, Span<bool> face_pos_erase, IMeshAr
|
|||
* mark with null pointer and caller should call remove_null_faces().
|
||||
* the loop is done.
|
||||
*/
|
||||
this->face_[f_index] = NULL;
|
||||
this->face_[f_index] = nullptr;
|
||||
return true;
|
||||
}
|
||||
Array<const Vert *> new_vert(new_len);
|
||||
|
|
|
@ -84,11 +84,11 @@ class Task {
|
|||
free_taskdata(other.free_taskdata),
|
||||
freedata(other.freedata)
|
||||
{
|
||||
((Task &)other).pool = NULL;
|
||||
((Task &)other).run = NULL;
|
||||
((Task &)other).taskdata = NULL;
|
||||
((Task &)other).pool = nullptr;
|
||||
((Task &)other).run = nullptr;
|
||||
((Task &)other).taskdata = nullptr;
|
||||
((Task &)other).free_taskdata = false;
|
||||
((Task &)other).freedata = NULL;
|
||||
((Task &)other).freedata = nullptr;
|
||||
}
|
||||
#else
|
||||
Task(const Task &other) = delete;
|
||||
|
|
|
@ -181,7 +181,7 @@ static void testbuffer_list_state_from_data__stride_expand(ListBase *lb,
|
|||
#define TESTBUFFER_STRINGS_CREATE(lb, ...) \
|
||||
{ \
|
||||
BLI_listbase_clear(lb); \
|
||||
const char *data_array[] = {__VA_ARGS__ NULL}; \
|
||||
const char *data_array[] = {__VA_ARGS__ nullptr}; \
|
||||
testbuffer_list_state_from_string_array((lb), data_array); \
|
||||
} \
|
||||
((void)0)
|
||||
|
@ -795,10 +795,10 @@ TEST(array_store, TestChunk_Rand31_Stride11_Chunk21)
|
|||
|
||||
/* Test From Files (disabled, keep for local tests.) */
|
||||
|
||||
void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
|
||||
static void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_size)
|
||||
{
|
||||
FILE *fp = fopen(filepath, "rb");
|
||||
void *mem = NULL;
|
||||
void *mem = nullptr;
|
||||
|
||||
if (fp) {
|
||||
long int filelen_read;
|
||||
|
@ -810,14 +810,14 @@ void *file_read_binary_as_mem(const char *filepath, size_t pad_bytes, size_t *r_
|
|||
fseek(fp, 0L, SEEK_SET);
|
||||
|
||||
mem = MEM_mallocN(filelen + pad_bytes, __func__);
|
||||
if (mem == NULL) {
|
||||
if (mem == nullptr) {
|
||||
goto finally;
|
||||
}
|
||||
|
||||
filelen_read = fread(mem, 1, filelen, fp);
|
||||
if ((filelen_read != filelen) || ferror(fp)) {
|
||||
MEM_freeN(mem);
|
||||
mem = NULL;
|
||||
mem = nullptr;
|
||||
goto finally;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath)
|
|||
}
|
||||
|
||||
char abspath[FILENAME_MAX];
|
||||
BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, NULL);
|
||||
BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, nullptr);
|
||||
|
||||
BlendFileReadReport bf_reports = {nullptr};
|
||||
bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, &bf_reports);
|
||||
|
|
|
@ -55,7 +55,7 @@ static bool pointcloud_batch_cache_valid(PointCloud &pointcloud)
|
|||
{
|
||||
PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
|
||||
|
||||
if (cache == NULL) {
|
||||
if (cache == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (cache->mat_len != DRW_pointcloud_material_count_get(&pointcloud)) {
|
||||
|
@ -86,7 +86,7 @@ static void pointcloud_batch_cache_init(PointCloud &pointcloud)
|
|||
void DRW_pointcloud_batch_cache_dirty_tag(PointCloud *pointcloud, int mode)
|
||||
{
|
||||
PointCloudBatchCache *cache = pointcloud_batch_cache_get(*pointcloud);
|
||||
if (cache == NULL) {
|
||||
if (cache == nullptr) {
|
||||
return;
|
||||
}
|
||||
switch (mode) {
|
||||
|
@ -137,7 +137,7 @@ static void pointcloud_batch_cache_ensure_pos(const PointCloud &pointcloud,
|
|||
PointCloudBatchCache &cache)
|
||||
{
|
||||
using namespace blender;
|
||||
if (cache.pos != NULL) {
|
||||
if (cache.pos != nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -198,7 +198,7 @@ static const uint half_octahedron_tris[4][3] = {
|
|||
|
||||
static void pointcloud_batch_cache_ensure_geom(PointCloudBatchCache &cache)
|
||||
{
|
||||
if (cache.geom != NULL) {
|
||||
if (cache.geom != nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -232,9 +232,9 @@ GPUBatch *DRW_pointcloud_batch_cache_get_dots(Object *ob)
|
|||
PointCloud &pointcloud = *static_cast<PointCloud *>(ob->data);
|
||||
PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
|
||||
|
||||
if (cache->dots == NULL) {
|
||||
if (cache->dots == nullptr) {
|
||||
pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
|
||||
cache->dots = GPU_batch_create(GPU_PRIM_POINTS, cache->pos, NULL);
|
||||
cache->dots = GPU_batch_create(GPU_PRIM_POINTS, cache->pos, nullptr);
|
||||
}
|
||||
|
||||
return cache->dots;
|
||||
|
@ -245,7 +245,7 @@ GPUBatch *DRW_pointcloud_batch_cache_get_surface(Object *ob)
|
|||
PointCloud &pointcloud = *static_cast<PointCloud *>(ob->data);
|
||||
PointCloudBatchCache *cache = pointcloud_batch_cache_get(pointcloud);
|
||||
|
||||
if (cache->surface == NULL) {
|
||||
if (cache->surface == nullptr) {
|
||||
pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
|
||||
pointcloud_batch_cache_ensure_geom(*cache);
|
||||
|
||||
|
@ -265,7 +265,7 @@ GPUBatch **DRW_cache_pointcloud_surface_shaded_get(Object *ob,
|
|||
BLI_assert(cache->mat_len == gpumat_array_len);
|
||||
UNUSED_VARS(gpumat_array_len);
|
||||
|
||||
if (cache->surface_per_mat[0] == NULL) {
|
||||
if (cache->surface_per_mat[0] == nullptr) {
|
||||
pointcloud_batch_cache_ensure_pos(pointcloud, *cache);
|
||||
pointcloud_batch_cache_ensure_geom(*cache);
|
||||
|
||||
|
|
|
@ -724,7 +724,7 @@ static void draw_subdiv_cache_update_extra_coarse_face_data(DRWSubdivCache *cach
|
|||
if (mr->extract_type == MR_EXTRACT_BMESH) {
|
||||
draw_subdiv_cache_extra_coarse_face_data_bm(cache->bm, mr->efa_act, flags_data);
|
||||
}
|
||||
else if (mr->p_origindex != NULL) {
|
||||
else if (mr->p_origindex != nullptr) {
|
||||
draw_subdiv_cache_extra_coarse_face_data_mapped(mesh, cache->bm, mr, flags_data);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -130,7 +130,7 @@ void ui_but_drag_start(bContext *C, uiBut *but)
|
|||
(but->dragflag & UI_BUT_DRAGPOIN_FREE) ? WM_DRAG_FREE_DATA :
|
||||
WM_DRAG_NOP);
|
||||
/* wmDrag has ownership over dragpoin now, stop messing with it. */
|
||||
but->dragpoin = NULL;
|
||||
but->dragpoin = nullptr;
|
||||
|
||||
if (but->imb) {
|
||||
WM_event_drag_image(drag, but->imb, but->imb_scale);
|
||||
|
@ -141,6 +141,6 @@ void ui_but_drag_start(bContext *C, uiBut *but)
|
|||
/* Special feature for assets: We add another drag item that supports multiple assets. It
|
||||
* gets the assets from context. */
|
||||
if (ELEM(but->dragtype, WM_DRAG_ASSET, WM_DRAG_ID)) {
|
||||
WM_event_start_drag(C, ICON_NONE, WM_DRAG_ASSET_LIST, NULL, 0, WM_DRAG_NOP);
|
||||
WM_event_start_drag(C, ICON_NONE, WM_DRAG_ASSET_LIST, nullptr, 0, WM_DRAG_NOP);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -756,13 +756,13 @@ static void override_idtemplate_ids_get(
|
|||
PropertyRNA *prop;
|
||||
UI_context_active_but_prop_get_templateID(C, &owner_ptr, &prop);
|
||||
|
||||
if (owner_ptr.data == NULL || prop == NULL) {
|
||||
*r_owner_id = *r_id = NULL;
|
||||
if (r_owner_ptr != NULL) {
|
||||
if (owner_ptr.data == nullptr || prop == nullptr) {
|
||||
*r_owner_id = *r_id = nullptr;
|
||||
if (r_owner_ptr != nullptr) {
|
||||
*r_owner_ptr = PointerRNA_NULL;
|
||||
}
|
||||
if (r_prop != NULL) {
|
||||
*r_prop = NULL;
|
||||
if (r_prop != nullptr) {
|
||||
*r_prop = nullptr;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -770,10 +770,10 @@ static void override_idtemplate_ids_get(
|
|||
*r_owner_id = owner_ptr.owner_id;
|
||||
PointerRNA idptr = RNA_property_pointer_get(&owner_ptr, prop);
|
||||
*r_id = static_cast<ID *>(idptr.data);
|
||||
if (r_owner_ptr != NULL) {
|
||||
if (r_owner_ptr != nullptr) {
|
||||
*r_owner_ptr = owner_ptr;
|
||||
}
|
||||
if (r_prop != NULL) {
|
||||
if (r_prop != nullptr) {
|
||||
*r_prop = prop;
|
||||
}
|
||||
}
|
||||
|
@ -781,9 +781,9 @@ static void override_idtemplate_ids_get(
|
|||
static bool override_idtemplate_poll(bContext *C, const bool is_create_op)
|
||||
{
|
||||
ID *owner_id, *id;
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, NULL, NULL);
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, nullptr, nullptr);
|
||||
|
||||
if (owner_id == NULL || id == NULL) {
|
||||
if (owner_id == nullptr || id == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -812,14 +812,14 @@ static int override_idtemplate_make_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
PointerRNA owner_ptr;
|
||||
PropertyRNA *prop;
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, &owner_ptr, &prop);
|
||||
if (ELEM(NULL, owner_id, id)) {
|
||||
if (ELEM(nullptr, owner_id, id)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
ID *id_override = ui_template_id_liboverride_hierarchy_make(
|
||||
C, CTX_data_main(C), owner_id, id, NULL);
|
||||
C, CTX_data_main(C), owner_id, id, nullptr);
|
||||
|
||||
if (id_override == NULL) {
|
||||
if (id_override == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -833,16 +833,16 @@ static int override_idtemplate_make_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
* override of the data too. */
|
||||
if (!ID_IS_LINKED(owner_id)) {
|
||||
RNA_id_pointer_create(id_override, &idptr);
|
||||
RNA_property_pointer_set(&owner_ptr, prop, idptr, NULL);
|
||||
RNA_property_pointer_set(&owner_ptr, prop, idptr, nullptr);
|
||||
}
|
||||
RNA_property_update(C, &owner_ptr, prop);
|
||||
|
||||
/* 'Security' extra tagging, since this process may also affect the owner ID and not only the
|
||||
* used ID, relying on the property update code only is not always enough. */
|
||||
DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_BASE_FLAGS | ID_RECALC_COPY_ON_WRITE);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -875,7 +875,7 @@ static int override_idtemplate_reset_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
PointerRNA owner_ptr;
|
||||
PropertyRNA *prop;
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, &owner_ptr, &prop);
|
||||
if (ELEM(NULL, owner_id, id)) {
|
||||
if (ELEM(nullptr, owner_id, id)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -888,7 +888,7 @@ static int override_idtemplate_reset_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
PointerRNA idptr;
|
||||
/* `idptr` is re-assigned to owner property to ensure proper updates etc. */
|
||||
RNA_id_pointer_create(id, &idptr);
|
||||
RNA_property_pointer_set(&owner_ptr, prop, idptr, NULL);
|
||||
RNA_property_pointer_set(&owner_ptr, prop, idptr, nullptr);
|
||||
RNA_property_update(C, &owner_ptr, prop);
|
||||
|
||||
/* No need for 'security' extra tagging here, since this process will never affect the owner ID.
|
||||
|
@ -923,7 +923,7 @@ static int override_idtemplate_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
PointerRNA owner_ptr;
|
||||
PropertyRNA *prop;
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, &owner_ptr, &prop);
|
||||
if (ELEM(NULL, owner_id, id)) {
|
||||
if (ELEM(nullptr, owner_id, id)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -948,7 +948,7 @@ static int override_idtemplate_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
if (do_remap_active) {
|
||||
Object *ref_object = (Object *)id_new;
|
||||
Base *basact = BKE_view_layer_base_find(view_layer, ref_object);
|
||||
if (basact != NULL) {
|
||||
if (basact != nullptr) {
|
||||
view_layer->basact = basact;
|
||||
}
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
|
||||
|
@ -967,9 +967,9 @@ static int override_idtemplate_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
/* 'Security' extra tagging, since this process may also affect the owner ID and not only the
|
||||
* used ID, relying on the property update code only is not always enough. */
|
||||
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS | ID_RECALC_COPY_ON_WRITE);
|
||||
WM_event_add_notifier(C, NC_WINDOW, NULL);
|
||||
WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, NULL);
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
WM_event_add_notifier(C, NC_WM | ND_LIB_OVERRIDE_CHANGED, nullptr);
|
||||
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -995,9 +995,9 @@ static bool override_idtemplate_menu_poll(const bContext *C_const, MenuType *UNU
|
|||
{
|
||||
bContext *C = (bContext *)C_const;
|
||||
ID *owner_id, *id;
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, NULL, NULL);
|
||||
override_idtemplate_ids_get(C, &owner_id, &id, nullptr, nullptr);
|
||||
|
||||
if (owner_id == NULL || id == NULL) {
|
||||
if (owner_id == nullptr || id == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -624,7 +624,7 @@ void paintvert_hide(bContext *C, Object *ob, const bool unselected)
|
|||
{
|
||||
using namespace blender;
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL || me->totvert == 0) {
|
||||
if (me == nullptr || me->totvert == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -657,7 +657,7 @@ void paintvert_reveal(bContext *C, Object *ob, const bool select)
|
|||
{
|
||||
using namespace blender;
|
||||
Mesh *me = BKE_mesh_from_object(ob);
|
||||
if (me == NULL || me->totvert == 0) {
|
||||
if (me == nullptr || me->totvert == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3664,7 +3664,7 @@ static int duplicate_exec(bContext *C, wmOperator *op)
|
|||
Object *ob_new_active = nullptr;
|
||||
|
||||
CTX_DATA_BEGIN (C, Base *, base, selected_bases) {
|
||||
Object *ob_new = NULL;
|
||||
Object *ob_new = nullptr;
|
||||
object_add_duplicate_internal(bmain,
|
||||
scene,
|
||||
view_layer,
|
||||
|
|
|
@ -376,7 +376,7 @@ void outliner_collection_delete(
|
|||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id);
|
||||
BLI_assert(id_type->owner_get != nullptr);
|
||||
|
||||
ID *scene_owner = id_type->owner_get(bmain, &parent->id, NULL);
|
||||
ID *scene_owner = id_type->owner_get(bmain, &parent->id, nullptr);
|
||||
BLI_assert(GS(scene_owner->name) == ID_SCE);
|
||||
if (ID_IS_LINKED(scene_owner) || ID_IS_OVERRIDE_LIBRARY(scene_owner)) {
|
||||
skip = true;
|
||||
|
@ -609,7 +609,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
|
|||
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id);
|
||||
BLI_assert(id_type->owner_get != nullptr);
|
||||
|
||||
Scene *scene_owner = (Scene *)id_type->owner_get(bmain, &parent->id, NULL);
|
||||
Scene *scene_owner = (Scene *)id_type->owner_get(bmain, &parent->id, nullptr);
|
||||
BLI_assert(scene_owner != nullptr);
|
||||
BLI_assert(GS(scene_owner->id.name) == ID_SCE);
|
||||
|
||||
|
|
|
@ -292,7 +292,7 @@ void OverrideRNAPathTreeBuilder::build_path(TreeElement &parent,
|
|||
PointerRNA idpoin;
|
||||
RNA_id_pointer_create(&override_data.id, &idpoin);
|
||||
|
||||
ListBase path_elems = {NULL};
|
||||
ListBase path_elems = {nullptr};
|
||||
if (!RNA_path_resolve_elements(&idpoin, override_data.override_property.rna_path, &path_elems)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ GLContext::GLContext(void *ghost_window, GLSharedOrphanLists &shared_orphan_list
|
|||
}
|
||||
}
|
||||
else {
|
||||
/* For off-screen contexts. Default frame-buffer is NULL. */
|
||||
/* For off-screen contexts. Default frame-buffer is null. */
|
||||
back_left = new GLFrameBuffer("back_left", this, GL_NONE, 0, 0, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ std::optional<std::string> USDVolumeWriter::construct_vdb_file_path(const Volume
|
|||
strcat(vdb_file_name, ".vdb");
|
||||
|
||||
char vdb_file_path[FILE_MAX];
|
||||
BLI_path_join(vdb_file_path, sizeof(vdb_file_path), vdb_directory_path, vdb_file_name, NULL);
|
||||
BLI_path_join(vdb_file_path, sizeof(vdb_file_path), vdb_directory_path, vdb_file_name, nullptr);
|
||||
|
||||
return vdb_file_path;
|
||||
}
|
||||
|
|
|
@ -748,7 +748,7 @@ MTLParser::MTLParser(StringRefNull mtl_library, StringRefNull obj_filepath)
|
|||
{
|
||||
char obj_file_dir[FILE_MAXDIR];
|
||||
BLI_split_dir_part(obj_filepath.data(), obj_file_dir, FILE_MAXDIR);
|
||||
BLI_path_join(mtl_file_path_, FILE_MAX, obj_file_dir, mtl_library.data(), NULL);
|
||||
BLI_path_join(mtl_file_path_, FILE_MAX, obj_file_dir, mtl_library.data(), nullptr);
|
||||
BLI_split_dir_part(mtl_file_path_, mtl_dir_path_, FILE_MAXDIR);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen)
|
|||
|
||||
/* Empty, return. */
|
||||
if (UNLIKELY(len == 0)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Try to use fixed buffer if possible. */
|
||||
|
@ -83,11 +83,11 @@ static char *rna_path_token_in_brackets(const char **path,
|
|||
int len = 0;
|
||||
bool quoted = false;
|
||||
|
||||
BLI_assert(r_quoted != NULL);
|
||||
BLI_assert(r_quoted != nullptr);
|
||||
|
||||
/* Get data between `[]`, check escaping quotes and back-slashes with #BLI_str_unescape. */
|
||||
if (UNLIKELY(**path != '[')) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
(*path)++;
|
||||
|
@ -99,9 +99,9 @@ static char *rna_path_token_in_brackets(const char **path,
|
|||
(*path)++;
|
||||
p = *path;
|
||||
const char *p_end = BLI_str_escape_find_quote(p);
|
||||
if (p_end == NULL) {
|
||||
if (p_end == nullptr) {
|
||||
/* No Matching quote. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
/* Exclude the last quote from the length. */
|
||||
len += (p_end - p);
|
||||
|
@ -120,12 +120,12 @@ static char *rna_path_token_in_brackets(const char **path,
|
|||
}
|
||||
|
||||
if (UNLIKELY(*p != ']')) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Empty, return. */
|
||||
if (UNLIKELY(len == 0)) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Try to use fixed buffer if possible. */
|
||||
|
@ -194,7 +194,7 @@ static bool rna_path_parse_collection_key(const char **path,
|
|||
found = true;
|
||||
}
|
||||
else {
|
||||
r_nextptr->data = NULL;
|
||||
r_nextptr->data = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -207,7 +207,7 @@ static bool rna_path_parse_collection_key(const char **path,
|
|||
found = true;
|
||||
}
|
||||
else {
|
||||
r_nextptr->data = NULL;
|
||||
r_nextptr->data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +221,7 @@ static bool rna_path_parse_collection_key(const char **path,
|
|||
}
|
||||
else {
|
||||
/* ensure we quit on invalid values */
|
||||
r_nextptr->data = NULL;
|
||||
r_nextptr->data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -255,7 +255,7 @@ static bool rna_path_parse_array_index(const char **path,
|
|||
bool quoted;
|
||||
token = rna_path_token_in_brackets(path, fixedbuf, sizeof(fixedbuf), "ed);
|
||||
|
||||
if (token == NULL) {
|
||||
if (token == nullptr) {
|
||||
/* invalid syntax blah[] */
|
||||
return false;
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ static bool rna_path_parse_array_index(const char **path,
|
|||
else if (dim == 1) {
|
||||
/* location.x || scale.X, single dimension arrays only */
|
||||
token = rna_path_token(path, fixedbuf, sizeof(fixedbuf));
|
||||
if (token == NULL) {
|
||||
if (token == nullptr) {
|
||||
/* invalid syntax blah. */
|
||||
return false;
|
||||
}
|
||||
|
@ -354,23 +354,23 @@ static bool rna_path_parse(const PointerRNA *ptr,
|
|||
ListBase *r_elements,
|
||||
const bool eval_pointer)
|
||||
{
|
||||
BLI_assert(r_item_ptr == NULL || !eval_pointer);
|
||||
BLI_assert(r_item_ptr == nullptr || !eval_pointer);
|
||||
PropertyRNA *prop;
|
||||
PointerRNA curptr, nextptr;
|
||||
PropertyElemRNA *prop_elem = NULL;
|
||||
PropertyElemRNA *prop_elem = nullptr;
|
||||
int index = -1;
|
||||
char fixedbuf[256];
|
||||
int type;
|
||||
const bool do_item_ptr = r_item_ptr != NULL && !eval_pointer;
|
||||
const bool do_item_ptr = r_item_ptr != nullptr && !eval_pointer;
|
||||
|
||||
if (do_item_ptr) {
|
||||
RNA_POINTER_INVALIDATE(&nextptr);
|
||||
}
|
||||
|
||||
prop = NULL;
|
||||
prop = nullptr;
|
||||
curptr = *ptr;
|
||||
|
||||
if (path == NULL || *path == '\0') {
|
||||
if (path == nullptr || *path == '\0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ static bool rna_path_parse(const PointerRNA *ptr,
|
|||
return false;
|
||||
}
|
||||
|
||||
prop = NULL;
|
||||
prop = nullptr;
|
||||
if (use_id_prop) { /* look up property name in current struct */
|
||||
IDProperty *group = RNA_struct_idprops(&curptr, 0);
|
||||
if (group && quoted) {
|
||||
|
@ -438,7 +438,7 @@ static bool rna_path_parse(const PointerRNA *ptr,
|
|||
|
||||
if (eval_pointer || *path != '\0') {
|
||||
curptr = nextptr;
|
||||
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
|
||||
prop = nullptr; /* now we have a PointerRNA, the prop is our parent so forget it */
|
||||
index = -1;
|
||||
}
|
||||
break;
|
||||
|
@ -455,7 +455,7 @@ static bool rna_path_parse(const PointerRNA *ptr,
|
|||
|
||||
if (eval_pointer || *path != '\0') {
|
||||
curptr = nextptr;
|
||||
prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
|
||||
prop = nullptr; /* now we have a PointerRNA, the prop is our parent so forget it */
|
||||
index = -1;
|
||||
}
|
||||
}
|
||||
|
@ -505,27 +505,27 @@ bool RNA_path_resolve(const PointerRNA *ptr,
|
|||
PointerRNA *r_ptr,
|
||||
PropertyRNA **r_prop)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, nullptr, nullptr, nullptr, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL;
|
||||
return r_ptr->data != nullptr;
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_full(
|
||||
const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, nullptr, nullptr, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL;
|
||||
return r_ptr->data != nullptr;
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_full_maybe_null(
|
||||
const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
|
||||
{
|
||||
return rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true);
|
||||
return rna_path_parse(ptr, path, r_ptr, r_prop, r_index, nullptr, nullptr, true);
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_property(const PointerRNA *ptr,
|
||||
|
@ -533,21 +533,21 @@ bool RNA_path_resolve_property(const PointerRNA *ptr,
|
|||
PointerRNA *r_ptr,
|
||||
PropertyRNA **r_prop)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, false)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, nullptr, nullptr, nullptr, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL && *r_prop != NULL;
|
||||
return r_ptr->data != nullptr && *r_prop != nullptr;
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_property_full(
|
||||
const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, nullptr, nullptr, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL && *r_prop != NULL;
|
||||
return r_ptr->data != nullptr && *r_prop != nullptr;
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_property_and_item_pointer(const PointerRNA *ptr,
|
||||
|
@ -556,11 +556,11 @@ bool RNA_path_resolve_property_and_item_pointer(const PointerRNA *ptr,
|
|||
PropertyRNA **r_prop,
|
||||
PointerRNA *r_item_ptr)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, r_item_ptr, NULL, false)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, nullptr, r_item_ptr, nullptr, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL && *r_prop != NULL;
|
||||
return r_ptr->data != nullptr && *r_prop != nullptr;
|
||||
}
|
||||
|
||||
bool RNA_path_resolve_property_and_item_pointer_full(const PointerRNA *ptr,
|
||||
|
@ -570,15 +570,15 @@ bool RNA_path_resolve_property_and_item_pointer_full(const PointerRNA *ptr,
|
|||
int *r_index,
|
||||
PointerRNA *r_item_ptr)
|
||||
{
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false)) {
|
||||
if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, nullptr, false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return r_ptr->data != NULL && *r_prop != NULL;
|
||||
return r_ptr->data != nullptr && *r_prop != nullptr;
|
||||
}
|
||||
bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, ListBase *r_elements)
|
||||
{
|
||||
return rna_path_parse(ptr, path, NULL, NULL, NULL, NULL, r_elements, false);
|
||||
return rna_path_parse(ptr, path, nullptr, nullptr, nullptr, nullptr, r_elements, false);
|
||||
}
|
||||
|
||||
char *RNA_path_append(const char *path,
|
||||
|
@ -640,10 +640,10 @@ static UNUSED_FUNCTION_WITH_RETURN_TYPE(char *, RNA_path_back)(const char *path)
|
|||
int i;
|
||||
|
||||
if (!path) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
previous = NULL;
|
||||
previous = nullptr;
|
||||
current = path;
|
||||
|
||||
/* parse token by token until the end, then we back up to the previous
|
||||
|
@ -654,7 +654,7 @@ static UNUSED_FUNCTION_WITH_RETURN_TYPE(char *, RNA_path_back)(const char *path)
|
|||
token = rna_path_token(¤t, fixedbuf, sizeof(fixedbuf));
|
||||
|
||||
if (!token) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (token != fixedbuf) {
|
||||
MEM_freeN(token);
|
||||
|
@ -675,7 +675,7 @@ static UNUSED_FUNCTION_WITH_RETURN_TYPE(char *, RNA_path_back)(const char *path)
|
|||
}
|
||||
|
||||
if (!previous) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* copy and strip off last token */
|
||||
|
@ -692,27 +692,27 @@ static UNUSED_FUNCTION_WITH_RETURN_TYPE(char *, RNA_path_back)(const char *path)
|
|||
|
||||
const char *RNA_path_array_index_token_find(const char *rna_path, const PropertyRNA *array_prop)
|
||||
{
|
||||
if (array_prop != NULL) {
|
||||
if (array_prop != nullptr) {
|
||||
if (!ELEM(array_prop->type, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
|
||||
BLI_assert(array_prop->arraydimension == 0);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
if (array_prop->arraydimension == 0) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/* Valid 'array part' of a rna path can only have '[', ']' and digit characters.
|
||||
* It may have more than one of those (e.g. `[12][1]`) in case of multi-dimensional arrays. */
|
||||
if (UNLIKELY(rna_path[0] == '\0')) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
size_t rna_path_len = (size_t)strlen(rna_path) - 1;
|
||||
if (rna_path[rna_path_len] != ']') {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char *last_valid_index_token_start = NULL;
|
||||
const char *last_valid_index_token_start = nullptr;
|
||||
while (rna_path_len--) {
|
||||
switch (rna_path[rna_path_len]) {
|
||||
case '[':
|
||||
|
@ -761,7 +761,7 @@ static char *rna_idp_path_create(IDP_Chain *child_link)
|
|||
|
||||
/* reverse the list */
|
||||
IDP_Chain *link_prev;
|
||||
link_prev = NULL;
|
||||
link_prev = nullptr;
|
||||
while (link) {
|
||||
IDP_Chain *link_next = link->up;
|
||||
link->up = link_prev;
|
||||
|
@ -787,7 +787,7 @@ static char *rna_idp_path_create(IDP_Chain *child_link)
|
|||
|
||||
if (*path == '\0') {
|
||||
MEM_freeN(path);
|
||||
path = NULL;
|
||||
path = nullptr;
|
||||
}
|
||||
|
||||
return path;
|
||||
|
@ -798,7 +798,7 @@ static char *rna_idp_path(PointerRNA *ptr,
|
|||
IDProperty *needle,
|
||||
IDP_Chain *parent_link)
|
||||
{
|
||||
char *path = NULL;
|
||||
char *path = nullptr;
|
||||
IDP_Chain link;
|
||||
|
||||
IDProperty *iter;
|
||||
|
@ -808,7 +808,7 @@ static char *rna_idp_path(PointerRNA *ptr,
|
|||
|
||||
link.up = parent_link;
|
||||
/* Always set both name and index, else a stale value might get used. */
|
||||
link.name = NULL;
|
||||
link.name = nullptr;
|
||||
link.index = -1;
|
||||
|
||||
for (i = 0, iter = static_cast<IDProperty *>(haystack->data.group.first); iter;
|
||||
|
@ -835,7 +835,7 @@ static char *rna_idp_path(PointerRNA *ptr,
|
|||
*
|
||||
* See T84091. */
|
||||
PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
|
||||
if (prop == NULL || (prop->flag & PROP_IDPROPERTY) == 0) {
|
||||
if (prop == nullptr || (prop->flag & PROP_IDPROPERTY) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -895,16 +895,16 @@ char *RNA_path_from_struct_to_idproperty(PointerRNA *ptr, IDProperty *needle)
|
|||
IDProperty *haystack = RNA_struct_idprops(ptr, false);
|
||||
|
||||
if (haystack) { /* can fail when called on bones */
|
||||
return rna_idp_path(ptr, haystack, needle, NULL);
|
||||
return rna_idp_path(ptr, haystack, needle, nullptr);
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static char *rna_path_from_ID_to_idpgroup(const PointerRNA *ptr)
|
||||
{
|
||||
PointerRNA id_ptr;
|
||||
|
||||
BLI_assert(ptr->owner_id != NULL);
|
||||
BLI_assert(ptr->owner_id != nullptr);
|
||||
|
||||
/* TODO: Support Bones/PoseBones. no pointers stored to the bones from here, only the ID.
|
||||
* See example in T25746.
|
||||
|
@ -922,7 +922,7 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
|
|||
*r_path = "";
|
||||
}
|
||||
|
||||
if ((id == NULL) || (id->flag & LIB_EMBEDDED_DATA) == 0) {
|
||||
if ((id == nullptr) || (id->flag & LIB_EMBEDDED_DATA) == 0) {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
@ -940,7 +940,7 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
|
|||
}
|
||||
}
|
||||
|
||||
if (id_type->owner_get == NULL) {
|
||||
if (id_type->owner_get == nullptr) {
|
||||
BLI_assert_msg(0, "Missing handling of embedded id type.");
|
||||
return id;
|
||||
}
|
||||
|
@ -949,19 +949,19 @@ ID *RNA_find_real_ID_and_path(Main *bmain, ID *id, const char **r_path)
|
|||
|
||||
static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_real_id)
|
||||
{
|
||||
if (r_real_id != NULL) {
|
||||
*r_real_id = NULL;
|
||||
if (r_real_id != nullptr) {
|
||||
*r_real_id = nullptr;
|
||||
}
|
||||
|
||||
const char *prefix;
|
||||
ID *real_id = RNA_find_real_ID_and_path(bmain, id, &prefix);
|
||||
|
||||
if (r_real_id != NULL) {
|
||||
if (r_real_id != nullptr) {
|
||||
*r_real_id = real_id;
|
||||
}
|
||||
|
||||
if (path != NULL) {
|
||||
char *new_path = NULL;
|
||||
if (path != nullptr) {
|
||||
char *new_path = nullptr;
|
||||
|
||||
if (real_id) {
|
||||
if (prefix[0]) {
|
||||
|
@ -975,15 +975,15 @@ static char *rna_prepend_real_ID_path(Main *bmain, ID *id, char *path, ID **r_re
|
|||
MEM_freeN(path);
|
||||
return new_path;
|
||||
}
|
||||
return prefix[0] != '\0' ? BLI_strdup(prefix) : NULL;
|
||||
return prefix[0] != '\0' ? BLI_strdup(prefix) : nullptr;
|
||||
}
|
||||
|
||||
char *RNA_path_from_ID_to_struct(const PointerRNA *ptr)
|
||||
{
|
||||
char *ptrpath = NULL;
|
||||
char *ptrpath = nullptr;
|
||||
|
||||
if (!ptr->owner_id || !ptr->data) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!RNA_struct_is_ID(ptr->type)) {
|
||||
|
@ -1005,7 +1005,7 @@ char *RNA_path_from_ID_to_struct(const PointerRNA *ptr)
|
|||
ptrpath = BLI_strdup(RNA_property_identifier(userprop));
|
||||
}
|
||||
else {
|
||||
return NULL; /* can't do anything about this case yet... */
|
||||
return nullptr; /* can't do anything about this case yet... */
|
||||
}
|
||||
}
|
||||
else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) {
|
||||
|
@ -1013,7 +1013,7 @@ char *RNA_path_from_ID_to_struct(const PointerRNA *ptr)
|
|||
return rna_path_from_ID_to_idpgroup(ptr);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1078,7 +1078,7 @@ char *RNA_path_from_ID_to_property_index(const PointerRNA *ptr,
|
|||
char *ptrpath, *path;
|
||||
|
||||
if (!ptr->owner_id || !ptr->data) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* path from ID to the struct holding this property */
|
||||
|
@ -1118,7 +1118,7 @@ char *RNA_path_from_ID_to_property_index(const PointerRNA *ptr,
|
|||
}
|
||||
}
|
||||
else {
|
||||
path = NULL;
|
||||
path = nullptr;
|
||||
}
|
||||
|
||||
return path;
|
||||
|
@ -1140,7 +1140,8 @@ char *RNA_path_from_real_ID_to_property_index(Main *bmain,
|
|||
|
||||
/* NULL path is always an error here, in that case do not return the 'fake ID from real ID' part
|
||||
* of the path either. */
|
||||
return path != NULL ? rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real_id) : NULL;
|
||||
return path != nullptr ? rna_prepend_real_ID_path(bmain, ptr->owner_id, path, r_real_id) :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
char *RNA_path_resolve_from_type_to_property(const PointerRNA *ptr,
|
||||
|
@ -1150,12 +1151,12 @@ char *RNA_path_resolve_from_type_to_property(const PointerRNA *ptr,
|
|||
/* Try to recursively find an "type"'d ancestor,
|
||||
* to handle situations where path from ID is not enough. */
|
||||
PointerRNA idptr;
|
||||
ListBase path_elems = {NULL};
|
||||
char *path = NULL;
|
||||
ListBase path_elems = {nullptr};
|
||||
char *path = nullptr;
|
||||
char *full_path = RNA_path_from_ID_to_property(ptr, prop);
|
||||
|
||||
if (full_path == NULL) {
|
||||
return NULL;
|
||||
if (full_path == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RNA_id_pointer_create(ptr->owner_id, &idptr);
|
||||
|
@ -1222,7 +1223,7 @@ char *RNA_path_full_struct_py(Main *bmain, const PointerRNA *ptr)
|
|||
char *ret;
|
||||
|
||||
if (!ptr->owner_id) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* never fails */
|
||||
|
@ -1253,7 +1254,7 @@ char *RNA_path_full_property_py_ex(
|
|||
char *ret;
|
||||
|
||||
if (!ptr->owner_id) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* never fails */
|
||||
|
@ -1302,12 +1303,12 @@ char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
|
|||
char *ret;
|
||||
|
||||
if (!ptr->owner_id) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
data_path = RNA_path_from_ID_to_property(ptr, prop);
|
||||
|
||||
if (data_path == NULL) {
|
||||
if (data_path == nullptr) {
|
||||
/* This may not be an ID at all, check for simple when pointer owns property.
|
||||
* TODO: more complex nested case. */
|
||||
if (!RNA_struct_is_ID(ptr->type)) {
|
||||
|
|
|
@ -249,7 +249,7 @@ static void node_geo_exec(GeoNodeExecParams params)
|
|||
Mesh &surface_object_data = *static_cast<Mesh *>(surface_ob_orig->data);
|
||||
|
||||
if (BMEditMesh *em = surface_object_data.edit_mesh) {
|
||||
surface_mesh_orig = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL, &surface_object_data);
|
||||
surface_mesh_orig = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, nullptr, &surface_object_data);
|
||||
free_suface_mesh_orig = true;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -617,7 +617,7 @@ static bool ntree_shader_implicit_closure_cast(bNodeTree *ntree)
|
|||
bool modified = false;
|
||||
LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &ntree->links) {
|
||||
if ((link->fromsock->type != SOCK_SHADER) && (link->tosock->type == SOCK_SHADER)) {
|
||||
bNode *emission_node = nodeAddStaticNode(NULL, ntree, SH_NODE_EMISSION);
|
||||
bNode *emission_node = nodeAddStaticNode(nullptr, ntree, SH_NODE_EMISSION);
|
||||
bNodeSocket *in_sock = ntree_shader_node_find_input(emission_node, "Color");
|
||||
bNodeSocket *out_sock = ntree_shader_node_find_output(emission_node, "Emission");
|
||||
nodeAddLink(ntree, link->fromnode, link->fromsock, emission_node, in_sock);
|
||||
|
@ -645,7 +645,7 @@ static void ntree_weight_tree_merge_weight(bNodeTree *ntree,
|
|||
bNode **tonode,
|
||||
bNodeSocket **tosock)
|
||||
{
|
||||
bNode *addnode = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
bNode *addnode = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
addnode->custom1 = NODE_MATH_ADD;
|
||||
addnode->tmp_flag = -2; /* Copy */
|
||||
bNodeSocket *addsock_out = ntree_shader_node_output_get(addnode, 0);
|
||||
|
@ -683,19 +683,19 @@ static bool ntree_weight_tree_tag_nodes(bNode *fromnode, bNode *tonode, void *us
|
|||
* with their respective weights. */
|
||||
static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node)
|
||||
{
|
||||
bNodeLink *displace_link = NULL;
|
||||
bNodeLink *displace_link = nullptr;
|
||||
bNodeSocket *displace_output = ntree_shader_node_find_input(output_node, "Displacement");
|
||||
if (displace_output && displace_output->link) {
|
||||
/* Remove any displacement link to avoid tagging it later on. */
|
||||
displace_link = displace_output->link;
|
||||
displace_output->link = NULL;
|
||||
displace_output->link = nullptr;
|
||||
}
|
||||
bNodeLink *thickness_link = NULL;
|
||||
bNodeLink *thickness_link = nullptr;
|
||||
bNodeSocket *thickness_output = ntree_shader_node_find_input(output_node, "Thickness");
|
||||
if (thickness_output && thickness_output->link) {
|
||||
/* Remove any thickness link to avoid tagging it later on. */
|
||||
thickness_link = thickness_output->link;
|
||||
thickness_output->link = NULL;
|
||||
thickness_output->link = nullptr;
|
||||
}
|
||||
/* Init tmp flag. */
|
||||
LISTBASE_FOREACH (bNode *, node, &ntree->nodes) {
|
||||
|
@ -717,7 +717,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
|
|||
case SH_NODE_OUTPUT_WORLD:
|
||||
case SH_NODE_OUTPUT_MATERIAL: {
|
||||
/* Start the tree with full weight. */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_VALUE);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_VALUE);
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
((bNodeSocketValueFloat *)ntree_shader_node_output_get(nodes_copy[id], 0)->default_value)
|
||||
->value = 1.0f;
|
||||
|
@ -726,7 +726,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
|
|||
case SH_NODE_ADD_SHADER: {
|
||||
/* Simple passthrough node. Each original inputs will get the same weight. */
|
||||
/* TODO(fclem): Better use some kind of reroute node? */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id]->custom1 = NODE_MATH_ADD;
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
((bNodeSocketValueFloat *)ntree_shader_node_input_get(nodes_copy[id], 0)->default_value)
|
||||
|
@ -739,17 +739,17 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
|
|||
bNodeSocket *fromsock, *tosock;
|
||||
int id_start = id;
|
||||
/* output = (factor * input_weight) */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id]->custom1 = NODE_MATH_MULTIPLY;
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
id++;
|
||||
/* output = ((1.0 - factor) * input_weight) <=> (input_weight - factor * input_weight) */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id]->custom1 = NODE_MATH_SUBTRACT;
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
id++;
|
||||
/* Node sanitizes the input mix factor by clamping it. */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id]->custom1 = NODE_MATH_ADD;
|
||||
nodes_copy[id]->custom2 = SHD_MATH_CLAMP;
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
|
@ -765,7 +765,7 @@ static void ntree_shader_weight_tree_invert(bNodeTree *ntree, bNode *output_node
|
|||
id++;
|
||||
/* Reroute the weight input to the 3 processing nodes. Simplify linking later-on. */
|
||||
/* TODO(fclem): Better use some kind of reroute node? */
|
||||
nodes_copy[id] = nodeAddStaticNode(NULL, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id] = nodeAddStaticNode(nullptr, ntree, SH_NODE_MATH);
|
||||
nodes_copy[id]->custom1 = NODE_MATH_ADD;
|
||||
nodes_copy[id]->tmp_flag = -2; /* Copy */
|
||||
((bNodeSocketValueFloat *)ntree_shader_node_input_get(nodes_copy[id], 0)->default_value)
|
||||
|
@ -1040,7 +1040,7 @@ void ntreeGPUMaterialNodes(bNodeTree *localtree, GPUMaterial *mat)
|
|||
/* Tree is valid if it contains no undefined implicit socket type cast. */
|
||||
bool valid_tree = ntree_shader_implicit_closure_cast(localtree);
|
||||
|
||||
if (valid_tree && output != NULL) {
|
||||
if (valid_tree && output != nullptr) {
|
||||
ntree_shader_pruned_unused(localtree, output);
|
||||
ntree_shader_shader_to_rgba_branch(localtree, output);
|
||||
ntree_shader_weight_tree_invert(localtree, output);
|
||||
|
|
|
@ -38,8 +38,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat,
|
|||
/* Use special matrix to let the shader branch to using the render object's matrix. */
|
||||
float dummy_matrix[4][4];
|
||||
dummy_matrix[3][3] = 0.0f;
|
||||
GPUNodeLink *inv_obmat = (ob != NULL) ? GPU_uniform(&ob->imat[0][0]) :
|
||||
GPU_uniform(&dummy_matrix[0][0]);
|
||||
GPUNodeLink *inv_obmat = (ob != nullptr) ? GPU_uniform(&ob->imat[0][0]) :
|
||||
GPU_uniform(&dummy_matrix[0][0]);
|
||||
|
||||
/* Optimization: don't request orco if not needed. */
|
||||
float4 zero(0.0f);
|
||||
|
|
|
@ -83,7 +83,7 @@ static const char *get_gpufn_name_from_to(short from, short to, bool is_directio
|
|||
}
|
||||
break;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static int gpu_shader_vect_transform(GPUMaterial *mat,
|
||||
|
|
Loading…
Reference in New Issue