Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
cee17e10
T
three.js
项目概览
Ablesons
/
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,发现更多精彩内容 >>
提交
cee17e10
编写于
12月 02, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'orgicus/master'
上级
59304d8a
e90f60ec
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
3415 addition
and
0 deletion
+3415
-0
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
+1205
-0
utils/exporters/blender/2.49/slim_threejs_export.py
utils/exporters/blender/2.49/slim_threejs_export.py
+946
-0
utils/exporters/cinema4d/convert_obj_threejs_slim.py
utils/exporters/cinema4d/convert_obj_threejs_slim.py
+1205
-0
utils/exporters/cinema4d/slim_export_to_three.js.py
utils/exporters/cinema4d/slim_export_to_three.js.py
+59
-0
未找到文件。
utils/exporters/blender/2.49/convert_obj_threejs_slim.py
0 → 100644
浏览文件 @
cee17e10
此差异已折叠。
点击以展开。
utils/exporters/blender/2.49/slim_threejs_export.py
0 → 100644
浏览文件 @
cee17e10
此差异已折叠。
点击以展开。
utils/exporters/cinema4d/convert_obj_threejs_slim.py
0 → 100644
浏览文件 @
cee17e10
此差异已折叠。
点击以展开。
utils/exporters/cinema4d/slim_export_to_three.js.py
0 → 100644
浏览文件 @
cee17e10
import
c4d
from
c4d
import
*
from
c4d.documents
import
*
from
c4d
import
symbols
as
sy
,
plugins
,
utils
,
bitmaps
,
gui
import
re
,
os
,
subprocess
clean
=
lambda
varStr
:
re
.
sub
(
'\W|^(?=\d)'
,
'_'
,
varStr
)
#save obj
name
=
op
.
GetName
()
c4dPath
=
c4d
.
storage
.
GeGetC4DPath
(
sy
.
C4D_PATH_LIBRARY
)
docPath
=
doc
.
GetDocumentPath
()
objPath
=
docPath
+
'/'
+
name
+
'.obj'
mtlPath
=
docPath
+
'/'
+
name
+
'.mtl'
jsPath
=
docPath
+
'/'
+
name
+
'.js'
SaveDocument
(
doc
,
objPath
,
sy
.
SAVEFLAG_AUTOSAVE
,
sy
.
FORMAT_OBJEXPORT
)
#save mtl
mcount
=
0
;
mtl
=
''
for
tag
in
op
.
GetTags
():
if
(
tag
.
GetType
()
==
5616
):
#texture tag
mcount
+=
1
m
=
tag
.
GetMaterial
()
mtl
+=
'newmtl '
+
clean
(
m
.
GetName
())
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_COLOR_COLOR
]):
mtl
+=
'Kd '
+
str
(
m
[
sy
.
MATERIAL_COLOR_COLOR
].
x
)
+
' '
+
str
(
m
[
sy
.
MATERIAL_COLOR_COLOR
].
y
)
+
' '
+
str
(
m
[
sy
.
MATERIAL_COLOR_COLOR
].
z
)
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_SPECULAR_COLOR
]):
mtl
+=
'Ks '
+
str
(
m
[
sy
.
MATERIAL_SPECULAR_COLOR
].
x
)
+
' '
+
str
(
m
[
sy
.
MATERIAL_SPECULAR_COLOR
].
y
)
+
' '
+
str
(
m
[
sy
.
MATERIAL_SPECULAR_COLOR
].
z
)
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_SPECULAR_BRIGHTNESS
]):
mtl
+=
'Ns '
+
str
(
m
[
sy
.
MATERIAL_SPECULAR_BRIGHTNESS
])
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_TRANSPARENCY_BRIGHTNESS
]):
mtl
+=
'd '
+
str
(
m
[
sy
.
MATERIAL_TRANSPARENCY_BRIGHTNESS
])
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_COLOR_SHADER
]):
mtl
+=
'map_Kd '
+
str
(
m
[
sy
.
MATERIAL_COLOR_SHADER
][
sy
.
BITMAPSHADER_FILENAME
])
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_TRANSPARENCY_SHADER
]):
mtl
+=
'map_d '
+
str
(
m
[
sy
.
MATERIAL_COLOR_SHADER
][
sy
.
BITMAPSHADER_FILENAME
])
+
'
\n
'
if
(
m
[
sy
.
MATERIAL_BUMP_SHADER
]):
mtl
+=
'map_bump '
+
str
(
m
[
sy
.
MATERIAL_BUMP_SHADER
][
sy
.
BITMAPSHADER_FILENAME
])
+
'
\n
'
mtl
+=
'illum 0
\n\n\n
'
#TODO: setup the illumination, ambient and optical density
mtl
=
'# Material Count: '
+
str
(
mcount
)
+
'
\n
'
+
mtl
file
=
open
(
mtlPath
,
'w'
)
file
.
write
(
mtl
)
file
.
close
()
#convert
convert
=
[
'python'
,
c4dPath
+
'/scripts/convert_obj_threejs_slim.py'
,
'-i'
,
objPath
,
'-o'
,
jsPath
]
try
:
# Start the process
p
=
subprocess
.
Popen
(
convert
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
# Block while process is running
while
p
.
poll
()
==
None
:
# Write stdout to file
'''
f = open(docPath+'/'+name+'_log.txt', 'a')
for l in p.stdout.readlines():
f.write(l)
f.close()
'''
pass
print
'done'
os
.
remove
(
objPath
)
os
.
remove
(
mtlPath
)
# Error runinng shell script
except
subprocess
.
CalledProcessError
:
print
'error!'
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录