Blender V4.3
ipo.cc File Reference
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstring>
#include "DNA_anim_types.h"
#include "DNA_camera_types.h"
#include "DNA_constraint_types.h"
#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
#include "DNA_light_types.h"
#include "DNA_material_types.h"
#include "DNA_nla_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_sequence_types.h"
#include "DNA_world_types.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"
#include "BLI_endian_switch.h"
#include "BLI_string_utils.hh"
#include "BLI_utildefines.h"
#include "BLT_translation.hh"
#include "BKE_action.hh"
#include "BKE_anim_data.hh"
#include "BKE_fcurve.hh"
#include "BKE_fcurve_driver.h"
#include "BKE_global.hh"
#include "BKE_idtype.hh"
#include "BKE_ipo.h"
#include "BKE_key.hh"
#include "BKE_lib_id.hh"
#include "BKE_lib_query.hh"
#include "BKE_main.hh"
#include "BKE_nla.hh"
#include "ANIM_action.hh"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "SEQ_iterator.hh"
#include "BLO_read_write.hh"

Go to the source code of this file.

Classes

struct  AdrBit2Path
 
struct  Seq_callback_data
 

Macros

#define DNA_DEPRECATED_ALLOW
 
#define RET_ABP(items)
 

Functions

static void ipo_free_data (ID *id)
 
static void ipo_foreach_id (ID *id, LibraryForeachIDData *data)
 
static void ipo_blend_read_data (BlendDataReader *reader, ID *id)
 
static AdrBit2Pathadrcode_bitmaps_to_paths (int blocktype, int adrcode, int *tot)
 
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 const char * constraint_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static char * shapekey_adrcodes_to_paths (ID *id, int adrcode, int *)
 
static const char * mtex_adrcodes_to_paths (int adrcode, int *)
 
static const char * texture_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * material_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * camera_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * light_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * sound_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * world_adrcodes_to_paths (int adrcode, int *r_array_index)
 
static const char * particle_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[], Sequence *seq, int *r_array_index)
 
static short adrcode_to_dtar_transchan (short adrcode)
 
static ChannelDriveridriver_to_cdriver (IpoDriver *idriver)
 
static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
 
static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, Sequence *seq, int muteipo)
 
static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq, ListBase *animgroups, ListBase *anim, ListBase *drivers)
 
