2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
2022-02-09 16:21:21 +11:00
|
|
|
* Copyright 2001-2002 NaN Holding BV. All rights reserved.
|
|
|
|
|
* 2003-2009 Blender Foundation.
|
2022-02-11 09:07:11 +11:00
|
|
|
* 2005-2006 Peter Schlaile <peter [at] schlaile [dot] de> */
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_sequence_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_scene.h"
|
|
|
|
|
|
2020-12-19 06:44:57 +01:00
|
|
|
#include "SEQ_select.h"
|
2020-11-16 05:02:30 +01:00
|
|
|
#include "SEQ_sequencer.h"
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
Sequence *SEQ_select_active_get(Scene *scene)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
2021-09-02 11:29:32 +10:00
|
|
|
Editing *ed = SEQ_editing_get(scene);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
if (ed == NULL) {
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ed->act_seq;
|
|
|
|
|
}
|
|
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
void SEQ_select_active_set(Scene *scene, Sequence *seq)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
2021-09-02 11:29:32 +10:00
|
|
|
Editing *ed = SEQ_editing_get(scene);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
if (ed == NULL) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ed->act_seq = seq;
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-26 15:57:43 +10:00
|
|
|
bool SEQ_select_active_get_pair(Scene *scene, Sequence **r_seq_act, Sequence **r_seq_other)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
2021-09-02 11:29:32 +10:00
|
|
|
Editing *ed = SEQ_editing_get(scene);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
*r_seq_act = SEQ_select_active_get(scene);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
if (*r_seq_act == NULL) {
|
2022-08-26 15:57:43 +10:00
|
|
|
return false;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Sequence *seq;
|
|
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
*r_seq_other = NULL;
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
|
2021-02-05 22:34:03 +11:00
|
|
|
if (seq->flag & SELECT && (seq != (*r_seq_act))) {
|
|
|
|
|
if (*r_seq_other) {
|
2022-08-26 15:57:43 +10:00
|
|
|
return false;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
|
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
*r_seq_other = seq;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-02-05 22:34:03 +11:00
|
|
|
return (*r_seq_other != NULL);
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|