Blender  V3.3
Classes | Macros | Typedefs | Functions | Variables
ipo.c File Reference
#include <math.h>
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#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.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_action.h"
#include "BKE_anim_data.h"
#include "BKE_fcurve.h"
#include "BKE_fcurve_driver.h"
#include "BKE_global.h"
#include "BKE_idtype.h"
#include "BKE_ipo.h"
#include "BKE_key.h"
#include "BKE_lib_id.h"
#include "BKE_main.h"
#include "BKE_nla.h"
#include "CLG_log.h"
#include "MEM_guardedalloc.h"
#include "SEQ_iterator.h"
#include "BLO_read_write.h"

Go to the source code of this file.

Classes

struct  AdrBit2Path
 
struct  Seq_callback_data
 

Macros

#define DNA_DEPRECATED_ALLOW
 
#define RET_ABP(items)
 

Typedefs

typedef struct AdrBit2Path AdrBit2Path
 
typedef struct Seq_callback_data Seq_callback_data
 

Functions

static void ipo_free_data (ID *id)
 
static void ipo_blend_read_data (BlendDataReader *reader, ID *id)
 
static void ipo_blend_read_lib (BlendLibReader *reader, ID *id)
 
static void ipo_blend_read_expand (BlendExpander *expander, ID *id)
 
static AdrBit2Pathadrcode_bitmaps_to_paths (int blocktype, int adrcode, int *tot)
 
static const char * ob_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * pchan_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * constraint_adrcodes_to_paths (int adrcode, int *array_index)
 
static char * shapekey_adrcodes_to_paths (ID *id, int adrcode, int *UNUSED(array_index))
 
static const char * mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
 
static const char * texture_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * material_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * camera_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * light_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * sound_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * world_adrcodes_to_paths (int adrcode, int *array_index)
 
static const char * particle_adrcodes_to_paths (int adrcode, int *array_index)
 
static char * get_rna_access (ID *id, int blocktype, int adrcode, char actname[], char constname[], Sequence *seq, int *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 22 of file ipo.c.

◆ RET_ABP

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

Definition at line 223 of file ipo.c.

Typedef Documentation

◆ AdrBit2Path

typedef struct AdrBit2Path AdrBit2Path

◆ Seq_callback_data

Function Documentation

◆ action_to_animato()

static void action_to_animato ( ID id,
bAction act,
ListBase groups,
ListBase curves,
ListBase drivers 
)
static

◆ action_to_animdata()

static void action_to_animdata ( ID id,
bAction act 
)
static

◆ adrcode_bitmaps_to_paths()

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

Definition at line 231 of file ipo.c.

References ID_OB, NULL, OB_LAY, ob_layer_bits, and RET_ABP.

Referenced by icu_to_fcurves().

◆ adrcode_to_dtar_transchan()

static short adrcode_to_dtar_transchan ( short  adrcode)
static

◆ camera_adrcodes_to_paths()

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

Definition at line 771 of file ipo.c.

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

Referenced by get_rna_access().

◆ constraint_adrcodes_to_paths()

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

Definition at line 420 of file ipo.c.

References CO_ENFORCE, CO_HEADTAIL, and NULL.

Referenced by get_rna_access().

◆ do_versions_ipos_to_animato()

void do_versions_ipos_to_animato ( struct Main main)

Called from do_versions() in readfile.c 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 2082 of file ipo.c.

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, bPoseChannel::constraints, Object::constraints, Ipo::curve, Main::curves, bAction::curves, Scene::ed, ListBase::first, ID::flag, G, G_DEBUG, bAction::groups, id, 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, Main::ipo, bConstraintChannel::ipo, ipo_to_animato(), ipo_to_animdata(), LIB_FAKEUSER, Main::lights, LOG, Main::materials, bConstraintChannel::name, bPoseChannel::name, bConstraint::name, ID::name, bPoseChannel::next, bConstraintChannel::next, bConstraint::next, ID::next, nlastrips_to_animdata(), NULL, Main::objects, Object::pose, 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 setup_app_data().

◆ fcurve_add_to_list()

static void fcurve_add_to_list ( ListBase groups,
ListBase list,
FCurve fcu,
char *  grpname,
int  muteipo 
)
static

◆ get_rna_access()

static char* get_rna_access ( ID id,
int  blocktype,
int  adrcode,
char  actname[],
char  constname[],
Sequence seq,
int *  array_index 
)
static

◆ 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 1406 of file ipo.c.

References AC_EUL_X, AC_EUL_Y, AC_EUL_Z, add_fmodifier(), IpoCurve::adrcode, adrcode_bitmaps_to_paths(), AdrBit2Path::array_index, FCurve::array_index, usdtokens::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, data, 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, ID_OB, ID_PO, idriver_to_cdriver(), if(), 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(), ID::name, NULL, OB_ROT_X, OB_ROT_Y, OB_ROT_Z, offset, AdrBit2Path::path, Curve::pathlen, FCurve::rna_path, SEQ_IPO_FRAME_LOCKED, src, Sequence::startdisp, STREQ, DriverVar::targets, FCurve::totvert, IpoCurve::totvert, DriverTarget::transChan, ChannelDriver::variables, and BezTriple::vec.

Referenced by ipo_to_animato().

◆ idriver_to_cdriver()

static ChannelDriver* idriver_to_cdriver ( IpoDriver idriver)
static

◆ ipo_blend_read_data()

static void ipo_blend_read_data ( BlendDataReader reader,
ID id 
)
static

◆ ipo_blend_read_expand()

static void ipo_blend_read_expand ( BlendExpander expander,
ID id 
)
static

Definition at line 152 of file ipo.c.

References BLO_expand, Ipo::curve, and LISTBASE_FOREACH.

◆ ipo_blend_read_lib()

static void ipo_blend_read_lib ( BlendLibReader reader,
ID id 
)
static

Definition at line 141 of file ipo.c.

References BLO_read_id_address, Ipo::curve, Ipo::id, ID::lib, and LISTBASE_FOREACH.

◆ ipo_free_data()

static void ipo_free_data ( ID id)
static

◆ ipo_to_animato()

static void ipo_to_animato ( ID id,
Ipo ipo,
char  actname[],
char  constname[],
Sequence seq,
ListBase animgroups,
ListBase anim,
ListBase drivers 
)
static

◆ ipo_to_animdata()

static void ipo_to_animdata ( Main bmain,
ID id,
Ipo ipo,
char  actname[],
char  constname[],
Sequence seq 
)
static

◆ light_adrcodes_to_paths()

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

◆ material_adrcodes_to_paths()

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

◆ mtex_adrcodes_to_paths()

static const char* mtex_adrcodes_to_paths ( int  adrcode,
int *  UNUSEDarray_index 
)
static

◆ nlastrips_to_animdata()

static void nlastrips_to_animdata ( ID id,
ListBase strips 
)
static

◆ ob_adrcodes_to_paths()

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

◆ particle_adrcodes_to_paths()

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

◆ pchan_adrcodes_to_paths()

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

◆ seq_convert_callback()

static bool seq_convert_callback ( Sequence seq,
void userdata 
)
static

◆ shapekey_adrcodes_to_paths()

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

Definition at line 441 of file ipo.c.

References BKE_keyblock_from_key(), BLI_snprintf(), BLI_str_escape(), BLI_strncpy(), and KeyBlock::name.

Referenced by get_rna_access().

◆ sound_adrcodes_to_paths()

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

Definition at line 861 of file ipo.c.

References NULL, 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 *  array_index 
)
static

