File indexing completed on 2024-05-19 04:26:40

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Emmet O'Neill <emmetoneill.pdx@gmail.com>
0003  *  SPDX-FileCopyrightText: 2022 Eoin O'Neill <eoinoneill1991@gmail.com>
0004  *
0005  *  SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef _KIS_ANIM_AUTOKEY_H
0009 #define _KIS_ANIM_AUTOKEY_H
0010 
0011 #include "kritaimage_export.h"
0012 #include <QFlags>
0013 #include <QMetaType>
0014 
0015 template<class T>
0016 class KisSharedPtr;
0017 
0018 class KisPaintDevice;
0019 typedef KisSharedPtr<KisPaintDevice> KisPaintDeviceSP;
0020 
0021 class KUndo2Command;
0022 
0023 namespace KisAutoKey {
0024 enum Mode {
0025     NONE, // AutoKey is disabled. Keyframes must be created manually.
0026     BLANK, // AutoKey creates an empty/blank frame. Acts like DUPLICATE when not
0027            // applicable (i.e.: filters, transforms, etc.).
0028     DUPLICATE // AutoKey will duplicate the active frame.
0029 };
0030 
0031 KRITAIMAGE_EXPORT Mode activeMode();
0032 KRITAIMAGE_EXPORT void testingSetActiveMode(Mode mode);
0033 
0034 enum AutoCreateKeyframeFlag {
0035     None = 0x0,
0036     AllowBlankMode = 0x1,
0037     SupportsLod = 0x2
0038 };
0039 
0040 Q_DECLARE_FLAGS(AutoCreateKeyframeFlags, AutoCreateKeyframeFlag)
0041 
0042 /**
0043  * @brief create a new **duplicated** keyframe if auto-keyframe mode is on
0044  * @param device a paint device of the layer to be processed
0045  * @return an undo command if the keyframe has been duplicated
0046  */
0047 KRITAIMAGE_EXPORT
0048 KUndo2Command* tryAutoCreateDuplicatedFrame(KisPaintDeviceSP device, AutoCreateKeyframeFlags flags = None);
0049 
0050 }
0051 
0052 Q_DECLARE_OPERATORS_FOR_FLAGS(KisAutoKey::AutoCreateKeyframeFlags)
0053 Q_DECLARE_METATYPE(KisAutoKey::Mode)
0054 
0055 #endif //_KIS_ANIM_AUTOKEY_H