mirror of
https://github.com/tidys/cc-inspector-chrome
synced 2025-04-19 08:28:41 +00:00
3.8.5 warn消除不掉,只能剔除检索该属性
This commit is contained in:
parent
ef970e9d4c
commit
915f144986
@ -5,13 +5,12 @@ import { ArrayData, BoolData, ColorData, DataType, EngineData, Group, ImageData,
|
|||||||
import { InjectEvent } from "./event";
|
import { InjectEvent } from "./event";
|
||||||
import { Hint } from "./hint";
|
import { Hint } from "./hint";
|
||||||
import { injectView } from "./inject-view";
|
import { injectView } from "./inject-view";
|
||||||
|
import { inspectTarget } from "./inspect-list";
|
||||||
import { getValue, trySetValueWithConfig } from "./setValue";
|
import { getValue, trySetValueWithConfig } from "./setValue";
|
||||||
import { BuildArrayOptions, BuildImageOptions, BuildObjectOptions, BuildVecOptions } from "./types";
|
import { BuildArrayOptions, BuildImageOptions, BuildObjectOptions, BuildVecOptions } from "./types";
|
||||||
import { isHasProperty } from "./util";
|
import { isHasProperty } from "./util";
|
||||||
import { inspectTarget } from "./inspect-list";
|
|
||||||
|
|
||||||
declare const cc: any;
|
declare const cc: any;
|
||||||
|
|
||||||
export class Inspector extends InjectEvent {
|
export class Inspector extends InjectEvent {
|
||||||
inspectorGameMemoryStorage: Record<string, any> = {};
|
inspectorGameMemoryStorage: Record<string, any> = {};
|
||||||
private hint: Hint = new Hint(this);
|
private hint: Hint = new Hint(this);
|
||||||
@ -280,38 +279,64 @@ export class Inspector extends InjectEvent {
|
|||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isExcludeProperty(node: any, key: string) {
|
||||||
|
const mapArray = [
|
||||||
|
{
|
||||||
|
type: cc.UITransformComponent || cc.UITransform,
|
||||||
|
keys: ["priority"],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: null, // null 表示所有适配类型
|
||||||
|
keys: [
|
||||||
|
"children",
|
||||||
|
"quat",
|
||||||
|
"node",
|
||||||
|
"components",
|
||||||
|
"enabledInHierarchy",
|
||||||
|
"hideFlags",
|
||||||
|
"isValid",
|
||||||
|
"parent",
|
||||||
|
// 生命周期函数
|
||||||
|
"onFocusInEditor",
|
||||||
|
"onRestore",
|
||||||
|
"start",
|
||||||
|
"lateUpdate",
|
||||||
|
"update",
|
||||||
|
"resetInEditor",
|
||||||
|
"onLostFocusInEditor",
|
||||||
|
"onEnable",
|
||||||
|
"onDisable",
|
||||||
|
"onDestroy",
|
||||||
|
"onLoad",
|
||||||
|
"internalLateUpdate",
|
||||||
|
"internalOnDestroy",
|
||||||
|
"internalOnEnable",
|
||||||
|
"internalOnDisable",
|
||||||
|
"internalUpdate",
|
||||||
|
"internalPreload",
|
||||||
|
"internalOnLoad",
|
||||||
|
"internalStart",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
for (let i = 0; i < mapArray.length; i++) {
|
||||||
|
const { type, keys } = mapArray[i];
|
||||||
|
if (type === null) {
|
||||||
|
if (keys.find((v) => v === key)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (node instanceof type) {
|
||||||
|
if (keys.find((v) => v === key)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
_getNodeKeys(node: any) {
|
_getNodeKeys(node: any) {
|
||||||
// 3.x变成了getter
|
// 3.x变成了getter
|
||||||
let excludeProperty = [
|
|
||||||
"children",
|
|
||||||
"quat",
|
|
||||||
"node",
|
|
||||||
"components",
|
|
||||||
"enabledInHierarchy",
|
|
||||||
"hideFlags",
|
|
||||||
"isValid",
|
|
||||||
"parent",
|
|
||||||
// 生命周期函数
|
|
||||||
"onFocusInEditor",
|
|
||||||
"onRestore",
|
|
||||||
"start",
|
|
||||||
"lateUpdate",
|
|
||||||
"update",
|
|
||||||
"resetInEditor",
|
|
||||||
"onLostFocusInEditor",
|
|
||||||
"onEnable",
|
|
||||||
"onDisable",
|
|
||||||
"onDestroy",
|
|
||||||
"onLoad",
|
|
||||||
"internalLateUpdate",
|
|
||||||
"internalOnDestroy",
|
|
||||||
"internalOnEnable",
|
|
||||||
"internalOnDisable",
|
|
||||||
"internalUpdate",
|
|
||||||
"internalPreload",
|
|
||||||
"internalOnLoad",
|
|
||||||
"internalStart",
|
|
||||||
];
|
|
||||||
const keyHidden = this.getAllPropertyDescriptors(node);
|
const keyHidden = this.getAllPropertyDescriptors(node);
|
||||||
const keyVisible1 = Object.keys(node); // Object不走原型链
|
const keyVisible1 = Object.keys(node); // Object不走原型链
|
||||||
let keyVisible2: string[] = [];
|
let keyVisible2: string[] = [];
|
||||||
@ -321,7 +346,7 @@ export class Inspector extends InjectEvent {
|
|||||||
}
|
}
|
||||||
let allKeys: string[] = uniq(keyHidden.concat(keyVisible1, keyVisible2)).sort();
|
let allKeys: string[] = uniq(keyHidden.concat(keyVisible1, keyVisible2)).sort();
|
||||||
allKeys = allKeys.filter((key) => {
|
allKeys = allKeys.filter((key) => {
|
||||||
return !key.startsWith("_") && !excludeProperty.includes(key);
|
return !key.startsWith("_") && !this.isExcludeProperty(node, key);
|
||||||
});
|
});
|
||||||
|
|
||||||
allKeys = allKeys.filter((key) => {
|
allKeys = allKeys.filter((key) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user