Blender V5.3
otio_import_kdenlive.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "opentimelineio/clip.h"
10
12#include "otio_metadata.hh"
13
14namespace blender::io::otio {
15
16std::optional<StripType> kdenlive_generator_type(const GeneratorReference &generator)
17{
18 if (generator.generator_kind() == "kdenlive:SolidColor") {
19 return STRIP_TYPE_COLOR;
20 }
21 return std::nullopt;
22}
23
24AnyDictionary kdenlive_strip_properties(SerializableObjectWithMetadata &object)
25{
26 AnyDictionary properties;
27 auto *clip = dynamic_cast<Clip *>(&object);
28 auto *generator = clip ? dynamic_cast<GeneratorReference *>(clip->media_reference()) : nullptr;
29 const AnyDictionary *kdenlive = generator ?
30 find<AnyDictionary>(generator->parameters(), "kdenlive") :
31 nullptr;
32 const std::string *color = kdenlive ? find<std::string>(*kdenlive, "color") : nullptr;
33 if (color && color->starts_with("0x")) {
34 properties["color"] = hex_to_color(color->substr(2));
35 }
36 return properties;
37}
38
39} // namespace blender::io::otio
std::optional< StripType > kdenlive_generator_type(const GeneratorReference &generator)
AnyVector hex_to_color(const std::string &hex)
AnyDictionary kdenlive_strip_properties(SerializableObjectWithMetadata &object)
const std::any * find(const AnyDictionary &dictionary, const std::string &key)