static void action_to_animato (ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
 
static void ipo_to_animdata (Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq)
 
static void action_to_animdata (ID *id, bAction *act)
 
static void nlastrips_to_animdata (ID *id, ListBase *strips)
 
static bool seq_convert_callback (Sequence *seq, void *userdata)
 
void do_versions_ipos_to_animato (Main *bmain)
 

Variables

static CLG_LogRef LOG = {"bke.ipo"}
 
IDTypeInfo IDType_ID_IP
 
static AdrBit2Path ob_layer_bits []
 

Macro Definition Documentation

◆ DNA_DEPRECATED_ALLOW

#define DNA_DEPRECATED_ALLOW

Definition at line 23 of file ipo.cc.

◆ RET_ABP

#define RET_ABP ( items)
Value:
{ \
*tot = ARRAY_SIZE(items); \
return items; \
} \
(void)0
#define ARRAY_SIZE(arr)

Definition at line 221 of file ipo.cc.

Referenced by adrcode_bitmaps_to_paths().

Function Documentation

◆ action_to_animato()

◆ action_to_animdata()

◆ adrcode_bitmaps_to_paths()

static AdrBit2Path * adrcode_bitmaps_to_paths ( int blocktype,
int adrcode,
int * tot )
static

Definition at line 229 of file ipo.cc.

References ID_OB, OB_LAY, ob_layer_bits, and RET_ABP.

Referenced by icu_to_fcurves().

◆ adrcode_to_dtar_transchan()

◆ camera_adrcodes_to_paths()

static const char * camera_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

Definition at line 769 of file ipo.cc.

References CAM_END, CAM_LENS, CAM_ORTHO, CAM_SHIFT_X, CAM_SHIFT_Y, CAM_STA, CAM_YF_APERT, and CAM_YF_FDIST.

Referenced by get_rna_access().

◆ constraint_adrcodes_to_paths()

static const char * constraint_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

Definition at line 418 of file ipo.cc.

References CO_ENFORCE, and CO_HEADTAIL.

Referenced by get_rna_access().

◆ do_versions_ipos_to_animato()

void do_versions_ipos_to_animato ( struct Main * bmain)

Called from do_versions() in readfile.cc to convert the old 'IPO/adrcode' system to the new 'Animato/RNA' system.

The basic method used here, is to loop over data-blocks which have IPO-data, and add those IPO's to new AnimData blocks as Actions. Action/NLA data only works well for Objects, so these only need to be checked for there.

Data that has been converted should be freed immediately, which means that it is immediately clear which data-blocks have yet to be converted, and also prevent freeing errors when we exit.

Note
Currently done after all file reading.

Definition at line 2091 of file ipo.cc.

References AnimData::action, action_to_animato(), action_to_animdata(), Main::actions, BKE_action_add(), BKE_animdata_ensure_id(), BKE_animdata_from_id(), BKE_fcurves_free(), BLI_freelinkN(), Ipo::blocktype, Main::cameras, bPose::chanbase, CLOG_ERROR, CLOG_WARN, Object::constraints, Ipo::curve, bAction::curves, Main::curves, ListBase::first, ID::flag, G, G_DEBUG, bAction::groups, Camera::id, Curve::id, Ipo::id, Key::id, Light::id, Material::id, Object::id, Tex::id, World::id, ID_OB, id_us_min(), bAction::idroot, bConstraintChannel::ipo, Main::ipo, ipo_to_animato(), ipo_to_animdata(), Main::lights, LISTBASE_FOREACH, LOG, Main::materials, bConstraintChannel::name, bConstraintChannel::next, nlastrips_to_animdata(), Main::objects, Object::pose, printf, scene, Main::scenes, seq_convert_callback(), SEQ_for_each_callback(), Editing::seqbase, Editing::seqbasep, Main::shapekeys, Main::textures, ID::us, Main::versionfile, and Main::worlds.

Referenced by do_versions_after_setup().

◆ fcurve_add_to_list()

◆ get_rna_access()

◆ icu_to_fcurves()

static void icu_to_fcurves ( ID * id,
ListBase * groups,
ListBase * list,
IpoCurve * icu,
char * actname,
char * constname,
Sequence * seq,
int muteipo )
static

Convert IPO-Curve to F-Curve (including Driver data), and free any of the old data that is not relevant, BUT do not free the IPO-Curve itself...

Parameters
actnamename of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to.
constnamename of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to seq.
seqsequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to.

Definition at line 1402 of file ipo.cc.

References AC_EUL_X, AC_EUL_Y, AC_EUL_Z, add_fmodifier(), IpoCurve::adrcode, adrcode_bitmaps_to_paths(), AdrBit2Path::array_index, FCurve::array_index, b, FCurve::bezt, IpoCurve::bezt, BEZT_IPO_CONST, BEZT_KEYTYPE_KEYFRAME, AdrBit2Path::bit, BKE_fcurve_copy(), BKE_fcurve_create(), BLI_strdup(), IpoCurve::blocktype, IpoCurve::bp, FModifier::data, FCurve::driver, IpoCurve::driver, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ, ELEM, Sequence::enddisp, FCurve::extend, IpoCurve::extrap, FCM_EXTRAPOLATE_CYCLIC, FCM_EXTRAPOLATE_CYCLIC_OFFSET, FCURVE_ACTIVE, fcurve_add_to_list(), FCURVE_DISABLED, FCURVE_DISCRETE_VALUES, FCURVE_INT_VALUES, FCURVE_MUTED, FCURVE_PROTECTED, FCURVE_SELECTED, FCURVE_VISIBLE, ListBase::first, FCurve::flag, IpoCurve::flag, Sequence::flag, float, FMODIFIER_TYPE_CYCLES, G, G_DEBUG, get_rna_access(), GS, BezTriple::h1, BezTriple::h2, HD_AUTO, HD_AUTO_ANIM, BezTriple::hide, ID_CU_LEGACY, ID_OB, ID_PO, idriver_to_cdriver(), BezTriple::ipo, IpoCurve::ipo, IPO_ACTIVE, IPO_AUTO_HORIZ, IPO_CYCL, IPO_CYCLX, IPO_DIR, IPO_HORIZ, IPO_MIXED, IPO_MUTE, IPO_PROTECT, IPO_SELECT, IPO_VISIBLE, M_PI, MEM_callocN, FCurve::modifiers, mul(), OB_ROT_X, OB_ROT_Y, OB_ROT_Z, AdrBit2Path::path, Curve::pathlen, printf, FCurve::rna_path, SEQ_IPO_FRAME_LOCKED, Sequence::startdisp, STREQ, DriverVar::targets, FCurve::totvert, IpoCurve::totvert, DriverTarget::transChan, ChannelDriver::variables, and BezTriple::vec.

Referenced by ipo_to_animato().

◆ idriver_to_cdriver()

◆ ipo_blend_read_data()

static void ipo_blend_read_data ( BlendDataReader * reader,
ID * id )
static

◆ ipo_foreach_id()

◆ ipo_free_data()

static void ipo_free_data ( ID * id)
static

◆ ipo_to_animato()

◆ ipo_to_animdata()

◆ light_adrcodes_to_paths()

static const char * light_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ material_adrcodes_to_paths()

static const char * material_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ mtex_adrcodes_to_paths()

◆ nlastrips_to_animdata()

◆ ob_adrcodes_to_paths()

static const char * ob_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ particle_adrcodes_to_paths()

static const char * particle_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ pchan_adrcodes_to_paths()

static const char * pchan_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ seq_convert_callback()

◆ shapekey_adrcodes_to_paths()

static char * shapekey_adrcodes_to_paths ( ID * id,
int adrcode,
int *  )
static

Definition at line 439 of file ipo.cc.

References BKE_keyblock_find_by_index(), BLI_str_escape(), KeyBlock::name, SNPRINTF, and STRNCPY.

Referenced by get_rna_access().

◆ sound_adrcodes_to_paths()

static const char * sound_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

Definition at line 859 of file ipo.cc.

References SND_ATTEN, SND_PANNING, SND_PITCH, and SND_VOLUME.

Referenced by get_rna_access().

◆ texture_adrcodes_to_paths()

static const char * texture_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

◆ world_adrcodes_to_paths()

static const char * world_adrcodes_to_paths ( int adrcode,
int * r_array_index )
static

Variable Documentation

◆ IDType_ID_IP

IDTypeInfo IDType_ID_IP
Initial value:
= {
0,
sizeof(Ipo),
"Ipo",
N_("ipos"),
"",
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
nullptr,
}
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition BKE_idtype.hh:41
@ IDTYPE_FLAGS_NO_COPY
Definition BKE_idtype.hh:30
@ IDTYPE_FLAGS_NO_LIBLINKING
Definition BKE_idtype.hh:32
@ INDEX_ID_IP
Definition DNA_ID.h:1251
#define FILTER_ID_IP
Definition DNA_ID.h:1204
@ ID_IP
struct Ipo Ipo
static void ipo_blend_read_data(BlendDataReader *reader, ID *id)
Definition ipo.cc:120
static void ipo_foreach_id(ID *id, LibraryForeachIDData *data)
Definition ipo.cc:106
static void ipo_free_data(ID *id)
Definition ipo.cc:77
#define N_(msgid)

Definition at line 161 of file ipo.cc.

◆ LOG

CLG_LogRef LOG = {"bke.ipo"}
static

◆ ob_layer_bits

AdrBit2Path ob_layer_bits[]
static
Initial value:
= {
{(1 << 0), "layers", 0}, {(1 << 1), "layers", 1}, {(1 << 2), "layers", 2},
{(1 << 3), "layers", 3}, {(1 << 4), "layers", 4}, {(1 << 5), "layers", 5},
{(1 << 6), "layers", 6}, {(1 << 7), "layers", 7}, {(1 << 8), "layers", 8},
{(1 << 9), "layers", 9}, {(1 << 10), "layers", 10}, {(1 << 11), "layers", 11},
{(1 << 12), "layers", 12}, {(1 << 13), "layers", 13}, {(1 << 14), "layers", 14},
{(1 << 15), "layers", 15}, {(1 << 16), "layers", 16}, {(1 << 17), "layers", 17},
{(1 << 18), "layers", 18}, {(1 << 19), "layers", 19},
}

Definition at line 208 of file ipo.cc.

Referenced by adrcode_bitmaps_to_paths().