Cleanup: Reduce use and scope of templates in vertex paint #2

Closed
Hans Goudey wants to merge 10 commits from paint-vertex-fewer-templates into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
7 changed files with 785 additions and 738 deletions
Showing only changes of commit 779a808174 - Show all commits

View File

@ -1023,7 +1023,7 @@ static void ccgDM_release(DerivedMesh *dm)
if (ccgdm->multires.modified_flags) { if (ccgdm->multires.modified_flags) {
/* Check that mmd still exists */ /* Check that mmd still exists */
if (!ccgdm->multires.local_mmd && if (!ccgdm->multires.local_mmd &&
BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) < 0) BLI_findindex(&ccgdm->multires.ob->modifiers, ccgdm->multires.mmd) == -1)
{ {
ccgdm->multires.mmd = nullptr; ccgdm->multires.mmd = nullptr;
} }

File diff suppressed because it is too large Load Diff

View File

@ -658,7 +658,7 @@ static void rna_ArmatureConstraint_target_remove(
bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data); bArmatureConstraint *acon = static_cast<bArmatureConstraint *>(con->data);
bConstraintTarget *tgt = static_cast<bConstraintTarget *>(target_ptr->data); bConstraintTarget *tgt = static_cast<bConstraintTarget *>(target_ptr->data);
if (BLI_findindex(&acon->targets, tgt) < 0) { if (BLI_findindex(&acon->targets, tgt) == -1) {
BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list"); BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
return; return;
} }

View File

@ -1474,8 +1474,9 @@ static Sequence *rna_SeqTimelineChannel_owner_get(Editing *ed, SeqTimelineChanne
if (seq->type != SEQ_TYPE_META) { if (seq->type != SEQ_TYPE_META) {
continue; continue;
} }
if (BLI_findindex(&seq->channels, channel) >= 0) { if (BLI_findindex(&seq->channels, channel) != -1) {
channel_owner = seq; channel_owner = seq;
break;
} }
} }

View File

@ -280,7 +280,8 @@ int seq_get_shown_sequences(const Scene *scene,
scene, channels, seqbase, timeline_frame, chanshown); scene, channels, seqbase, timeline_frame, chanshown);
const int strip_count = BLI_gset_len(collection->set); const int strip_count = BLI_gset_len(collection->set);
if (strip_count > MAXSEQ) { if (UNLIKELY(strip_count > MAXSEQ)) {
SEQ_collection_free(collection);
BLI_assert_msg(0, "Too many strips, this shouldn't happen"); BLI_assert_msg(0, "Too many strips, this shouldn't happen");
return 0; return 0;
} }
@ -1878,7 +1879,7 @@ static ImBuf *seq_render_strip_stack(const SeqRenderData *context,
ImBuf *out = NULL; ImBuf *out = NULL;
count = seq_get_shown_sequences( count = seq_get_shown_sequences(
context->scene, channels, seqbasep, timeline_frame, chanshown, (Sequence **)&seq_arr); context->scene, channels, seqbasep, timeline_frame, chanshown, seq_arr);
if (count == 0) { if (count == 0) {
return NULL; return NULL;

View File

@ -377,7 +377,7 @@ ListBase *SEQ_get_seqbase_by_seq(const Scene *scene, Sequence *seq)
if (seq_meta != NULL) { if (seq_meta != NULL) {
return &seq_meta->seqbase; return &seq_meta->seqbase;
} }
if (BLI_findindex(main_seqbase, seq) >= 0) { if (BLI_findindex(main_seqbase, seq) != -1) {
return main_seqbase; return main_seqbase;
} }
return NULL; return NULL;

View File

@ -1950,7 +1950,7 @@ void wm_window_delete_removed_timers(wmWindowManager *wm)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer) void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
{ {
/* Extra security check. */ /* Extra security check. */
if (BLI_findindex(&wm->timers, timer) < 0) { if (BLI_findindex(&wm->timers, timer) == -1) {
return; return;
} }