Cleanup: Use `nullptr` in new Outliner C++ files

This commit is contained in:
Julian Eisel 2022-01-13 16:58:38 +01:00
parent 039cc32917
commit 22dc865a86
11 changed files with 484 additions and 458 deletions

View File

@ -81,7 +81,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
TreeStoreElem *tselem = TREESTORE(te);
if (!tselem) {
return NULL;
return nullptr;
}
if (tselem->type == TSE_LAYER_COLLECTION) {
@ -96,7 +96,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te)
return (Collection *)tselem->id;
}
return NULL;
return nullptr;
}
TreeTraversalAction outliner_find_selected_collections(TreeElement *te, void *customdata)
@ -125,7 +125,7 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom
return TRAVERSE_CONTINUE;
}
if ((tselem->type != TSE_SOME_ID) || (tselem->id == NULL) || (GS(tselem->id->name) != ID_OB)) {
if ((tselem->type != TSE_SOME_ID) || (tselem->id == nullptr) || (GS(tselem->id->name) != ID_OB)) {
return TRAVERSE_SKIP_CHILDS;
}
@ -137,7 +137,7 @@ TreeTraversalAction outliner_find_selected_objects(TreeElement *te, void *custom
void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
{
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
struct IDsSelectedData data = {{NULL}};
struct IDsSelectedData data = {{nullptr}};
outliner_tree_traverse(space_outliner,
&space_outliner->tree,
0,
@ -161,14 +161,14 @@ void ED_outliner_selected_objects_get(const bContext *C, ListBase *objects)
bool ED_outliner_collections_editor_poll(bContext *C)
{
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
return (space_outliner != NULL) &&
return (space_outliner != nullptr) &&
ELEM(space_outliner->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES);
}
static bool outliner_view_layer_collections_editor_poll(bContext *C)
{
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
return (space_outliner != NULL) && (space_outliner->outlinevis == SO_VIEW_LAYER);
return (space_outliner != nullptr) && (space_outliner->outlinevis == SO_VIEW_LAYER);
}
static bool collection_edit_in_active_scene_poll(bContext *C)
@ -203,7 +203,7 @@ static TreeTraversalAction collection_find_selected_to_add(TreeElement *te, void
return TRAVERSE_SKIP_CHILDS;
}
if (data->collection != NULL) {
if (data->collection != nullptr) {
data->error = true;
return TRAVERSE_BREAK;
}
@ -238,7 +238,7 @@ static int collection_new_exec(bContext *C, wmOperator *op)
}
}
if (data.collection == NULL || ID_IS_LINKED(data.collection) ||
if (data.collection == nullptr || ID_IS_LINKED(data.collection) ||
ID_IS_OVERRIDE_LIBRARY(data.collection)) {
data.collection = scene->master_collection;
}
@ -248,13 +248,13 @@ static int collection_new_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
BKE_collection_add(bmain, data.collection, NULL);
BKE_collection_add(bmain, data.collection, nullptr);
DEG_id_tag_update(&data.collection->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
outliner_cleanup_tree(space_outliner);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
return OPERATOR_FINISHED;
}
@ -355,7 +355,7 @@ void outliner_collection_delete(
BLI_assert(parent->id.flag & LIB_EMBEDDED_DATA);
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id);
BLI_assert(id_type->owner_get != NULL);
BLI_assert(id_type->owner_get != nullptr);
ID *scene_owner = id_type->owner_get(bmain, &parent->id);
BLI_assert(GS(scene_owner->name) == ID_SCE);
@ -381,7 +381,7 @@ void outliner_collection_delete(
}
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
}
static int collection_hierarchy_delete_exec(bContext *C, wmOperator *op)
@ -397,7 +397,7 @@ static int collection_hierarchy_delete_exec(bContext *C, wmOperator *op)
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
if (basact_prev != BASACT(view_layer)) {
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
@ -474,7 +474,7 @@ static int collection_objects_select_exec(bContext *C, wmOperator *op)
LayerCollection *layer_collection = outliner_active_layer_collection(C);
bool deselect = STREQ(op->idname, "OUTLINER_OT_collection_objects_deselect");
if (layer_collection == NULL) {
if (layer_collection == nullptr) {
return OPERATOR_CANCELLED;
}
@ -565,38 +565,38 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
TreeElement *te = outliner_active_collection(C);
const bool linked = strstr(op->idname, "linked") != NULL;
const bool linked = strstr(op->idname, "linked") != nullptr;
/* Can happen when calling from a key binding. */
if (te == NULL) {
if (te == nullptr) {
BKE_report(op->reports, RPT_ERROR, "No active collection");
return OPERATOR_CANCELLED;
}
Collection *collection = outliner_collection_from_tree_element(te);
Collection *parent = (te->parent) ? outliner_collection_from_tree_element(te->parent) : NULL;
Collection *parent = (te->parent) ? outliner_collection_from_tree_element(te->parent) : nullptr;
/* We are allowed to duplicated linked collections (they will become local IDs then),
* but we should not allow its parent to be a linked ID, ever.
* This can happen when a whole scene is linked e.g. */
if (parent != NULL && (ID_IS_LINKED(parent) || ID_IS_OVERRIDE_LIBRARY(parent))) {
if (parent != nullptr && (ID_IS_LINKED(parent) || ID_IS_OVERRIDE_LIBRARY(parent))) {
Scene *scene = CTX_data_scene(C);
parent = (ID_IS_LINKED(scene) || ID_IS_OVERRIDE_LIBRARY(scene)) ? NULL :
parent = (ID_IS_LINKED(scene) || ID_IS_OVERRIDE_LIBRARY(scene)) ? nullptr :
scene->master_collection;
}
else if (parent != NULL && (parent->flag & COLLECTION_IS_MASTER) != 0) {
else if (parent != nullptr && (parent->flag & COLLECTION_IS_MASTER) != 0) {
BLI_assert(parent->id.flag & LIB_EMBEDDED_DATA);
const IDTypeInfo *id_type = BKE_idtype_get_info_from_id(&parent->id);
BLI_assert(id_type->owner_get != NULL);
BLI_assert(id_type->owner_get != nullptr);
Scene *scene_owner = (Scene *)id_type->owner_get(bmain, &parent->id);
BLI_assert(scene_owner != NULL);
BLI_assert(scene_owner != nullptr);
BLI_assert(GS(scene_owner->id.name) == ID_SCE);
if (ID_IS_LINKED(scene_owner) || ID_IS_OVERRIDE_LIBRARY(scene_owner)) {
scene_owner = CTX_data_scene(C);
parent = ID_IS_LINKED(scene_owner) ? NULL : scene_owner->master_collection;
parent = ID_IS_LINKED(scene_owner) ? nullptr : scene_owner->master_collection;
}
}
@ -605,7 +605,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
if (parent == NULL) {
if (parent == nullptr) {
BKE_report(op->reports,
RPT_WARNING,
"Could not find a valid parent collection for the new duplicate, "
@ -696,12 +696,12 @@ static int collection_link_exec(bContext *C, wmOperator *op)
id_fake_user_clear(&collection->id);
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
DEG_id_tag_update(&active_collection->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
return OPERATOR_FINISHED;
}
@ -762,18 +762,18 @@ static int collection_instance_exec(bContext *C, wmOperator *UNUSED(op))
Collection *collection = reinterpret_cast<Collection *>(
BLI_gsetIterator_getKey(&collections_to_edit_iter));
Object *ob = ED_object_add_type(
C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, NULL, false, 0);
C, OB_EMPTY, collection->id.name + 2, scene->cursor.location, nullptr, false, 0);
ob->instance_collection = collection;
ob->transflag |= OB_DUPLICOLLECTION;
id_lib_extern(&collection->id);
id_us_plus(&collection->id);
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
return OPERATOR_FINISHED;
}
@ -858,7 +858,7 @@ static bool collections_view_layer_poll(bContext *C, bool clear, int flag)
}
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
return result;
}
@ -901,7 +901,7 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
CollectionEditData data{};
data.scene = scene;
data.space_outliner = space_outliner;
bool clear = strstr(op->idname, "clear") != NULL;
bool clear = strstr(op->idname, "clear") != nullptr;
int flag = strstr(op->idname, "holdout") ? LAYER_COLLECTION_HOLDOUT :
strstr(op->idname, "indirect_only") ? LAYER_COLLECTION_INDIRECT_ONLY :
LAYER_COLLECTION_EXCLUDE;
@ -922,12 +922,12 @@ static int collection_view_layer_exec(bContext *C, wmOperator *op)
BKE_layer_collection_set_flag(lc, flag, !clear);
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
BKE_layer_collection_sync(scene, view_layer);
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER, nullptr);
return OPERATOR_FINISHED;
}
@ -1065,16 +1065,16 @@ static int collection_isolate_exec(bContext *C, wmOperator *op)
* was called. */
const bool value = !RNA_property_boolean_get(&ptr, prop);
outliner_collection_isolate_flag(
scene, view_layer, layer_collection, NULL, prop, "hide_viewport", value);
scene, view_layer, layer_collection, nullptr, prop, "hide_viewport", value);
break;
}
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}
@ -1123,7 +1123,7 @@ static bool collection_inside_poll(bContext *C)
if (!ED_outliner_collections_editor_poll(C)) {
return false;
}
return outliner_active_layer_collection(C) != NULL;
return outliner_active_layer_collection(C) != nullptr;
}
static int collection_visibility_exec(bContext *C, wmOperator *op)
@ -1131,8 +1131,8 @@ static int collection_visibility_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
const bool is_inside = strstr(op->idname, "inside") != NULL;
const bool show = strstr(op->idname, "show") != NULL;
const bool is_inside = strstr(op->idname, "inside") != nullptr;
const bool show = strstr(op->idname, "show") != nullptr;
CollectionEditData data{};
data.scene = scene;
data.space_outliner = space_outliner;
@ -1151,12 +1151,12 @@ static int collection_visibility_exec(bContext *C, wmOperator *op)
BLI_gsetIterator_getKey(&collections_to_edit_iter));
BKE_layer_collection_set_visible(view_layer, layer_collection, show, is_inside);
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}
@ -1233,12 +1233,12 @@ static bool collection_flag_poll(bContext *C, bool clear, int flag)
}
TreeElement *te = outliner_active_collection(C);
if (te == NULL) {
if (te == nullptr) {
return false;
}
Collection *collection = outliner_collection_from_tree_element(te);
if (collection == NULL) {
if (collection == nullptr) {
return false;
}
@ -1313,7 +1313,7 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
layer_collection->flag &= ~LAYER_COLLECTION_HIDE;
}
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
}
else {
outliner_tree_traverse(space_outliner,
@ -1337,7 +1337,7 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
collection->flag |= flag;
}
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
}
BKE_layer_collection_sync(scene, view_layer);
@ -1347,7 +1347,7 @@ static int collection_flag_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(CTX_data_main(C));
}
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}
@ -1430,7 +1430,7 @@ static TreeTraversalAction outliner_hide_find_data_to_edit(TreeElement *te, void
OutlinerHideEditData *data = reinterpret_cast<OutlinerHideEditData *>(customdata);
TreeStoreElem *tselem = TREESTORE(te);
if (tselem == NULL) {
if (tselem == nullptr) {
return TRAVERSE_CONTINUE;
}
@ -1481,19 +1481,19 @@ static int outliner_hide_exec(bContext *C, wmOperator *UNUSED(op))
BLI_gsetIterator_getKey(&collections_to_edit_iter));
BKE_layer_collection_set_visible(view_layer, layer_collection, false, false);
}
BLI_gset_free(data.collections_to_edit, NULL);
BLI_gset_free(data.collections_to_edit, nullptr);
GSetIterator bases_to_edit_iter;
GSET_ITER (bases_to_edit_iter, data.bases_to_edit) {
Base *base = reinterpret_cast<Base *>(BLI_gsetIterator_getKey(&bases_to_edit_iter));
base->flag |= BASE_HIDDEN;
}
BLI_gset_free(data.bases_to_edit, NULL);
BLI_gset_free(data.bases_to_edit, nullptr);
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}
@ -1532,7 +1532,7 @@ static int outliner_unhide_all_exec(bContext *C, wmOperator *UNUSED(op))
BKE_layer_collection_sync(scene, view_layer);
DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}
@ -1589,7 +1589,7 @@ static int outliner_color_tag_set_exec(bContext *C, wmOperator *op)
BLI_freelistN(&selected.selected_array);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, nullptr);
return OPERATOR_FINISHED;
}

View File

