Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
b8a76997
T
three.js
项目概览
车家大少爷
/
three.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
three.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b8a76997
编写于
4月 28, 2019
作者:
M
Mr.doob
提交者:
GitHub
4月 28, 2019
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #16349 from Mugen87/dev30
Utils: Clean up
上级
f87352b0
11411f92
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
21 deletion
+24
-21
utils/modularize.js
utils/modularize.js
+1
-1
utils/packLDrawModel.js
utils/packLDrawModel.js
+23
-20
未找到文件。
utils/modularize.js
浏览文件 @
b8a76997
...
...
@@ -144,4 +144,4 @@ function convert( path, ignoreList ) {
fs
.
writeFileSync
(
dstFolder
+
path
,
output
,
'
utf-8
'
);
}
;
}
utils/packLDrawModel.js
浏览文件 @
b8a76997
...
...
@@ -26,8 +26,10 @@ var fs = require( 'fs' );
var
path
=
require
(
'
path
'
);
if
(
process
.
argv
.
length
!==
3
)
{
console
.
log
(
"
Usage: node packLDrawModel <modelFilePath>
"
);
exit
(
0
);
exit
(
0
);
}
var
fileName
=
process
.
argv
[
2
];
...
...
@@ -61,14 +63,18 @@ for ( var i = 0; i < listOfNotFound.length; i ++ ) {
}
if
(
someNotFound
)
{
console
.
log
(
"
Some files were not found, aborting.
"
);
process
.
exit
(
-
1
);
process
.
exit
(
-
1
);
}
// Obtain packed content
var
packedContent
=
materialsContent
+
"
\n
"
;
for
(
var
i
=
objectsPaths
.
length
-
1
;
i
>=
0
;
i
--
)
{
packedContent
+=
objectsContents
[
i
];
}
packedContent
+=
"
\n
"
;
...
...
@@ -92,7 +98,7 @@ function parseObject( fileName, isRoot ) {
var
prefix
=
""
;
var
objectContent
=
null
;
for
(
var
attempt
=
0
;
attempt
<
2
;
attempt
++
)
{
for
(
var
attempt
=
0
;
attempt
<
2
;
attempt
++
)
{
prefix
=
""
;
...
...
@@ -106,8 +112,7 @@ function parseObject( fileName, isRoot ) {
prefix
=
"
p/
"
;
}
else
if
(
fileName
.
startsWith
(
'
s/
'
)
)
{
}
else
if
(
fileName
.
startsWith
(
'
s/
'
)
)
{
prefix
=
"
parts/
"
;
...
...
@@ -120,8 +125,7 @@ function parseObject( fileName, isRoot ) {
objectContent
=
fs
.
readFileSync
(
absoluteObjectPath
,
{
encoding
:
"
utf8
"
}
);
break
;
}
catch
(
e
)
{
}
catch
(
e
)
{
prefix
=
"
parts/
"
;
absoluteObjectPath
=
path
.
join
(
ldrawPath
,
prefix
,
fileName
);
...
...
@@ -131,8 +135,7 @@ function parseObject( fileName, isRoot ) {
objectContent
=
fs
.
readFileSync
(
absoluteObjectPath
,
{
encoding
:
"
utf8
"
}
);
break
;
}
catch
(
e
)
{
}
catch
(
e
)
{
prefix
=
"
p/
"
;
absoluteObjectPath
=
path
.
join
(
ldrawPath
,
prefix
,
fileName
);
...
...
@@ -142,8 +145,7 @@ function parseObject( fileName, isRoot ) {
objectContent
=
fs
.
readFileSync
(
absoluteObjectPath
,
{
encoding
:
"
utf8
"
}
);
break
;
}
catch
(
e
)
{
}
catch
(
e
)
{
try
{
...
...
@@ -153,8 +155,8 @@ function parseObject( fileName, isRoot ) {
objectContent
=
fs
.
readFileSync
(
absoluteObjectPath
,
{
encoding
:
"
utf8
"
}
);
break
;
}
catch
(
e
)
{
}
catch
(
e
)
{
if
(
attempt
===
1
)
{
// The file has not been found, add to list of not found
...
...
@@ -184,7 +186,7 @@ function parseObject( fileName, isRoot ) {
if
(
objectContent
.
indexOf
(
'
\r\n
'
)
!==
-
1
)
{
// This is faster than String.split with regex that splits on both
objectContent
=
objectContent
.
replace
(
/
\r\n
/g
,
'
\n
'
);
objectContent
=
objectContent
.
replace
(
/
\r\n
/g
,
'
\n
'
);
}
...
...
@@ -201,7 +203,7 @@ function parseObject( fileName, isRoot ) {
var
charIndex
=
0
;
while
(
(
line
.
charAt
(
charIndex
)
===
'
'
||
line
.
charAt
(
charIndex
)
===
'
\t
'
)
&&
charIndex
<
lineLength
)
{
charIndex
++
;
charIndex
++
;
}
line
=
line
.
substring
(
charIndex
);
...
...
@@ -209,7 +211,7 @@ function parseObject( fileName, isRoot ) {
charIndex
=
0
;
if
(
line
.
startsWith
(
'
0 FILE
'
)
)
{
if
(
line
.
startsWith
(
'
0 FILE
'
)
)
{
if
(
i
===
0
)
{
...
...
@@ -238,6 +240,7 @@ function parseObject( fileName, isRoot ) {
}
if
(
line
.
startsWith
(
'
1
'
)
)
{
// Subobject, add it
charIndex
=
2
;
...
...
@@ -247,14 +250,14 @@ function parseObject( fileName, isRoot ) {
// Skip token
while
(
line
.
charAt
(
charIndex
)
!==
'
'
&&
line
.
charAt
(
charIndex
)
!==
'
\t
'
&&
charIndex
<
lineLength
)
{
charIndex
++
;
charIndex
++
;
}
// Skip spaces/tabs
while
(
(
line
.
charAt
(
charIndex
)
===
'
'
||
line
.
charAt
(
charIndex
)
===
'
\t
'
)
&&
charIndex
<
lineLength
)
{
charIndex
++
;
charIndex
++
;
}
...
...
@@ -280,8 +283,7 @@ function parseObject( fileName, isRoot ) {
}
}
else
{
}
else
{
processedObjectContent
+=
line
+
"
\n
"
;
...
...
@@ -297,4 +299,5 @@ function parseObject( fileName, isRoot ) {
}
return
objectPath
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录