Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
车家大少爷
three.js
提交
55baeb7e
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,发现更多精彩内容 >>
提交
55baeb7e
编写于
11月 11, 2010
作者:
M
Mr.doob
浏览文件
操作
浏览文件
下载
差异文件
Merge remote branch 'alteredq/master'
上级
237c6656
f9ec9325
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
35 addition
and
29 deletion
+35
-29
utils/exporters/blender/2.54/scripts/op/io_mesh_threejs/export_threejs.py
...blender/2.54/scripts/op/io_mesh_threejs/export_threejs.py
+1
-1
utils/exporters/blender/2.54/scripts/op/io_mesh_threejs_slim/export_threejs_slim.py
...54/scripts/op/io_mesh_threejs_slim/export_threejs_slim.py
+34
-28
未找到文件。
utils/exporters/blender/2.54/scripts/op/io_mesh_threejs/export_threejs.py
浏览文件 @
55baeb7e
...
...
@@ -100,7 +100,7 @@ def save(operator, context, filepath="", use_modifiers=True, use_normals=True, u
# incase
color
=
uvcoord
=
uvcoord_key
=
normal
=
normal_key
=
None
file
.
write
(
'// Generated with Blender
2.54 exporter
\n
'
)
file
.
write
(
'// Generated with Blender
exporter (compatible with Blender 2.54 / 2.55)
\n
'
)
file
.
write
(
'// http://github.com/mrdoob/three.js/tree/master/utils/exporters/blender
\n\n
'
)
file
.
write
(
'var %s = function () {
\n\n
'
%
classname
)
...
...
utils/exporters/blender/2.54/scripts/op/io_mesh_threejs_slim/export_threejs_slim.py
浏览文件 @
55baeb7e
...
...
@@ -55,7 +55,7 @@ TEMPLATE_FILE_ASCII = """\
// faces: %(nface)d
// materials: %(nmaterial)d
//
// Generated with Blender
2.54 slim exporter
// Generated with Blender
slim exporter (compatible with Blender 2.54 / 2.55)
// https://github.com/alteredq/three.js/tree/master/utils/exporters/blender/
...
...
@@ -453,31 +453,32 @@ def extract_materials(mesh, scene):
materials
=
{}
for
m
in
mesh
.
materials
:
materials
[
m
.
name
]
=
{}
materials
[
m
.
name
][
'col_diffuse'
]
=
[
m
.
diffuse_intensity
*
m
.
diffuse_color
[
0
],
m
.
diffuse_intensity
*
m
.
diffuse_color
[
1
],
m
.
diffuse_intensity
*
m
.
diffuse_color
[
2
]]
materials
[
m
.
name
][
'col_specular'
]
=
[
m
.
specular_intensity
*
m
.
specular_color
[
0
],
m
.
specular_intensity
*
m
.
specular_color
[
1
],
m
.
specular_intensity
*
m
.
specular_color
[
2
]]
materials
[
m
.
name
][
'col_ambient'
]
=
[
m
.
ambient
*
world
.
ambient_color
[
0
],
m
.
ambient
*
world
.
ambient_color
[
1
],
m
.
ambient
*
world
.
ambient_color
[
2
]]
materials
[
m
.
name
][
'transparency'
]
=
m
.
alpha
# not sure about mapping values to Blinn-Phong shader
# Blender uses INT from [1,511] with default 0
# http://www.blender.org/documentation/blender_python_api_2_54_0/bpy.types.Material.html#bpy.types.Material.specular_hardness
materials
[
m
.
name
][
"specular_coef"
]
=
m
.
specular_hardness
if
m
.
active_texture
and
m
.
active_texture
.
type
==
'IMAGE'
:
fn
=
bpy
.
path
.
abspath
(
m
.
active_texture
.
image
.
filepath
)
fn
=
os
.
path
.
normpath
(
fn
)
fn_strip
=
os
.
path
.
basename
(
fn
)
materials
[
m
.
name
][
'map_diffuse'
]
=
fn_strip
if
m
:
materials
[
m
.
name
]
=
{}
materials
[
m
.
name
][
'col_diffuse'
]
=
[
m
.
diffuse_intensity
*
m
.
diffuse_color
[
0
],
m
.
diffuse_intensity
*
m
.
diffuse_color
[
1
],
m
.
diffuse_intensity
*
m
.
diffuse_color
[
2
]]
materials
[
m
.
name
][
'col_specular'
]
=
[
m
.
specular_intensity
*
m
.
specular_color
[
0
],
m
.
specular_intensity
*
m
.
specular_color
[
1
],
m
.
specular_intensity
*
m
.
specular_color
[
2
]]
materials
[
m
.
name
][
'col_ambient'
]
=
[
m
.
ambient
*
world
.
ambient_color
[
0
],
m
.
ambient
*
world
.
ambient_color
[
1
],
m
.
ambient
*
world
.
ambient_color
[
2
]]
materials
[
m
.
name
][
'transparency'
]
=
m
.
alpha
# not sure about mapping values to Blinn-Phong shader
# Blender uses INT from [1,511] with default 0
# http://www.blender.org/documentation/blender_python_api_2_54_0/bpy.types.Material.html#bpy.types.Material.specular_hardness
materials
[
m
.
name
][
"specular_coef"
]
=
m
.
specular_hardness
if
m
.
active_texture
and
m
.
active_texture
.
type
==
'IMAGE'
:
fn
=
bpy
.
path
.
abspath
(
m
.
active_texture
.
image
.
filepath
)
fn
=
os
.
path
.
normpath
(
fn
)
fn_strip
=
os
.
path
.
basename
(
fn
)
materials
[
m
.
name
][
'map_diffuse'
]
=
fn_strip
return
materials
...
...
@@ -486,8 +487,13 @@ def generate_materials_string(mesh, scene):
random
.
seed
(
42
)
# to get well defined color order for debug materials
materials
=
{}
for
i
,
m
in
enumerate
(
mesh
.
materials
):
materials
[
m
.
name
]
=
i
if
mesh
.
materials
:
for
i
,
m
in
enumerate
(
mesh
.
materials
):
if
m
:
materials
[
m
.
name
]
=
i
else
:
materials
[
"undefined_dummy_%0d"
%
i
]
=
i
if
not
materials
:
materials
=
{
'default'
:
0
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录