Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/ipo.c
| Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | |||||
| #include "BKE_fcurve.h" | #include "BKE_fcurve.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "CLG_log.h" | |||||
| #include "MEM_guardedalloc.h" | #include "MEM_guardedalloc.h" | ||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| # include "BLI_math_base.h" /* M_PI */ | # include "BLI_math_base.h" /* M_PI */ | ||||
| #endif | #endif | ||||
| static CLG_LogRef LOG = {"bke.ipo"}; | |||||
| /* *************************************************** */ | /* *************************************************** */ | ||||
| /* Old-Data Freeing Tools */ | /* Old-Data Freeing Tools */ | ||||
| /* Free data from old IPO-Blocks (those which haven't been converted), but not IPO block itself */ | /* Free data from old IPO-Blocks (those which haven't been converted), but not IPO block itself */ | ||||
| // XXX this shouldn't be necessary anymore, but may occur while not all data is converted yet | // XXX this shouldn't be necessary anymore, but may occur while not all data is converted yet | ||||
| void BKE_ipo_free(Ipo *ipo) | void BKE_ipo_free(Ipo *ipo) | ||||
| { | { | ||||
| IpoCurve *icu, *icn; | IpoCurve *icu, *icn; | ||||
| ▲ Show 20 Lines • Show All 193 Lines • ▼ Show 20 Lines | case AC_SIZE_X: | ||||
| *array_index = 0; return "scale"; | *array_index = 0; return "scale"; | ||||
| case AC_SIZE_Y: | case AC_SIZE_Y: | ||||
| *array_index = 1; return "scale"; | *array_index = 1; return "scale"; | ||||
| case AC_SIZE_Z: | case AC_SIZE_Z: | ||||
| *array_index = 2; return "scale"; | *array_index = 2; return "scale"; | ||||
| } | } | ||||
| /* for debugging only */ | /* for debugging only */ | ||||
| printf("ERROR: unmatched PoseChannel setting (code %d)\n", adrcode); | CLOG_ERROR(&LOG, "unmatched PoseChannel setting (code %d)", adrcode); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* Constraint types */ | /* Constraint types */ | ||||
| static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index) | static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index) | ||||
| { | { | ||||
| /* set array index like this in-case nothing sets it correctly */ | /* set array index like this in-case nothing sets it correctly */ | ||||
| *array_index = 0; | *array_index = 0; | ||||
| ▲ Show 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | switch (blocktype) { | ||||
| /* special hacks */ | /* special hacks */ | ||||
| case -1: | case -1: | ||||
| /* special case for rotdiff drivers... we don't need a property for this... */ | /* special case for rotdiff drivers... we don't need a property for this... */ | ||||
| break; | break; | ||||
| /* TODO... add other blocktypes... */ | /* TODO... add other blocktypes... */ | ||||
| default: | default: | ||||
| printf("IPO2ANIMATO WARNING: No path for blocktype %d, adrcode %d yet\n", blocktype, adrcode); | CLOG_WARN(&LOG, "No path for blocktype %d, adrcode %d yet", blocktype, adrcode); | ||||
| break; | break; | ||||
| } | } | ||||
| /* check if any property found | /* check if any property found | ||||
| * - blocktype < 0 is special case for a specific type of driver, where we don't need a property name... | * - blocktype < 0 is special case for a specific type of driver, where we don't need a property name... | ||||
| */ | */ | ||||
| if ((propname == NULL) && (blocktype > 0)) { | if ((propname == NULL) && (blocktype > 0)) { | ||||
| /* nothing was found, so exit */ | /* nothing was found, so exit */ | ||||
| ▲ Show 20 Lines • Show All 609 Lines • ▼ Show 20 Lines | static void ipo_to_animdata(Main *bmain, ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq) | ||||
| AnimData *adt = BKE_animdata_from_id(id); | AnimData *adt = BKE_animdata_from_id(id); | ||||
| ListBase anim = {NULL, NULL}; | ListBase anim = {NULL, NULL}; | ||||
| ListBase drivers = {NULL, NULL}; | ListBase drivers = {NULL, NULL}; | ||||
| /* sanity check */ | /* sanity check */ | ||||
| if (ELEM(NULL, id, ipo)) | if (ELEM(NULL, id, ipo)) | ||||
| return; | return; | ||||
| if (adt == NULL) { | if (adt == NULL) { | ||||
| printf("ERROR ipo_to_animdata(): adt invalid\n"); | CLOG_ERROR(&LOG, "adt invalid"); | ||||
| return; | return; | ||||
| } | } | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n", | printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s curves:%d\n", | ||||
| id->name + 2, ipo->id.name + 2, (actname) ? actname : "<None>", (constname) ? constname : "<None>", (seq) ? (seq->name + 2) : "<None>", | id->name + 2, ipo->id.name + 2, (actname) ? actname : "<None>", (constname) ? constname : "<None>", (seq) ? (seq->name + 2) : "<None>", | ||||
| BLI_listbase_count(&ipo->curve)); | BLI_listbase_count(&ipo->curve)); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
| */ | */ | ||||
| // XXX currently done after all file reading... | // XXX currently done after all file reading... | ||||
| void do_versions_ipos_to_animato(Main *bmain) | void do_versions_ipos_to_animato(Main *bmain) | ||||
| { | { | ||||
| ListBase drivers = {NULL, NULL}; | ListBase drivers = {NULL, NULL}; | ||||
| ID *id; | ID *id; | ||||
| if (bmain == NULL) { | if (bmain == NULL) { | ||||
| printf("Argh! Main is NULL in do_versions_ipos_to_animato()\n"); | CLOG_ERROR(&LOG, "Argh! Main is NULL"); | ||||
| return; | return; | ||||
| } | } | ||||
| /* only convert if version is right */ | /* only convert if version is right */ | ||||
| if (bmain->versionfile >= 250) { | if (bmain->versionfile >= 250) { | ||||
| printf("WARNING: Animation data too new to convert (Version %d)\n", bmain->versionfile); | CLOG_WARN(&LOG, "Animation data too new to convert (Version %d)", bmain->versionfile); | ||||
| return; | return; | ||||
| } | } | ||||
| else if (G.debug & G_DEBUG) | else if (G.debug & G_DEBUG) | ||||
| printf("INFO: Converting to Animato...\n"); | printf("INFO: Converting to Animato...\n"); | ||||
| /* ----------- Animation Attached to Data -------------- */ | /* ----------- Animation Attached to Data -------------- */ | ||||
| /* objects */ | /* objects */ | ||||
| ▲ Show 20 Lines • Show All 388 Lines • Show Last 20 Lines | |||||