Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/fcurve.c
| Context not available. | |||||
| #include "atomic_ops.h" | #include "atomic_ops.h" | ||||
| #include "CLG_log.h" | |||||
| #ifdef WITH_PYTHON | #ifdef WITH_PYTHON | ||||
| #include "BPY_extern.h" | #include "BPY_extern.h" | ||||
| #endif | #endif | ||||
| Context not available. | |||||
| static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER; | static ThreadMutex python_driver_lock = BLI_MUTEX_INITIALIZER; | ||||
| #endif | #endif | ||||
| static CLG_LogRef LOG = { "bke.fcurve" }; | |||||
| /* ************************** Data-Level Functions ************************* */ | /* ************************** Data-Level Functions ************************* */ | ||||
| /* ---------------------- Freeing --------------------------- */ | /* ---------------------- Freeing --------------------------- */ | ||||
| Context not available. | |||||
| * - keyframe to be added would replace one of the existing ones on bounds | * - keyframe to be added would replace one of the existing ones on bounds | ||||
| */ | */ | ||||
| if ((arraylen <= 0) || (array == NULL)) { | if ((arraylen <= 0) || (array == NULL)) { | ||||
| printf("Warning: binarysearch_bezt_index() encountered invalid array\n"); | CLOG_WARN(&LOG, "encountered invalid array"); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| /* print error if loop-limit exceeded */ | /* print error if loop-limit exceeded */ | ||||
| if (loopbreaker == (maxloop - 1)) { | if (loopbreaker == (maxloop - 1)) { | ||||
| printf("Error: binarysearch_bezt_index() was taking too long\n"); | CLOG_ERROR(&LOG, "search taking too long"); | ||||
| /* include debug info */ | /* include debug info */ | ||||
| printf("\tround = %d: start = %d, end = %d, arraylen = %d\n", loopbreaker, start, end, arraylen); | CLOG_ERROR(&LOG, "\tround = %d: start = %d, end = %d, arraylen = %d", loopbreaker, start, end, arraylen); | ||||
| } | } | ||||
| /* not found, so return where to place it */ | /* not found, so return where to place it */ | ||||
| Context not available. | |||||
| int cfra; | int cfra; | ||||
| /* sanity checks */ | /* sanity checks */ | ||||
| /* TODO: make these tests report errors using reports not printf's */ | /* TODO: make these tests report errors using reports not CLOG's */ | ||||
| if (ELEM(NULL, fcu, sample_cb)) { | if (ELEM(NULL, fcu, sample_cb)) { | ||||
| printf("Error: No F-Curve with F-Curve Modifiers to Bake\n"); | CLOG_ERROR(&LOG, "No F-Curve with F-Curve Modifiers to Bake"); | ||||
| return; | return; | ||||
| } | } | ||||
| if (start > end) { | if (start > end) { | ||||
| printf("Error: Frame range for Sampled F-Curve creation is inappropriate\n"); | CLOG_ERROR(&LOG, "Error: Frame range for Sampled F-Curve creation is inappropriate"); | ||||
| return; | return; | ||||
| } | } | ||||
| Context not available. | |||||
| /* error check for missing pointer... */ | /* error check for missing pointer... */ | ||||
| if (id == NULL) { | if (id == NULL) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path); | CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path); | ||||
| } | } | ||||
| driver->flag |= DRIVER_FLAG_INVALID; | driver->flag |= DRIVER_FLAG_INVALID; | ||||
| Context not available. | |||||
| else { | else { | ||||
| /* out of bounds */ | /* out of bounds */ | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)", | CLOG_ERROR(&LOG, "Driver Evaluation Error: array index is out of bounds for %s -> %s (%d)", | ||||
| id->name, dtar->rna_path, index); | id->name, dtar->rna_path, index); | ||||
| } | } | ||||
| driver->flag |= DRIVER_FLAG_INVALID; | driver->flag |= DRIVER_FLAG_INVALID; | ||||
| Context not available. | |||||
| else { | else { | ||||
| /* path couldn't be resolved */ | /* path couldn't be resolved */ | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path); | CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path); | ||||
| } | } | ||||
| driver->flag |= DRIVER_FLAG_INVALID; | driver->flag |= DRIVER_FLAG_INVALID; | ||||
| Context not available. | |||||
| /* error check for missing pointer... */ | /* error check for missing pointer... */ | ||||
| if (id == NULL) { | if (id == NULL) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Error: driver has an invalid target to use (path = %s)\n", dtar->rna_path); | CLOG_ERROR(&LOG, "driver has an invalid target to use (path = %s)", dtar->rna_path); | ||||
| } | } | ||||
| driver->flag |= DRIVER_FLAG_INVALID; | driver->flag |= DRIVER_FLAG_INVALID; | ||||
| Context not available. | |||||
| else { | else { | ||||
| /* path couldn't be resolved */ | /* path couldn't be resolved */ | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("Driver Evaluation Error: cannot resolve target for %s -> %s\n", id->name, dtar->rna_path); | CLOG_ERROR(&LOG, "Driver Evaluation Error: cannot resolve target for %s -> %s", id->name, dtar->rna_path); | ||||
| } | } | ||||
| ptr = PointerRNA_NULL; | ptr = PointerRNA_NULL; | ||||
| Context not available. | |||||
| /* make sure we have enough valid targets to use - all or nothing for now... */ | /* make sure we have enough valid targets to use - all or nothing for now... */ | ||||
| if (driver_check_valid_targets(driver, dvar) != 2) { | if (driver_check_valid_targets(driver, dvar) != 2) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n", | CLOG_WARN(&LOG, "RotDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)", | ||||
| valid_targets, dvar->targets[0].id, dvar->targets[1].id); | valid_targets, dvar->targets[0].id, dvar->targets[1].id); | ||||
| } | } | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| Context not available. | |||||
| /* make sure we have enough valid targets to use - all or nothing for now... */ | /* make sure we have enough valid targets to use - all or nothing for now... */ | ||||
| if (valid_targets < dvar->num_targets) { | if (valid_targets < dvar->num_targets) { | ||||
| if (G.debug & G_DEBUG) { | if (G.debug & G_DEBUG) { | ||||
| printf("LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)\n", | CLOG_WARN(&LOG, "LocDiff DVar: not enough valid targets (n = %d) (a = %p, b = %p)", | ||||
| valid_targets, dvar->targets[0].id, dvar->targets[1].id); | valid_targets, dvar->targets[0].id, dvar->targets[1].id); | ||||
| } | } | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| Context not available. | |||||
| case EXPR_PYLIKE_DIV_BY_ZERO: | case EXPR_PYLIKE_DIV_BY_ZERO: | ||||
| case EXPR_PYLIKE_MATH_ERROR: | case EXPR_PYLIKE_MATH_ERROR: | ||||
| message = (status == EXPR_PYLIKE_DIV_BY_ZERO) ? "Division by Zero" : "Math Domain Error"; | message = (status == EXPR_PYLIKE_DIV_BY_ZERO) ? "Division by Zero" : "Math Domain Error"; | ||||
| fprintf(stderr, "\n%s in Driver: '%s'\n", message, driver->expression); | CLOG_ERROR(&LOG, "%s in Driver: '%s'", message, driver->expression); | ||||
| driver->flag |= DRIVER_FLAG_INVALID; | driver->flag |= DRIVER_FLAG_INVALID; | ||||
| return true; | return true; | ||||
| default: | default: | ||||
| /* arriving here means a bug, not user error */ | /* arriving here means a bug, not user error */ | ||||
| printf("Error: simple driver expression evaluation failed: '%s'\n", driver->expression); | CLOG_ERROR(&LOG, "simple driver expression evaluation failed: '%s'", driver->expression); | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||