Only log completely absent script functions as an error
This commit is contained in:
parent
3bc9497ea2
commit
98f4bae728
2 changed files with 6 additions and 3 deletions
|
@ -9,6 +9,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Changed
|
### Changed
|
||||||
- If an object event is inanimate, it will always render using its first frame.
|
- 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
|
## [4.5.0] - 2021-12-26
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -94,18 +94,20 @@ void Scripting::invokeAction(QString actionName) {
|
||||||
if (!instance) return;
|
if (!instance) return;
|
||||||
if (!instance->registeredActions.contains(actionName)) return;
|
if (!instance->registeredActions.contains(actionName)) return;
|
||||||
|
|
||||||
|
bool foundFunction = false;
|
||||||
QString functionName = instance->registeredActions.value(actionName);
|
QString functionName = instance->registeredActions.value(actionName);
|
||||||
for (QJSValue module : instance->modules) {
|
for (QJSValue module : instance->modules) {
|
||||||
QJSValue callbackFunction = module.property(functionName);
|
QJSValue callbackFunction = module.property(functionName);
|
||||||
if (callbackFunction.isUndefined() || !callbackFunction.isCallable()) {
|
if (callbackFunction.isUndefined() || !callbackFunction.isCallable())
|
||||||
logError(QString("Unknown custom script function '%1'").arg(functionName));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
foundFunction = true;
|
||||||
if (tryErrorJS(callbackFunction)) continue;
|
if (tryErrorJS(callbackFunction)) continue;
|
||||||
|
|
||||||
QJSValue result = callbackFunction.call(QJSValueList());
|
QJSValue result = callbackFunction.call(QJSValueList());
|
||||||
if (tryErrorJS(result)) continue;
|
if (tryErrorJS(result)) continue;
|
||||||
}
|
}
|
||||||
|
if (!foundFunction)
|
||||||
|
logError(QString("Unknown custom script function '%1'").arg(functionName));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scripting::cb_ProjectOpened(QString projectPath) {
|
void Scripting::cb_ProjectOpened(QString projectPath) {
|
||||||
|
|
Loading…
Reference in a new issue