11#include <fmt/format.h>
23#include "RNA_prototypes.hh"
29#include "opentimelineio/anyVector.h"
30#include "opentimelineio/effect.h"
43 const std::any &value,
44 const std::string &variant_type)
46 AnyDictionary parameter;
47 parameter[
"Parameter ID"] =
id;
48 parameter[
"Parameter Value"] = value;
49 parameter[
"Variant Type"] = variant_type;
55 const AnyVector ¶meters,
56 const std::string &name =
"")
59 effect[
"Effect Name"] = effect_name;
60 effect[
"Enabled"] =
true;
61 effect[
"Name"] = name.empty() ? effect_name : name;
62 effect[
"Parameters"] = parameters;
63 effect[
"Type"] = type;
81 const std::string &
id,
88 AnyDictionary keyframes;
92 &ptr, prop, 0,
nullptr,
nullptr,
nullptr,
nullptr);
93 if (fcurve && fcurve->
bezt) {
95 AnyDictionary keyframe;
96 keyframe[
"Value"] =
convert(bezt.vec[1][1]);
97 keyframe[
"Variant Type"] = std::string(
"Double");
98 keyframes[std::to_string(
int(std::round(bezt.vec[1][0] - strip.left_handle())))] =
104 parameter[
"Key Frames"] = keyframes;
113 AnyVector parameters;
115 if (number.effect == effect) {
118 strip_ptr, strip, number.parameter, number.rna_path.c_str(), [&](
const double value) {
119 return value / scale;
129 const_cast<ID *
>(&scene.
id), RNA_Strip,
const_cast<Strip *
>(&strip));
138 const auto to_decibels = [](
const double gain) {
139 return std::max(20.0 * std::log10(gain), -100.0);
157 if (strip.
data && strip.
data->transform) {
162 "transformationAnchorPoint", AnyVector{double(anchor.x), double(anchor.y)},
"POINTF"));
163 parameters.push_back(
165 parameters.push_back(
169 if (strip.
data && strip.
data->crop) {
175 const char *blend_type =
"";
194 return fmt::format(
"#{:02x}{:02x}{:02x}",
color[0],
color[1],
color[2]);
199 std::string html = fmt::format(
200 "<span style=\"font-size:{}pt; color:{};\">",
data.text_size,
color_hex(
data.color));
221 AnyDictionary parameter;
222 parameter[
"Parameter ID"] = std::string(
"title blob");
223 parameter[
"Title HTML"] = html;
228 const TimeRange &available_range)
231 AnyDictionary effect;
234 kind =
"Solid Color";
248 "position", AnyVector{double(
data->loc[0]), double(
data->loc[1])},
"POINTF")});
255 AnyDictionary generator_metadata;
256 generator_metadata[
"Generator Type"] = kind;
257 metadata[
"Resolve_OTIO"] = generator_metadata;
258 AnyDictionary parameters;
259 parameters[
"Resolve_OTIO"] = AnyVector{effect};
260 return new GeneratorReference(strip.name + 2, kind, available_range, parameters,
metadata);
275 link_groups.
add(strip, link_group);
277 link_groups.
add(connected, link_group);
289 auto *otio_effect =
new otio::Effect(
"",
"Resolve Effect");
290 otio_effect->metadata()[
"Resolve_OTIO"] = effect;
291 clip.effects().push_back(otio_effect);
299 const Strip &transition,
300 Transition &otio_transition)
311 resolve[
"Transition Type"] = std::string(
"Edge Wipe");
321 resolve_metadata(timeline)[
"Resolve OTIO Meta Version"] = std::string(
"1.0");
const Value * lookup_ptr(const Key &key) const
bool add(const Key &key, const Value &value)
bool contains(const Key &key) const
const T & data(const Action &owning_action) const
float3x3 scale(float3x3 mat, float2 scale)
static std::string color_hex(const float rgb[3])
void resolve_add_clip_data(const Scene &scene, const Strip &strip, const Map< const Strip *, int64_t > &link_groups, Clip &clip)
static double rna_number(PointerRNA &ptr, PropertyRNA *prop)
static PointerRNA strip_pointer(const Scene &scene, const Strip &strip)
static AnyDictionary title_parameter(const TextVars &data)
AnyDictionary & ensure_dictionary(AnyDictionary &parent, const std::string &key)
GeneratorReference * resolve_generator_reference(const Strip &strip, const TimeRange &available_range)
Span< ResolveNumber > resolve_numbers()
static AnyDictionary resolve_effect(const std::string &effect_name, const int64_t type, const AnyVector ¶meters, const std::string &name="")
static AnyDictionary & resolve_metadata(SerializableObjectWithMetadata &object)
static AnyVector number_parameters(PointerRNA &strip_ptr, const Strip &strip, const ResolveUnits &units, const StringRef effect)
static AnyVector strip_effects(const Scene &scene, const Strip &strip)
void resolve_add_transition_data(const Scene &scene, const Strip &transition, Transition &otio_transition)
Map< const Strip *, int64_t > resolve_link_groups(const ListBaseT< Strip > &seqbase)
void resolve_add_track_data(const SeqTimelineChannel *channel, Track &track)
std::optional< int64_t > resolve_composite_mode(const StringRef blend_type)
static AnyDictionary resolve_parameter(const std::string &id, const std::any &value, const std::string &variant_type)
void resolve_add_timeline_metadata(Timeline &timeline)
static AnyDictionary number_parameter(PointerRNA &strip_ptr, const Strip &strip, const std::string &id, const char *rna_path, const FunctionRef< double(double)> convert)
bool is_strip_connected(const Strip *strip)
float2 image_transform_origin_get(const Scene *scene, const Strip *strip)
VectorSet< Strip * > query_all_strips_recursive(const ListBaseT< Strip > *seqbase)
VectorSet< Strip * > connected_strips_get(const Strip *strip)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
FCurve * BKE_fcurve_find_by_rna(PointerRNA *ptr, PropertyRNA *prop, int rnaindex, AnimData **r_adt, bAction **r_action, bool *r_driven, bool *r_special)
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
PropertyType RNA_property_type(PropertyRNA *prop)
VecBase< float, 2 > float2
BMesh const char void * data
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
ResolveUnits(const Scene &scene, const Strip &strip)
double to_blender(ResolveUnit unit) const
float2 anchor_to_origin() const