Cleanup: use BLI_assert_msg instead of checking string literals
This commit is contained in:
parent
c4c1aedd00
commit
b03332a055
|
@ -73,7 +73,8 @@ bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop)
|
|||
has_parent = (pchan->parent != nullptr);
|
||||
}
|
||||
else {
|
||||
BLI_assert(!"visualkey_can_use called for data-block that is not an Object or PoseBone.");
|
||||
BLI_assert_msg(false,
|
||||
"visualkey_can_use called for data-block that is not an Object or PoseBone.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ std::unique_ptr<AssetCatalogDefinitionFile> AssetCatalogDefinitionFile::copy_and
|
|||
continue;
|
||||
}
|
||||
|
||||
BLI_assert(!"A CDF should only reference known catalogs.");
|
||||
BLI_assert_msg(false, "A CDF should only reference known catalogs.");
|
||||
}
|
||||
|
||||
return copy;
|
||||
|
|
|
@ -2850,8 +2850,9 @@ static void nlastrip_evaluate_transition(const int evaluation_mode,
|
|||
break;
|
||||
}
|
||||
case STRIP_EVAL_NOBLEND: {
|
||||
BLI_assert( !"This case shouldn't occur. Transitions assumed to not reference other "
|
||||
"transitions. ");
|
||||
BLI_assert_msg(false,
|
||||
"This case shouldn't occur. "
|
||||
"Transitions assumed to not reference other transitions.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1455,7 +1455,7 @@ bool BKE_object_modifier_stack_copy(Object *ob_dst,
|
|||
const int flag_subdata)
|
||||
{
|
||||
if ((ob_dst->type == OB_GPENCIL_LEGACY) != (ob_src->type == OB_GPENCIL_LEGACY)) {
|
||||
BLI_assert_msg(0,
|
||||
BLI_assert_msg(false,
|
||||
"Trying to copy a modifier stack between a GPencil object and another type.");
|
||||
return false;
|
||||
}
|
||||
|
@ -1463,8 +1463,9 @@ bool BKE_object_modifier_stack_copy(Object *ob_dst,
|
|||
if (!BLI_listbase_is_empty(&ob_dst->modifiers) ||
|
||||
!BLI_listbase_is_empty(&ob_dst->greasepencil_modifiers))
|
||||
{
|
||||
BLI_assert(
|
||||
!"Trying to copy a modifier stack into an object having a non-empty modifier stack.");
|
||||
BLI_assert_msg(
|
||||
false,
|
||||
"Trying to copy a modifier stack into an object having a non-empty modifier stack.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -806,8 +806,9 @@ bool BKE_undosys_step_load_data_ex(UndoStack *ustack,
|
|||
}
|
||||
}
|
||||
|
||||
BLI_assert(
|
||||
!"This should never be reached, either undo stack is corrupted, or code above is buggy");
|
||||
BLI_assert_msg(
|
||||
false,
|
||||
"This should never be reached, either undo stack is corrupted, or code above is buggy");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1335,8 +1335,9 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
|||
}
|
||||
}
|
||||
if (relation->parentid == 0) {
|
||||
BLI_assert(
|
||||
!"Found a valid parent for workspace data relation, but no valid parent id.");
|
||||
BLI_assert_msg(
|
||||
false,
|
||||
"Found a valid parent for workspace data relation, but no valid parent id.");
|
||||
}
|
||||
}
|
||||
if (relation->parentid == 0) {
|
||||
|
|
|
@ -604,8 +604,8 @@ void update_list_orig_pointers(const ListBase *listbase_orig,
|
|||
element_orig = element_orig->next;
|
||||
}
|
||||
|
||||
BLI_assert((element_orig == nullptr && element_cow == nullptr) ||
|
||||
!"list of pointers of different sizes, unable to reliably set orig pointer");
|
||||
BLI_assert_msg(element_orig == nullptr && element_cow == nullptr,
|
||||
"list of pointers of different sizes, unable to reliably set orig pointer");
|
||||
}
|
||||
|
||||
void update_particle_system_orig_pointers(const Object *object_orig, Object *object_cow)
|
||||
|
|
|
@ -120,7 +120,7 @@ float MotionBlurModule::shutter_time_to_scene_time(float time)
|
|||
time -= 1.0;
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"Invalid motion blur position enum!");
|
||||
BLI_assert_msg(false, "Invalid motion blur position enum!");
|
||||
break;
|
||||
}
|
||||
time *= shutter_time_;
|
||||
|
|
|
@ -1191,8 +1191,8 @@ static void drw_draw_pass_ex(DRWPass *pass,
|
|||
|
||||
DST.shader = nullptr;
|
||||
|
||||
BLI_assert(DST.buffer_finish_called &&
|
||||
"DRW_render_instance_buffer_finish had not been called before drawing");
|
||||
BLI_assert_msg(DST.buffer_finish_called,
|
||||
"DRW_render_instance_buffer_finish had not been called before drawing");
|
||||
|
||||
if (DST.view_previous != DST.view_active || DST.view_active->is_dirty) {
|
||||
drw_update_view();
|
||||
|
|
|
@ -154,10 +154,10 @@ void DRW_stats_query_end()
|
|||
|
||||
void DRW_stats_reset()
|
||||
{
|
||||
BLI_assert((DTP.timer_increment - DTP.end_increment) <= 0 &&
|
||||
"You forgot a DRW_stats_group/query_end somewhere!");
|
||||
BLI_assert((DTP.timer_increment - DTP.end_increment) >= 0 &&
|
||||
"You forgot a DRW_stats_group/query_start somewhere!");
|
||||
BLI_assert_msg((DTP.timer_increment - DTP.end_increment) <= 0,
|
||||
"You forgot a DRW_stats_group/query_end somewhere!");
|
||||
BLI_assert_msg((DTP.timer_increment - DTP.end_increment) >= 0,
|
||||
"You forgot a DRW_stats_group/query_start somewhere!");
|
||||
|
||||
if (DTP.is_recording) {
|
||||
uint64_t lvl_time[MAX_NESTED_TIMER] = {0};
|
||||
|
|
|
@ -498,8 +498,8 @@ void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max
|
|||
ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz;
|
||||
|
||||
BLI_assert(min < max);
|
||||
BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(gz, "offset")) &&
|
||||
"Make sure this function is called before WM_gizmo_target_property_def_rna"));
|
||||
BLI_assert_msg(!WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(gz, "offset")),
|
||||
"Make sure this function is called before WM_gizmo_target_property_def_rna");
|
||||
|
||||
arrow->data.range = max - min;
|
||||
arrow->data.min = min;
|
||||
|
@ -510,8 +510,8 @@ void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max
|
|||
void ED_gizmo_arrow3d_set_range_fac(wmGizmo *gz, const float range_fac)
|
||||
{
|
||||
ArrowGizmo3D *arrow = (ArrowGizmo3D *)gz;
|
||||
BLI_assert(!(WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(gz, "offset")) &&
|
||||
"Make sure this function is called before WM_gizmo_target_property_def_rna"));
|
||||
BLI_assert_msg(!WM_gizmo_target_property_is_valid(WM_gizmo_target_property_find(gz, "offset")),
|
||||
"Make sure this function is called before WM_gizmo_target_property_def_rna");
|
||||
|
||||
arrow->data.range_fac = range_fac;
|
||||
}
|
||||
|
|
|
@ -1152,7 +1152,9 @@ bool UI_context_copy_to_selected_list(bContext *C,
|
|||
printf("BoneColor is unexpectedly owned by %s '%s'\n",
|
||||
BKE_idtype_idcode_to_name(GS(ptr->owner_id->name)),
|
||||
ptr->owner_id->name + 2);
|
||||
BLI_assert(!"expected BoneColor to be owned by the Armature (bone & edit bone) or the Object (pose bone)");
|
||||
BLI_assert_msg(false,
|
||||
"expected BoneColor to be owned by the Armature "
|
||||
"(bone & edit bone) or the Object (pose bone)");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ static void standard_defines(Vector<const char *> &sources)
|
|||
sources.append("#define GPU_VULKAN\n");
|
||||
break;
|
||||
default:
|
||||
BLI_assert(false && "Invalid GPU Backend Type");
|
||||
BLI_assert_msg(false, "Invalid GPU Backend Type");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ auto imb_steal_buffer_data(BufferType &buffer) -> decltype(BufferType::data)
|
|||
|
||||
switch (buffer.ownership) {
|
||||
case IB_DO_NOT_TAKE_OWNERSHIP:
|
||||
BLI_assert(!"Unexpected behavior: stealing non-owned data pointer");
|
||||
BLI_assert_msg(false, "Unexpected behavior: stealing non-owned data pointer");
|
||||
return nullptr;
|
||||
|
||||
case IB_TAKE_OWNERSHIP: {
|
||||
|
|
|
@ -4047,8 +4047,8 @@ void IMB_colormanagement_processor_apply_pixel(ColormanageProcessor *cm_processo
|
|||
}
|
||||
}
|
||||
else {
|
||||
BLI_assert(
|
||||
!"Incorrect number of channels passed to IMB_colormanagement_processor_apply_pixel");
|
||||
BLI_assert_msg(
|
||||
false, "Incorrect number of channels passed to IMB_colormanagement_processor_apply_pixel");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,7 +170,9 @@ AbstractHierarchyIterator::~AbstractHierarchyIterator()
|
|||
/* release_writers() cannot be called here directly, as it calls into the pure-virtual
|
||||
* release_writer() function. By the time this destructor is called, the subclass that implements
|
||||
* that pure-virtual function is already destructed. */
|
||||
BLI_assert(writers_.empty() || !"release_writers() should be called before the AbstractHierarchyIterator goes out of scope");
|
||||
BLI_assert_msg(
|
||||
writers_.empty(),
|
||||
"release_writers() should be called before the AbstractHierarchyIterator goes out of scope");
|
||||
}
|
||||
|
||||
void AbstractHierarchyIterator::iterate_and_write()
|
||||
|
|
|
@ -265,7 +265,7 @@ void export_frame(Depsgraph *depsgraph, const OBJExportParams &export_params, co
|
|||
return;
|
||||
}
|
||||
if (!frame_writer) {
|
||||
BLI_assert(!"File should be writable by now.");
|
||||
BLI_assert_msg(false, "File should be writable by now.");
|
||||
return;
|
||||
}
|
||||
std::unique_ptr<MTLWriter> mtl_writer = nullptr;
|
||||
|
|
|
@ -779,8 +779,8 @@ bool rna_AnimaData_override_apply(Main *bmain, RNAPropertyOverrideApplyContext &
|
|||
IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
|
||||
|
||||
BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
|
||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_REPLACE &&
|
||||
"Unsupported RNA override operation on animdata pointer");
|
||||
BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_REPLACE,
|
||||
"Unsupported RNA override operation on animdata pointer");
|
||||
UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
|
||||
|
||||
/* AnimData is a special case, since you cannot edit/replace it, it's either existent or not.
|
||||
|
@ -841,8 +841,8 @@ bool rna_NLA_tracks_override_apply(Main *bmain, RNAPropertyOverrideApplyContext
|
|||
PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
|
||||
IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
|
||||
|
||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER &&
|
||||
"Unsupported RNA override operation on constraints collection");
|
||||
BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER,
|
||||
"Unsupported RNA override operation on constraints collection");
|
||||
|
||||
AnimData *anim_data_dst = (AnimData *)ptr_dst->data;
|
||||
AnimData *anim_data_src = (AnimData *)ptr_src->data;
|
||||
|
|
|
@ -173,8 +173,8 @@ static bool rna_Collection_objects_override_apply(Main *bmain,
|
|||
PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
|
||||
IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
|
||||
|
||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_REPLACE &&
|
||||
"Unsupported RNA override operation on collections' objects");
|
||||
BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_REPLACE,
|
||||
"Unsupported RNA override operation on collections' objects");
|
||||
UNUSED_VARS_NDEBUG(opop);
|
||||
|
||||
Collection *coll_dst = (Collection *)ptr_dst->owner_id;
|
||||
|
@ -301,8 +301,8 @@ static bool rna_Collection_children_override_apply(Main *bmain,
|
|||
PointerRNA *ptr_item_src = &rnaapply_ctx.ptr_item_src;
|
||||
IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
|
||||
|
||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_REPLACE &&
|
||||
"Unsupported RNA override operation on collections' children");
|
||||
BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_REPLACE,
|
||||
"Unsupported RNA override operation on collections' children");
|
||||
UNUSED_VARS_NDEBUG(opop);
|
||||
|
||||
Collection *coll_dst = (Collection *)ptr_dst->owner_id;
|
||||
|
|
|
@ -459,8 +459,8 @@ bool rna_PoseChannel_constraints_override_apply(Main *bmain,
|
|||
PropertyRNA *prop_dst = rnaapply_ctx.prop_dst;
|
||||
IDOverrideLibraryPropertyOperation *opop = rnaapply_ctx.liboverride_operation;
|
||||
|
||||
BLI_assert(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER &&
|
||||
"Unsupported RNA override operation on constraints collection");
|
||||
BLI_assert_msg(opop->operation == LIBOVERRIDE_OP_INSERT_AFTER,
|
||||
"Unsupported RNA override operation on constraints collection");
|
||||
|
||||
bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
|
||||
bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
|
||||
|
|
|
@ -1872,8 +1872,9 @@ static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
|
|||
BLI_strncpy(str, value, attr_maxncpy); /* utf8 already ensured */ \
|
||||
} \
|
||||
else { \
|
||||
BLI_assert( \
|
||||
!"setting the bl_" STRINGIFY(translation_context) " on a non-builtin operator"); \
|
||||
BLI_assert_msg( \
|
||||
false, \
|
||||
"setting the bl_" STRINGIFY(translation_context) " on a non-builtin operator"); \
|
||||
} \
|
||||
} \
|
||||
static void rna_Operator_bl_##attr##_get(PointerRNA *ptr, char *value) \
|
||||
|
|
|
@ -690,8 +690,8 @@ void SEQ_add_reload_new_file(Main *bmain, Scene *scene, Sequence *seq, const boo
|
|||
void SEQ_add_movie_reload_if_needed(
|
||||
Main *bmain, Scene *scene, Sequence *seq, bool *r_was_reloaded, bool *r_can_produce_frames)
|
||||
{
|
||||
BLI_assert(seq->type == SEQ_TYPE_MOVIE ||
|
||||
!"This function is only implemented for movie strips.");
|
||||
BLI_assert_msg(seq->type == SEQ_TYPE_MOVIE,
|
||||
"This function is only implemented for movie strips.");
|
||||
|
||||
bool must_reload = false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue