Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/anim_sys.c
| Context not available. | |||||
| #include "atomic_ops.h" | #include "atomic_ops.h" | ||||
| #include "CLG_log.h" | |||||
| static CLG_LogRef LOG = { "bke.anim_sys" }; | |||||
| /* ***************************************** */ | /* ***************************************** */ | ||||
| /* AnimData API */ | /* AnimData API */ | ||||
| Context not available. | |||||
| // TODO: we must unset all "tweakmode" flags | // TODO: we must unset all "tweakmode" flags | ||||
| if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) { | if ((src->flag & ADT_NLA_EDIT_ON) || (dst->flag & ADT_NLA_EDIT_ON)) { | ||||
| printf("ERROR: Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption\n"); | CLOG_ERROR(&LOG, "Merging AnimData blocks while editing NLA is dangerous as it may cause data corruption"); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| /* sanity checks */ | /* sanity checks */ | ||||
| if (ELEM(NULL, srcAct, dstAct, basepath)) { | if (ELEM(NULL, srcAct, dstAct, basepath)) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("ERROR: action_partition_fcurves_by_basepath(%p, %p, %p) has insufficient info to work with\n", | CLOG_ERROR(&LOG, "srcAct: %p, dstAct: %p, basepath: %p has insufficient info to work with", | ||||
| (void *)srcAct, (void *)dstAct, (void *)basepath); | (void *)srcAct, (void *)dstAct, (void *)basepath); | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| /* sanity checks */ | /* sanity checks */ | ||||
| if (ELEM(NULL, srcID, dstID)) { | if (ELEM(NULL, srcID, dstID)) { | ||||
| if (G.debug & G_DEBUG) | if (G.debug & G_DEBUG) | ||||
| printf("ERROR: no source or destination ID to separate AnimData with\n"); | CLOG_ERROR(&LOG, "no source or destination ID to separate AnimData with"); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| if (ELEM(NULL, srcAdt, dstAdt)) { | if (ELEM(NULL, srcAdt, dstAdt)) { | ||||
| if (G.debug & G_DEBUG) | if (G.debug & G_DEBUG) | ||||
| printf("ERROR: no AnimData for this pair of ID's\n"); | CLOG_ERROR(&LOG, "no AnimData for this pair of ID's"); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| dstAdt->action = BKE_action_add(bmain, srcAdt->action->id.name + 2); | dstAdt->action = BKE_action_add(bmain, srcAdt->action->id.name + 2); | ||||
| } | } | ||||
| else if (dstAdt->action == srcAdt->action) { | else if (dstAdt->action == srcAdt->action) { | ||||
| printf("Argh! Source and Destination share animation! ('%s' and '%s' both use '%s') Making new empty action\n", | CLOG_WARN(&LOG, "Argh! Source and Destination share animation! " | ||||
| srcID->name, dstID->name, srcAdt->action->id.name); | "('%s' and '%s' both use '%s') Making new empty action", | ||||
| srcID->name, dstID->name, srcAdt->action->id.name); | |||||
| /* TODO: review this... */ | /* TODO: review this... */ | ||||
| id_us_min(&dstAdt->action->id); | id_us_min(&dstAdt->action->id); | ||||
| Context not available. | |||||
| /* if no action, no need to proceed */ | /* if no action, no need to proceed */ | ||||
| if (ELEM(NULL, owner_id, old_path)) { | if (ELEM(NULL, owner_id, old_path)) { | ||||
| if (G.debug & G_DEBUG) printf("%s: early abort\n", __func__); | if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "early abort"); | ||||
| return old_path; | return old_path; | ||||
| } | } | ||||
| Context not available. | |||||
| /* sanity checks */ | /* sanity checks */ | ||||
| if (ELEM(NULL, ks, rna_path)) { | if (ELEM(NULL, ks, rna_path)) { | ||||
| printf("ERROR: no Keying Set and/or RNA Path to add path with\n"); | CLOG_ERROR(&LOG, "no Keying Set and/or RNA Path to add path with"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* ID is required for all types of KeyingSets */ | /* ID is required for all types of KeyingSets */ | ||||
| if (id == NULL) { | if (id == NULL) { | ||||
| printf("ERROR: No ID provided for Keying Set Path\n"); | CLOG_ERROR(&LOG, "No ID provided for Keying Set Path"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| /* don't add if there is already a matching KS_Path in the KeyingSet */ | /* don't add if there is already a matching KS_Path in the KeyingSet */ | ||||
| if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) { | if (BKE_keyingset_find_path(ks, id, group_name, rna_path, array_index, groupmode)) { | ||||
| if (G.debug & G_DEBUG) | if (G.debug & G_DEBUG) | ||||
| printf("ERROR: destination already exists in Keying Set\n"); | CLOG_ERROR(&LOG, "destination already exists in Keying Set"); | ||||
| return NULL; | return NULL; | ||||
| } | } | ||||
| Context not available. | |||||
| if (array_len && array_index >= array_len) { | if (array_len && array_index >= array_len) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d\n", | CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d", | ||||
| (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", | (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", | ||||
| path, array_index, array_len - 1); | path, array_index, array_len - 1); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| /* XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) | /* XXX don't tag as failed yet though, as there are some legit situations (Action Constraint) | ||||
| * where some channels will not exist, but shouldn't lock up Action */ | * where some channels will not exist, but shouldn't lock up Action */ | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Animato: Invalid path. ID = '%s', '%s[%d]'\n", | CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s[%d]'", | ||||
| (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", | (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", | ||||
| path, array_index); | path, array_index); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (!RNA_path_resolve_property(ptr, path, &key.ptr, &key.prop)) { | if (!RNA_path_resolve_property(ptr, path, &key.ptr, &key.prop)) { | ||||
| /* Report failure to resolve the path. */ | /* Report failure to resolve the path. */ | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Animato: Invalid path. ID = '%s', '%s'\n", | CLOG_WARN(&LOG, "Animato: Invalid path. ID = '%s', '%s'", | ||||
| (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", path); | (ptr->id.data) ? (((ID *)ptr->id.data)->name + 2) : "<No ID>", path); | ||||
| } | } | ||||
| /* Cache NULL result. */ | /* Cache NULL result. */ | ||||
| Context not available. | |||||
| if (index < 0) { | if (index < 0) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| ID *id = nec->key.ptr.id.data; | ID *id = nec->key.ptr.id.data; | ||||
| printf("Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d\n", | CLOG_WARN(&LOG, "Animato: Invalid array index. ID = '%s', '%s[%d]', array length is %d", | ||||
| id ? (id->name + 2) : "<No ID>", nec->rna_path, array_index, nec->base_snapshot.length); | id ? (id->name + 2) : "<No ID>", nec->rna_path, array_index, nec->base_snapshot.length); | ||||
| } | } | ||||
| return false; | return false; | ||||
| Context not available. | |||||
| return; | return; | ||||
| if (strip->act == NULL) { | if (strip->act == NULL) { | ||||
| printf("NLA-Strip Eval Error: Strip '%s' has no Action\n", strip->name); | CLOG_ERROR(&LOG, "NLA-Strip Eval Error: Strip '%s' has no Action", strip->name); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| else { | else { | ||||
| /* special case - evaluate as if there isn't any NLA data */ | /* special case - evaluate as if there isn't any NLA data */ | ||||
| /* TODO: this is really just a stop-gap measure... */ | /* TODO: this is really just a stop-gap measure... */ | ||||
| if (G.debug & G_DEBUG) printf("NLA Eval: Stopgap for active action on NLA Stack - no strips case\n"); | if (G.debug & G_DEBUG) CLOG_WARN(&LOG, "NLA Eval: Stopgap for active action on NLA Stack - no strips case"); | ||||
| animsys_evaluate_action(depsgraph, ptr, adt->action, ctime); | animsys_evaluate_action(depsgraph, ptr, adt->action, ctime); | ||||
| } | } | ||||
| Context not available. | |||||
| /* set error-flag if evaluation failed */ | /* set error-flag if evaluation failed */ | ||||
| if (ok == 0) { | if (ok == 0) { | ||||
| printf("invalid driver - %s[%d]\n", fcu->rna_path, fcu->array_index); | CLOG_ERROR(&LOG, "invalid driver - %s[%d]", fcu->rna_path, fcu->array_index); | ||||
| driver_orig->flag |= DRIVER_FLAG_INVALID; | driver_orig->flag |= DRIVER_FLAG_INVALID; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||