Cleanup: Use c++ casting in liboverride BKE code.
No functional change expected here!
This commit is contained in:
parent
bd467100dd
commit
f8d13a1b58
|
@ -82,8 +82,8 @@ static void lib_override_library_property_operation_clear(
|
|||
BLI_INLINE void lib_override_object_posemode_transfer(ID *id_dst, ID *id_src)
|
||||
{
|
||||
if (GS(id_src->name) == ID_OB && GS(id_dst->name) == ID_OB) {
|
||||
Object *ob_src = (Object *)id_src;
|
||||
Object *ob_dst = (Object *)id_dst;
|
||||
Object *ob_src = reinterpret_cast<Object *>(id_src);
|
||||
Object *ob_dst = reinterpret_cast<Object *>(id_dst);
|
||||
if (ob_src->type == OB_ARMATURE && (ob_src->mode & OB_MODE_POSE) != 0) {
|
||||
ob_dst->restore_mode = ob_dst->mode;
|
||||
ob_dst->mode |= OB_MODE_POSE;
|
||||
|
@ -187,7 +187,7 @@ void BKE_lib_override_library_copy(ID *dst_id, const ID *src_id, const bool do_f
|
|||
* Otherwise, source is only an override template, it then becomes reference of dest ID. */
|
||||
dst_id->override_library->reference = src_id->override_library->reference ?
|
||||
src_id->override_library->reference :
|
||||
(ID *)src_id;
|
||||
const_cast<ID *>(src_id);
|
||||
id_us_plus(dst_id->override_library->reference);
|
||||
|
||||
dst_id->override_library->hierarchy_root = src_id->override_library->hierarchy_root;
|
||||
|
@ -683,7 +683,7 @@ static void lib_override_group_tag_data_object_to_collection_init_collection_pro
|
|||
LinkNodePair **collections_linkedlist_p;
|
||||
if (!BLI_ghash_ensure_p(data->linked_object_to_instantiating_collections,
|
||||
ob,
|
||||
(void ***)&collections_linkedlist_p)) {
|
||||
reinterpret_cast<void ***>(&collections_linkedlist_p))) {
|
||||
*collections_linkedlist_p = static_cast<LinkNodePair *>(
|
||||
BLI_memarena_calloc(data->mem_arena, sizeof(**collections_linkedlist_p)));
|
||||
}
|
||||
|
@ -724,7 +724,7 @@ static void lib_override_hierarchy_dependencies_recursive_tag_from(LibOverrideGr
|
|||
ID *id = data->id_root;
|
||||
const bool is_override = data->is_override;
|
||||
|
||||
if ((*(uint *)&id->tag & data->tag) == 0) {
|
||||
if ((*reinterpret_cast<uint *>(&id->tag) & data->tag) == 0) {
|
||||
/* This ID is not tagged, no reason to proceed further to its parents. */
|
||||
return;
|
||||
}
|
||||
|
@ -782,7 +782,7 @@ static bool lib_override_hierarchy_dependencies_recursive_tag(LibOverrideGroupTa
|
|||
|
||||
if (entry->tags & MAINIDRELATIONS_ENTRY_TAGS_PROCESSED_TO) {
|
||||
/* This ID has already been processed. */
|
||||
return (*(uint *)&id->tag & data->tag) != 0;
|
||||
return (*reinterpret_cast<uint *>(&id->tag) & data->tag) != 0;
|
||||
}
|
||||
/* This way we won't process again that ID, should we encounter it again through another
|
||||
* relationship hierarchy. */
|
||||
|
@ -815,11 +815,11 @@ static bool lib_override_hierarchy_dependencies_recursive_tag(LibOverrideGroupTa
|
|||
*
|
||||
* This will cover e.g. the case where user override an armature, and would expect the mesh
|
||||
* object deformed by that armature to also be overridden. */
|
||||
if ((*(uint *)&id->tag & data->tag) != 0 && !is_resync) {
|
||||
if ((*reinterpret_cast<uint *>(&id->tag) & data->tag) != 0 && !is_resync) {
|
||||
lib_override_hierarchy_dependencies_recursive_tag_from(data);
|
||||
}
|
||||
|
||||
return (*(uint *)&id->tag & data->tag) != 0;
|
||||
return (*reinterpret_cast<uint *>(&id->tag) & data->tag) != 0;
|
||||
}
|
||||
|
||||
static void lib_override_linked_group_tag_recursive(LibOverrideGroupTagData *data)
|
||||
|
@ -1224,9 +1224,9 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
switch (GS(id_root->name)) {
|
||||
case ID_GR: {
|
||||
Object *ob_reference = id_instance_hint != nullptr && GS(id_instance_hint->name) == ID_OB ?
|
||||
(Object *)id_instance_hint :
|
||||
reinterpret_cast<Object *>(id_instance_hint) :
|
||||
nullptr;
|
||||
Collection *collection_new = ((Collection *)id_root->newid);
|
||||
Collection *collection_new = (reinterpret_cast<Collection *>(id_root->newid));
|
||||
if (is_resync && BKE_collection_is_in_scene(collection_new)) {
|
||||
break;
|
||||
}
|
||||
|
@ -1236,11 +1236,11 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
else if (id_instance_hint != nullptr) {
|
||||
BLI_assert(GS(id_instance_hint->name) == ID_GR);
|
||||
BKE_collection_add_from_collection(
|
||||
bmain, scene, ((Collection *)id_instance_hint), collection_new);
|
||||
bmain, scene, (reinterpret_cast<Collection *>(id_instance_hint)), collection_new);
|
||||
}
|
||||
else {
|
||||
BKE_collection_add_from_collection(
|
||||
bmain, scene, ((Collection *)id_root), collection_new);
|
||||
bmain, scene, (reinterpret_cast<Collection *>(id_root)), collection_new);
|
||||
}
|
||||
|
||||
BLI_assert(BKE_collection_is_in_scene(collection_new));
|
||||
|
@ -1249,9 +1249,10 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
break;
|
||||
}
|
||||
case ID_OB: {
|
||||
Object *ob_new = (Object *)id_root->newid;
|
||||
Object *ob_new = reinterpret_cast<Object *>(id_root->newid);
|
||||
if (BLI_gset_lookup(all_objects_in_scene, ob_new) == nullptr) {
|
||||
BKE_collection_object_add_from(bmain, scene, (Object *)id_root, ob_new);
|
||||
BKE_collection_object_add_from(
|
||||
bmain, scene, reinterpret_cast<Object *>(id_root), ob_new);
|
||||
all_objects_in_scene = BKE_scene_objects_as_gset(scene, all_objects_in_scene);
|
||||
}
|
||||
break;
|
||||
|
@ -1264,7 +1265,7 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
/* We need to ensure all new overrides of objects are properly instantiated. */
|
||||
Collection *default_instantiating_collection = residual_storage;
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
Object *ob_new = (Object *)ob->id.newid;
|
||||
Object *ob_new = reinterpret_cast<Object *>(ob->id.newid);
|
||||
if (ob_new == nullptr || (ID_IS_LINKED(ob_new) && ob_new->id.lib != owner_library)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1298,7 +1299,7 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
case ID_OB: {
|
||||
/* Add the other objects to one of the collections instantiating the
|
||||
* root object, or scene's master collection if none found. */
|
||||
Object *ob_ref = (Object *)id_ref;
|
||||
Object *ob_ref = reinterpret_cast<Object *>(id_ref);
|
||||
LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
|
||||
if (BKE_collection_has_object(collection, ob_ref) &&
|
||||
(view_layer != nullptr ?
|
||||
|
@ -1328,8 +1329,10 @@ static void lib_override_library_create_post_process(Main *bmain,
|
|||
ID *id_ref = id_root->newid != nullptr ? id_root->newid : id_root;
|
||||
switch (GS(id_ref->name)) {
|
||||
case ID_GR:
|
||||
BKE_collection_add_from_collection(
|
||||
bmain, scene, (Collection *)id_ref, default_instantiating_collection);
|
||||
BKE_collection_add_from_collection(bmain,
|
||||
scene,
|
||||
reinterpret_cast<Collection *>(id_ref),
|
||||
default_instantiating_collection);
|
||||
break;
|
||||
default:
|
||||
/* Add to master collection. */
|
||||
|
@ -1802,14 +1805,15 @@ static bool lib_override_library_resync(Main *bmain,
|
|||
if (GS(reference_id->name) != GS(id->name)) {
|
||||
switch (GS(id->name)) {
|
||||
case ID_KE:
|
||||
reference_id = (ID *)BKE_key_from_id(reference_id);
|
||||
reference_id = reinterpret_cast<ID *>(BKE_key_from_id(reference_id));
|
||||
break;
|
||||
case ID_GR:
|
||||
BLI_assert(GS(reference_id->name) == ID_SCE);
|
||||
reference_id = (ID *)((Scene *)reference_id)->master_collection;
|
||||
reference_id = reinterpret_cast<ID *>(
|
||||
reinterpret_cast<Scene *>(reference_id)->master_collection);
|
||||
break;
|
||||
case ID_NT:
|
||||
reference_id = (ID *)ntreeFromID(id);
|
||||
reference_id = reinterpret_cast<ID *>(ntreeFromID(id));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2310,7 +2314,7 @@ static bool lib_override_resync_tagging_finalize_recurse(
|
|||
BLI_assert(id_root->override_library != nullptr);
|
||||
|
||||
LinkNodePair **id_resync_roots_p;
|
||||
if (!BLI_ghash_ensure_p(id_roots, id_root, (void ***)&id_resync_roots_p)) {
|
||||
if (!BLI_ghash_ensure_p(id_roots, id_root, reinterpret_cast<void ***>(&id_resync_roots_p))) {
|
||||
*id_resync_roots_p = MEM_cnew<LinkNodePair>(__func__);
|
||||
}
|
||||
|
||||
|
@ -2485,8 +2489,8 @@ static void lib_override_library_main_resync_on_library_indirect_level(
|
|||
2,
|
||||
"Resyncing all dependencies under root %s (%p), first one being '%s'...",
|
||||
id_root->name,
|
||||
library,
|
||||
((ID *)id_resync_roots->list->link)->name);
|
||||
reinterpret_cast<void *>(library),
|
||||
reinterpret_cast<ID *>(id_resync_roots->list->link)->name);
|
||||
const bool success = lib_override_library_resync(bmain,
|
||||
scene,
|
||||
view_layer,
|
||||
|
@ -2580,7 +2584,7 @@ static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data)
|
|||
|
||||
if (owner_library_indirect_level >= id->lib->temp_index) {
|
||||
id->lib->temp_index = owner_library_indirect_level + 1;
|
||||
*(bool *)cb_data->user_data = true;
|
||||
*reinterpret_cast<bool *>(cb_data->user_data) = true;
|
||||
}
|
||||
}
|
||||
return IDWALK_RET_NOP;
|
||||
|
@ -2738,7 +2742,7 @@ void BKE_lib_override_library_make_local(ID *id)
|
|||
}
|
||||
|
||||
if (GS(id->name) == ID_SCE) {
|
||||
Collection *master_collection = ((Scene *)id)->master_collection;
|
||||
Collection *master_collection = reinterpret_cast<Scene *>(id)->master_collection;
|
||||
if (master_collection != nullptr) {
|
||||
master_collection->id.flag &= ~LIB_EMBEDDED_DATA_LIB_OVERRIDE;
|
||||
}
|
||||
|
@ -3120,9 +3124,9 @@ bool BKE_lib_override_library_status_check_local(Main *bmain, ID *local)
|
|||
/* Our beloved pose's bone cross-data pointers. Usually, depsgraph evaluation would
|
||||
* ensure this is valid, but in some situations (like hidden collections etc.) this won't
|
||||
* be the case, so we need to take care of this ourselves. */
|
||||
Object *ob_local = (Object *)local;
|
||||
Object *ob_local = reinterpret_cast<Object *>(local);
|
||||
if (ob_local->type == OB_ARMATURE) {
|
||||
Object *ob_reference = (Object *)local->override_library->reference;
|
||||
Object *ob_reference = reinterpret_cast<Object *>(local->override_library->reference);
|
||||
BLI_assert(ob_local->data != nullptr);
|
||||
BLI_assert(ob_reference->data != nullptr);
|
||||
BKE_pose_ensure(bmain, ob_local, static_cast<bArmature *>(ob_local->data), true);
|
||||
|
@ -3180,9 +3184,9 @@ bool BKE_lib_override_library_status_check_reference(Main *bmain, ID *local)
|
|||
/* Our beloved pose's bone cross-data pointers. Usually, depsgraph evaluation would
|
||||
* ensure this is valid, but in some situations (like hidden collections etc.) this won't
|
||||
* be the case, so we need to take care of this ourselves. */
|
||||
Object *ob_local = (Object *)local;
|
||||
Object *ob_local = reinterpret_cast<Object *>(local);
|
||||
if (ob_local->type == OB_ARMATURE) {
|
||||
Object *ob_reference = (Object *)local->override_library->reference;
|
||||
Object *ob_reference = reinterpret_cast<Object *>(local->override_library->reference);
|
||||
BLI_assert(ob_local->data != nullptr);
|
||||
BLI_assert(ob_reference->data != nullptr);
|
||||
BKE_pose_ensure(bmain, ob_local, static_cast<bArmature *>(ob_local->data), true);
|
||||
|
@ -3228,9 +3232,9 @@ bool BKE_lib_override_library_operations_create(Main *bmain, ID *local)
|
|||
/* Our beloved pose's bone cross-data pointers. Usually, depsgraph evaluation would
|
||||
* ensure this is valid, but in some situations (like hidden collections etc.) this won't
|
||||
* be the case, so we need to take care of this ourselves. */
|
||||
Object *ob_local = (Object *)local;
|
||||
Object *ob_local = reinterpret_cast<Object *>(local);
|
||||
if (ob_local->type == OB_ARMATURE) {
|
||||
Object *ob_reference = (Object *)local->override_library->reference;
|
||||
Object *ob_reference = reinterpret_cast<Object *>(local->override_library->reference);
|
||||
BLI_assert(ob_local->data != nullptr);
|
||||
BLI_assert(ob_reference->data != nullptr);
|
||||
BKE_pose_ensure(bmain, ob_local, static_cast<bArmature *>(ob_local->data), true);
|
||||
|
@ -3284,7 +3288,7 @@ static void lib_override_library_operations_create_cb(TaskPool *__restrict pool,
|
|||
if (BKE_lib_override_library_operations_create(create_data->bmain, id)) {
|
||||
/* Technically no need for atomic, all jobs write the same value and we only care if one did
|
||||
* it. But play safe and avoid implicit assumptions. */
|
||||
atomic_fetch_and_or_uint8((uint8_t *)&create_data->changed, true);
|
||||
atomic_fetch_and_or_uint8(reinterpret_cast<uint8_t *>(&create_data->changed), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3324,7 +3328,7 @@ bool BKE_lib_override_library_main_operations_create(Main *bmain, const bool for
|
|||
/* Usual issue with pose, it's quiet rare but sometimes they may not be up to date when this
|
||||
* function is called. */
|
||||
if (GS(id->name) == ID_OB) {
|
||||
Object *ob = (Object *)id;
|
||||
Object *ob = reinterpret_cast<Object *>(id);
|
||||
if (ob->type == OB_ARMATURE) {
|
||||
BLI_assert(ob->data != nullptr);
|
||||
BKE_pose_ensure(bmain, ob, static_cast<bArmature *>(ob->data), true);
|
||||
|
@ -3768,7 +3772,7 @@ bool BKE_lib_override_library_id_is_user_deletable(Main *bmain, ID *id)
|
|||
if (GS(id->name) != ID_OB) {
|
||||
return true;
|
||||
}
|
||||
Object *ob = (Object *)id;
|
||||
Object *ob = reinterpret_cast<Object *>(id);
|
||||
LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
|
||||
if (!ID_IS_OVERRIDE_LIBRARY(collection)) {
|
||||
continue;
|
||||
|
@ -3839,7 +3843,7 @@ ID *BKE_lib_override_library_operations_store_start(Main *bmain,
|
|||
* (and possibly all over Blender code).
|
||||
* Not impossible to do, but would rather see first is extra useless usual user handling is
|
||||
* actually a (performances) issue here, before doing it. */
|
||||
storage_id = BKE_id_copy((Main *)override_storage, local);
|
||||
storage_id = BKE_id_copy(reinterpret_cast<Main *>(override_storage), local);
|
||||
|
||||
if (storage_id != nullptr) {
|
||||
PointerRNA rnaptr_reference, rnaptr_final, rnaptr_storage;
|
||||
|
|
Loading…
Reference in New Issue