23#define DNA_DEPRECATED_ALLOW
105 printf(
"Freed %d (Unconverted) Ipo-Curves from IPO '%s'\n", n, ipo->
id.
name + 2);
111 Ipo *ipo =
reinterpret_cast<Ipo *
>(id);
137 if (icu->driver !=
nullptr) {
142 if (icu->driver !=
nullptr) {
151 if (icu->driver !=
nullptr) {
212 {(1 << 0),
"layers", 0}, {(1 << 1),
"layers", 1}, {(1 << 2),
"layers", 2},
213 {(1 << 3),
"layers", 3}, {(1 << 4),
"layers", 4}, {(1 << 5),
"layers", 5},
214 {(1 << 6),
"layers", 6}, {(1 << 7),
"layers", 7}, {(1 << 8),
"layers", 8},
215 {(1 << 9),
"layers", 9}, {(1 << 10),
"layers", 10}, {(1 << 11),
"layers", 11},
216 {(1 << 12),
"layers", 12}, {(1 << 13),
"layers", 13}, {(1 << 14),
"layers", 14},
217 {(1 << 15),
"layers", 15}, {(1 << 16),
"layers", 16}, {(1 << 17),
"layers", 17},
218 {(1 << 18),
"layers", 18}, {(1 << 19),
"layers", 19},
224#define RET_ABP(items) \
226 *tot = ARRAY_SIZE(items); \
267 return "delta_location";
270 return "delta_location";
273 return "delta_location";
277 return "rotation_euler";
280 return "rotation_euler";
283 return "rotation_euler";
286 return "delta_rotation_euler";
289 return "delta_rotation_euler";
292 return "delta_rotation_euler";
305 return "delta_scale";
308 return "delta_scale";
311 return "delta_scale";
327 poin = &(ob->pd->f_strength);
332 poin = &(ob->pd->f_power);
337 poin = &(ob->pd->pdef_damp);
342 poin = &(ob->pd->pdef_rdamp);
347 poin = &(ob->pd->pdef_perm);
352 poin = &(ob->pd->maxdist);
373 return "rotation_quaternion";
376 return "rotation_quaternion";
379 return "rotation_quaternion";
382 return "rotation_quaternion";
386 return "rotation_euler";
389 return "rotation_euler";
392 return "rotation_euler";
416 CLOG_ERROR(&
LOG,
"unmatched PoseChannel setting (code %d)", adrcode);
432 return "data.head_tail";
444 static char buf[128];
459 char kb_name_esc[
sizeof(kb->
name) * 2];
461 SNPRINTF(buf,
"key_blocks[\"%s\"].value", kb_name_esc);
465 SNPRINTF(buf,
"key_blocks[%d].value", adrcode);
474 const char *base =
nullptr, *prop =
nullptr;
475 static char buf[128];
479 base =
"textures[0]";
482 base =
"textures[1]";
485 base =
"textures[2]";
488 base =
"textures[3]";
491 base =
"textures[4]";
494 base =
"textures[5]";
497 base =
"textures[6]";
500 base =
"textures[7]";
503 base =
"textures[8]";
506 base =
"textures[9]";
509 base =
"textures[10]";
512 base =
"textures[11]";
515 base =
"textures[12]";
518 base =
"textures[13]";
521 base =
"textures[14]";
524 base =
"textures[15]";
527 base =
"textures[16]";
530 base =
"textures[17]";
534 adrcode = (adrcode & (
MA_MAP1 - 1));
538 poin = &(mtex->ofs[0]);
541 poin = &(mtex->ofs[1]);
544 poin = &(mtex->ofs[2]);
547 poin = &(mtex->size[0]);
550 poin = &(mtex->size[1]);
553 poin = &(mtex->size[2]);
565 poin = &(mtex->def_var);
568 poin = &(mtex->colfac);
571 poin = &(mtex->norfac);
574 poin = &(mtex->varfac);
578 prop =
"warp_factor";
612 return "noise_basis";
614 return "noise_basis";
619 return "feature_weights";
622 return "feature_weights";
625 return "feature_weights";
628 return "feature_weights";
630 return "minkovsky_exponent";
632 return "distance_metric";
638 return "noise_intensity";
642 return "distortion_amount";
649 return "highest_dimension";
688 return "diffuse_color";
691 return "diffuse_color";
694 return "diffuse_color";
698 return "specular_color";
701 return "specular_color";
704 return "specular_color";
708 return "mirror_color";
711 return "mirror_color";
714 return "mirror_color";
720 return "diffuse_intensity";
729 return "specular_intensity";
732 return "specular_hardness";
735 return "specular_opacity";
744 return "translucency";
747 return "raytrace_mirror.reflect";
750 return "raytrace_mirror.fresnel";
753 return "raytrace_mirror.fresnel_factor";
756 return "raytrace_transparency.fresnel";
759 return "raytrace_transparency.fresnel_factor";
783 return "ortho_scale";
799 poin = &(ca->YF_aperture);
802 poin = &(ca->dof_distance);
846 return "linear_attenuation";
848 return "quadratic_attenuation";
851 return "halo_intensity";
880 return "attenuation";
897 return "horizon_color";
900 return "horizon_color";
903 return "horizon_color";
906 return "zenith_color";
909 return "zenith_color";
912 return "zenith_color";
918 return "mist.intensity";
924 return "mist.height";
942 return "settings.clump_factor";
944 return "settings.angular_velocity_factor";
946 return "settings.particle_size";
948 return "settings.drag_factor";
950 return "settings.brownian_factor";
952 return "settings.damp_factor";
954 return "settings.length";
957 return "settings.acceleration";
960 return "settings.acceleration";
963 return "settings.acceleration";
965 return "settings.kink_amplitude";
967 return "settings.kink_frequency";
969 return "settings.kink_shape";
971 return "settings.billboard_tilt";
981 poin = &(part->pd->f_strength);
986 poin = &(part->pd->f_power);
991 poin = &(part->pd->maxdist);
996 poin = &(part->pd2->f_strength);
1001 poin = &(part->pd2->f_power);
1006 poin = &(part->pd2->maxdist);
1032 const char actname[],
1033 const char constname[],
1038 const char *propname =
nullptr;
1039 char *rpath =
nullptr;
1041 int dummy_index = 0;
1049 switch (blocktype) {
1098 propname =
"eval_time";
1106 propname =
"effect_fader";
1109 propname =
"speed_fader";
1112 propname =
"blend_alpha";
1126 CLOG_WARN(&
LOG,
"No path for blocktype %d, adrcode %d yet", blocktype, adrcode);
1134 if ((propname ==
nullptr) && (blocktype > 0)) {
1136 if (r_array_index) {
1145 if (r_array_index) {
1146 *r_array_index = dummy_index;
1152 if ((actname && actname[0]) && (constname && constname[0])) {
1158 SNPRINTF(buf,
"pose.bones[\"%s\"].constraints[\"%s\"]", actname_esc, constname_esc);
1160 else if (actname && actname[0]) {
1161 if ((blocktype ==
ID_OB) &&
STREQ(actname,
"Object")) {
1165 else if ((blocktype ==
ID_KE) &&
STREQ(actname,
"Shape")) {
1168 STRNCPY(buf,
"data.shape_keys");
1174 SNPRINTF(buf,
"pose.bones[\"%s\"]", actname_esc);
1177 else if (constname && constname[0]) {
1181 SNPRINTF(buf,
"constraints[\"%s\"]", constname_esc);
1185 char strip_name_esc[(
sizeof(strip->
name) - 2) * 2];
1187 SNPRINTF(buf,
"sequence_editor.sequences_all[\"%s\"]", strip_name_esc);
1204 if (r_array_index ==
nullptr) {
1205 SNPRINTF(buf,
"[\"%d\"]", dummy_index);
1263 if (idriver->
name[0]) {
1283 dtar->
id = (
ID *)idriver->
ob;
1285 if (idriver->
name[0]) {
1291 dtar->
id = (
ID *)idriver->
ob;
1293 if (idriver->
name[0]) {
1304 dtar->
id = (
ID *)idriver->
ob;
1306 if (idriver->
name[0]) {
1320 dtar->
id = (
ID *)idriver->
ob;
1337 if (groups && grpname) {
1354 if (agrp ==
nullptr) {
1371 sizeof(agrp->
name));
1478 if (abp && totbits) {
1483 printf(
"\tconvert bitflag ipocurve, totbits = %d\n", totbits);
1495 for (
b = 0;
b < totbits;
b++, abp++) {
1499 if (
b < (totbits - 1)) {
1546 if (
int(dst->
vec[1][1]) & (abp->
bit)) {
1547 dst->
vec[0][1] = dst->
vec[1][1] = dst->
vec[2][1] = 1.0f;
1550 dst->
vec[0][1] = dst->
vec[1][1] = dst->
vec[2][1] = 0.0f;
1620 const float fac = float(
M_PI) / 18.0f;
1622 dst->
vec[0][1] *= fac;
1623 dst->
vec[1][1] *= fac;
1624 dst->
vec[2][1] *= fac;
1652 const float fac = float(
M_PI) / 18.0f;
1654 dst->
vec[0][0] *= fac;
1655 dst->
vec[1][0] *= fac;
1656 dst->
vec[2][0] *= fac;
1666 dst->
vec[0][0] += offset;
1669 dst->
vec[1][0] += offset;
1672 dst->
vec[2][0] += offset;
1720 if (
ELEM(
nullptr, ipo, anim, drivers)) {
1725 printf(
"ipo_to_animato\n");
1810 BLI_assert_msg(is_pre_animato_action,
"Action is not pre-Animato.");
1811 if (!is_pre_animato_action) {
1825 ipo_to_animato(
id, achan->ipo, achan->name,
nullptr,
nullptr, groups, curves, drivers);
1827 achan->ipo =
nullptr;
1835 id, conchan->ipo, achan->name, conchan->name,
nullptr, groups, curves, drivers);
1837 conchan->ipo =
nullptr;
1875 if (is_pre_animato_action) {
1895 Main *bmain,
ID *
id,
Ipo *ipo,
char actname[],
char constname[],
Strip *strip)
1898 ListBase anim = {
nullptr,
nullptr};
1899 ListBase drivers = {
nullptr,
nullptr};
1902 if (
ELEM(
nullptr,
id, ipo)) {
1905 if (adt ==
nullptr) {
1911 printf(
"ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s stripname:%s curves:%d\n",
1914 (actname) ? actname :
"<None>",
1915 (constname) ? constname :
"<None>",
1916 (strip) ? (strip->
name + 2) :
"<None>",
1924 ipo_to_animato(
id, ipo, actname, constname, strip,
nullptr, &anim, &drivers);
1932 if (adt->
action ==
nullptr) {
1940 BLI_assert_msg(assign_ok,
"Expecting the assignment of a new Action to always work");
1944 printf(
"\t\tadded new action - '%s'\n", nameBuf);
1957 if (drivers.
first) {
1959 printf(
"\thas drivers\n");
1974 if (
ELEM(
nullptr, adt, act->chanbase.first)) {
1979 if (adt->
action ==
nullptr) {
1982 printf(
"act_to_adt - set adt action to act\n");
1985 BLI_assert_msg(assign_ok,
"Expecting the assignment of a just-converted Action to work");
2103 IpoCurve *icu =
static_cast<IpoCurve *
>((strip->ipo) ? strip->ipo->curve.first :
nullptr);
2107 printf(
"\tconverting sequence strip %s\n", strip->
name + 2);
2110 if (
ELEM(
nullptr, strip->ipo, icu)) {
2116 switch (strip->
type) {
2140 strip->ipo =
nullptr;
2151 ListBase drivers = {
nullptr,
nullptr};
2154 if (bmain ==
nullptr) {
2171 bool shown_info =
false;
2177 if (!is_pre_animato_action) {
2183 printf(
"INFO: Converting IPO Action to modern animation data types...\n");
2187 printf(
"\tconverting action %s\n", id->
name + 2);
2199 printf(
"INFO: Converting IPO to modern animation data types...\n");
2210 printf(
"\tconverting ob %s\n", id->
name + 2);
2214 if (ob->nlastrips.first) {
2230 ob->action =
nullptr;
2236 else if ((ob->ipo) || (ob->action)) {
2244 ob->action =
nullptr;
2299 if (ob->constraintChannels.first) {
2300 for (conchan =
static_cast<bConstraintChannel *
>(ob->constraintChannels.first); conchan;
2304 conchann = conchan->
next;
2313 conchan->
ipo =
nullptr;
2324 if (adt && adt->
action && !action_is_layered(*adt->
action)) {
2335 printf(
"\tconverting key %s\n", id->
name + 2);
2363 printf(
"\tconverting material %s\n", id->
name + 2);
2388 printf(
"\tconverting world %s\n", id->
name + 2);
2412 if (
ed &&
ed->seqbasep) {
2423 printf(
"\tconverting texture %s\n", id->
name + 2);
2448 printf(
"\tconverting camera %s\n", id->
name + 2);
2473 printf(
"\tconverting light %s\n", id->
name + 2);
2498 printf(
"\tconverting curve %s\n", id->
name + 2);
2534 printf(
"\tconverting action %s\n", id->
name + 2);
2538 if (act->chanbase.first) {
2547 for (
id =
static_cast<ID *
>(bmain->
ipo.
first);
id;
id =
static_cast<ID *
>(id->
next)) {
2551 printf(
"\tconverting ipo %s\n", id->
name + 2);
2577 printf(
"INFO: Animato convert done\n");
Functions and classes to work with Actions.
Versioning of old animation data. Most animation versioning code lives in the versioning_xxx....
Blender kernel action and pose functionality.
void action_groups_add_channel(bAction *act, bActionGroup *agrp, FCurve *fcurve)
bAction * BKE_action_add(Main *bmain, const char name[])
bActionGroup * BKE_action_group_find_name(bAction *act, const char name[])
AnimData * BKE_animdata_ensure_id(ID *id)
AnimData * BKE_animdata_from_id(const ID *id)
FCurve * BKE_fcurve_copy(const FCurve *fcu)
FCurve * BKE_fcurve_create()
FModifier * add_fmodifier(ListBase *modifiers, int type, FCurve *owner_fcu)
void BKE_fcurves_free(ListBase *list)
struct DriverVar * driver_add_new_variable(struct ChannelDriver *driver)
void driver_change_variable_type(struct DriverVar *dvar, int type)
@ IDTYPE_FLAGS_NO_ANIMDATA
@ IDTYPE_FLAGS_NO_LIBLINKING
KeyBlock * BKE_keyblock_find_by_index(Key *key, int index)
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(data_, id_super_, cb_flag_)
LibraryForeachIDFlag BKE_lib_query_foreachid_process_flags_get(const LibraryForeachIDData *data)
@ IDWALK_DO_DEPRECATED_POINTERS
bool BKE_nlatrack_add_strip(NlaTrack *nlt, NlaStrip *strip, bool is_liboverride)
void BKE_nlatrack_set_active(ListBase *tracks, NlaTrack *nlt)
NlaTrack * BKE_nlatrack_new_tail(ListBase *nla_tracks, const bool is_liboverride)
void BKE_nlastrip_validate_name(AnimData *adt, NlaStrip *strip)
#define BLI_assert_msg(a, msg)
A dynamically sized string ADT.
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
void BLI_dynstr_append(DynStr *__restrict ds, const char *cstr) ATTR_NONNULL()
BLI_INLINE void BLI_endian_switch_int16(short *val) ATTR_NONNULL(1)
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define SNPRINTF(dst, format,...)
char * STRNCPY(char(&dst)[N], const char *src)
size_t BLI_str_escape(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
void BLI_uniquename(const struct ListBase *list, void *vlink, const char *defname, char delim, int name_offset, size_t name_maxncpy) ATTR_NONNULL(1
#define UNUSED_VARS_NDEBUG(...)
bool BLO_read_requires_endian_switch(BlendDataReader *reader)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_read_struct_array(reader, struct_name, array_size, ptr_p)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
@ NLASTRIP_FLAG_AUTO_BLENDS
@ NLASTRIP_FLAG_SYNC_LENGTH
@ FCM_EXTRAPOLATE_CYCLIC_OFFSET
@ DVAR_TYPE_TRANSFORM_CHAN
@ NLASTRIP_EXTEND_NOTHING
#define IPO_DRIVER_TYPE_PYTHON
#define STRIP_FAC_OPACITY
Object is a sort of wrapper for general info.
@ SEQ_USE_EFFECT_DEFAULT_FADE
Read Guarded memory(de)allocation.
BMesh const char void * data
static void mul(btAlignedObjectArray< T > &items, const Q &value)
#define ID_REAL_USERS(id)
static const char * texture_adrcodes_to_paths(int adrcode, int *r_array_index)
static char * shapekey_adrcodes_to_paths(ID *id, int adrcode, int *)
static const char * material_adrcodes_to_paths(int adrcode, int *r_array_index)
static AdrBit2Path ob_layer_bits[]
static void ipo_blend_read_data(BlendDataReader *reader, ID *id)
static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Strip *strip)
static void ipo_foreach_id(ID *id, LibraryForeachIDData *data)
static void nlastrips_to_animdata(ID *id, ListBase *strips)
static const char * world_adrcodes_to_paths(int adrcode, int *r_array_index)
static const char * camera_adrcodes_to_paths(int adrcode, int *r_array_index)
static void action_to_animdata(ID *id, bAction *act)
static const char * ob_adrcodes_to_paths(int adrcode, int *r_array_index)
static const char * pchan_adrcodes_to_paths(int adrcode, int *r_array_index)
static bool strip_convert_callback(Strip *strip, void *userdata)
static const char * sound_adrcodes_to_paths(int adrcode, int *r_array_index)
static char * get_rna_access(ID *id, int blocktype, int adrcode, const char actname[], const char constname[], Strip *strip, int *r_array_index)
static void convert_pre_animato_action_to_animato_action_in_place(ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
static const char * light_adrcodes_to_paths(int adrcode, int *r_array_index)
static void ensure_action_is_layered(ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
static AdrBit2Path * adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *tot)
static const char * constraint_adrcodes_to_paths(int adrcode, int *r_array_index)
static void icu_to_fcurves(ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, Strip *strip, int muteipo)
static void ipo_to_animato(ID *id, Ipo *ipo, char actname[], char constname[], Strip *strip, ListBase *animgroups, ListBase *anim, ListBase *drivers)
static short adrcode_to_dtar_transchan(short adrcode)
static const char * particle_adrcodes_to_paths(int adrcode, int *r_array_index)
static void fcurve_add_to_list(ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
static const char * mtex_adrcodes_to_paths(int adrcode, int *)
static void ipo_free_data(ID *id)
static ChannelDriver * idriver_to_cdriver(IpoDriver *idriver)
void do_versions_ipos_to_layered_actions(Main *bmain)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void convert_legacy_animato_action(bAction &dna_action)
void tag_action_user_for_slotted_actions_conversion(ID &animated_id)
bool action_is_layered(const bAction &dna_action)
bool assign_action(bAction *action, ID &animated_id)
void for_each_callback(ListBase *seqbase, ForEachFunc callback, void *user_data)
struct bActionStrip * next
struct bConstraintChannel * next