diff --git a/README.md b/README.md index dade7a2..e52ba9d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ccc-devtools v1.2.7 +# ccc-devtools v2.0.0 Cocos Creator 网页调试器,运行时查看、修改节点树,实时更新节点属性。 ## TODO @@ -7,13 +7,14 @@ Cocos Creator 网页调试器,运行时查看、修改节点树,实时更新 - [x] 实时刷新节点信息 - [x] 开关 - [x] 控制台输出节点信息 +- [x] 组件信息 - [ ] 节点搜索 - [ ] 拖动节点更改层级 - [ ] 自定义布局等配置 -- [ ] 组件信息 ## 预览 +v1.0.0 ![preview](./screenshots/preview.gif) v1.1.0: 拖拽节点,增加开关 @@ -24,6 +25,10 @@ v1.2.0: 控制台输出节点信息 ![t6](./screenshots/t5.png) +v2.0.0: 节点信息自动同步,避免手动刷新。增加组件信息显示。增加内存、FPS、渲染时间显示。更新提醒。 + +![preview2](./screenshots/preview2.png) + ## 使用 1. 点击 Creator 右上角进入编辑器 resources 目录,再依次进入`static/preview-templates`目录 @@ -41,9 +46,23 @@ v1.2.0: 控制台输出节点信息 ## 已知问题 -- 当有大量节点动态加载时,可能需要手动点击一下右上角的刷新按钮来重载节点树。 - 当升级 Cococs Creator 时会清空resources目录,需要重新下载配置,如自定义了一些配置,请做好备份。 +- 开启节点树会增加渲染消耗,非调试阶段请关闭。 ## 需求、更新 -https://github.com/potato47/ccc-devtools \ No newline at end of file +https://github.com/potato47/ccc-devtools + +如果没有更改源码,可直接在目录下 git pull + +## 本项目依赖以下开源项目 + +https://github.com/vuejs/vue + +https://github.com/ElemeFE/element + +https://github.com/iview/iview + +https://github.com/FE-Driver/vue-beauty + +https://github.com/mrdoob/stats.js diff --git a/config.js b/config.js index bba45bc..033bf41 100644 --- a/config.js +++ b/config.js @@ -1,188 +1,156 @@ const NEX_CONFIG = { - propSchema: { + nodeSchema: { node2d: { title: 'Node', - key: 'node', + key: 'cc.Node', rows: [ // Position [{ - key: 'node_pos_label', type: 'label', span: 6, - value: 'Position' + field: 'Position' }, { - key: 'node_x_label', type: 'label', span: 1, - value: 'X' + field: 'X' }, { - key: 'node_x', type: 'number', span: 8, field: 'x' }, { - key: 'node_y_label', type: 'label', span: 1, - value: 'Y' + field: 'Y' }, { - key: 'node_y', type: 'number', span: 8, field: 'y' }], // Angle [{ - key: 'node_angle_label', type: 'label', span: 6, - value: 'Angle' + field: 'Angle' }, { - key: 'node_angle', type: 'number', span: 18, field: 'angle' }], // Scale [{ - key: 'node_scale_label', type: 'label', span: 6, - value: 'Scale' + field: 'Scale' }, { - key: 'node_scalex_label', type: 'label', span: 1, - value: 'X' + field: 'X' }, { - key: 'node_scalex', type: 'number', span: 8, field: 'scaleX' }, { - key: 'node_scaley_label', type: 'label', span: 1, - value: 'Y' + field: 'Y' }, { - key: 'node_scaley', type: 'number', span: 8, field: 'scaleY' }], // Anchor [{ - key: 'node_anchor_label', type: 'label', span: 6, - value: 'Anchor' + field: 'Anchor' }, { - key: 'node_anchorx_label', type: 'label', span: 1, - value: 'X' + field: 'X' }, { - key: 'node_anchorx', type: 'number', span: 8, field: 'anchorX' }, { - key: 'node_anchory_label', type: 'label', span: 1, - value: 'Y' + field: 'Y' }, { - key: 'node_anchory', type: 'number', span: 8, field: 'anchorY' }], // Size [{ - key: 'node_size_label', type: 'label', span: 6, - value: 'Size' + field: 'Size' }, { - key: 'node_width_label', type: 'label', span: 1, - value: 'W' + field: 'W' }, { - key: 'node_width', type: 'number', span: 8, field: 'width' }, { - key: 'node_height_label', type: 'label', span: 1, - value: 'H' + field: 'H' }, { - key: 'node_height', type: 'number', span: 8, field: 'height' }], // Color [{ - key: 'node_color_label', type: 'label', span: 6, - value: 'Color', + field: 'Color', }, { - key: 'node_color', type: 'color', - span: 16, - field: 'hex_color' + span: 18, + field: 'hex_color', + rawField: 'color', }], // Opacity [{ - key: 'node_opacity_label', type: 'label', span: 6, - value: 'Opacity' + field: 'Opacity' }, { - key: 'node_opacity', type: 'number', span: 18, field: 'opacity' }], // Skew [{ - key: 'node_skew_label', type: 'label', span: 6, - value: 'Skew' + field: 'Skew' }, { - key: 'node_skewx_label', type: 'label', span: 1, - value: 'X' + field: 'X' }, { - key: 'node_skewx', type: 'number', span: 8, field: 'skewX' }, { - key: 'node_skewy_label', type: 'label', span: 1, - value: 'Y' + field: 'Y' }, { - key: 'node_skewy', type: 'number', span: 8, field: 'skewY' }], // Group [{ - key: 'node_group_label', type: 'label', span: 6, - value: 'Group' + field: 'Group' }, { - key: 'node_group', type: 'input', span: 18, field: 'group' @@ -190,10 +158,397 @@ const NEX_CONFIG = { ] }, node3d: { - + title: 'Node', + key: 'cc.Node', + rows: [ + // Position + [{ + type: 'label', + span: 6, + field: 'Position' + }, { + type: 'label', + span: 1, + field: 'X' + }, { + type: 'number', + span: 5, + field: 'x' + }, { + type: 'label', + span: 1, + field: 'Y' + }, { + type: 'number', + span: 5, + field: 'y' + }, { + type: 'label', + span: 1, + field: 'Z' + }, { + type: 'number', + span: 5, + field: 'z' + }], + // Angle + [{ + type: 'label', + span: 6, + field: 'Rotation' + }, { + type: 'label', + span: 1, + field: 'X' + }, { + type: '3DAngle', + span: 5, + field: 'x' + }, { + type: 'label', + span: 1, + field: 'Y' + }, { + type: '3DAngle', + span: 5, + field: 'y' + }, { + type: 'label', + span: 1, + field: 'Z' + }, { + type: '3DAngle', + span: 5, + field: 'z' + }], + // Scale + [{ + type: 'label', + span: 6, + field: 'Scale' + }, { + type: 'label', + span: 1, + field: 'X' + }, { + type: 'number', + span: 5, + field: 'scaleX' + }, { + type: 'label', + span: 1, + field: 'Y' + }, { + type: 'number', + span: 5, + field: 'scaleY' + }, { + type: 'label', + span: 1, + field: 'Z' + }, { + type: 'number', + span: 5, + field: 'scaleZ' + }], + // Anchor + [{ + type: 'label', + span: 6, + field: 'Anchor' + }, { + type: 'label', + span: 1, + field: 'X' + }, { + type: 'number', + span: 8, + field: 'anchorX' + }, { + type: 'label', + span: 1, + field: 'Y' + }, { + type: 'number', + span: 8, + field: 'anchorY' + }], + // Size + [{ + type: 'label', + span: 6, + field: 'Size' + }, { + type: 'label', + span: 1, + field: 'W' + }, { + type: 'number', + span: 8, + field: 'width' + }, { + type: 'label', + span: 1, + field: 'H' + }, { + type: 'number', + span: 8, + field: 'height' + }], + // Color + [{ + type: 'label', + span: 6, + field: 'Color', + }, { + type: 'color', + span: 18, + field: 'hex_color', + rawField: 'color', + }], + // Opacity + [{ + type: 'label', + span: 6, + field: 'Opacity' + }, { + type: 'number', + span: 18, + field: 'opacity' + }], + // Skew + [{ + type: 'label', + span: 6, + field: 'Skew' + }, { + type: 'label', + span: 1, + field: 'X' + }, { + type: 'number', + span: 8, + field: 'skewX' + }, { + type: 'label', + span: 1, + field: 'Y' + }, { + type: 'number', + span: 8, + field: 'skewY' + }], + // Group + [{ + type: 'label', + span: 6, + field: 'Group' + }, { + type: 'input', + span: 18, + field: 'group' + }] + ] }, - label: { - + }, + componentsSchema: { + 'cc.Camera': { + title: 'cc.Camera', + key: 'cc.Camera', + rows: [ + // Zoom Ratio + [{ + type: 'label', + span: 6, + field: 'Zoom Ratio' + }, { + type: 'number', + span: 18, + field: 'zoomRatio' + }], + // Background Color + [{ + type: 'label', + span: 6, + field: 'Bg Color' + }, { + type: 'color', + span: 18, + field: 'hex_backgroundColor', + rawField: 'backgroundColor' + }], + // Depth + [{ + type: 'label', + span: 6, + field: 'Depth' + }, { + type: 'number', + span: 18, + field: 'depth' + }], + ] + }, + 'cc.Sprite': { + key: 'cc.Sprite', + title: 'cc.Sprite', + rows: [ + // Type + [{ + type: 'label', + span: 6, + field: 'Type' + }, { + type: 'select', + span: 18, + field: 'type', + options: [{ + label: 'SIMPLE', + value: 0 + }, { + label: 'SLICED', + value: 1 + }, { + label: 'TILED', + vlaue: 2 + }, { + label: 'FILLED', + value: 3 + }, { + label: 'MESH', + value: 4 + }] + }], + // Size Mode + [{ + type: 'label', + span: 6, + field: 'Size Mode' + }, { + type: 'select', + span: 18, + field: 'sizeMode', + options: [{ + label: 'CUSTOM', + value: 0 + }, { + label: 'TRIMMED', + value: 1 + }, { + label: 'RAW', + vlaue: 2 + }] + }], + // Trim + [{ + type: 'label', + span: 6, + field: 'Trim' + }, { + type: 'bool', + span: 18, + field: 'trim' + }], + ] + }, + 'cc.Label': { + title: 'cc.Label', + key: 'cc.Label', + rows: [ + // String + [{ + type: 'label', + span: 6, + field: 'String' + }, { + type: 'textarea', + span: 18, + field: 'string' + }], + // Horizontal Align + [{ + type: 'label', + span: 6, + field: 'Horizontal' + }, { + type: 'select', + span: 18, + field: 'horizontalAlign', + options: [{ + label: 'LEFT', + value: 0 + }, { + label: 'CENTER', + value: 1 + }, { + label: 'RIGHT', + value: 2 + }] + }], + // Vertical Align + [{ + type: 'label', + span: 6, + field: 'Vertical' + }, { + type: 'select', + span: 18, + field: 'verticalAlign', + options: [{ + label: 'TOP', + value: 0 + }, { + label: 'CENTER', + value: 1 + }, { + label: 'BOTTOM', + value: 2 + }] + }], + // Font Size + [{ + type: 'label', + span: 6, + field: 'Font Size' + }, { + type: 'number', + span: 18, + field: 'fontSize' + }], + // Line Height + [{ + type: 'label', + span: 6, + field: 'Line Height', + }, { + type: 'number', + span: 18, + field: 'lineHeight' + }], + // Overflow + [{ + type: 'label', + span: 6, + field: 'Overflow' + }, { + type: 'select', + span: 18, + field: 'overflow', + options: [{ + label: 'NONE', + value: 0 + }, { + label: 'CLAMP', + value: 1 + }, { + label: 'SHRINK', + value: 2 + }, { + label: 'RESIZE_HEIGHT', + value: 3 + }] + }], + ] } } } \ No newline at end of file diff --git a/index.html b/index.html index 0ade592..aaa57ba 100644 --- a/index.html +++ b/index.html @@ -1,6 +1,6 @@ + -
@@ -36,7 +43,7 @@
- + - - - 源码 - - - - - -
- +
+ + +
+ + + 节点树 + + + + + + + + + FPS + + + + + + + + + 帧时间 + + + + + + + + + 内存 + + + + + + + + + 源码 + + + + + + + +
+
+
+ - - - \ No newline at end of file diff --git a/screenshots/preview2.png b/screenshots/preview2.png new file mode 100644 index 0000000..399d979 Binary files /dev/null and b/screenshots/preview2.png differ diff --git a/version.json b/version.json index 85cddb1..ed2cd1a 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "name": "ccc-devtools", - "version": "1.2.7", + "version": "2.0.0", "author": "Next", "repo": "https://github.com/potato47/ccc-devtools.git" } \ No newline at end of file