34#include "RNA_prototypes.hh"
40#include "opentimelineio/anyVector.h"
41#include "opentimelineio/deserialization.h"
42#include "opentimelineio/serialization.h"
56 "select_right_handle",
60 "right_handle_offset",
94 return std::string(
static_cast<ID *
>(ptr.
data)->
name + 2);
97 return std::string(
static_cast<Strip *
>(ptr.
data)->name + 2);
116 return AnyVector(values.
begin(), values.
end());
125 for (
const int value : values) {
126 vector.push_back(
int64_t(value));
137 for (
const float value : values) {
138 vector.push_back(
double(value));
145 const char *identifier;
151 return std::string(identifier);
161 if (value.has_value()) {
162 vector.push_back(value);
174 AnyDictionary dictionary;
180 if (value.has_value()) {
190 if (
const double *
number = std::any_cast<double>(&value)) {
193 if (
const int64_t *
number = std::any_cast<int64_t>(&value)) {
196 if (
const bool *
number = std::any_cast<bool>(&value)) {
202const std::any *
find(
const AnyDictionary &dictionary,
const std::string &key)
204 auto it = dictionary.find(key);
205 return it != dictionary.end() ? &it->second :
nullptr;
217 const bool is_array =
index >= 0;
239 const AnyVector &keyframes)
252 for (
const std::any &item : keyframes) {
253 const AnyVector *keyframe = std::any_cast<AnyVector>(&item);
254 if (!keyframe || keyframe->size() != 2) {
257 const std::optional<double> frame =
to_number((*keyframe)[0]);
258 const std::optional<double> value =
to_number((*keyframe)[1]);
259 if (frame && value) {
288 for (
const std::any &item : items) {
289 const AnyDictionary *dictionary = std::any_cast<AnyDictionary>(&item);
290 const std::string *type_name = dictionary && dictionary->has_key(
"type") ?
291 std::any_cast<std::string>(&dictionary->at(
"type")) :
310 MEM_SAFE_DELETE(curve_map->
curve);
311 curve_map->
curve = MEM_new_array<CurveMapPoint>(size, __func__);
317 for ([[maybe_unused]]
const int i :
IndexRange(size)) {
331 if (name ==
"clip_min_x") {
334 if (name ==
"clip_max_x") {
337 if (name ==
"clip_min_y") {
340 if (name ==
"clip_max_y") {
360 else if (
const AnyDictionary *animation = std::any_cast<AnyDictionary>(&value)) {
361 if (
const AnyVector *keyframes =
find<AnyVector>(*animation,
"keyframes")) {
365 else if (
const AnyVector *values = std::any_cast<AnyVector>(&value)) {
379 if (
const std::string *
string = std::any_cast<std::string>(&value)) {
384 const std::string *identifier = std::any_cast<std::string>(&value);
394 if (
const std::string *target_name = std::any_cast<std::string>(&value)) {
401 else if (
const AnyDictionary *dictionary = std::any_cast<AnyDictionary>(&value)) {
413 const AnyVector *items = std::any_cast<AnyVector>(&value);
424 if (i < items->size()) {
425 if (
const AnyDictionary *dictionary = std::any_cast<AnyDictionary>(&(*items)[i])) {
439 const AnyDictionary &dictionary,
442 for (
const auto &[key, value] : dictionary) {
459 if (!otio_metadata) {
468 deserialize_json_from_string(
IDP_string_get(prop), &value,
nullptr))
470 object.metadata()[prop->
name] = value;
477 for (
const auto &[key, value] :
object.
metadata()) {
478 if (key ==
"blender") {
485 if (!otio_metadata) {
Functions and classes to work with Actions.
Functions to work with AnimData.
Functions to modify FCurves.
#define IDP_string_get(prop)
ID and Library types, which are fundamental for SDNA.
Read Blender memory allocation and freeing.
#define RNA_STRUCT_BEGIN_SKIP_RNA_TYPE(sptr, prop)
#define RNA_PROP_BEGIN(sptr, itemptr, prop)
#define SOUND_EQUALIZER_DEFAULT_MAX_FREQ
#define SOUND_EQUALIZER_DEFAULT_MIN_FREQ
constexpr IndexRange()=default
bool contains(const Key &key) const
constexpr int64_t size() const
float length(VecOp< float, D >) RET
KeyframeSettings get_keyframe_settings(bool from_userprefs)
bAction * id_action_ensure(Main *bmain, ID *id)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
FCurve & action_fcurve_ensure(Main *bmain, bAction &action, ID &animated_id, const FCurveDescriptor &fcurve_descriptor)
std::unique_ptr< IDProperty, IDPropertyDeleter > create(StringRef prop_name, int32_t value, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_INT, set its name and value.
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
static void add_modifiers(Main *bmain, Editing *editing, PointerRNA &ptr, const AnyVector &items)
static std::any pointer_value(PointerRNA &ptr)
static PointerRNA find_by_name(Main *bmain, Editing *editing, PointerRNA &owner, StructRNA *type, const std::string &name)
AnyDictionary rna_to_dictionary(PointerRNA &ptr)
AnyVector hex_to_color(const std::string &hex)
static float * curve_mapping_clip(PointerRNA &ptr, const StringRef name)
static std::any property_value(PointerRNA &ptr, PropertyRNA *prop)
static void set_property(Main *bmain, Editing *editing, PointerRNA &ptr, PropertyRNA *prop, const std::any &value)
static void set_number(PointerRNA &ptr, PropertyRNA *prop, const int index, const double value)
std::optional< double > to_number(const std::any &value)
void store_foreign_metadata(const SerializableObjectWithMetadata &object, IDProperty *&properties)
static void insert_keyframes(Main *bmain, PointerRNA &ptr, PropertyRNA *prop, const AnyVector &keyframes)
void rna_from_dictionary(Main *bmain, Editing *editing, const AnyDictionary &dictionary, PointerRNA &ptr)
const std::any * find(const AnyDictionary &dictionary, const std::string &key)
static void resize_collection(PointerRNA &ptr, const StringRef name, const int size)
static bool skip_property(PointerRNA &ptr, PropertyRNA *prop)
void add_foreign_metadata(IDProperty *properties, SerializableObjectWithMetadata &object)
static std::optional< double > number(const std::any *value)
Strip * lookup_strip_by_name(Editing *ed, const char *key)
void modifier_persistent_uid_init(const Strip &strip, StripModifierData &smd)
void sound_equalizermodifier_free(StripModifierData *smd)
EQCurveMappingData * sound_equalizermodifier_add_graph(SoundEqualizerModifierData *semd, float min_freq, float max_freq)
StripModifierData * modifier_new(Strip *strip, const char *name, eStripModifierType type)
const EnumPropertyItem rna_enum_strip_modifier_type_items[]
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
void IDP_ReplaceInGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
ID * BKE_libblock_find_name(Main *bmain, short type, const char *name, const std::optional< Library * > lib=std::nullopt) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value, ReportList *reports)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
bool RNA_property_editable_flag(const PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **r_identifier)
PointerRNA RNA_id_pointer_create(ID *id)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
const char * RNA_property_identifier(const PropertyRNA *prop)
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
IDProperty * IDP_GetPropertyFromGroup(const IDProperty *prop, StringRef name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_foreach_property(IDProperty *id_property_root, int type_filter, FunctionRef< void(IDProperty *id_property)> callback)
short RNA_type_to_ID_code(const StructRNA *type)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PropertyType RNA_property_type(PropertyRNA *prop)
VecBase< float, 2 > float2
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
StructRNA * RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void BKE_curvemapping_changed_all(CurveMapping *cumap)
bool RNA_struct_is_ID(const StructRNA *type)
const DeprecatedRNA * RNA_property_deprecated(const PropertyRNA *prop)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
ViewLayer * BKE_view_layer_find(const Scene *scene, const char *layer_name)
void hex_to_rgb(const char *hexcol, float *r_r, float *r_g, float *r_b)
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
PointerRNA RNA_pointer_create_id_subdata(ID &id, StructRNA *type, void *data)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
VecBase< float, 3 > float3
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eBezTriple_Interpolation interpolation