This commit is contained in:
xuyanfeng 2021-05-11 22:15:29 +08:00
parent bd0ac9b6a4
commit 7cc45b788c
4 changed files with 46 additions and 18 deletions

View File

@ -42,6 +42,7 @@ module.exports = {
"@typescript-eslint/no-explicit-any": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/ban-ts-comment": "off",
"no-inner-declarations":"off",
"no-inner-declarations": "off",
"vue/no-unused-vars": "off",
}
};

View File

@ -117,6 +117,7 @@ export class EnumData extends Info {
}
export class TreeData {
active: boolean = true;
uuid: string = '';
name: string = '';
children: Array<TreeData> = [];
@ -145,7 +146,7 @@ export class Group {
}
sort() {
let order = ['name', 'uuid', 'position', 'rotation', 'scale', 'anchor', 'size', 'color', 'opacity', 'skew', 'group'];
let order = ['name', 'active', 'enabled', 'uuid', 'position', 'rotation', 'scale', 'anchor', 'size', 'color', 'opacity', 'skew', 'group'];
let orderKeys: Array<Property> = [];
let otherKeys: Array<Property> = [];
this.data.forEach(property => {

View File

@ -27,7 +27,13 @@
node-key="uuid"
@node-expand="onNodeExpand"
@node-collapse="onNodeCollapse"
@node-click="handleNodeClick"></el-tree>
@node-click="handleNodeClick">
<span slot-scope="{node,data}" class="leaf" :class="data.active?'leaf-show':'leaf-hide'">
<span>{{ node.label }}</span>
<!-- <el-button v-if="!!data||true"> 显示</el-button>-->
</span>
</el-tree>
</div>
</div>
<div class="right">
@ -175,24 +181,26 @@ export default class Index extends Vue {
const uuid = data.path[0];
const key = data.path[1];
const value = data.data;
if (key === 'name') {
let treeArray: Array<TreeData> = [];
let treeArray: Array<TreeData> = [];
function circle(array: Array<TreeData>) {
array.forEach(item => {
treeArray.push(item);
circle(item.children);
})
}
// uuidtreename
circle(this.treeData)
let ret = treeArray.find(el => el.uuid === uuid);
if (ret) {
ret.name = value;
}
function circle(array: Array<TreeData>) {
array.forEach(item => {
treeArray.push(item);
circle(item.children);
})
}
// uuidtreename
circle(this.treeData)
let ret = treeArray.find(el => el.uuid === uuid);
if (ret) {
if (key === 'name') {
ret.name = value;
}
if (key === 'active') {
ret.active = !!value;
}
}
}
handleNodeClick(data: TreeData) {
@ -319,6 +327,18 @@ export default class Index extends Vue {
overflow: auto;
width: 300px;
.leaf {
width: 100%;
}
.leaf-show {
color: black;
}
.leaf-hide {
color: #c7bbbb;
text-decoration: line-through;
}
&::-webkit-scrollbar {
width: 6px;

View File

@ -102,6 +102,12 @@ class CCInspector {
getNodeChildren(node: any, data: TreeData) {
data.uuid = node.uuid;
data.name = node.name;
// @ts-ignore
if (node instanceof cc.Scene) {
// 场景不允许获取active引擎会报错
} else {
data.active = !!node.active;
}
this.inspectorGameMemoryStorage[node.uuid] = node;
let nodeChildren = node.getChildren();
for (let i = 0; i < nodeChildren.length; i++) {