diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a948072..6d9bb4e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d ## [Unreleased] ### Changed - If an object event is inanimate, it will always render using its first frame. +- Only log "Unknown custom script function" when a registered script function is not present in any script. ## [4.5.0] - 2021-12-26 ### Added diff --git a/src/scripting.cpp b/src/scripting.cpp index a5472846..ef757464 100644 --- a/src/scripting.cpp +++ b/src/scripting.cpp @@ -94,18 +94,20 @@ void Scripting::invokeAction(QString actionName) { if (!instance) return; if (!instance->registeredActions.contains(actionName)) return; + bool foundFunction = false; QString functionName = instance->registeredActions.value(actionName); for (QJSValue module : instance->modules) { QJSValue callbackFunction = module.property(functionName); - if (callbackFunction.isUndefined() || !callbackFunction.isCallable()) { - logError(QString("Unknown custom script function '%1'").arg(functionName)); + if (callbackFunction.isUndefined() || !callbackFunction.isCallable()) continue; - } + foundFunction = true; if (tryErrorJS(callbackFunction)) continue; QJSValue result = callbackFunction.call(QJSValueList()); if (tryErrorJS(result)) continue; } + if (!foundFunction) + logError(QString("Unknown custom script function '%1'").arg(functionName)); } void Scripting::cb_ProjectOpened(QString projectPath) {