Skip to content

Commit

Permalink
kodbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jymusic0663 committed May 13, 2024
1 parent 7edd448 commit a272d82
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 63 deletions.
31 changes: 10 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,19 @@
<h1>D3ModelViewer</h1>
# D3ModelViewer

**D3ModelViewer**一个基于Three.js的用于在可道云KodExplorer与KodBox中查看3d模型的插件,支持常用的fbx,obj,gltf,glb,bvh,3ds,ply,stl,usdz,3dm文件格式

<b>D3ModelViewer</b>一个基于Three.js的用于在<a href="https://github.com/kalcaddle/KodExplorer" >可道云</a>中查看3d模型的插件,支持常用的fbx,obj,gltf,glb,bvh,3ds,ply,stl,usdz,3dm文件格式
## 版本说明

<b>插件安装说明:</b>
<ol>
* main分支为KodExplorer版本
* kodbox分支为KodBox版本

<li>安装此插件请保证可道云的文件夹(KodExplorer)存放在服务器根目录,以保证各文件的准确获取;</li>

<li>插件解压后放置在<code>/KodExplorer/plugins/</code>文件夹下即可。</li>
</ol>
## 插件安装说明

<hr/>


D3ModelViewer is a Three.js based plugin for viewing 3D models in <a href="https://github.com/kalcaddle/KodExplorer" >KodExplorer</a>, supporting commonly used file formats such as fbx, obj, gltf, glb, bvh, 3ds, ply, stl, USDZ, 3DM

<b>Plugin installation instructions:</b>
<ol>

<li>Please ensure that the KodExplorer folder for installing this plugin is stored in the server root directory to ensure accurate retrieval of all files;</li>

<li>After extracting the plugin, place it in the <code>/KodExplorer/plugins/</code> folder.</li>
</ol>
插件解压后放置在`/plugins`文件夹下,然后登录可道云后台插件中心启用即可。

## 演示视频

以KodExplorer为例,KodBox操作方法相似

https://github.com/xuc7950/D3ModelViewer/assets/45794709/1400120b-81e6-475f-9951-0072b61b1736
<video controls src="https://github.com/xuc7950/D3ModelViewer/assets/45794709/1400120b-81e6-475f-9951-0072b61b1736" />

17 changes: 8 additions & 9 deletions app.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,22 @@ function __construct() {
parent::__construct();
}

public function regiest() {
$this->hookRegiest(array(
public function regist() {
$this->hookRegist(array(
'user.commonJs.insert' => 'D3ModelViewerPlugin.echoJs'
));
}

public function echoJs($st, $act) {
if ($this->isFileExtence($st, $act)) {
public function echoJs() {
//if ($this->isFileExtence($st, $act)) {
$this->echoFile('static/main.js');
}
//}
}

public function index() {
$path = _DIR($this->in['path']);
$fileUrl = _make_file_proxy($path);
$fileName = get_path_this(rawurldecode($this->in['path']));
$fileName = htmlspecialchars($fileName);
$path = $this->filePath($this->in['path']);
$fileUrl = $this->filePathLink($this->in['path']) . '&name=/' . $this->in['name'];
$fileName = $this->in['name'];
include($this->pluginPath . 'static/page.html');
}
}
37 changes: 18 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
{
"id": "D3ModelViewer",
"name": "{{LNG.D3ModelViewer.meta.name}}",
"title": "{{LNG.D3ModelViewer.meta.title}}",
"name": "{{LNG['D3ModelViewer.meta.name']}}",
"title": "{{LNG['D3ModelViewer.meta.title']}}",
"version": "1.0",
"category": "file",
"source": {
"icon": "{{pluginHost}}static/images/icon.png"
},
"description": "{{LNG.D3ModelViewer.meta.desc}}",
"description": "{{LNG['D3ModelViewer.meta.desc']}}",
"auther": {
"copyright": "mengkun",
"homePage": "https://mkblog.cn"
},
"configItem": {
"formStyle": {
"className": "form-box-title-left",
"tabs": [{
"name": "{{LNG.Plugin.tab.basic}}",
"field": ["pluginAuth", "pluginAuthOpen", "sep001", "openWith"]
}]
"tabs": {
"{{LNG['admin.setting.base']}}": "pluginAuth,sep001,openWith"
}
},
"pluginAuth": {
"type": "userSelect",
"value": "all:1",
"display": "{{LNG.Plugin.config.auth}}",
"desc": "{{LNG.Plugin.config.authDesc}}",
"value": {"all": 1},
"display": "{{LNG['admin.plugin.auth']}}",
"desc": "{{LNG['admin.plugin.authDesc']}}",
"require": 1
},
"sep001": "<hr/>",
"openWith": {
"type": "radio",
"value": "dialog",
"display": "{{LNG.Plugin.Config.openWith}}",
"info": [
["dialog", "{{LNG.Plugin.Config.openWithDilog}}"],
["window", "{{LNG.Plugin.Config.openWithWindow}}"]
]
"display": "{{LNG['admin.plugin.openWith']}}",
"info": {
"dialog": "{{LNG['admin.plugin.openWithDilog']}}",
"window": "{{LNG['admin.plugin.openWithWindow']}}"
}
},
"fileExt": {
"type": "tags",
"display": "{{LNG.Plugin.Config.fileExt}}",
"desc": "{{LNG.Plugin.Config.fileExtDesc}}",
"display": "{{LNG['admin.plugin.fileExt']}}",
"desc": "{{LNG['admin.plugin.fileExtDesc']}}",
"value": "fbx,obj,gltf,glb,bvh,3ds,ply,stl,usdz,3dm"
},
"fileSort": {
"type": "number",
"display": "{{LNG.Plugin.Config.fileSort}}",
"desc": "{{LNG.Plugin.Config.fileSortDesc}}",
"display": "{{LNG['admin.plugin.fileSort']}}",
"desc": "{{LNG['admin.plugin.fileSortDesc']}}",
"value": 10
}
}
Expand Down
23 changes: 10 additions & 13 deletions static/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
kodReady.push(function() {
kodApp.add({
name: "D3ModelViewer",
title: "{{LNG.D3ModelViewer.meta.name}}",
icon: "{{pluginHost}}static/images/icon.png",
ext: "{{config.fileExt}}",
sort: "{{config.fileSort}}",
callback: function(path, ext) {
var url = '{{pluginApi}}&path=' + core.pathCommon(path);
if ('window' == "{{config.openWith}}" && !core.isFileView()) {
window.open(url);
} else {
core.openDialog(url, core.icon(ext), htmlEncode(core.pathThis(path)));
Events.bind('explorer.kodApp.before', function(appList) {
appList.push({
name: "D3ModelViewer",
title: "{{LNG['D3ModelViewer.meta.name']}}",
icon: '{{pluginHost}}static/images/icon.png',
ext: "{{config.fileExt}}",
sort: "{{config.fileSort}}",
callback: function(path, ext) {
core.openFile('{{pluginApi}}', "{{config.openWith}}", _.toArray(arguments));
}
}
});
});
});
2 changes: 1 addition & 1 deletion static/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<title><?php echo $fileName . ' - ' . LNG('kod_name') . LNG('kod_power_by'); ?></title>
<title><?php echo $fileName; ?></title>
<meta itemprop="image" content="<?php echo $this->pluginHost;?>static/images/icon.png" />
<link href="<?php echo $this->pluginHost;?>static/images/icon.png" rel="Shortcut Icon" type="image/x-icon">
<link href="<?php echo $this->pluginHost;?>static/images/icon.png" rel="icon" type="image/x-icon">
Expand Down

0 comments on commit a272d82

Please sign in to comment.