Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Ablesons
three.js
提交
1fc403c4
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,发现更多精彩内容 >>
提交
1fc403c4
编写于
7月 24, 2012
作者:
A
alteredq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changed skinning export in Blender to use the most influencing bones.
上级
24ca8588
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
33 deletion
+30
-33
utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py
...der/2.63/scripts/addons/io_mesh_threejs/export_threejs.py
+30
-33
未找到文件。
utils/exporters/blender/2.63/scripts/addons/io_mesh_threejs/export_threejs.py
浏览文件 @
1fc403c4
...
...
@@ -718,15 +718,16 @@ def generate_bones(option_bones, flipyz):
# ##############################################################################
# Model exporter - skin indices
# Model exporter - skin indices
and weights
# ##############################################################################
def
generate_indices
(
meshes
,
option_skinning
):
def
generate_indices
_and_weights
(
meshes
,
option_skinning
):
if
not
option_skinning
:
return
""
indices
=
[]
weights
=
[]
armature
=
bpy
.
data
.
armatures
[
0
]
...
...
@@ -743,55 +744,50 @@ def generate_indices(meshes, option_skinning):
i
+=
1
if
mesh_index
==
-
1
:
print
(
"generate_indices: couldn't find mesh"
,
mesh
.
name
)
print
(
"generate_indices: couldn't find
object for
mesh"
,
mesh
.
name
)
continue
object
=
bpy
.
data
.
objects
[
mesh_index
]
for
vertex
in
mesh
.
vertices
:
for
vgroup
in
range
(
MAX_INFLUENCES
):
if
vgroup
<
len
(
vertex
.
groups
):
# sort bones by influence
group_index
=
vertex
.
groups
[
vgroup
].
group
bone_array
=
[]
index
=
0
for
group
in
vertex
.
groups
:
index
=
group
.
group
weight
=
group
.
weight
for
bone
in
armature
.
bones
:
if
object
.
vertex_groups
[
group_index
].
name
==
bone
.
name
:
indices
.
append
(
'%d'
%
index
)
bone_array
.
append
(
(
index
,
weight
)
)
index
+=
1
else
:
indices
.
append
(
'0'
)
bone_array
.
sort
(
key
=
operator
.
itemgetter
(
1
),
reverse
=
True
)
indices_string
=
","
.
join
(
indices
)
# select first N bones
return
indices_string
for
i
in
range
(
MAX_INFLUENCES
):
if
i
<
len
(
bone_array
):
bone_proxy
=
bone_array
[
i
]
# ##############################################################################
# Model exporter - skin weights
# ##############################################################################
index
=
bone_proxy
[
0
]
weight
=
bone_proxy
[
1
]
def
generate_weights
(
vertices
,
option_skinning
):
for
j
,
bone
in
enumerate
(
armature
.
bones
):
if
object
.
vertex_groups
[
index
].
name
==
bone
.
name
:
indices
.
append
(
'%d'
%
j
)
weights
.
append
(
'%g'
%
weight
)
break
if
not
option_skinning
:
return
""
weights
=
[]
else
:
indices
.
append
(
'0'
)
weights
.
append
(
'0'
)
for
vertex
in
vertices
:
for
vgroup
in
range
(
MAX_INFLUENCES
):
if
vgroup
<
len
(
vertex
.
groups
):
weights
.
append
(
'%g'
%
(
vertex
.
groups
[
vgroup
].
weight
))
else
:
weights
.
append
(
'0'
)
indices_string
=
","
.
join
(
indices
)
weights_string
=
","
.
join
(
weights
)
return
weights_string
return
indices_string
,
weights_string
# ##############################################################################
...
...
@@ -1281,6 +1277,7 @@ def generate_ascii_model(meshes, morphs,
faces_string
,
nfaces
=
generate_faces
(
normals
,
uvs
,
colors
,
meshes
,
option_normals
,
option_colors
,
option_uv_coords
,
option_materials
,
option_faces
)
bones_string
,
nbone
=
generate_bones
(
option_bones
,
flipyz
)
indices_string
,
weights_string
=
generate_indices_and_weights
(
meshes
,
option_skinning
)
materials_string
=
",
\n\n
"
.
join
(
materials
)
...
...
@@ -1300,8 +1297,8 @@ def generate_ascii_model(meshes, morphs,
"morphTargets"
:
morphTargets_string
,
"bones"
:
bones_string
,
"indices"
:
generate_indices
(
meshes
,
option_skinning
)
,
"weights"
:
generate_weights
(
vertices
,
option_skinning
)
,
"indices"
:
indices_string
,
"weights"
:
weights_string
,
"animation"
:
generate_animation
(
option_animation_skeletal
,
option_frame_step
,
flipyz
)
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录