From db379e91b359d7f9e72e1701ce5c4235a1c5ef9b Mon Sep 17 00:00:00 2001 From: xyf-mac Date: Sun, 7 Nov 2021 18:31:49 +0800 Subject: [PATCH] bugfix --- source/src/devtools/ui/index.vue | 3 ++- source/src/devtools/ui/ui-prop.vue | 4 ++++ source/src/inject/index.ts | 16 +++++++++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/source/src/devtools/ui/index.vue b/source/src/devtools/ui/index.vue index 6ead9b4..7a0ad8f 100644 --- a/source/src/devtools/ui/index.vue +++ b/source/src/devtools/ui/index.vue @@ -11,7 +11,8 @@
- + +
节点树
diff --git a/source/src/devtools/ui/ui-prop.vue b/source/src/devtools/ui/ui-prop.vue index 4c44847..6153eeb 100644 --- a/source/src/devtools/ui/ui-prop.vue +++ b/source/src/devtools/ui/ui-prop.vue @@ -210,6 +210,10 @@ export default class UiProp extends Vue { return this.value && (this.value.type === DataType.Image) } + isImageValid() { + return !!this.value.data; + } + isEngine() { return this.value && (this.value.type === DataType.Engine) } diff --git a/source/src/inject/index.ts b/source/src/inject/index.ts index 6bb7a5b..f97a204 100644 --- a/source/src/inject/index.ts +++ b/source/src/inject/index.ts @@ -173,7 +173,7 @@ class CCInspector { data.active = !!node.active; } this.inspectorGameMemoryStorage[node.uuid] = node; - let nodeChildren = node.getChildren(); + let nodeChildren = node.children; for (let i = 0; i < nodeChildren.length; i++) { let childItem = nodeChildren[i]; let treeData = new TreeData(); @@ -259,12 +259,14 @@ class CCInspector { const path: Array = options.path; if (ctor && value instanceof ctor) { // 2.4.6 没有了这个属性 + data.path = path; if (value.hasOwnProperty("_textureFilename")) { - data.path = path; //@ts-ignore data.data = `${window.location.origin}/${value._textureFilename}`; - return data; + } else { + data.data = null; } + return data; } return null; } @@ -330,14 +332,18 @@ class CCInspector { if (typeof propertyValue === "object") { let ctorName = propertyValue.constructor?.name; if (ctorName) { - if (ctorName.startsWith("cc_")) { + if (ctorName.startsWith("cc_") || + // 2.4.0 + ctorName === "CCClass") { info = new EngineData(); info.engineType = ctorName; info.engineName = propertyValue.name; info.engineUUID = propertyValue.uuid; } - } else { + } + if (!info) { // 空{} + // MaterialVariant 2.4.0 info = this._buildObjectData({ data: new ObjectData(), path: path,