Fix check children
This commit is contained in:
1 parent
6f9097f73d
commit
6e3db26b33
3 files changed
+6
-8
No files matched your search
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "behavior3editor",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "behavior3editor",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "behavior3editor",
|
||||
"version": "1.9.0",
|
||||
"version": "1.9.1",
|
||||
"main": "dist-electron/main/index.js",
|
||||
"description": "行为树编辑器",
|
||||
"author": "zhandouxiaojiji & codetypes",
|
||||
|
||||
+3
-5
@@ -468,13 +468,11 @@ const checkNodeData = (data: NodeData | null | undefined, printer: ErrorPrinter)
|
||||
}
|
||||
}
|
||||
|
||||
if (conf.children !== undefined && conf.children !== -1) {
|
||||
const count = data.children?.length || 0;
|
||||
if (conf.children !== count) {
|
||||
if (!isValidChildren(data)) {
|
||||
hasError = true;
|
||||
const count = data.children?.filter((c) => !c.disabled).length || 0;
|
||||
error(`expect ${conf.children} children, but got ${count}`);
|
||||
}
|
||||
}
|
||||
|
||||
let hasVaridicInput = false;
|
||||
if (conf.input) {
|
||||
@@ -700,7 +698,7 @@ const buildStatusFlag = (data: NodeData, childStatus: number) => {
|
||||
export const isValidChildren = (data: NodeData) => {
|
||||
const def = nodeDefs.get(data.name);
|
||||
if (def.children !== undefined && def.children !== -1) {
|
||||
return (data.children?.length || 0) === def.children;
|
||||
return (data.children?.filter((c) => !c.disabled).length || 0) === def.children;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user