Fix: Reduce AnimData versioning overhead for node socket changes
Since the code only does anything if both substrings are found, implement an early-out if either of them isn't found. This seems like a micro-optimization at first, but since the current node socket versioning requires looping over all AnimData in the file, this adds up to e.g. 1.9sec saved when loading the Spring benchmark file.
This commit is contained in:
@@ -789,14 +789,22 @@ static char *rna_path_rename_fix(ID *owner_id,
|
||||
bool verify_paths)
|
||||
{
|
||||
char *prefixPtr = strstr(oldpath, prefix);
|
||||
if (prefixPtr == nullptr) {
|
||||
return oldpath;
|
||||
}
|
||||
|
||||
char *oldNamePtr = strstr(oldpath, oldName);
|
||||
if (oldNamePtr == nullptr) {
|
||||
return oldpath;
|
||||
}
|
||||
|
||||
int prefixLen = strlen(prefix);
|
||||
int oldNameLen = strlen(oldName);
|
||||
|
||||
/* only start fixing the path if the prefix and oldName feature in the path,
|
||||
* and prefix occurs immediately before oldName
|
||||
*/
|
||||
if ((prefixPtr && oldNamePtr) && (prefixPtr + prefixLen == oldNamePtr)) {
|
||||
if (prefixPtr + prefixLen == oldNamePtr) {
|
||||
/* if we haven't aren't able to resolve the path now, try again after fixing it */
|
||||
if (!verify_paths || check_rna_path_is_valid(owner_id, oldpath) == 0) {
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
|
||||
Reference in New Issue
Block a user