2023-05-31 16:19:06 +02:00
|
|
|
/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
|
2023-08-16 00:20:26 +10:00
|
|
|
* SPDX-FileCopyrightText: 2003-2009 Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
* SPDX-FileCopyrightText: 2005-2006 Peter Schlaile <peter [at] schlaile [dot] de>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2020-11-16 05:02:30 +01:00
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
|
* \ingroup bke
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
|
#include "DNA_sequence_types.h"
|
|
|
|
|
|
2023-11-02 01:05:06 +01:00
|
|
|
#include "SEQ_select.hh"
|
|
|
|
|
#include "SEQ_sequencer.hh"
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2020-12-19 05:57:27 +01:00
|
|
|
Sequence *SEQ_select_active_get(Scene *scene)
|
2020-11-16 05:02:30 +01:00
|
|
|
{
|
2023-07-07 16:00:50 +10:00
|
|
|
const Editing *ed = SEQ_editing_get(scene);
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
if (ed == nullptr) {
|
|
|
|
|
return nullptr;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
if (ed == nullptr) {
|
2020-11-16 05:02:30 +01:00
|
|
|
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
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
if (*r_seq_act == nullptr) {
|
2022-08-26 15:57:43 +10:00
|
|
|
return false;
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
*r_seq_other = nullptr;
|
2020-11-16 05:02:30 +01:00
|
|
|
|
2023-08-04 08:51:13 +10:00
|
|
|
LISTBASE_FOREACH (Sequence *, seq, ed->seqbasep) {
|
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
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-20 09:46:24 +02:00
|
|
|
return (*r_seq_other != nullptr);
|
2020-11-16 05:02:30 +01:00
|
|
|
}
|