@ -48,7 +48,7 @@ static void outliner_context_selected_ids(const SpaceOutliner *space_outliner,
CTX_data_type_set(result, CTX_DATA_TYPE_COLLECTION);
}
static const char *outliner_context_dir[] = {"selected_ids", NULL};
static const char *outliner_context_dir[] = {"selected_ids", nullptr};
int /*eContextResult*/ outliner_context(const bContext *C,
const char *member,

View File

@ -83,7 +83,7 @@ static TreeElement *outliner_dropzone_element(TreeElement *te,
}
}
}
return NULL;
return nullptr;
}
/* Find tree element to drop into. */
@ -97,7 +97,7 @@ static TreeElement *outliner_dropzone_find(const SpaceOutliner *space_outliner,
return te_valid;
}
}
return NULL;
return nullptr;
}
static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
@ -113,12 +113,12 @@ static TreeElement *outliner_drop_find(bContext *C, const wmEvent *event)
static ID *outliner_ID_drop_find(bContext *C, const wmEvent *event, short idcode)
{
TreeElement *te = outliner_drop_find(C, event);
TreeStoreElem *tselem = (te) ? TREESTORE(te) : NULL;
TreeStoreElem *tselem = (te) ? TREESTORE(te) : nullptr;
if (te && (te->idcode == idcode) && (tselem->type == TSE_SOME_ID)) {
return tselem->id;
}
return NULL;
return nullptr;
}
/* Find tree element to drop into, with additional before and after reorder support. */
@ -133,7 +133,7 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
/* Empty tree, e.g. while filtered. */
if (BLI_listbase_is_empty(&space_outliner->tree)) {
return NULL;
return nullptr;
}
int mval[2];
@ -184,7 +184,7 @@ static TreeElement *outliner_drop_insert_find(bContext *C,
return first;
}
BLI_assert(0);
return NULL;
return nullptr;
}
typedef bool (*CheckTypeFn)(TreeElement *te);
@ -192,13 +192,13 @@ typedef bool (*CheckTypeFn)(TreeElement *te);
static TreeElement *outliner_data_from_tree_element_and_parents(CheckTypeFn check_type,
TreeElement *te)
{
while (te != NULL) {
while (te != nullptr) {
if (check_type(te)) {
return te;
}
te = te->parent;
}
return NULL;
return nullptr;
}
static bool is_collection_element(TreeElement *te)
@ -224,13 +224,13 @@ static TreeElement *outliner_drop_insert_collection_find(bContext *C,
{
TreeElement *te = outliner_drop_insert_find(C, xy, r_insert_type);
if (!te) {
return NULL;
return nullptr;
}
TreeElement *collection_te = outliner_data_from_tree_element_and_parents(is_collection_element,
te);
if (!collection_te) {
return NULL;
return nullptr;
}
Collection *collection = outliner_collection_from_tree_element(collection_te);
@ -263,7 +263,7 @@ static int outliner_get_insert_index(TreeElement *drag_te,
}
}
if (drop_te == NULL) {
if (drop_te == nullptr) {
return 0;
}
@ -367,7 +367,7 @@ static void parent_drop_set_parents(bContext *C,
TreeElement *te = outliner_find_id(space_outliner, &space_outliner->tree, &parent->id);
Scene *scene = (Scene *)outliner_search_back(te, ID_SCE);
if (scene == NULL) {
if (scene == nullptr) {
/* currently outliner organized in a way, that if there's no parent scene
* element for object it means that all displayed objects belong to
* active scene and parenting them is allowed (sergey)
@ -390,7 +390,7 @@ static void parent_drop_set_parents(bContext *C,
}
if (ED_object_parent_set(
reports, C, scene, object, parent, parent_type, false, keep_transform, NULL)) {
reports, C, scene, object, parent, parent_type, false, keep_transform, nullptr)) {
parent_set = true;
}
}
@ -402,15 +402,15 @@ static void parent_drop_set_parents(bContext *C,
if (parent_set) {
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, nullptr);
}
}
static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
TreeElement *te = outliner_drop_find(C, event);
TreeStoreElem *tselem = te ? TREESTORE(te) : NULL;
TreeStoreElem *tselem = te ? TREESTORE(te) : nullptr;
if (!(te && (te->idcode == ID_OB) && (tselem->type == TSE_SOME_ID))) {
return OPERATOR_CANCELLED;
@ -419,7 +419,7 @@ static int parent_drop_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Object *par = (Object *)tselem->id;
Object *ob = (Object *)WM_drag_get_local_ID_from_event(event, ID_OB);
if (ELEM(NULL, ob, par)) {
if (ELEM(nullptr, ob, par)) {
return OPERATOR_CANCELLED;
}
if (ob == par) {
@ -517,8 +517,8 @@ static int parent_clear_invoke(bContext *C, wmOperator *UNUSED(op), const wmEven
}
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, nullptr);
return OPERATOR_FINISHED;
}
@ -544,7 +544,7 @@ static bool scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
/* Ensure item under cursor is valid drop target */
Object *ob = (Object *)WM_drag_get_local_ID(drag, ID_OB);
return (ob && (outliner_ID_drop_find(C, event, ID_SCE) != NULL));
return (ob && (outliner_ID_drop_find(C, event, ID_SCE) != nullptr));
}
static int scene_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
@ -553,7 +553,7 @@ static int scene_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent
Scene *scene = (Scene *)outliner_ID_drop_find(C, event, ID_SCE);
Object *ob = (Object *)WM_drag_get_local_ID_from_event(event, ID_OB);
if (ELEM(NULL, ob, scene) || ID_IS_LINKED(scene)) {
if (ELEM(nullptr, ob, scene) || ID_IS_LINKED(scene)) {
return OPERATOR_CANCELLED;
}
@ -609,7 +609,7 @@ static bool material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event)
{
/* Ensure item under cursor is valid drop target */
Material *ma = (Material *)WM_drag_get_local_ID(drag, ID_MA);
return (ma && (outliner_ID_drop_find(C, event, ID_OB) != NULL));
return (ma && (outliner_ID_drop_find(C, event, ID_OB) != nullptr));
}
static int material_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
@ -618,19 +618,19 @@ static int material_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEve
Object *ob = (Object *)outliner_ID_drop_find(C, event, ID_OB);
Material *ma = (Material *)WM_drag_get_local_ID_from_event(event, ID_MA);
if (ELEM(NULL, ob, ma)) {
if (ELEM(nullptr, ob, ma)) {
return OPERATOR_CANCELLED;
}
/* only drop grease pencil material on grease pencil objects */
if ((ma->gp_style != NULL) && (ob->type != OB_GPENCIL)) {
if ((ma->gp_style != nullptr) && (ob->type != OB_GPENCIL)) {
return OPERATOR_CANCELLED;
}
BKE_object_material_assign(bmain, ob, ma, ob->totcol + 1, BKE_MAT_ASSIGN_USERPREF);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, ob);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, ma);
return OPERATOR_FINISHED;
@ -721,20 +721,20 @@ static bool datastack_drop_init(bContext *C, const wmEvent *event, StackDropData
return false;
}
Object *ob = NULL;
Object *ob = nullptr;
TreeElement *object_te = outliner_data_from_tree_element_and_parents(is_object_element,
te_target);
if (object_te) {
ob = (Object *)TREESTORE(object_te)->id;
}
bPoseChannel *pchan = NULL;
bPoseChannel *pchan = nullptr;
TreeElement *pchan_te = outliner_data_from_tree_element_and_parents(is_pchan_element, te_target);
if (pchan_te) {
pchan = (bPoseChannel *)pchan_te->directdata;
}
if (pchan) {
ob = NULL;
ob = nullptr;
}
if (ob && ID_IS_LINKED(&ob->id)) {
@ -897,7 +897,7 @@ static char *datastack_drop_tooltip(bContext *UNUSED(C),
}
break;
}
return NULL;
return nullptr;
}
static void datastack_drop_link(bContext *C, StackDropData *drop_data)
@ -1094,7 +1094,7 @@ static Collection *collection_parent_from_ID(ID *id)
{
/* Can't change linked parent collections. */
if (!id || ID_IS_LINKED(id)) {
return NULL;
return nullptr;
}
/* Also support dropping into/from scene collection. */
@ -1105,7 +1105,7 @@ static Collection *collection_parent_from_ID(ID *id)
return (Collection *)id;
}
return NULL;
return nullptr;
}
static bool collection_drop_init(
@ -1129,7 +1129,7 @@ static bool collection_drop_init(
}
wmDragID *drag_id = reinterpret_cast<wmDragID *>(drag->ids.first);
if (drag_id == NULL) {
if (drag_id == nullptr) {
return false;
}
@ -1142,11 +1142,11 @@ static bool collection_drop_init(
ID *parent = drag_id->from_parent;
Collection *from_collection = collection_parent_from_ID(parent);
if (is_link) {
from_collection = NULL;
from_collection = nullptr;
}
/* Currently this should not be allowed, cannot edit items in an override of a Collection. */
if (from_collection != NULL && ID_IS_OVERRIDE_LIBRARY(from_collection)) {
if (from_collection != nullptr && ID_IS_OVERRIDE_LIBRARY(from_collection)) {
return false;
}
@ -1223,7 +1223,7 @@ static char *collection_drop_tooltip(bContext *C,
wmDropBox *UNUSED(drop))
{
wmWindow *win = CTX_wm_window(C);
const wmEvent *event = win ? win->eventstate : NULL;
const wmEvent *event = win ? win->eventstate : nullptr;
CollectionDrop data;
if (event && !event->shift && collection_drop_init(C, drag, xy, event->ctrl, &data)) {
@ -1263,7 +1263,7 @@ static char *collection_drop_tooltip(bContext *C,
}
}
}
return NULL;
return nullptr;
}
static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *event)
@ -1284,7 +1284,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
}
/* Before/after insert handling. */
Collection *relative = NULL;
Collection *relative = nullptr;
bool relative_after = false;
if (ELEM(data.insert_type, TE_INSERT_BEFORE, TE_INSERT_AFTER)) {
@ -1293,8 +1293,8 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
relative = data.to;
relative_after = (data.insert_type == TE_INSERT_AFTER);
TreeElement *parent_te = outliner_find_parent_element(&space_outliner->tree, NULL, data.te);
data.to = (parent_te) ? outliner_collection_from_tree_element(parent_te) : NULL;
TreeElement *parent_te = outliner_find_parent_element(&space_outliner->tree, nullptr, data.te);
data.to = (parent_te) ? outliner_collection_from_tree_element(parent_te) : nullptr;
}
if (!data.to) {
@ -1307,7 +1307,7 @@ static int collection_drop_invoke(bContext *C, wmOperator *UNUSED(op), const wmE
LISTBASE_FOREACH (wmDragID *, drag_id, &drag->ids) {
/* Ctrl enables linking, so we don't need a from collection then. */
Collection *from = (event->ctrl) ? NULL : collection_parent_from_ID(drag_id->from_parent);
Collection *from = (event->ctrl) ? nullptr : collection_parent_from_ID(drag_id->from_parent);
if (GS(drag_id->id->name) == ID_OB) {
/* Move/link object into collection. */
@ -1419,10 +1419,10 @@ static int outliner_item_drag_drop_invoke(bContext *C,
TSE_GPENCIL_EFFECT_BASE);
const int wm_drag_type = use_datastack_drag ? WM_DRAG_DATASTACK : WM_DRAG_ID;
wmDrag *drag = WM_event_start_drag(C, data.icon, wm_drag_type, NULL, 0.0, WM_DRAG_NOP);
wmDrag *drag = WM_event_start_drag(C, data.icon, wm_drag_type, nullptr, 0.0, WM_DRAG_NOP);
if (use_datastack_drag) {
TreeElement *te_bone = NULL;
TreeElement *te_bone = nullptr;
bPoseChannel *pchan = outliner_find_parent_bone(te, &te_bone);
datastack_drop_data_init(drag, (Object *)tselem->id, pchan, te, tselem, te->directdata);
}
@ -1483,7 +1483,7 @@ static int outliner_item_drag_drop_invoke(bContext *C,
}
/* Find parent collection. */
Collection *parent = NULL;
Collection *parent = nullptr;
if (te_selected->parent) {
for (TreeElement *te_parent = te_selected->parent; te_parent;
@ -1536,16 +1536,16 @@ void outliner_dropboxes(void)
{
ListBase *lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW);
WM_dropbox_add(lb, "OUTLINER_OT_parent_drop", parent_drop_poll, NULL, NULL, NULL);
WM_dropbox_add(lb, "OUTLINER_OT_parent_clear", parent_clear_poll, NULL, NULL, NULL);
WM_dropbox_add(lb, "OUTLINER_OT_scene_drop", scene_drop_poll, NULL, NULL, NULL);
WM_dropbox_add(lb, "OUTLINER_OT_material_drop", material_drop_poll, NULL, NULL, NULL);
WM_dropbox_add(lb, "OUTLINER_OT_parent_drop", parent_drop_poll, nullptr, nullptr, nullptr);
WM_dropbox_add(lb, "OUTLINER_OT_parent_clear", parent_clear_poll, nullptr, nullptr, nullptr);
WM_dropbox_add(lb, "OUTLINER_OT_scene_drop", scene_drop_poll, nullptr, nullptr, nullptr);
WM_dropbox_add(lb, "OUTLINER_OT_material_drop", material_drop_poll, nullptr, nullptr, nullptr);
WM_dropbox_add(
lb, "OUTLINER_OT_datastack_drop", datastack_drop_poll, NULL, NULL, datastack_drop_tooltip);
lb, "OUTLINER_OT_datastack_drop", datastack_drop_poll, nullptr, nullptr, datastack_drop_tooltip);
WM_dropbox_add(lb,
"OUTLINER_OT_collection_drop",
collection_drop_poll,
NULL,
NULL,
nullptr,
nullptr,
collection_drop_tooltip);
}

View File

@ -94,7 +94,7 @@ static void outliner_tree_dimensions_impl(SpaceOutliner *space_outliner,
{
LISTBASE_FOREACH (TreeElement *, te, lb) {
*width = MAX2(*width, te->xend);
if (height != NULL) {
if (height != nullptr) {
*height += UI_UNIT_Y;
}
@ -103,7 +103,7 @@ static void outliner_tree_dimensions_impl(SpaceOutliner *space_outliner,
outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, height);
}
else {
outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, NULL);
outliner_tree_dimensions_impl(space_outliner, &te->subtree, width, nullptr);
}
}
}
@ -120,7 +120,7 @@ void outliner_tree_dimensions(SpaceOutliner *space_outliner, int *r_width, int *
*/
static bool is_object_data_in_editmode(const ID *id, const Object *obact)
{
if (id == NULL) {
if (id == nullptr) {
return false;
}
@ -194,7 +194,7 @@ static void restrictbutton_bone_select_fn(bContext *C, void *UNUSED(poin), void
restrictbutton_recursive_bone(bone, BONE_UNSELECTABLE, (bone->flag & BONE_UNSELECTABLE) != 0);
}
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
}
static void restrictbutton_ebone_select_fn(bContext *C, void *poin, void *poin2)
@ -211,7 +211,7 @@ static void restrictbutton_ebone_select_fn(bContext *C, void *poin, void *poin2)
arm, ebone, BONE_UNSELECTABLE, (ebone->flag & BONE_UNSELECTABLE) != 0);
}
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
}
static void restrictbutton_ebone_visibility_fn(bContext *C, void *poin, void *poin2)
@ -226,7 +226,7 @@ static void restrictbutton_ebone_visibility_fn(bContext *C, void *poin, void *po
restrictbutton_recursive_ebone(arm, ebone, BONE_HIDDEN_A, (ebone->flag & BONE_HIDDEN_A) != 0);
}
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
}
static void restrictbutton_gp_layer_flag_fn(bContext *C, void *poin, void *UNUSED(poin2))
@ -234,14 +234,14 @@ static void restrictbutton_gp_layer_flag_fn(bContext *C, void *poin, void *UNUSE
ID *id = (ID *)poin;
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, nullptr);
}
static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2))
{
ID *id = (ID *)poin;
BLI_assert(id != NULL);
BLI_assert(id != nullptr);
if (id->flag & LIB_FAKEUSER) {
id_us_plus(id);
@ -289,7 +289,7 @@ static void outliner_object_set_flag_recursive_fn(bContext *C,
else {
Base *base_iter = BKE_view_layer_base_find(view_layer, ob_iter);
/* Child can be in a collection excluded from viewlayer. */
if (base_iter == NULL) {
if (base_iter == nullptr) {
continue;
}
RNA_pointer_create(&scene->id, &RNA_ObjectBase, base_iter, &ptr);
@ -316,7 +316,7 @@ static void outliner__object_set_flag_recursive_fn(bContext *C, void *poin, void
{
Object *ob = reinterpret_cast<Object *>(poin);
char *propname = reinterpret_cast<char *>(poin2);
outliner_object_set_flag_recursive_fn(C, NULL, ob, propname);
outliner_object_set_flag_recursive_fn(C, nullptr, ob, propname);
}
/**
@ -326,7 +326,7 @@ static void outliner__base_set_flag_recursive_fn(bContext *C, void *poin, void *
{
Base *base = reinterpret_cast<Base *>(poin);
char *propname = reinterpret_cast<char *>(poin2);
outliner_object_set_flag_recursive_fn(C, base, NULL, propname);
outliner_object_set_flag_recursive_fn(C, base, nullptr, propname);
}
/** Create either a RNA_LayerCollection or a RNA_Collection pointer. */
@ -391,9 +391,9 @@ static void outliner_collection_set_flag_recursive(Scene *scene,
/* Keep going recursively. */
ListBase *lb = (layer_collection ? &layer_collection->layer_collections : &collection->children);
LISTBASE_FOREACH (Link *, link, lb) {
LayerCollection *layer_collection_iter = layer_collection ? (LayerCollection *)link : NULL;
LayerCollection *layer_collection_iter = layer_collection ? (LayerCollection *)link : nullptr;
Collection *collection_iter = layer_collection ?
(collection ? layer_collection_iter->collection : NULL) :
(collection ? layer_collection_iter->collection : nullptr) :
((CollectionChild *)link)->collection;
outliner_collection_set_flag_recursive(scene,
view_layer,
@ -457,9 +457,9 @@ static bool outliner_collection_is_isolated(Scene *scene,
/* Keep going recursively. */
ListBase *lb = (layer_collection ? &layer_collection->layer_collections : &collection->children);
LISTBASE_FOREACH (Link *, link, lb) {
LayerCollection *layer_collection_iter = layer_collection ? (LayerCollection *)link : NULL;
LayerCollection *layer_collection_iter = layer_collection ? (LayerCollection *)link : nullptr;
Collection *collection_iter = layer_collection ?
(collection ? layer_collection_iter->collection : NULL) :
(collection ? layer_collection_iter->collection : nullptr) :
((CollectionChild *)link)->collection;
if (layer_collection_iter && layer_collection_iter->flag & LAYER_COLLECTION_EXCLUDE) {
continue;
@ -487,13 +487,13 @@ void outliner_collection_isolate_flag(Scene *scene,
const bool value)
{
PointerRNA ptr;
const bool is_hide = strstr(propname, "hide_") != NULL;
const bool is_hide = strstr(propname, "hide_") != nullptr;
LayerCollection *top_layer_collection = layer_collection ?
reinterpret_cast<LayerCollection *>(
view_layer->layer_collections.first) :
NULL;
Collection *top_collection = collection ? scene->master_collection : NULL;
nullptr;
Collection *top_collection = collection ? scene->master_collection : nullptr;
bool was_isolated = (value == is_hide);
was_isolated &= outliner_collection_is_isolated(scene,
@ -505,14 +505,14 @@ void outliner_collection_isolate_flag(Scene *scene,
top_collection);
if (was_isolated) {
const bool default_value = RNA_property_boolean_get_default(NULL, layer_or_collection_prop);
const bool default_value = RNA_property_boolean_get_default(nullptr, layer_or_collection_prop);
/* Make every collection go back to its default "visibility" state. */
outliner_collection_set_flag_recursive(scene,
view_layer,
top_layer_collection,
top_collection,
layer_or_collection_prop,
NULL,
nullptr,
default_value);
return;
}
@ -523,12 +523,12 @@ void outliner_collection_isolate_flag(Scene *scene,
top_layer_collection,
top_collection,
layer_or_collection_prop,
NULL,
nullptr,
is_hide);
/* Make this collection and its children collections the only "visible". */
outliner_collection_set_flag_recursive(
scene, view_layer, layer_collection, collection, layer_or_collection_prop, NULL, !is_hide);
scene, view_layer, layer_collection, collection, layer_or_collection_prop, nullptr, !is_hide);
/* Make this collection direct parents also "visible". */
if (layer_collection) {
@ -542,7 +542,7 @@ void outliner_collection_isolate_flag(Scene *scene,
while (lc_parent != layer_collection) {
outliner_layer_or_collection_pointer_create(
scene, lc_parent, collection ? lc_parent->collection : NULL, &ptr);
scene, lc_parent, collection ? lc_parent->collection : nullptr, &ptr);
RNA_property_boolean_set(&ptr, layer_or_collection_prop, !is_hide);
LISTBASE_FOREACH (LayerCollection *, lc_iter, &lc_parent->layer_collections) {
@ -595,8 +595,8 @@ static void outliner_collection_set_flag_recursive_fn(bContext *C,
PropertyRNA *layer_or_collection_prop = RNA_struct_type_find_property(struct_rna, propname);
const bool value = RNA_property_boolean_get(&ptr, layer_or_collection_prop);
PropertyRNA *base_or_object_prop = NULL;
if (layer_collection != NULL) {
PropertyRNA *base_or_object_prop = nullptr;
if (layer_collection != nullptr) {
/* If we are toggling Layer collections we still want to change the properties of the base
* or the objects. If we have a matching property, toggle it as well, it can be NULL. */
struct_rna = collection ? &RNA_Object : &RNA_ObjectBase;
@ -637,7 +637,7 @@ static void view_layer__layer_collection_set_flag_recursive_fn(bContext *C,
{
LayerCollection *layer_collection = reinterpret_cast<LayerCollection *>(poin);
char *propname = reinterpret_cast<char *>(poin2);
outliner_collection_set_flag_recursive_fn(C, layer_collection, NULL, propname);
outliner_collection_set_flag_recursive_fn(C, layer_collection, nullptr, propname);
}
/**
@ -660,7 +660,7 @@ static void scenes__collection_set_flag_recursive_fn(bContext *C, void *poin, vo
{
Collection *collection = reinterpret_cast<Collection *>(poin);
char *propname = reinterpret_cast<char *>(poin2);
outliner_collection_set_flag_recursive_fn(C, NULL, collection, propname);
outliner_collection_set_flag_recursive_fn(C, nullptr, collection, propname);
}
static void namebutton_fn(bContext *C, void *tsep, char *oldname)
@ -681,16 +681,16 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
switch (GS(tselem->id->name)) {
case ID_MA:
WM_event_add_notifier(C, NC_MATERIAL, NULL);
WM_event_add_notifier(C, NC_MATERIAL, nullptr);
break;
case ID_TE:
WM_event_add_notifier(C, NC_TEXTURE, NULL);
WM_event_add_notifier(C, NC_TEXTURE, nullptr);
break;
case ID_IM:
WM_event_add_notifier(C, NC_IMAGE, NULL);
WM_event_add_notifier(C, NC_IMAGE, nullptr);
break;
case ID_SCE:
WM_event_add_notifier(C, NC_SCENE, NULL);
WM_event_add_notifier(C, NC_SCENE, nullptr);
break;
case ID_OB: {
Object *ob = (Object *)tselem->id;
@ -703,7 +703,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
default:
break;
}
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL);
WM_event_add_notifier(C, NC_ID | NA_RENAME, nullptr);
/* Check the library target exists */
if (te->idcode == ID_LI) {
@ -755,7 +755,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
BLI_strncpy(ebone->name, oldname, sizeof(ebone->name));
ED_armature_bone_rename(bmain, arm, oldname, newname);
WM_msg_publish_rna_prop(mbus, &arm->id, ebone, EditBone, name);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
}
break;
}
@ -776,7 +776,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
BLI_strncpy(bone->name, oldname, sizeof(bone->name));
ED_armature_bone_rename(bmain, arm, oldname, newname);
WM_msg_publish_rna_prop(mbus, &arm->id, bone, Bone, name);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
break;
}
case TSE_POSE_CHANNEL: {
@ -799,7 +799,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
ED_armature_bone_rename(
bmain, reinterpret_cast<bArmature *>(ob->data), oldname, newname);
WM_msg_publish_rna_prop(mbus, &arm->id, pchan->bone, Bone, name);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
break;
}
case TSE_POSEGRP: {
@ -844,7 +844,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
/* Rename, preserving animation and compositing data. */
BKE_view_layer_rename(bmain, scene, view_layer, newname);
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, ViewLayer, name);
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL);
WM_event_add_notifier(C, NC_ID | NA_RENAME, nullptr);
break;
}
case TSE_LAYER_COLLECTION: {
@ -852,7 +852,7 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
Collection *collection = (Collection *)tselem->id;
BLI_libblock_ensure_unique_name(bmain, collection->id.name);
WM_msg_publish_rna_prop(mbus, &collection->id, &collection->id, ID, name);
WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL);
WM_event_add_notifier(C, NC_ID | NA_RENAME, nullptr);
break;
}
}
@ -986,7 +986,7 @@ static bool outliner_restrict_properties_collection_set(Scene *scene,
TreeStoreElem *tselem = TREESTORE(te);
LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ?
reinterpret_cast<LayerCollection *>(te->directdata) :
NULL;
nullptr;
Collection *collection = outliner_collection_from_tree_element(te);
if (collection->flag & COLLECTION_IS_MASTER) {
@ -995,7 +995,7 @@ static bool outliner_restrict_properties_collection_set(Scene *scene,
/* Create the PointerRNA. */
RNA_id_pointer_create(&collection->id, collection_ptr);
if (layer_collection != NULL) {
if (layer_collection != nullptr) {
RNA_pointer_create(&scene->id, &RNA_LayerCollection, layer_collection, layer_collection_ptr);
}
@ -1116,7 +1116,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Use view layer for rendering"));
UI_but_func_set(bt, restrictbutton_r_lay_fn, tselem->id, NULL);
UI_but_func_set(bt, restrictbutton_r_lay_fn, tselem->id, nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@ -1259,7 +1259,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
-1,
-1,
NULL);
nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.constraint_enable) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@ -1288,7 +1288,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
-1,
-1,
NULL);
nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.modifier_show_viewport) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@ -1311,7 +1311,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
-1,
-1,
NULL);
nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.modifier_show_render) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@ -1345,7 +1345,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
-1,
TIP_("Restrict visibility in the 3D View\n"
"* Shift to set children"));
UI_but_func_set(bt, restrictbutton_bone_visibility_fn, bone, NULL);
UI_but_func_set(bt, restrictbutton_bone_visibility_fn, bone, nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@ -1475,10 +1475,10 @@ static void outliner_draw_restrictbuts(uiBlock *block,
LayerCollection *layer_collection = (tselem->type == TSE_LAYER_COLLECTION) ?
reinterpret_cast<LayerCollection *>(
te->directdata) :
NULL;
nullptr;
Collection *collection = outliner_collection_from_tree_element(te);
if (layer_collection != NULL) {
if (layer_collection != nullptr) {
if (space_outliner->show_restrict_flags & SO_RESTRICT_ENABLE) {
bt = uiDefIconButR_prop(block,
UI_BTYPE_ICON_TOGGLE,
@ -1495,7 +1495,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
0,
NULL);
nullptr);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
}
@ -1609,7 +1609,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
TIP_("Globally disable in viewports\n"
"* Ctrl to isolate collection\n"
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
if (layer_collection != nullptr) {
UI_but_func_set(bt,
view_layer__collection_set_flag_recursive_fn,
layer_collection,
@ -1646,7 +1646,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
TIP_("Globally disable in renders\n"
"* Ctrl to isolate collection\n"
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
if (layer_collection != nullptr) {
UI_but_func_set(bt,
view_layer__collection_set_flag_recursive_fn,
layer_collection,
@ -1681,7 +1681,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
TIP_("Disable selection in viewport\n"
"* Ctrl to isolate collection\n"
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
if (layer_collection != nullptr) {
UI_but_func_set(bt,
view_layer__collection_set_flag_recursive_fn,
layer_collection,
@ -1725,7 +1725,7 @@ static void outliner_draw_userbuts(uiBlock *block,
if (tselem->type == TSE_SOME_ID) {
uiBut *bt;
ID *id = tselem->id;
const char *tip = NULL;
const char *tip = nullptr;
char buf[16] = "";
int but_flag = UI_BUT_DRAG_LOCK;
@ -1742,7 +1742,7 @@ static void outliner_draw_userbuts(uiBlock *block,
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
NULL,
nullptr,
0.0,
0.0,
0,
@ -1771,7 +1771,7 @@ static void outliner_draw_userbuts(uiBlock *block,
0,
0,
tip);
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL);
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, nullptr);
UI_but_flag_enable(bt, but_flag);
}
}
@ -1795,7 +1795,7 @@ static bool outliner_draw_overrides_buts(uiBlock *block,
const bool do_draw = (te->ys + 2 * UI_UNIT_Y >= region->v2d.cur.ymin &&
te->ys <= region->v2d.cur.ymax);
int but_flag = UI_BUT_DRAG_LOCK;
const char *tip = NULL;
const char *tip = nullptr;
TreeStoreElem *tselem = TREESTORE(te);
switch (tselem->type) {
@ -1842,7 +1842,7 @@ static bool outliner_draw_overrides_buts(uiBlock *block,
if (do_draw &&
(item_has_warnings || (any_child_has_warnings && !TSELEM_OPEN(tselem, space_outliner)))) {
if (tip == NULL) {
if (tip == nullptr) {
tip = TIP_("Some sub-items require attention");
}
uiBut *bt = uiDefIconBut(block,
@ -1853,7 +1853,7 @@ static bool outliner_draw_overrides_buts(uiBlock *block,
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
NULL,
nullptr,
0.0,
0.0,
0.0,
@ -1927,7 +1927,7 @@ static void outliner_draw_rnabuts(
ptr,
prop,
-1,
NULL,
nullptr,
ICON_NONE,
sizex,
te->ys,
@ -2023,7 +2023,7 @@ static void outliner_buttons(const bContext *C,
tselem->flag &= ~TSE_TEXTBUT;
/* Bad! (notifier within draw) without this, we don't get a refresh. */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr);
}
}
@ -2040,7 +2040,7 @@ static void outliner_mode_toggle_fn(bContext *C, void *tselem_poin, void *UNUSED
}
/* Check that the item is actually an object. */
BLI_assert(tselem->id != NULL && GS(tselem->id->name) == ID_OB);
BLI_assert(tselem->id != nullptr && GS(tselem->id->name) == ID_OB);
Object *ob = (Object *)tselem->id;
const bool object_data_shared = (ob->data == tvc.obact->data);
@ -2109,13 +2109,13 @@ static void outliner_draw_mode_column_toggle(uiBlock *block,
te->ys,
UI_UNIT_X,
UI_UNIT_Y,
NULL,
nullptr,
0.0,
0.0,
0.0,
0.0,
tip);
UI_but_func_set(but, outliner_mode_toggle_fn, tselem, NULL);
UI_but_func_set(but, outliner_mode_toggle_fn, tselem, nullptr);
UI_but_flag_enable(but, UI_BUT_DRAG_LOCK);
/* Mode toggling handles its own undo state because undo steps need to be grouped. */
UI_but_flag_disable(but, UI_BUT_UNDO);
@ -2192,7 +2192,7 @@ static bool outliner_draw_warning_tree_element(uiBlock *block,
te_ys,
UI_UNIT_X,
UI_UNIT_Y,
NULL,
nullptr,
0.0,
0.0,
0.0,
@ -2377,7 +2377,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
BLI_findlink(&ob->modifiers, tselem->nr));
const ModifierTypeInfo *modifier_type = reinterpret_cast<const ModifierTypeInfo *>(
BKE_modifier_get_info((ModifierType)md->type));
if (modifier_type != NULL) {
if (modifier_type != nullptr) {
data.icon = modifier_type->icon;
}
else {
@ -2558,7 +2558,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
Collection *collection = outliner_collection_from_tree_element(te);
if (collection && !(collection->flag & COLLECTION_IS_MASTER)) {
data.drag_id = tselem->id;
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : NULL;
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : nullptr;
}
data.icon = ICON_OUTLINER_COLLECTION;
@ -2580,7 +2580,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
}
else if (tselem->id) {
data.drag_id = tselem->id;
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : NULL;
data.drag_parent = (data.drag_id && te->parent) ? TREESTORE(te->parent)->id : nullptr;
if (GS(tselem->id->name) == ID_OB) {
Object *ob = (Object *)tselem->id;
@ -2720,7 +2720,7 @@ TreeElementIcon tree_element_get_icon(TreeStoreElem *tselem, TreeElement *te)
break;
case ID_TXT: {
Text *text = (Text *)tselem->id;
if (text->filepath == NULL || (text->flags & TXT_ISMEM)) {
if (text->filepath == nullptr || (text->flags & TXT_ISMEM)) {
data.icon = ICON_FILE_TEXT;
}
else {
@ -2853,7 +2853,7 @@ static void tselem_draw_icon(uiBlock *block,
UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, color, true);
}
else {
UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, NULL, false);
UI_icon_draw_ex(x, y, data.icon, U.inv_dpi_fac, alpha, 0.0f, nullptr, false);
}
}
else {
@ -2865,7 +2865,7 @@ static void tselem_draw_icon(uiBlock *block,
y,
UI_UNIT_X,
UI_UNIT_Y,
NULL,
nullptr,
0.0,
0.0,
1.0,
@ -3076,7 +3076,7 @@ static void outliner_draw_iconrow(bContext *C,
else {
const int index = tree_element_id_type_to_index(te);
merged->num_elements[index]++;
if ((merged->tree_element[index] == NULL) || (active > merged->active[index])) {
if ((merged->tree_element[index] == nullptr) || (active > merged->active[index])) {
merged->tree_element[index] = te;
}
merged->active[index] = MAX2(active, merged->active[index]);
@ -3153,7 +3153,7 @@ static bool element_should_draw_faded(const TreeViewContext *tvc,
const Base *base = (te->directdata) ? (const Base *)te->directdata :
BKE_view_layer_base_find(
(ViewLayer *)tvc->view_layer, (Object *)ob);
const bool is_visible = (base != NULL) && (base->flag & BASE_VISIBLE_VIEWLAYER);
const bool is_visible = (base != nullptr) && (base->flag & BASE_VISIBLE_VIEWLAYER);
if (!is_visible) {
return true;
}
@ -3202,7 +3202,7 @@ static void outliner_draw_tree_element(bContext *C,
const float alpha_fac = element_should_draw_faded(tvc, te, tselem) ? 0.5f : 1.0f;
int xmax = region->v2d.cur.xmax;
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) {
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == nullptr)) {
*te_edit = te;
}
@ -3219,7 +3219,7 @@ static void outliner_draw_tree_element(bContext *C,
Object *ob = (Object *)tselem->id;
Base *base = (te->directdata) ? (Base *)te->directdata :
BKE_view_layer_base_find(tvc->view_layer, ob);
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
const bool is_selected = (base != nullptr) && ((base->flag & BASE_SELECTED) != 0);
if (ob == tvc->obact) {
active = OL_DRAWSEL_ACTIVE;
@ -3822,7 +3822,7 @@ void draw_outliner(const bContext *C)
View2D *v2d = &region->v2d;
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
uiBlock *block;
TreeElement *te_edit = NULL;
TreeElement *te_edit = nullptr;
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);

View File

@ -107,11 +107,11 @@ static int outliner_highlight_update(bContext *C, wmOperator *UNUSED(op), const
TreeElement *hovered_te = outliner_find_item_at_y(
space_outliner, &space_outliner->tree, view_mval[1]);
TreeElement *icon_te = NULL;
TreeElement *icon_te = nullptr;
bool is_over_icon = false;
if (hovered_te) {
icon_te = outliner_find_item_at_x_in_row(
space_outliner, hovered_te, view_mval[0], NULL, &is_over_icon);
space_outliner, hovered_te, view_mval[0], nullptr, &is_over_icon);
}
bool changed = false;
@ -218,7 +218,7 @@ static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEv
data->prev_tselem = TREESTORE(te);
}
else {
data->prev_tselem = NULL;
data->prev_tselem = nullptr;
}
}
else if (event->val == KM_RELEASE) {
@ -375,7 +375,7 @@ static TreeElement *outliner_item_rename_find_active(const SpaceOutliner *space_
if (!active_element) {
BKE_report(reports, RPT_WARNING, "No active item to rename");
return NULL;
return nullptr;
}
return active_element;
@ -393,7 +393,7 @@ static TreeElement *outliner_item_rename_find_hovered(const SpaceOutliner *space
return hovered;
}
return NULL;
return nullptr;
}
static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *event)
@ -452,12 +452,12 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
Main *bmain = CTX_data_main(C);
ID *id = tselem->id;
BLI_assert(id != NULL);
BLI_assert(id != nullptr);
BLI_assert(((tselem->type == TSE_SOME_ID) && (te->idcode != 0)) ||
(tselem->type == TSE_LAYER_COLLECTION));
UNUSED_VARS_NDEBUG(te);
if (te->idcode == ID_LI && ((Library *)id)->parent != NULL) {
if (te->idcode == ID_LI && ((Library *)id)->parent != nullptr) {
BKE_reportf(reports, RPT_WARNING, "Cannot delete indirectly linked library '%s'", id->name);
return;
}
@ -483,7 +483,7 @@ static void id_delete(bContext *C, ReportList *reports, TreeElement *te, TreeSto
BKE_id_delete(bmain, id);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
}
void id_delete_fn(bContext *C,
@ -581,7 +581,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
BLI_findlink(which_libbase(CTX_data_main(C), id_type), RNA_enum_get(op->ptr, "new_id")));
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -614,7 +614,7 @@ static int outliner_id_remap_exec(bContext *C, wmOperator *op)
* such as lights so freeing correctly refreshes. */
GPU_materials_free(bmain);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
return OPERATOR_FINISHED;
}
@ -662,11 +662,11 @@ static const EnumPropertyItem *outliner_id_itemf(bContext *C,
PropertyRNA *UNUSED(prop),
bool *r_free)
{
if (C == NULL) {
if (C == nullptr) {
return DummyRNA_NULL_items;
}
EnumPropertyItem item_tmp = {0}, *item = NULL;
EnumPropertyItem item_tmp = {0}, *item = nullptr;
int totitem = 0;
int i = 0;
@ -708,7 +708,7 @@ void OUTLINER_OT_id_remap(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
prop = RNA_def_enum(ot->srna, "old_id", DummyRNA_NULL_items, 0, "Old ID", "Old ID to replace");
RNA_def_property_enum_funcs_runtime(prop, NULL, NULL, outliner_id_itemf);
RNA_def_property_enum_funcs_runtime(prop, nullptr, nullptr, outliner_id_itemf);
RNA_def_property_flag(prop, (PropertyFlag)(PROP_ENUM_NO_TRANSLATE | PROP_HIDDEN));
ot->prop = RNA_def_enum(ot->srna,
@ -717,7 +717,7 @@ void OUTLINER_OT_id_remap(wmOperatorType *ot)
0,
"New ID",
"New ID to remap all selected IDs' users to");
RNA_def_property_enum_funcs_runtime(ot->prop, NULL, NULL, outliner_id_itemf);
RNA_def_property_enum_funcs_runtime(ot->prop, nullptr, nullptr, outliner_id_itemf);
RNA_def_property_flag(ot->prop, PROP_ENUM_NO_TRANSLATE);
}
@ -732,7 +732,7 @@ void id_remap_fn(bContext *C,
wmOperatorType *ot = WM_operatortype_find("OUTLINER_OT_id_remap", false);
PointerRNA op_props;
BLI_assert(tselem->id != NULL);
BLI_assert(tselem->id != nullptr);
WM_operator_properties_create_ptr(&op_props, ot);
@ -829,7 +829,7 @@ static int outliner_id_paste_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
BKE_reportf(op->reports, RPT_INFO, "%d data-block(s) pasted", num_pasted);
@ -863,7 +863,7 @@ static int lib_relocate(
PointerRNA op_props;
int ret = 0;
BLI_assert(te->idcode == ID_LI && tselem->id != NULL);
BLI_assert(te->idcode == ID_LI && tselem->id != nullptr);
UNUSED_VARS_NDEBUG(te);
WM_operator_properties_create_ptr(&op_props, ot);
@ -1255,12 +1255,12 @@ static TreeElement *outliner_show_active_get_element(bContext *C,
Object *obact = OBACT(view_layer);
if (!obact) {
return NULL;
return nullptr;
}
te = outliner_find_id(space_outliner, &space_outliner->tree, &obact->id);
if (te != NULL && obact->type == OB_ARMATURE) {
if (te != nullptr && obact->type == OB_ARMATURE) {
/* traverse down the bone hierarchy in case of armature */
TreeElement *te_obact = te;
@ -1433,14 +1433,14 @@ static TreeElement *outliner_find_name(
}
/* nothing valid found */
return NULL;
return nullptr;
}
static void outliner_find_panel(
Scene *UNUSED(scene), ARegion *region, SpaceOutliner *space_outliner, int again, int flags)
{
ReportList *reports = NULL; /* CTX_wm_reports(C); */
TreeElement *te = NULL;
ReportList *reports = nullptr; /* CTX_wm_reports(C); */
TreeElement *te = nullptr;
TreeElement *last_find;
TreeStoreElem *tselem;
int ytop, xdelta, prevFound = 0;
@ -1457,7 +1457,7 @@ static void outliner_find_panel(
/* try to find matching element */
te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, last_find, &prevFound);
if (te == NULL) {
if (te == nullptr) {
/* no more matches after previous, start from beginning again */
prevFound = 1;
te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, last_find, &prevFound);
@ -1467,7 +1467,7 @@ static void outliner_find_panel(
/* pop up panel - no previous, or user didn't want search after previous */
name[0] = '\0';
/* XXX if (sbutton(name, 0, sizeof(name) - 1, "Find: ") && name[0]) { */
/* te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, NULL, &prevFound); */
/* te = outliner_find_name(space_outliner, &space_outliner->tree, name, flags, nullptr, &prevFound); */
/* } */
/* else return; XXX RETURN! XXX */
}
@ -1713,13 +1713,13 @@ static void tree_element_to_path(TreeElement *te,
short *flag,
short *UNUSED(groupmode))
{
ListBase hierarchy = {NULL, NULL};
ListBase hierarchy = {nullptr, nullptr};
LinkData *ld;
TreeElement *tem, *temnext;
TreeStoreElem *tse /* , *tsenext */ /* UNUSED */;
PointerRNA *ptr, *nextptr;
PropertyRNA *prop;
char *newpath = NULL;
char *newpath = nullptr;
/* optimize tricks:
* - Don't do anything if the selected item is a 'struct', but arrays are allowed
@ -1762,7 +1762,7 @@ static void tree_element_to_path(TreeElement *te,
if (tse->type == TSE_RNA_PROPERTY) {
if (RNA_property_type(prop) == PROP_POINTER) {
/* for pointer we just append property name */
newpath = RNA_path_append(*path, ptr, prop, 0, NULL);
newpath = RNA_path_append(*path, ptr, prop, 0, nullptr);
}
else if (RNA_property_type(prop) == PROP_COLLECTION) {
char buf[128], *name;
@ -1771,11 +1771,11 @@ static void tree_element_to_path(TreeElement *te,
// tsenext = TREESTORE(temnext); /* UNUSED */
nextptr = &temnext->rnaptr;
name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), NULL);
name = RNA_struct_name_get_alloc(nextptr, buf, sizeof(buf), nullptr);
if (name) {
/* if possible, use name as a key in the path */
newpath = RNA_path_append(*path, NULL, prop, 0, name);
newpath = RNA_path_append(*path, nullptr, prop, 0, name);
if (name != buf) {
MEM_freeN(name);
@ -1790,7 +1790,7 @@ static void tree_element_to_path(TreeElement *te,
break;
}
}
newpath = RNA_path_append(*path, NULL, prop, index, NULL);
newpath = RNA_path_append(*path, nullptr, prop, index, nullptr);
}
ld = ld->next;
@ -1802,7 +1802,7 @@ static void tree_element_to_path(TreeElement *te,
MEM_freeN(*path);
}
*path = newpath;
newpath = NULL;
newpath = nullptr;
}
}
else {
@ -1817,7 +1817,7 @@ static void tree_element_to_path(TreeElement *te,
/* clear path */
if (*path) {
MEM_freeN(*path);
path = NULL;
path = nullptr;
}
}
}
@ -1841,7 +1841,7 @@ static void tree_element_to_path(TreeElement *te,
}
/* path */
newpath = RNA_path_append(*path, NULL, prop, 0, NULL);
newpath = RNA_path_append(*path, nullptr, prop, 0, nullptr);
if (*path) {
MEM_freeN(*path);
}
@ -1880,8 +1880,8 @@ static void do_outliner_drivers_editop(SpaceOutliner *space_outliner,
/* if item is selected, perform operation */
if (tselem->flag & TSE_SELECTED) {
ID *id = NULL;
char *path = NULL;
ID *id = nullptr;
char *path = nullptr;
int array_index = 0;
short flag = 0;
short groupmode = KSP_GROUP_KSNAME;
@ -1953,7 +1953,7 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -1962,7 +1962,7 @@ static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op)
space_outliner, &space_outliner->tree, op->reports, DRIVERS_EDITMODE_ADD);
/* send notifiers */
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, NULL); /* XXX */
WM_event_add_notifier(C, NC_ANIMATION | ND_FCURVES_ORDER, nullptr); /* XXX */
return OPERATOR_FINISHED;
}
@ -1993,7 +1993,7 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -2002,7 +2002,7 @@ static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op)
space_outliner, &space_outliner->tree, op->reports, DRIVERS_EDITMODE_REMOVE);
/* send notifiers */
WM_event_add_notifier(C, ND_KEYS, NULL); /* XXX */
WM_event_add_notifier(C, ND_KEYS, nullptr); /* XXX */
return OPERATOR_FINISHED;
}
@ -2043,11 +2043,11 @@ enum {
/* TODO: should this be an API func? */
static KeyingSet *verify_active_keyingset(Scene *scene, short add)
{
KeyingSet *ks = NULL;
KeyingSet *ks = nullptr;
/* sanity check */
if (scene == NULL) {
return NULL;
if (scene == nullptr) {
return nullptr;
}
/* try to find one from scene */
@ -2058,8 +2058,8 @@ static KeyingSet *verify_active_keyingset(Scene *scene, short add)
/* Add if none found */
/* XXX the default settings have yet to evolve. */
if ((add) && (ks == NULL)) {
ks = BKE_keyingset_add(&scene->keyingsets, NULL, NULL, KEYINGSET_ABSOLUTE, 0);
if ((add) && (ks == nullptr)) {
ks = BKE_keyingset_add(&scene->keyingsets, nullptr, nullptr, KEYINGSET_ABSOLUTE, 0);
scene->active_keyingset = BLI_listbase_count(&scene->keyingsets);
}
@ -2077,8 +2077,8 @@ static void do_outliner_keyingset_editop(SpaceOutliner *space_outliner,
/* if item is selected, perform operation */
if (tselem->flag & TSE_SELECTED) {
ID *id = NULL;
char *path = NULL;
ID *id = nullptr;
char *path = nullptr;
int array_index = 0;
short flag = 0;
short groupmode = KSP_GROUP_KSNAME;
@ -2098,13 +2098,13 @@ static void do_outliner_keyingset_editop(SpaceOutliner *space_outliner,
/* add a new path with the information obtained (only if valid) */
/* TODO: what do we do with group name?
* for now, we don't supply one, and just let this use the KeyingSet name */
BKE_keyingset_add_path(ks, id, NULL, path, array_index, flag, groupmode);
BKE_keyingset_add_path(ks, id, nullptr, path, array_index, flag, groupmode);
ks->active_path = BLI_listbase_count(&ks->paths);
break;
}
case KEYINGSET_EDITMODE_REMOVE: {
/* find the relevant path, then remove it from the KeyingSet */
KS_Path *ksp = BKE_keyingset_find_path(ks, id, NULL, path, array_index, groupmode);
KS_Path *ksp = BKE_keyingset_find_path(ks, id, nullptr, path, array_index, groupmode);
if (ksp) {
/* free path's data */
@ -2141,11 +2141,11 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
KeyingSet *ks = verify_active_keyingset(scene, 1);
/* check for invalid states */
if (ks == NULL) {
if (ks == nullptr) {
BKE_report(op->reports, RPT_ERROR, "Operation requires an active keying set");
return OPERATOR_CANCELLED;
}
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -2153,7 +2153,7 @@ static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op)
do_outliner_keyingset_editop(space_outliner, ks, &space_outliner->tree, KEYINGSET_EDITMODE_ADD);
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, nullptr);
return OPERATOR_FINISHED;
}
@ -2186,7 +2186,7 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
KeyingSet *ks = verify_active_keyingset(scene, 1);
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -2195,7 +2195,7 @@ static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *UNUSED(o
space_outliner, ks, &space_outliner->tree, KEYINGSET_EDITMODE_REMOVE);
/* send notifiers */
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_KEYINGSET, nullptr);
return OPERATOR_FINISHED;
}
@ -2224,7 +2224,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot)
static bool ed_operator_outliner_id_orphans_active(bContext *C)
{
ScrArea *area = CTX_wm_area(C);
if (area != NULL && area->spacetype == SPACE_OUTLINER) {
if (area != nullptr && area->spacetype == SPACE_OUTLINER) {
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
return (space_outliner->outlinevis == SO_ID_ORPHANS);
}
@ -2309,14 +2309,14 @@ static int outliner_orphans_purge_exec(bContext *C, wmOperator *op)
* outliner several mouse events can be handled in one cycle without
* handling notifiers/redraw which leads to deleting the same object twice.
* cleanup tree here to prevent such cases. */
if ((area != NULL) && (area->spacetype == SPACE_OUTLINER)) {
if ((area != nullptr) && (area->spacetype == SPACE_OUTLINER)) {
outliner_cleanup_tree(space_outliner);
}
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_ID | NA_REMOVED, NULL);
WM_event_add_notifier(C, NC_ID | NA_REMOVED, nullptr);
/* Force full redraw of the UI. */
WM_main_add_notifier(NC_WINDOW, NULL);
WM_main_add_notifier(NC_WINDOW, nullptr);
return OPERATOR_FINISHED;
}

View File

@ -96,14 +96,14 @@ static void do_outliner_item_editmode_toggle(bContext *C, Scene *scene, Base *ba
changed = ED_object_editmode_exit_ex(bmain, scene, ob, EM_FREEDATA);
if (changed) {
ED_object_base_select(base, BA_DESELECT);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, nullptr);
}
}
else {
changed = ED_object_editmode_enter_ex(CTX_data_main(C), scene, ob, EM_NO_CONTEXT);
if (changed) {
ED_object_base_select(base, BA_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE, nullptr);
}
}
@ -134,14 +134,14 @@ static void do_outliner_item_posemode_toggle(bContext *C, Scene *scene, Base *ba
changed = ED_object_posemode_exit_ex(bmain, ob);
if (changed) {
ED_object_base_select(base, BA_DESELECT);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_OBJECT, nullptr);
}
}
else {
changed = ED_object_posemode_enter_ex(bmain, ob);
if (changed) {
ED_object_base_select(base, BA_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_MODE | NS_MODE_POSE, nullptr);
}
}
@ -228,7 +228,7 @@ static void tree_element_viewlayer_activate(bContext *C, TreeElement *te)
if (BLI_findindex(&scene->view_layers, view_layer) != -1) {
WM_window_set_active_view_layer(win, view_layer);
WM_event_add_notifier(C, NC_SCREEN | ND_LAYER, NULL);
WM_event_add_notifier(C, NC_SCREEN | ND_LAYER, nullptr);
}
}
@ -286,11 +286,11 @@ static void tree_element_object_activate(bContext *C,
bool recursive)
{
TreeStoreElem *tselem = TREESTORE(te);
TreeStoreElem *parent_tselem = NULL;
TreeElement *parent_te = NULL;
TreeStoreElem *parent_tselem = nullptr;
TreeElement *parent_te = nullptr;
Scene *sce;
Base *base;
Object *ob = NULL;
Object *ob = nullptr;
/* if id is not object, we search back */
if ((tselem->type == TSE_SOME_ID) && (te->idcode == ID_OB)) {
@ -308,7 +308,7 @@ static void tree_element_object_activate(bContext *C,
}
}
}
if (ob == NULL) {
if (ob == nullptr) {
return;
}
@ -322,7 +322,7 @@ static void tree_element_object_activate(bContext *C,
base = BKE_view_layer_base_find(view_layer, ob);
if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) {
if (base != NULL) {
if (base != nullptr) {
Object *obact = OBACT(view_layer);
const eObjectMode object_mode = obact ? (eObjectMode)obact->mode : OB_MODE_OBJECT;
if (base && !BKE_object_is_mode_compat(base->object, object_mode)) {
@ -332,7 +332,7 @@ static void tree_element_object_activate(bContext *C,
ED_object_mode_generic_exit(bmain, depsgraph, scene, base->object);
}
if (!BKE_object_is_mode_compat(base->object, object_mode)) {
base = NULL;
base = nullptr;
}
}
}
@ -389,8 +389,8 @@ static void tree_element_material_activate(bContext *C, ViewLayer *view_layer, T
{
/* we search for the object parent */
Object *ob = (Object *)outliner_search_back(te, ID_OB);
/* Note : ob->matbits can be NULL when a local object points to a library mesh. */
if (ob == NULL || ob != OBACT(view_layer) || ob->matbits == NULL) {
/* Note : ob->matbits can be nullptr when a local object points to a library mesh. */
if (ob == nullptr || ob != OBACT(view_layer) || ob->matbits == nullptr) {
return; /* just paranoia */
}
@ -410,7 +410,7 @@ static void tree_element_material_activate(bContext *C, ViewLayer *view_layer, T
* for render views to update. See T42973.
* Note that RNA material update does it too, see e.g. rna_MaterialSlot_update(). */
DEG_id_tag_update((ID *)ob, ID_RECALC_TRANSFORM);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, NULL);
WM_event_add_notifier(C, NC_MATERIAL | ND_SHADING_LINKS, nullptr);
}
static void tree_element_camera_activate(bContext *C, Scene *scene, TreeElement *te)
@ -425,12 +425,12 @@ static void tree_element_camera_activate(bContext *C, Scene *scene, TreeElement
WM_windows_scene_data_sync(&wm->windows, scene);
DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
DEG_relations_tag_update(bmain);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_SCENE | NA_EDITED, nullptr);
}
static void tree_element_world_activate(bContext *C, Scene *scene, TreeElement *te)
{
Scene *sce = NULL;
Scene *sce = nullptr;
TreeElement *tep = te->parent;
if (tep) {
@ -495,13 +495,13 @@ static void tree_element_posechannel_activate(bContext *C,
if (set != OL_SETSEL_EXTEND) {
/* Single select forces all other bones to get unselected. */
uint objects_len = 0;
Object **objects = BKE_object_pose_array_get_unique(view_layer, NULL, &objects_len);
Object **objects = BKE_object_pose_array_get_unique(view_layer, nullptr, &objects_len);
for (uint object_index = 0; object_index < objects_len; object_index++) {
Object *ob_iter = BKE_object_pose_armature_get(objects[object_index]);
/* Sanity checks. */
if (ELEM(NULL, ob_iter, ob_iter->pose, ob_iter->data)) {
if (ELEM(nullptr, ob_iter, ob_iter->pose, ob_iter->data)) {
continue;
}
@ -550,7 +550,7 @@ static void tree_element_bone_activate(bContext *C,
if (ob) {
if (set != OL_SETSEL_EXTEND) {
/* single select forces all other bones to get unselected */
for (Bone *bone_iter = reinterpret_cast<Bone *>(arm->bonebase.first); bone_iter != NULL;
for (Bone *bone_iter = reinterpret_cast<Bone *>(arm->bonebase.first); bone_iter != nullptr;
bone_iter = bone_iter->next) {
bone_iter->flag &= ~(BONE_TIPSEL | BONE_SELECTED | BONE_ROOTSEL);
do_outliner_bone_select_recursive(arm, bone_iter, false);
@ -603,7 +603,7 @@ static void tree_element_ebone_activate(bContext *C,
ob_params.no_dup_data = true;
Base **bases = BKE_view_layer_array_from_bases_in_mode_params(
view_layer, NULL, &bases_len, &ob_params);
view_layer, nullptr, &bases_len, &ob_params);
ED_armature_edit_deselect_all_multi_ex(bases, bases_len);
MEM_freeN(bases);
@ -681,7 +681,7 @@ static void tree_element_sequence_activate(bContext *C,
if (BLI_findindex(ed->seqbasep, seq) != -1) {
if (set == OL_SETSEL_EXTEND) {
SEQ_select_active_set(scene, NULL);
SEQ_select_active_set(scene, nullptr);
}
ED_sequencer_deselect_all(scene);
@ -728,7 +728,7 @@ static void tree_element_master_collection_activate(const bContext *C)
BKE_layer_collection_activate(view_layer, layer_collection);
/* A very precise notifier - ND_LAYER alone is quite vague, we want to avoid unnecessary work
* when only the active collection changes. */
WM_main_add_notifier(NC_SCENE | ND_LAYER | NS_LAYER_COLLECTION | NA_ACTIVATED, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER | NS_LAYER_COLLECTION | NA_ACTIVATED, nullptr);
}
static void tree_element_layer_collection_activate(bContext *C, TreeElement *te)
@ -739,7 +739,7 @@ static void tree_element_layer_collection_activate(bContext *C, TreeElement *te)
BKE_layer_collection_activate(view_layer, layer_collection);
/* A very precise notifier - ND_LAYER alone is quite vague, we want to avoid unnecessary work
* when only the active collection changes. */
WM_main_add_notifier(NC_SCENE | ND_LAYER | NS_LAYER_COLLECTION | NA_ACTIVATED, NULL);
WM_main_add_notifier(NC_SCENE | ND_LAYER | NS_LAYER_COLLECTION | NA_ACTIVATED, nullptr);
}
static void tree_element_text_activate(bContext *C, TreeElement *te)
@ -898,7 +898,7 @@ static eOLDrawState tree_element_pose_state_get(const ViewLayer *view_layer,
const Object *ob = (const Object *)tselem->id;
/* This will just lookup in a cache, it will not change the arguments. */
const Base *base = BKE_view_layer_base_find((ViewLayer *)view_layer, (Object *)ob);
if (base == NULL) {
if (base == nullptr) {
/* Armature not instantiated in current scene (e.g. inside an appended group). */
return OL_DRAWSEL_NONE;
}
@ -1006,8 +1006,8 @@ static eOLDrawState tree_element_active_material_get(const ViewLayer *view_layer
{
/* we search for the object parent */
const Object *ob = (const Object *)outliner_search_back((TreeElement *)te, ID_OB);
/* Note : ob->matbits can be NULL when a local object points to a library mesh. */
if (ob == NULL || ob != OBACT(view_layer) || ob->matbits == NULL) {
/* Note : ob->matbits can be nullptr when a local object points to a library mesh. */
if (ob == nullptr || ob != OBACT(view_layer) || ob->matbits == nullptr) {
return OL_DRAWSEL_NONE; /* just paranoia */
}
@ -1046,7 +1046,7 @@ static eOLDrawState tree_element_active_scene_get(const TreeViewContext *tvc,
static eOLDrawState tree_element_active_world_get(const Scene *scene, const TreeElement *te)
{
const TreeElement *tep = te->parent;
if (tep == NULL) {
if (tep == nullptr) {
return OL_DRAWSEL_NORMAL;
}
@ -1142,7 +1142,7 @@ bPoseChannel *outliner_find_parent_bone(TreeElement *te, TreeElement **r_bone_te
te = te->parent;
}
return NULL;
return nullptr;
}
static void outliner_sync_to_properties_editors(const bContext *C,
@ -1213,7 +1213,7 @@ static void outliner_set_properties_tab(bContext *C, TreeElement *te, TreeStoreE
break;
case TSE_CONSTRAINT_BASE:
case TSE_CONSTRAINT: {
TreeElement *bone_te = NULL;
TreeElement *bone_te = nullptr;
bPoseChannel *pchan = outliner_find_parent_bone(te, &bone_te);
if (pchan) {
@ -1421,7 +1421,7 @@ static void do_outliner_item_activate_tree_element(bContext *C,
FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (gr, object) {
Base *base = BKE_view_layer_base_find(tvc->view_layer, object);
/* Object may not be in this scene */
if (base != NULL) {
if (base != nullptr) {
if ((base->flag & BASE_SELECTED) == 0) {
ED_object_base_select(base, BA_SELECT);
}

View File

@ -189,9 +189,9 @@ static void selected_items_init(SelectedItems *selected_items)
static void selected_items_free(SelectedItems *selected_items)
{
BLI_gset_free(selected_items->objects, NULL);
BLI_gset_free(selected_items->edit_bones, NULL);
BLI_gset_free(selected_items->pose_bones, NULL);
BLI_gset_free(selected_items->objects, nullptr);
BLI_gset_free(selected_items->edit_bones, nullptr);
BLI_gset_free(selected_items->pose_bones, nullptr);
}
/* Check if an instance of this object been selected by the sync */
@ -404,7 +404,7 @@ static void outliner_select_sync_from_object(ViewLayer *view_layer,
Object *ob = (Object *)tselem->id;
Base *base = (te->directdata) ? (Base *)te->directdata :
BKE_view_layer_base_find(view_layer, ob);
const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0);
const bool is_selected = (base != nullptr) && ((base->flag & BASE_SELECTED) != 0);
if (base && (ob == obact)) {
tselem->flag |= TSE_ACTIVE;

View File

@ -208,7 +208,7 @@ static bool outliner_operation_tree_element_poll(bContext *C)
}
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te = get_target_element(space_outliner);
if (te == NULL) {
if (te == nullptr) {
return false;
}
@ -223,8 +223,8 @@ static void unlink_action_fn(bContext *C,
TreeStoreElem *UNUSED(tselem),
void *UNUSED(user_data))
{
/* just set action to NULL */
BKE_animdata_set_action(CTX_wm_reports(C), tsep->id, NULL);
/* just set action to nullptr */
BKE_animdata_set_action(CTX_wm_reports(C), tsep->id, nullptr);
}
static void unlink_material_fn(bContext *UNUSED(C),
@ -235,7 +235,7 @@ static void unlink_material_fn(bContext *UNUSED(C),
TreeStoreElem *UNUSED(tselem),
void *UNUSED(user_data))
{
Material **matar = NULL;
Material **matar = nullptr;
int a, totcol = 0;
if (GS(tsep->id->name) == ID_OB) {
@ -277,11 +277,11 @@ static void unlink_material_fn(bContext *UNUSED(C),
BLI_assert(0);
}
if (LIKELY(matar != NULL)) {
if (LIKELY(matar != nullptr)) {
for (a = 0; a < totcol; a++) {
if (a == te->index && matar[a]) {
id_us_min(&matar[a]->id);
matar[a] = NULL;
matar[a] = nullptr;
}
}
}
@ -295,7 +295,7 @@ static void unlink_texture_fn(bContext *UNUSED(C),
TreeStoreElem *UNUSED(tselem),
void *UNUSED(user_data))
{
MTex **mtex = NULL;
MTex **mtex = nullptr;
int a;
if (GS(tsep->id->name) == ID_LS) {
@ -310,7 +310,7 @@ static void unlink_texture_fn(bContext *UNUSED(C),
if (a == te->index && mtex[a]) {
if (mtex[a]->tex) {
id_us_min(&mtex[a]->tex->id);
mtex[a]->tex = NULL;
mtex[a]->tex = nullptr;
}
}
}
@ -330,7 +330,7 @@ static void unlink_collection_fn(bContext *C,
if (tsep) {
if (GS(tsep->id->name) == ID_OB) {
Object *ob = (Object *)tsep->id;
ob->instance_collection = NULL;
ob->instance_collection = nullptr;
DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
DEG_relations_tag_update(bmain);
}
@ -369,7 +369,7 @@ static void unlink_object_fn(bContext *C,
TreeElement *te_parent = te->parent;
while (tsep && GS(tsep->id->name) == ID_OB) {
te_parent = te_parent->parent;
tsep = te_parent ? TREESTORE(te_parent) : NULL;
tsep = te_parent ? TREESTORE(te_parent) : nullptr;
}
}
@ -404,7 +404,7 @@ static void unlink_world_fn(bContext *UNUSED(C),
/* need to use parent scene not just scene, otherwise may end up getting wrong one */
id_us_min(&wo->id);
parscene->world = NULL;
parscene->world = nullptr;
}
static void outliner_do_libdata_operation(bContext *C,
@ -420,7 +420,7 @@ static void outliner_do_libdata_operation(bContext *C,
if (tselem->flag & TSE_SELECTED) {
if (((tselem->type == TSE_SOME_ID) && (te->idcode != 0)) ||
tselem->type == TSE_LAYER_COLLECTION) {
TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL;
TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : nullptr;
operation_fn(C, reports, scene, te, tsep, tselem, user_data);
}
}
@ -443,7 +443,7 @@ typedef enum eOutliner_PropSceneOps {
static const EnumPropertyItem prop_scene_op_types[] = {
{OL_SCENE_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static bool outliner_do_scene_operation(
@ -615,13 +615,13 @@ static uiBlock *merged_element_search_menu(bContext *C, ARegion *region, void *d
but = uiDefSearchBut(
block, search, 0, ICON_VIEWZOOM, sizeof(search), 10, 10, menu_width, UI_UNIT_Y, 0, 0, "");
UI_but_func_search_set(but,
NULL,
nullptr,
merged_element_search_update_fn,
data,
false,
NULL,
nullptr,
merged_element_search_exec_fn,
NULL);
nullptr);
UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
/* Fake button to hold space for search items */
@ -633,12 +633,12 @@ static uiBlock *merged_element_search_menu(bContext *C, ARegion *region, void *d
10 - UI_searchbox_size_y(),
menu_width,
UI_searchbox_size_y(),
NULL,
nullptr,
0,
0,
0,
0,
NULL);
nullptr);
/* Center the menu on the cursor */
const int offset[2] = {-(menu_width / 2), 0};
@ -774,7 +774,7 @@ static void object_proxy_to_override_convert_fn(bContext *C,
Object *ob_proxy = (Object *)id_proxy;
Scene *scene = CTX_data_scene(C);
if (ob_proxy->proxy == NULL) {
if (ob_proxy->proxy == nullptr) {
return;
}
@ -789,7 +789,7 @@ static void object_proxy_to_override_convert_fn(bContext *C,
}
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_WINDOW, nullptr);
}
typedef struct OutlinerLibOverrideData {
@ -815,9 +815,9 @@ static void id_override_library_create_fn(bContext *C,
const bool do_hierarchy = data->do_hierarchy;
bool success = false;
ID *id_reference = NULL;
ID *id_reference = nullptr;
bool is_override_instancing_object = false;
if (tsep != NULL && tsep->type == TSE_SOME_ID && tsep->id != NULL &&
if (tsep != nullptr && tsep->type == TSE_SOME_ID && tsep->id != nullptr &&
GS(tsep->id->name) == ID_OB && !ID_IS_OVERRIDE_LIBRARY(tsep->id)) {
Object *ob = (Object *)tsep->id;
if (ob->type == OB_EMPTY && &ob->instance_collection->id == id_root) {
@ -848,7 +848,7 @@ static void id_override_library_create_fn(bContext *C,
if (do_hierarchy) {
/* Tag all linked parents in tree hierarchy to be also overridden. */
while ((te = te->parent) != NULL) {
while ((te = te->parent) != nullptr) {
if (!TSE_IS_REAL_ID(te->store_elem)) {
continue;
}
@ -870,10 +870,10 @@ static void id_override_library_create_fn(bContext *C,
}
success = BKE_lib_override_library_create(
bmain, CTX_data_scene(C), CTX_data_view_layer(C), id_root, id_reference, NULL);
bmain, CTX_data_scene(C), CTX_data_view_layer(C), id_root, id_reference, nullptr);
}
else if (ID_IS_OVERRIDABLE_LIBRARY(id_root)) {
success = BKE_lib_override_library_create_from_id(bmain, id_root, true) != NULL;
success = BKE_lib_override_library_create_from_id(bmain, id_root, true) != nullptr;
/* Cleanup. */
BKE_main_id_newptr_and_tag_clear(bmain);
@ -917,8 +917,8 @@ static void id_override_library_reset_fn(bContext *C,
BKE_lib_override_library_id_reset(bmain, id_root);
}
WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, NULL);
WM_event_add_notifier(C, NC_WM | ND_DATACHANGED, nullptr);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, nullptr);
}
else {
CLOG_WARN(&LOG, "Could not reset library override of data block '%s'", id_root->name);
@ -944,7 +944,7 @@ static void id_override_library_resync_fn(bContext *C,
id_root->tag |= LIB_TAG_DOIT;
/* Tag all linked parents in tree hierarchy to be also overridden. */
while ((te = te->parent) != NULL) {
while ((te = te->parent) != nullptr) {
if (!TSE_IS_REAL_ID(te->store_elem)) {
continue;
}
@ -957,9 +957,9 @@ static void id_override_library_resync_fn(bContext *C,
BlendFileReadReport report{};
report.reports = reports;
BKE_lib_override_library_resync(
bmain, scene, CTX_data_view_layer(C), id_root, NULL, do_hierarchy_enforce, &report);
bmain, scene, CTX_data_view_layer(C), id_root, nullptr, do_hierarchy_enforce, &report);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
}
else {
CLOG_WARN(&LOG, "Could not resync library override of data block '%s'", id_root->name);
@ -983,7 +983,7 @@ static void id_override_library_delete_fn(bContext *C,
id_root->tag |= LIB_TAG_DOIT;
/* Tag all linked parents in tree hierarchy to be also overridden. */
while ((te = te->parent) != NULL) {
while ((te = te->parent) != nullptr) {
if (!TSE_IS_REAL_ID(te->store_elem)) {
continue;
}
@ -995,7 +995,7 @@ static void id_override_library_delete_fn(bContext *C,
BKE_lib_override_library_delete(bmain, id_root);
WM_event_add_notifier(C, NC_WINDOW, NULL);
WM_event_add_notifier(C, NC_WINDOW, nullptr);
}
else {
CLOG_WARN(&LOG, "Could not delete library override of data block '%s'", id_root->name);
@ -1059,7 +1059,7 @@ static void singleuser_action_fn(bContext *C,
if (id) {
IdAdtTemplate *iat = (IdAdtTemplate *)tsep->id;
PointerRNA ptr = {NULL};
PointerRNA ptr = {nullptr};
PropertyRNA *prop;
RNA_pointer_create(&iat->id, &RNA_AnimData, iat->adt, &ptr);
@ -1082,7 +1082,7 @@ static void singleuser_world_fn(bContext *C,
/* need to use parent scene not just scene, otherwise may end up getting wrong one */
if (id) {
Scene *parscene = (Scene *)tsep->id;
PointerRNA ptr = {NULL};
PointerRNA ptr = {nullptr};
PropertyRNA *prop;
RNA_id_pointer_create(&parscene->id, &ptr);
@ -1112,10 +1112,10 @@ void outliner_do_object_operation_ex(bContext *C,
WM_window_set_active_scene(CTX_data_main(C), C, CTX_wm_window(C), scene_owner);
}
/* Important to use 'scene_owner' not scene_act else deleting objects can crash.
* only use 'scene_act' when 'scene_owner' is NULL, which can happen when the
* only use 'scene_act' when 'scene_owner' is nullptr, which can happen when the
* outliner isn't showing scenes: Visible Layer draw mode for eg. */
operation_fn(
C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, user_data);
C, reports, scene_owner ? scene_owner : scene_act, te, nullptr, tselem, user_data);
select_handled = true;
}
}
@ -1127,7 +1127,7 @@ void outliner_do_object_operation_ex(bContext *C,
space_outliner,
&te->subtree,
operation_fn,
NULL,
nullptr,
recurse_selected);
}
}
@ -1142,7 +1142,7 @@ void outliner_do_object_operation(bContext *C,
outliner_operation_fn operation_fn)
{
outliner_do_object_operation_ex(
C, reports, scene_act, space_outliner, lb, operation_fn, NULL, true);
C, reports, scene_act, space_outliner, lb, operation_fn, nullptr, true);
}
/** \} */
@ -1165,8 +1165,8 @@ static void unlinkact_animdata_fn(int UNUSED(event),
TreeStoreElem *tselem,
void *UNUSED(arg))
{
/* just set action to NULL */
BKE_animdata_set_action(NULL, tselem->id, NULL);
/* just set action to nullptr */
BKE_animdata_set_action(nullptr, tselem->id, nullptr);
DEG_id_tag_update(tselem->id, ID_RECALC_ANIMATION);
}
@ -1364,7 +1364,7 @@ static void constraint_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
WM_event_add_notifier(C, NC_OBJECT | ND_CONSTRAINT, ob);
}
else if (event == OL_CONSTRAINTOP_DELETE) {
ListBase *lb = NULL;
ListBase *lb = nullptr;
if (TREESTORE(te->parent->parent)->type == TSE_POSE_CHANNEL) {
lb = &((bPoseChannel *)te->parent->parent->directdata)->constraints;
@ -1375,7 +1375,7 @@ static void constraint_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tsel
if (BKE_constraint_remove_ex(lb, ob, constraint, true)) {
/* there's no active constraint now, so make sure this is the case */
BKE_constraints_active_set(&ob->constraints, NULL);
BKE_constraints_active_set(&ob->constraints, nullptr);
/* needed to set the flags on posebones correctly */
ED_object_constraint_update(bmain, ob);
@ -1405,7 +1405,7 @@ static void modifier_fn(int event, TreeElement *te, TreeStoreElem *UNUSED(tselem
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
}
else if (event == OL_MODIFIER_OP_DELETE) {
ED_object_modifier_remove(NULL, bmain, scene, ob, md);
ED_object_modifier_remove(nullptr, bmain, scene, ob, md);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_REMOVED, ob);
te->store_elem->flag &= ~TSE_SELECTED;
}
@ -1439,7 +1439,7 @@ static Base *outliner_batch_delete_hierarchy(
Object *object, *parent;
if (!base) {
return NULL;
return nullptr;
}
object = base->object;
@ -1538,7 +1538,7 @@ static const EnumPropertyItem prop_object_op_types[] = {
0,
"Convert Proxy to Override",
"Convert a Proxy object to a full library override, including all its dependencies"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int outliner_object_operation_exec(bContext *C, wmOperator *op)
@ -1548,11 +1548,11 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
wmWindow *win = CTX_wm_window(C);
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
const char *str = nullptr;
bool selection_changed = false;
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -1577,7 +1577,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
object_select_hierarchy_fn,
NULL,
nullptr,
false);
if (scene != sce) {
WM_window_set_active_scene(bmain, C, win, sce);
@ -1593,7 +1593,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
else if (event == OL_OP_REMAP) {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, nullptr);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
}
@ -1622,7 +1622,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
ED_outliner_select_sync_from_object_tag(C);
}
if (str != NULL) {
if (str != nullptr) {
ED_undo_push(C, str);
}
@ -1676,7 +1676,8 @@ static TreeTraversalAction outliner_find_objects_to_delete(TreeElement *te, void
return TRAVERSE_CONTINUE;
}
if ((tselem->type != TSE_SOME_ID) || (tselem->id == NULL) || (GS(tselem->id->name) != ID_OB)) {
if ((tselem->type != TSE_SOME_ID) || (tselem->id == nullptr) ||
(GS(tselem->id->name) != ID_OB)) {
return TRAVERSE_SKIP_CHILDS;
}
@ -1718,7 +1719,7 @@ static int outliner_delete_exec(bContext *C, wmOperator *op)
outliner_do_object_delete(C, op->reports, scene, objects_to_delete, outliner_object_delete_fn);
}
BLI_gset_free(objects_to_delete, NULL);
BLI_gset_free(objects_to_delete, nullptr);
outliner_collection_delete(C, bmain, scene, op->reports, delete_hierarchy);
@ -1809,7 +1810,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
0,
"Remap Users",
"Make all users of selected data-blocks to use instead current (clicked) one"},
{0, "", 0, NULL, NULL},
{0, "", 0, nullptr, nullptr},
{OUTLINER_IDOP_OVERRIDE_LIBRARY_CREATE,
"OVERRIDE_LIBRARY_CREATE",
0,
@ -1854,10 +1855,10 @@ static const EnumPropertyItem prop_id_op_types[] = {
"Delete Library Override Hierarchy",
"Delete this local override (including its hierarchy of override dependencies) and relink "
"its usages to the linked data-blocks"},
{0, "", 0, NULL, NULL},
{0, "", 0, nullptr, nullptr},
{OUTLINER_IDOP_COPY, "COPY", ICON_COPYDOWN, "Copy", ""},
{OUTLINER_IDOP_PASTE, "PASTE", ICON_PASTEDOWN, "Paste", ""},
{0, "", 0, NULL, NULL},
{0, "", 0, nullptr, nullptr},
{OUTLINER_IDOP_FAKE_ADD,
"ADD_FAKE",
0,
@ -1867,7 +1868,7 @@ static const EnumPropertyItem prop_id_op_types[] = {
{OUTLINER_IDOP_FAKE_CLEAR, "CLEAR_FAKE", 0, "Clear Fake User", ""},
{OUTLINER_IDOP_RENAME, "RENAME", 0, "Rename", ""},
{OUTLINER_IDOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static bool outliner_id_operation_item_poll(bContext *C,
@ -1901,7 +1902,7 @@ static bool outliner_id_operation_item_poll(bContext *C,
if (GS(tselem->id->name) == ID_OB) {
Object *ob = (Object *)tselem->id;
if ((ob != NULL) && (ob->proxy != NULL)) {
if ((ob != nullptr) && (ob->proxy != nullptr)) {
return true;
}
}
@ -1933,13 +1934,13 @@ static const EnumPropertyItem *outliner_id_operation_itemf(bContext *C,
PropertyRNA *prop,
bool *r_free)
{
EnumPropertyItem *items = NULL;
EnumPropertyItem *items = nullptr;
int totitem = 0;
if ((C == NULL) || (ED_operator_outliner_active(C) == false)) {
if ((C == nullptr) || (ED_operator_outliner_active(C) == false)) {
return prop_id_op_types;
}
for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != NULL; it++) {
for (const EnumPropertyItem *it = prop_id_op_types; it->identifier != nullptr; it++) {
if (!outliner_id_operation_item_poll(C, ptr, prop, it->value)) {
continue;
}
@ -1959,7 +1960,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -1971,10 +1972,15 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_UNLINK: {
/* unlink datablock from its parent */
if (objectlevel) {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, unlink_object_fn, NULL);
outliner_do_libdata_operation(C,
op->reports,
scene,
space_outliner,
&space_outliner->tree,
unlink_object_fn,
nullptr);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, nullptr);
ED_undo_push(C, "Unlink Object");
break;
}
@ -1987,9 +1993,9 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
unlink_action_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
ED_undo_push(C, "Unlink action");
break;
case ID_MA:
@ -1999,9 +2005,9 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
unlink_material_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, nullptr);
ED_undo_push(C, "Unlink material");
break;
case ID_TE:
@ -2011,16 +2017,21 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
unlink_texture_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, nullptr);
ED_undo_push(C, "Unlink texture");
break;
case ID_WO:
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, unlink_world_fn, NULL);
outliner_do_libdata_operation(C,
op->reports,
scene,
space_outliner,
&space_outliner->tree,
unlink_world_fn,
nullptr);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, nullptr);
ED_undo_push(C, "Unlink world");
break;
case ID_GR:
@ -2030,9 +2041,9 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
unlink_collection_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_LAYER, nullptr);
ED_undo_push(C, "Unlink Collection");
break;
default:
@ -2044,7 +2055,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_LOCAL: {
/* make local */
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_local_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, id_local_fn, nullptr);
ED_undo_push(C, "Localized Data");
break;
}
@ -2158,9 +2169,9 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
singleuser_action_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
ED_undo_push(C, "Single-User Action");
break;
@ -2171,9 +2182,9 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
singleuser_world_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL);
WM_event_add_notifier(C, NC_SCENE | ND_WORLD, nullptr);
ED_undo_push(C, "Single-User World");
break;
@ -2186,7 +2197,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_DELETE: {
if (idlevel > 0) {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, nullptr);
ED_undo_push(C, "Delete");
}
break;
@ -2194,7 +2205,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_IDOP_REMAP: {
if (idlevel > 0) {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, id_remap_fn, nullptr);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
}
@ -2202,14 +2213,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
case OUTLINER_IDOP_COPY: {
wm->op_undo_depth++;
WM_operator_name_call(C, "OUTLINER_OT_id_copy", WM_OP_INVOKE_DEFAULT, NULL);
WM_operator_name_call(C, "OUTLINER_OT_id_copy", WM_OP_INVOKE_DEFAULT, nullptr);
wm->op_undo_depth--;
/* No need for undo, this operation does not change anything... */
break;
}
case OUTLINER_IDOP_PASTE: {
wm->op_undo_depth++;
WM_operator_name_call(C, "OUTLINER_OT_id_paste", WM_OP_INVOKE_DEFAULT, NULL);
WM_operator_name_call(C, "OUTLINER_OT_id_paste", WM_OP_INVOKE_DEFAULT, nullptr);
wm->op_undo_depth--;
ED_outliner_select_sync_from_all_tag(C);
ED_undo_push(C, "Paste");
@ -2217,10 +2228,15 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
case OUTLINER_IDOP_FAKE_ADD: {
/* set fake user */
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_fake_user_set_fn, NULL);
outliner_do_libdata_operation(C,
op->reports,
scene,
space_outliner,
&space_outliner->tree,
id_fake_user_set_fn,
nullptr);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
ED_undo_push(C, "Add Fake User");
break;
}
@ -2232,24 +2248,29 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
space_outliner,
&space_outliner->tree,
id_fake_user_clear_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
ED_undo_push(C, "Clear Fake User");
break;
}
case OUTLINER_IDOP_RENAME: {
/* rename */
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, nullptr);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
ED_undo_push(C, "Rename");
break;
}
case OUTLINER_IDOP_SELECT_LINKED:
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_select_linked_fn, NULL);
outliner_do_libdata_operation(C,
op->reports,
scene,
space_outliner,
&space_outliner->tree,
id_select_linked_fn,
nullptr);
ED_outliner_select_sync_from_all_tag(C);
ED_undo_push(C, "Select");
break;
@ -2260,10 +2281,10 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op)
}
/* wrong notifier still... */
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
/* XXX: this is just so that outliner is always up to date. */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr);
return OPERATOR_FINISHED;
}
@ -2314,7 +2335,7 @@ static const EnumPropertyItem outliner_lib_op_type_items[] = {
"Relocate",
"Select a new path for this library, and reload all its data"},
{OL_LIB_RELOAD, "RELOAD", ICON_FILE_REFRESH, "Reload", "Reload all data from this library"},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
@ -2324,7 +2345,7 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
int scenelevel = 0, objectlevel = 0, idlevel = 0, datalevel = 0;
/* check for invalid states */
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return OPERATOR_CANCELLED;
}
@ -2335,28 +2356,28 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
switch (event) {
case OL_LIB_RENAME: {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, item_rename_fn, nullptr);
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
ED_undo_push(C, "Rename Library");
break;
}
case OL_LIB_DELETE: {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, id_delete_fn, nullptr);
ED_undo_push(C, "Delete Library");
break;
}
case OL_LIB_RELOCATE: {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, lib_relocate_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, lib_relocate_fn, nullptr);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
break;
}
case OL_LIB_RELOAD: {
outliner_do_libdata_operation(
C, op->reports, scene, space_outliner, &space_outliner->tree, lib_reload_fn, NULL);
C, op->reports, scene, space_outliner, &space_outliner->tree, lib_reload_fn, nullptr);
/* No undo push here, operator does it itself (since it's a modal one, the op_undo_depth
* trick does not work here). */
break;
@ -2367,10 +2388,10 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op)
}
/* wrong notifier still... */
WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_ID | NA_EDITED, nullptr);
/* XXX: this is just so that outliner is always up to date */
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL);
WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, nullptr);
return OPERATOR_FINISHED;
}
@ -2407,7 +2428,7 @@ static void outliner_do_id_set_operation(
TreeStoreElem *tselem = TREESTORE(te);
if (tselem->flag & TSE_SELECTED) {
if (tselem->type == type) {
TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL;
TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : nullptr;
operation_fn(te, tselem, tsep, newid);
}
}
@ -2426,14 +2447,14 @@ static void actionset_id_fn(TreeElement *UNUSED(te),
if (tselem->type == TSE_ANIM_DATA) {
/* "animation" entries - action is child of this */
BKE_animdata_set_action(NULL, tselem->id, act);
BKE_animdata_set_action(nullptr, tselem->id, act);
}
/* TODO: if any other "expander" channels which own actions need to support this menu,
* add: tselem->type = ...
*/
else if (tsep && (tsep->type == TSE_ANIM_DATA)) {
/* "animation" entries case again */
BKE_animdata_set_action(NULL, tsep->id, act);
BKE_animdata_set_action(nullptr, tsep->id, act);
}
/* TODO: other cases not supported yet. */
}
@ -2452,7 +2473,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
act = reinterpret_cast<bAction *>(
BLI_findlink(&bmain->actions, RNA_enum_get(op->ptr, "action")));
if (act == NULL) {
if (act == nullptr) {
BKE_report(op->reports, RPT_ERROR, "No valid action to add");
return OPERATOR_CANCELLED;
}
@ -2481,7 +2502,7 @@ static int outliner_action_set_exec(bContext *C, wmOperator *op)
}
/* set notifier that things have changed */
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
ED_undo_push(C, "Set action");
/* done */
@ -2541,7 +2562,7 @@ static const EnumPropertyItem prop_animdata_op_types[] = {
{OUTLINER_ANIMOP_CLEAR_ACT, "CLEAR_ACT", 0, "Unlink Action", ""},
{OUTLINER_ANIMOP_REFRESH_DRV, "REFRESH_DRIVERS", 0, "Refresh Drivers", ""},
{OUTLINER_ANIMOP_CLEAR_DRV, "CLEAR_DRIVERS", 0, "Clear Drivers", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
@ -2562,16 +2583,16 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_ANIMOP_CLEAR_ADT:
/* Remove Animation Data - this may remove the active action, in some cases... */
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, clear_animdata_fn, NULL);
space_outliner, datalevel, event, &space_outliner->tree, clear_animdata_fn, nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
ED_undo_push(C, "Clear Animation Data");
break;
case OUTLINER_ANIMOP_SET_ACT:
/* delegate once again... */
wm->op_undo_depth++;
WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, NULL);
WM_operator_name_call(C, "OUTLINER_OT_action_set", WM_OP_INVOKE_REGION_WIN, nullptr);
wm->op_undo_depth--;
ED_undo_push(C, "Set active action");
break;
@ -2579,9 +2600,9 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
case OUTLINER_ANIMOP_CLEAR_ACT:
/* clear active action - using standard rules */
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, unlinkact_animdata_fn, NULL);
space_outliner, datalevel, event, &space_outliner->tree, unlinkact_animdata_fn, nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
ED_undo_push(C, "Unlink action");
break;
@ -2591,17 +2612,21 @@ static int outliner_animdata_operation_exec(bContext *C, wmOperator *op)
event,
&space_outliner->tree,
refreshdrivers_animdata_fn,
NULL);
nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, nullptr);
/* ED_undo_push(C, "Refresh Drivers"); No undo needed - shouldn't have any impact? */
break;
case OUTLINER_ANIMOP_CLEAR_DRV:
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, cleardrivers_animdata_fn, NULL);
outliner_do_data_operation(space_outliner,
datalevel,
event,
&space_outliner->tree,
cleardrivers_animdata_fn,
nullptr);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, NULL);
WM_event_add_notifier(C, NC_ANIMATION | ND_ANIMCHAN, nullptr);
ED_undo_push(C, "Clear Drivers");
break;
@ -2641,7 +2666,7 @@ static const EnumPropertyItem prop_constraint_op_types[] = {
{OL_CONSTRAINTOP_ENABLE, "ENABLE", ICON_HIDE_OFF, "Enable", ""},
{OL_CONSTRAINTOP_DISABLE, "DISABLE", ICON_HIDE_ON, "Disable", ""},
{OL_CONSTRAINTOP_DELETE, "DELETE", ICON_X, "Delete", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int outliner_constraint_operation_exec(bContext *C, wmOperator *op)
@ -2688,7 +2713,7 @@ static const EnumPropertyItem prop_modifier_op_types[] = {
{OL_MODIFIER_OP_TOGVIS, "TOGVIS", ICON_RESTRICT_VIEW_OFF, "Toggle Viewport Use", ""},
{OL_MODIFIER_OP_TOGREN, "TOGREN", ICON_RESTRICT_RENDER_OFF, "Toggle Render Use", ""},
{OL_MODIFIER_OP_DELETE, "DELETE", ICON_X, "Delete", ""},
{0, NULL, 0, NULL, NULL},
{0, nullptr, 0, nullptr, nullptr},
};
static int outliner_modifier_operation_exec(bContext *C, wmOperator *op)
@ -2741,24 +2766,24 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
switch (datalevel) {
case TSE_POSE_CHANNEL: {
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, pchan_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
space_outliner, datalevel, event, &space_outliner->tree, pchan_fn, nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
ED_undo_push(C, "PoseChannel operation");
break;
}
case TSE_BONE: {
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, bone_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
space_outliner, datalevel, event, &space_outliner->tree, bone_fn, nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
ED_undo_push(C, "Bone operation");
break;
}
case TSE_EBONE: {
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, ebone_fn, NULL);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
space_outliner, datalevel, event, &space_outliner->tree, ebone_fn, nullptr);
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, nullptr);
ED_undo_push(C, "EditBone operation");
break;
@ -2774,8 +2799,8 @@ static int outliner_data_operation_exec(bContext *C, wmOperator *op)
}
case TSE_GP_LAYER: {
outliner_do_data_operation(
space_outliner, datalevel, event, &space_outliner->tree, gpencil_layer_fn, NULL);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
space_outliner, datalevel, event, &space_outliner->tree, gpencil_layer_fn, nullptr);
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, nullptr);
ED_undo_push(C, "Grease Pencil Layer operation");
break;
@ -2803,17 +2828,17 @@ static const EnumPropertyItem *outliner_data_op_sets_enum_item_fn(bContext *C,
bool *UNUSED(r_free))
{
/* Check for invalid states. */
if (C == NULL) {
if (C == nullptr) {
return DummyRNA_DEFAULT_items;
}
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
if (space_outliner == NULL) {
if (space_outliner == nullptr) {
return DummyRNA_DEFAULT_items;
}
TreeElement *te = get_target_element(space_outliner);
if (te == NULL) {
if (te == nullptr) {
return DummyRNA_NULL_items;
}
@ -2824,10 +2849,11 @@ static const EnumPropertyItem *outliner_data_op_sets_enum_item_fn(bContext *C,
{OL_DOP_DESELECT, "DESELECT", 0, "Deselect", ""},
{OL_DOP_HIDE, "HIDE", 0, "Hide", ""},
{OL_DOP_UNHIDE, "UNHIDE", 0, "Unhide", ""},
{0, NULL, 0, NULL, NULL}};
{0, nullptr, 0, nullptr, nullptr}};
static const EnumPropertyItem optype_sel_linked[] = {
{OL_DOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""}, {0, NULL, 0, NULL, NULL}};
{OL_DOP_SELECT_LINKED, "SELECT_LINKED", 0, "Select Linked", ""},
{0, nullptr, 0, nullptr, nullptr}};
if (tselem->type == TSE_RNA_STRUCT) {
return optype_sel_linked;
@ -2862,7 +2888,7 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
static int outliner_operator_menu(bContext *C, const char *opname)
{
wmOperatorType *ot = WM_operatortype_find(opname, false);
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(ot, NULL), ICON_NONE);
uiPopupMenu *pup = UI_popup_menu_begin(C, WM_operatortype_name(ot, nullptr), ICON_NONE);
uiLayout *layout = UI_popup_menu_layout(pup);
/* set this so the default execution context is the same as submenus */

View File

@ -113,7 +113,7 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
BLI_mempool_iternew(ts, &iter);
while ((tselem = reinterpret_cast<TreeStoreElem *>(BLI_mempool_iterstep(&iter)))) {
if (tselem->id == NULL) {
if (tselem->id == nullptr) {
unused++;
}
}
@ -121,10 +121,10 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
if (unused) {
if (BLI_mempool_len(ts) == unused) {
BLI_mempool_destroy(ts);
space_outliner->treestore = NULL;
space_outliner->treestore = nullptr;
if (space_outliner->runtime->treehash) {
BKE_outliner_treehash_free(space_outliner->runtime->treehash);
space_outliner->runtime->treehash = NULL;
space_outliner->runtime->treehash = nullptr;
}
}
else {
@ -157,12 +157,12 @@ static void outliner_storage_cleanup(SpaceOutliner *space_outliner)
static void check_persistent(
SpaceOutliner *space_outliner, TreeElement *te, ID *id, short type, short nr)
{
if (space_outliner->treestore == NULL) {
if (space_outliner->treestore == nullptr) {
/* if treestore was not created in readfile.c, create it here */
space_outliner->treestore = BLI_mempool_create(
sizeof(TreeStoreElem), 1, 512, BLI_MEMPOOL_ALLOW_ITER);
}
if (space_outliner->runtime->treehash == NULL) {
if (space_outliner->runtime->treehash == nullptr) {
space_outliner->runtime->treehash = reinterpret_cast<GHash *>(
BKE_outliner_treehash_create_from_treestore(space_outliner->treestore));
}
@ -320,7 +320,7 @@ static void outliner_add_object_contents(SpaceOutliner *space_outliner,
tenla->name = IFACE_("Pose");
/* channels undefined in editmode, but we want the 'tenla' pose icon itself */
if ((arm->edbo == NULL) && (ob->mode & OB_MODE_POSE)) {
if ((arm->edbo == nullptr) && (ob->mode & OB_MODE_POSE)) {
int const_index = 1000; /* ensure unique id for bone constraints */
int a;
LISTBASE_FOREACH_INDEX (bPoseChannel *, pchan, &ob->pose->chanbase, a) {
@ -717,7 +717,7 @@ static void outliner_add_id_contents(SpaceOutliner *space_outliner,
/* make hierarchy */
TreeElement *ten = arm->edbo->first ? reinterpret_cast<TreeElement *>(
((EditBone *)arm->edbo->first)->temp.p) :
NULL;
nullptr;
while (ten) {
TreeElement *nten = ten->next, *par;
EditBone *ebone = (EditBone *)ten->directdata;
@ -874,8 +874,8 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
if (type == TSE_ID_BASE) {
/* pass */
}
else if (id == NULL) {
return NULL;
else if (id == nullptr) {
return nullptr;
}
if (type == 0) {
@ -903,7 +903,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
te->type = outliner_tree_element_type_create(type, te, idv);
if (te->type) {
/* Element types ported to the new design are expected to have their name set at this point! */
BLI_assert(te->name != NULL);
BLI_assert(te->name != nullptr);
}
if (ELEM(type, TSE_SEQUENCE, TSE_SEQ_STRIP, TSE_SEQUENCE_DUP)) {
@ -1025,12 +1025,12 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
/* we do lazy build, for speed and to avoid infinite recursion */
if (ptr->data == NULL) {
if (ptr->data == nullptr) {
te->name = IFACE_("(empty)");
}
else if (type == TSE_RNA_STRUCT) {
/* struct */
te->name = RNA_struct_name_get_alloc(ptr, NULL, 0, NULL);
te->name = RNA_struct_name_get_alloc(ptr, nullptr, 0, nullptr);
if (te->name) {
te->flag |= TE_FREE_NAME;
@ -1154,7 +1154,7 @@ TreeElement *outliner_add_element(SpaceOutliner *space_outliner,
}
}
if (outliner_element_warnings_get(te, NULL, NULL)) {
if (outliner_element_warnings_get(te, nullptr, nullptr)) {
te->flag |= TE_HAS_WARNING;
}
@ -1348,7 +1348,7 @@ static int treesort_obtype_alpha(const void *v1, const void *v2)
static void outliner_sort(ListBase *lb)
{
TreeElement *last_te = reinterpret_cast<TreeElement *>(lb->last);
if (last_te == NULL) {
if (last_te == nullptr) {
return;
}
TreeStoreElem *last_tselem = TREESTORE(last_te);
@ -1416,7 +1416,7 @@ static void outliner_sort(ListBase *lb)
static void outliner_collections_children_sort(ListBase *lb)
{
TreeElement *last_te = reinterpret_cast<TreeElement *>(lb->last);
if (last_te == NULL) {
if (last_te == nullptr) {
return;
}
TreeStoreElem *last_tselem = TREESTORE(last_te);
@ -1473,12 +1473,12 @@ static void outliner_restore_scrolling_position(SpaceOutliner *space_outliner,
{
View2D *v2d = &region->v2d;
if (focus->tselem != NULL) {
if (focus->tselem != nullptr) {
outliner_set_coordinates(region, space_outliner);
TreeElement *te_new = outliner_find_tree_element(&space_outliner->tree, focus->tselem);
if (te_new != NULL) {
if (te_new != nullptr) {
int ys_new = te_new->ys;
int ys_old = focus->ys;
@ -1519,13 +1519,13 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
LISTBASE_FOREACH (TreeElement *, te_iter, &te->subtree) {
TreeElement *te_sub = outliner_find_first_desired_element_at_y_recursive(
space_outliner, te_iter, limit, callback_test);
if (te_sub != NULL) {
if (te_sub != nullptr) {
return te_sub;
}
}
}
return NULL;
return nullptr;
}
/**
@ -1536,7 +1536,7 @@ static TreeElement *outliner_find_first_desired_element_at_y_recursive(
*
* Basically we keep going up and down the outliner tree from that point forward, until we find
* what we are looking for. If we are past the visible range and we can't find a valid element
* we return NULL.
* we return nullptr.
*/
static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner *space_outliner,
const float view_co,
@ -1553,15 +1553,15 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
callback_test = test_collection_callback;
}
while (te != NULL) {
while (te != nullptr) {
TreeElement *te_sub = outliner_find_first_desired_element_at_y_recursive(
space_outliner, te, view_co_limit, callback_test);
if (te_sub != NULL) {
if (te_sub != nullptr) {
/* Skip the element if it was not visible to start with. */
if (te->ys + UI_UNIT_Y > view_co_limit) {
return te_sub;
}
return NULL;
return nullptr;
}
if (te->next) {
@ -1569,7 +1569,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
continue;
}
if (te->parent == NULL) {
if (te->parent == nullptr) {
break;
}
@ -1582,7 +1582,7 @@ static TreeElement *outliner_find_first_desired_element_at_y(const SpaceOutliner
}
}
return NULL;
return nullptr;
}
/**
@ -1603,12 +1603,12 @@ static void outliner_store_scrolling_position(SpaceOutliner *space_outliner,
TreeElement *te = outliner_find_first_desired_element_at_y(
space_outliner, region->v2d.cur.ymax, limit);
if (te != NULL) {
if (te != nullptr) {
focus->tselem = TREESTORE(te);
focus->ys = te->ys;
}
else {
focus->tselem = NULL;
focus->tselem = nullptr;
}
}
@ -1666,7 +1666,7 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
Object *ob = (Object *)tselem->id;
Base *base = (Base *)te->directdata;
BLI_assert((base == NULL) || (base->object == ob));
BLI_assert((base == nullptr) || (base->object == ob));
if (exclude_filter & SO_FILTER_OB_TYPE) {
switch (ob->type) {
@ -1704,10 +1704,10 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
}
if (exclude_filter & SO_FILTER_OB_STATE) {
if (base == NULL) {
if (base == nullptr) {
base = BKE_view_layer_base_find(view_layer, ob);
if (base == NULL) {
if (base == nullptr) {
return false;
}
}
@ -1742,14 +1742,14 @@ static bool outliner_element_visible_get(ViewLayer *view_layer,
return is_visible;
}
if ((te->parent != NULL) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
(te->parent->idcode == ID_OB)) {
if (exclude_filter & SO_FILTER_NO_CHILDREN) {
return false;
}
}
}
else if ((te->parent != NULL) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
else if ((te->parent != nullptr) && (TREESTORE(te->parent)->type == TSE_SOME_ID) &&
(te->parent->idcode == ID_OB)) {
if (exclude_filter & SO_FILTER_NO_OB_CONTENT) {
return false;
@ -1792,7 +1792,7 @@ static TreeElement *outliner_extract_children_from_subtree(TreeElement *element,
TreeElement *te_next = element->next;
if (outliner_element_is_collection_or_object(element)) {
TreeElement *te_prev = NULL;
TreeElement *te_prev = nullptr;
for (TreeElement *te = reinterpret_cast<TreeElement *>(element->subtree.last); te;
te = te_prev) {
te_prev = te->prev;
@ -1874,7 +1874,7 @@ static int outliner_filter_subtree(SpaceOutliner *space_outliner,
static void outliner_filter_tree(SpaceOutliner *space_outliner, ViewLayer *view_layer)
{
char search_buff[sizeof(((struct SpaceOutliner *)NULL)->search_string) + 2];
char search_buff[sizeof(((struct SpaceOutliner *)nullptr)->search_string) + 2];
char *search_string;
const int exclude_filter = outliner_exclude_filter_get(space_outliner);
@ -1900,7 +1900,7 @@ static void outliner_clear_newid_from_main(Main *bmain)
{
ID *id_iter;
FOREACH_MAIN_ID_BEGIN (bmain, id_iter) {
id_iter->newid = NULL;
id_iter->newid = nullptr;
}
FOREACH_MAIN_ID_END;
}

View File

@ -58,7 +58,7 @@ void outliner_viewcontext_init(const bContext *C, TreeViewContext *tvc)
/* Objects. */
tvc->obact = OBACT(tvc->view_layer);
if (tvc->obact != NULL) {
if (tvc->obact != nullptr) {
tvc->ob_edit = OBEDIT_FROM_OBACT(tvc->obact);
if ((tvc->obact->type == OB_ARMATURE) ||
@ -104,7 +104,7 @@ TreeElement *outliner_find_item_at_y(const SpaceOutliner *space_outliner,
}
}
return NULL;
return nullptr;
}
static TreeElement *outliner_find_item_at_x_in_row_recursive(const TreeElement *parent_te,
@ -168,7 +168,7 @@ TreeElement *outliner_find_tree_element(ListBase *lb, const TreeStoreElem *store
return tes;
}
}
return NULL;
return nullptr;
}
TreeElement *outliner_find_parent_element(ListBase *lb,
@ -185,15 +185,15 @@ TreeElement *outliner_find_parent_element(ListBase *lb,
return find_te;
}
}
return NULL;
return nullptr;
}
TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreElem *tse)
{
TreeStoreElem *tselem;
if (tse->id == NULL) {
return NULL;
if (tse->id == nullptr) {
return nullptr;
}
/* check if 'tse' is in treestore */
@ -203,7 +203,7 @@ TreeElement *outliner_find_tse(SpaceOutliner *space_outliner, const TreeStoreEle
return outliner_find_tree_element(&space_outliner->tree, tselem);
}
return NULL;
return nullptr;
}
TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const ID *id)
@ -221,7 +221,7 @@ TreeElement *outliner_find_id(SpaceOutliner *space_outliner, ListBase *lb, const
return tes;
}
}
return NULL;
return nullptr;
}
TreeElement *outliner_find_posechannel(ListBase *lb, const bPoseChannel *pchan)
@ -239,7 +239,7 @@ TreeElement *outliner_find_posechannel(ListBase *lb, const bPoseChannel *pchan)
}
}
}
return NULL;
return nullptr;
}
TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone)
@ -257,7 +257,7 @@ TreeElement *outliner_find_editbone(ListBase *lb, const EditBone *ebone)
}
}
}
return NULL;
return nullptr;
}
TreeElement *outliner_search_back_te(TreeElement *te, short idcode)
@ -272,7 +272,7 @@ TreeElement *outliner_search_back_te(TreeElement *te, short idcode)
}
te = te->parent;
}
return NULL;
return nullptr;
}
ID *outliner_search_back(TreeElement *te, short idcode)
@ -285,7 +285,7 @@ ID *outliner_search_back(TreeElement *te, short idcode)
tselem = TREESTORE(search_te);
return tselem->id;
}
return NULL;
return nullptr;
}
bool outliner_tree_traverse(const SpaceOutliner *space_outliner,
@ -383,7 +383,7 @@ TreeElement *outliner_find_element_with_flag(const ListBase *lb, short flag)
return active_element;
}
}
return NULL;
return nullptr;
}
bool outliner_is_element_visible(const TreeElement *te)
@ -468,7 +468,7 @@ Base *ED_outliner_give_base_under_cursor(bContext *C, const int mval[2])
ViewLayer *view_layer = CTX_data_view_layer(C);
SpaceOutliner *space_outliner = CTX_wm_space_outliner(C);
TreeElement *te;
Base *base = NULL;
Base *base = nullptr;
float view_mval[2];
UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &view_mval[0], &view_mval[1]);

View File

@ -92,7 +92,7 @@ static void outliner_main_region_draw(const bContext *C, ARegion *region)
UI_view2d_view_restore(C);
/* scrollers */
UI_view2d_scrollers_draw(v2d, NULL);
UI_view2d_scrollers_draw(v2d, nullptr);
}
static void outliner_main_region_free(ARegion *UNUSED(region))
@ -372,7 +372,7 @@ static void outliner_init(wmWindowManager *UNUSED(wm), ScrArea *area)
{
SpaceOutliner *space_outliner = reinterpret_cast<SpaceOutliner *>(area->spacedata.first);
if (space_outliner->runtime == NULL) {
if (space_outliner->runtime == nullptr) {
space_outliner->runtime = MEM_cnew<SpaceOutliner_Runtime>("SpaceOutliner_Runtime");
}
}
@ -383,15 +383,15 @@ static SpaceLink *outliner_duplicate(SpaceLink *sl)
SpaceOutliner *space_outliner_new = MEM_new<SpaceOutliner>(__func__, *space_outliner);
BLI_listbase_clear(&space_outliner_new->tree);
space_outliner_new->treestore = NULL;
space_outliner_new->treestore = nullptr;
space_outliner_new->sync_select_dirty = WM_OUTLINER_SYNC_SELECT_FROM_ALL;
if (space_outliner->runtime) {
space_outliner_new->runtime = MEM_new<SpaceOutliner_Runtime>("SpaceOutliner_runtime dup",
*space_outliner->runtime);
space_outliner_new->runtime->tree_display = NULL;
space_outliner_new->runtime->treehash = NULL;
space_outliner_new->runtime->tree_display = nullptr;
space_outliner_new->runtime->treehash = nullptr;
}
return (SpaceLink *)space_outliner_new;
@ -430,7 +430,7 @@ static void outliner_id_remap(ScrArea *area, SpaceLink *slink, ID *old_id, ID *n
/* postpone a full rebuild because this can be called many times on-free */
space_outliner->storeflag |= SO_TREESTORE_REBUILD;
if (new_id == NULL) {
if (new_id == nullptr) {
/* Redraw is needed when removing data for multiple outlines show the same data.
* without this, the stale data won't get fully flushed when this outliner
* is not the active outliner the user is interacting with. See T85976. */