From e81e8a93eb22121291d6b9f1ea70598880c38e5b Mon Sep 17 00:00:00 2001 From: JianMiau Date: Thu, 31 Mar 2022 09:00:38 +0800 Subject: [PATCH] [add] first --- README.MD | 27 +++++++++++++++++ i18n/en.js | 1 + i18n/zh.js | 1 + main.js | 1 + package.json | 20 +++++++++++++ panel/index.css | 2 ++ panel/index.html | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ panel/index.js | 12 ++++++++ panel/less.css | 68 +++++++++++++++++++++++++++++++++++++++++++ panel/scene.js | 10 +++++++ 10 files changed, 218 insertions(+) create mode 100644 README.MD create mode 100644 i18n/en.js create mode 100644 i18n/zh.js create mode 100644 main.js create mode 100644 package.json create mode 100644 panel/index.css create mode 100644 panel/index.html create mode 100644 panel/index.js create mode 100644 panel/less.css create mode 100644 panel/scene.js diff --git a/README.MD b/README.MD new file mode 100644 index 0000000..db68414 --- /dev/null +++ b/README.MD @@ -0,0 +1,27 @@ +前言: +creator提供的"查找使用"只能显示出在某个场景或预制上; +对于哪个资源、脚本用在哪个场景、哪个预制的哪个节点上并不能很清楚地表示出来。 +尤其是当项目越来越大、场景预制节点越来越多时,当不清楚资源、脚本在全部的引用位置,改动麻烦,牵一发而动全身。 +先来听听群众的呼声: +https://forum.cocos.org/t/topic/51103 +https://forum.cocos.org/t/topic/67449 +https://forum.cocos.org/t/topic/70327 +https://forum.cocos.org/t/topic/90091 + +那么问题来了,有没有一款能精确地显示出在哪个场景预制中,并且显示出节点的位置路径,还可以提供跳转的工具呢? +对,没错,find-assets插件正是你想要的。 + +使用方式: +支持两种使用方式,一种直接拖资源到面板上;一种模糊输入脚本名,再从右边列中选择完整的脚本路径 + +1、直接拖资源到assets框中,也可以把引用到该资源的场景和预制罗列出来,使用此方式可以不局限于脚本资源,也可以是场景,预制,图片,声音,动画等native-asset资源; +2、输入脚本名字后,在右边选择框中选择assets目录下对应的脚本路径(支持模糊搜索)后会自动在下方列表中列出引用到的场景和预制 +3、双条件查询。拖动资源到assets并输入脚本选择后,点击双条件查询按钮,则只显示既含有该资源和脚本的场景预制 +4、增加额外参数。对匹配到的资源进行参数对比,参数名和参数值对上才显示;一般是匹配到包含该资源的脚本,用参数对该脚本进行筛选(如gif中只显示t1属性为111的test1.js) +5、增加指定场景预制。只在该场景或预制中查询,否则默认整个assets目录。 +6、搜索结果的提示会显示是哪个资源、脚本 +7、搜索结果列表会显示场景预制名、节点名与路径、操作(高亮资源,跳转到节点,高亮节点) + +插件面板的编写借鉴了插件小王子的resource插件,不过在论坛上好像找不到有该帖子。。 + +by zilone diff --git a/i18n/en.js b/i18n/en.js new file mode 100644 index 0000000..88f94d3 --- /dev/null +++ b/i18n/en.js @@ -0,0 +1 @@ +module.exports={title:"find-assets"}; diff --git a/i18n/zh.js b/i18n/zh.js new file mode 100644 index 0000000..5c15e14 --- /dev/null +++ b/i18n/zh.js @@ -0,0 +1 @@ +module.exports={title:"\u67e5\u627e\u8d44\u6e90\u5f15\u7528\u63d2\u4ef6"}; diff --git a/main.js b/main.js new file mode 100644 index 0000000..f5cab0b --- /dev/null +++ b/main.js @@ -0,0 +1 @@ +var $jscomp$compprop0={};module.exports={load:function(){},unload:function(){},messages:($jscomp$compprop0.open=function(){Editor.Panel.open("find-assets")},$jscomp$compprop0)}; diff --git a/package.json b/package.json new file mode 100644 index 0000000..ff007f7 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "name": "find-assets", + "version": "0.0.1", + "description": "The package template for getting started.", + "author": "zilone", + "main": "main.js", + "main-menu": { + "i18n:MAIN_MENU.package.title/i18n:find-assets.title": { + "message": "find-assets:open" + } + }, + "panel": { + "main": "panel/index.js", + "type": "dockable", + "title": "find-assets", + "engineSupport": true, + "width": 500, + "height": 600 + } +} \ No newline at end of file diff --git a/panel/index.css b/panel/index.css new file mode 100644 index 0000000..2293ac0 --- /dev/null +++ b/panel/index.css @@ -0,0 +1,2 @@ +:host { margin: 5px; } +h2 { color: #f90; } \ No newline at end of file diff --git a/panel/index.html b/panel/index.html new file mode 100644 index 0000000..057d401 --- /dev/null +++ b/panel/index.html @@ -0,0 +1,76 @@ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
参数名 + +
+
参数值 + +
+
+ + +
+ + 刷新 + 清除 +
+
+ + +
+ 双条件查询 +
+
+ + +
{{resultTip}}
+
+ +
+
    +
  • +
    场景or预制
    +
    路径
    +
    操作
    +
  • +
  • +
    {{item.scene}}
    +
    {{item.path}}
    +
    + + 1 + 2 + 3 +
    +
  • +
+
+ +
diff --git a/panel/index.js b/panel/index.js new file mode 100644 index 0000000..768b571 --- /dev/null +++ b/panel/index.js @@ -0,0 +1,12 @@ +var FS=require("fire-fs"),PATH=require("fire-path"),fse=require("fs-extra"),Scene=Editor.require("packages://find-assets/panel/scene"),$jscomp$compprop0={}; +Editor.Panel.extend({style:FS.readFileSync(Editor.url("packages://find-assets/panel/less.css","utf8")),template:FS.readFileSync(Editor.url("packages://find-assets/panel/index.html","utf8")),$:{},ready:function(){window.plugin=new window.Vue({el:this.shadowRoot,created:function(){Editor.assetdb.queryAssets("db://assets/**/*","javascript",function(a,b){for(a=0;a div { + padding: 4px 6px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} +ul li .scene { + width: 200px; +} +ul li .path { + flex: 1; +} +ul li .controller { + width: 145px; +} +ul li .controller i { + margin: 0 2px; + padding: 0 4px; + cursor: pointer; +} diff --git a/panel/scene.js b/panel/scene.js new file mode 100644 index 0000000..0e545ff --- /dev/null +++ b/panel/scene.js @@ -0,0 +1,10 @@ +var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b