◆ world_adrcodes_to_paths()

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

Variable Documentation

◆ IDType_ID_IP

IDTypeInfo IDType_ID_IP
Initial value:
= {
.id_code = ID_IP,
.id_filter = 0,
.main_listbase_index = INDEX_ID_IP,
.struct_size = sizeof(Ipo),
.name = "Ipo",
.name_plural = "ipos",
.translation_context = "",
.asset_type_info = NULL,
.copy_data = NULL,
.free_data = ipo_free_data,
.make_local = NULL,
.foreach_id = NULL,
.foreach_cache = NULL,
.foreach_path = NULL,
.owner_get = NULL,
.blend_write = NULL,
.blend_read_data = ipo_blend_read_data,
.blend_read_lib = ipo_blend_read_lib,
.blend_read_expand = ipo_blend_read_expand,
.blend_read_undo_preserve = NULL,
.lib_override_apply_post = NULL,
}
@ IDTYPE_FLAGS_NO_ANIMDATA
Definition: BKE_idtype.h:41
@ IDTYPE_FLAGS_NO_COPY
Definition: BKE_idtype.h:30
@ IDTYPE_FLAGS_NO_LIBLINKING
Definition: BKE_idtype.h:32
@ INDEX_ID_IP
Definition: DNA_ID.h:983
@ ID_IP
Definition: DNA_ID_enums.h:57
struct Ipo Ipo
static void init_data(ModifierData *md)
static void ipo_blend_read_data(BlendDataReader *reader, ID *id)
Definition: ipo.c:100
static void ipo_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: ipo.c:141
static void ipo_blend_read_expand(BlendExpander *expander, ID *id)
Definition: ipo.c:152
static void ipo_free_data(ID *id)
Definition: ipo.c:71

Definition at line 163 of file ipo.c.

◆ 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 210 of file ipo.c.

Referenced by adrcode_bitmaps_to_paths().