Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
14c162c3
Commit
14c162c3
authored
13 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
remove HQ normals export option which wasnt working, simplify polygroup export code.
parent
29d1bd81
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
io_scene_obj/__init__.py
+11
-15
11 additions, 15 deletions
io_scene_obj/__init__.py
io_scene_obj/export_obj.py
+6
-25
6 additions, 25 deletions
io_scene_obj/export_obj.py
with
17 additions
and
40 deletions
io_scene_obj/__init__.py
+
11
−
15
View file @
14c162c3
...
@@ -217,7 +217,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
...
@@ -217,7 +217,7 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
)
)
use_animation
=
BoolProperty
(
use_animation
=
BoolProperty
(
name
=
"
Animation
"
,
name
=
"
Animation
"
,
description
=
""
,
description
=
"
Write out an OBJ for each frame
"
,
default
=
False
,
default
=
False
,
)
)
...
@@ -230,33 +230,28 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
...
@@ -230,33 +230,28 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
# extra data group
# extra data group
use_edges
=
BoolProperty
(
use_edges
=
BoolProperty
(
name
=
"
Edges
"
,
name
=
"
Include
Edges
"
,
description
=
""
,
description
=
""
,
default
=
True
,
default
=
True
,
)
)
use_normals
=
BoolProperty
(
use_normals
=
BoolProperty
(
name
=
"
Normals
"
,
name
=
"
Include
Normals
"
,
description
=
""
,
description
=
""
,
default
=
False
,
default
=
False
,
)
)
use_hq_normals
=
BoolProperty
(
name
=
"
High Quality Normals
"
,
description
=
""
,
default
=
True
,
)
use_uvs
=
BoolProperty
(
use_uvs
=
BoolProperty
(
name
=
"
UVs
"
,
name
=
"
Include
UVs
"
,
description
=
""
,
description
=
"
Write out the active UV coordinates
"
,
default
=
True
,
default
=
True
,
)
)
use_materials
=
BoolProperty
(
use_materials
=
BoolProperty
(
name
=
"
Materials
"
,
name
=
"
Write
Materials
"
,
description
=
""
,
description
=
"
Write out the MTL file
"
,
default
=
True
,
default
=
True
,
)
)
use_triangles
=
BoolProperty
(
use_triangles
=
BoolProperty
(
name
=
"
Triangulate
"
,
name
=
"
Triangulate
Faces
"
,
description
=
""
,
description
=
"
Convert all faces to triangles
"
,
default
=
False
,
default
=
False
,
)
)
use_vertex_groups
=
BoolProperty
(
use_vertex_groups
=
BoolProperty
(
...
@@ -266,7 +261,8 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
...
@@ -266,7 +261,8 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
)
)
use_nurbs
=
BoolProperty
(
use_nurbs
=
BoolProperty
(
name
=
"
Nurbs
"
,
name
=
"
Nurbs
"
,
description
=
""
,
description
=
"
Write nurbs curves as OBJ nurbs rather then
"
"
converting to geometry
"
,
default
=
False
,
default
=
False
,
)
)
...
...
This diff is collapsed.
Click to expand it.
io_scene_obj/export_obj.py
+
6
−
25
View file @
14c162c3
...
@@ -215,7 +215,6 @@ def write_file(filepath, objects, scene,
...
@@ -215,7 +215,6 @@ def write_file(filepath, objects, scene,
EXPORT_TRI
=
False
,
EXPORT_TRI
=
False
,
EXPORT_EDGES
=
False
,
EXPORT_EDGES
=
False
,
EXPORT_NORMALS
=
False
,
EXPORT_NORMALS
=
False
,
EXPORT_NORMALS_HQ
=
False
,
EXPORT_UV
=
True
,
EXPORT_UV
=
True
,
EXPORT_MTL
=
True
,
EXPORT_MTL
=
True
,
EXPORT_APPLY_MODIFIERS
=
True
,
EXPORT_APPLY_MODIFIERS
=
True
,
...
@@ -255,16 +254,12 @@ def write_file(filepath, objects, scene,
...
@@ -255,16 +254,12 @@ def write_file(filepath, objects, scene,
"""
"""
weightDict
=
{}
weightDict
=
{}
for
vert_index
in
face
.
vertices
:
for
vert_index
in
face
.
vertices
:
# for vert in face:
vWeights
=
vWeightMap
[
vert_index
]
vWeights
=
vWeightMap
[
vert_index
]
# vWeights = vWeightMap[vert]
for
vGroupName
,
weight
in
vWeights
:
for
vGroupName
,
weight
in
vWeights
:
weightDict
[
vGroupName
]
=
weightDict
.
get
(
vGroupName
,
0
)
+
weight
weightDict
[
vGroupName
]
=
weightDict
.
get
(
vGroupName
,
0.
0
)
+
weight
if
weightDict
:
if
weightDict
:
alist
=
[(
weight
,
vGroupName
)
for
vGroupName
,
weight
in
weightDict
.
items
()]
# sort least to greatest amount of weight
return
max
((
weight
,
vGroupName
)
for
vGroupName
,
weight
in
weightDict
.
items
())[
1
]
alist
.
sort
()
return
(
alist
[
-
1
][
1
])
# highest value last
else
:
else
:
return
'
(null)
'
return
'
(null)
'
...
@@ -369,17 +364,8 @@ def write_file(filepath, objects, scene,
...
@@ -369,17 +364,8 @@ def write_file(filepath, objects, scene,
continue
# dont bother with this mesh.
continue
# dont bother with this mesh.
# XXX
# High Quality Normals
if
EXPORT_NORMALS
and
face_index_pairs
:
if
EXPORT_NORMALS
and
face_index_pairs
:
me
.
calc_normals
()
me
.
calc_normals
()
# if EXPORT_NORMALS_HQ:
# BPyMesh.meshCalcNormals(me)
# else:
# # transforming normals is incorrect
# # when the matrix is scaled,
# # better to recalculate them
# me.calcNormals()
materials
=
me
.
materials
[:]
materials
=
me
.
materials
[:]
material_names
=
[
m
.
name
if
m
else
None
for
m
in
materials
]
material_names
=
[
m
.
name
if
m
else
None
for
m
in
materials
]
...
@@ -478,14 +464,13 @@ def write_file(filepath, objects, scene,
...
@@ -478,14 +464,13 @@ def write_file(filepath, objects, scene,
# XXX
# XXX
if
EXPORT_POLYGROUPS
:
if
EXPORT_POLYGROUPS
:
# Retrieve the list of vertex groups
# Retrieve the list of vertex groups
vertGroupNames
=
[
g
.
name
for
g
in
ob
.
vertex_groups
]
vertGroupNames
=
ob
.
vertex_groups
.
keys
()
currentVGroup
=
''
currentVGroup
=
''
# Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
# Create a dictionary keyed by face id and listing, for each vertex, the vertex groups it belongs to
vgroupsMap
=
[[]
for
_i
in
range
(
len
(
me_verts
))]
vgroupsMap
=
[[]
for
_i
in
range
(
len
(
me_verts
))]
for
v_idx
,
v
in
enumerate
(
me
.
vertices
):
for
v_idx
,
v_ls
in
enumerate
(
vgroupsMap
):
for
g
in
v
.
groups
:
v_ls
[:]
=
[(
vertGroupNames
[
g
.
group
],
g
.
weight
)
for
g
in
me_verts
[
v_idx
].
groups
]
vgroupsMap
[
v_idx
].
append
((
vertGroupNames
[
g
.
group
],
g
.
weight
))
for
f
,
f_index
in
face_index_pairs
:
for
f
,
f_index
in
face_index_pairs
:
f_smooth
=
f
.
use_smooth
f_smooth
=
f
.
use_smooth
...
@@ -506,7 +491,7 @@ def write_file(filepath, objects, scene,
...
@@ -506,7 +491,7 @@ def write_file(filepath, objects, scene,
if
ob
.
vertex_groups
:
if
ob
.
vertex_groups
:
# find what vertext group the face belongs to
# find what vertext group the face belongs to
theVGroup
=
findVertexGroupName
(
f
,
vgroupsMap
)
theVGroup
=
findVertexGroupName
(
f
,
vgroupsMap
)
if
theVGroup
!=
currentVGroup
:
if
theVGroup
!=
currentVGroup
:
currentVGroup
=
theVGroup
currentVGroup
=
theVGroup
file
.
write
(
'
g %s
\n
'
%
theVGroup
)
file
.
write
(
'
g %s
\n
'
%
theVGroup
)
...
@@ -639,7 +624,6 @@ def _write(context, filepath,
...
@@ -639,7 +624,6 @@ def _write(context, filepath,
EXPORT_TRI
,
# ok
EXPORT_TRI
,
# ok
EXPORT_EDGES
,
EXPORT_EDGES
,
EXPORT_NORMALS
,
# not yet
EXPORT_NORMALS
,
# not yet
EXPORT_NORMALS_HQ
,
# not yet
EXPORT_UV
,
# ok
EXPORT_UV
,
# ok
EXPORT_MTL
,
EXPORT_MTL
,
EXPORT_APPLY_MODIFIERS
,
# ok
EXPORT_APPLY_MODIFIERS
,
# ok
...
@@ -691,7 +675,6 @@ def _write(context, filepath,
...
@@ -691,7 +675,6 @@ def _write(context, filepath,
EXPORT_TRI
,
EXPORT_TRI
,
EXPORT_EDGES
,
EXPORT_EDGES
,
EXPORT_NORMALS
,
EXPORT_NORMALS
,
EXPORT_NORMALS_HQ
,
EXPORT_UV
,
EXPORT_UV
,
EXPORT_MTL
,
EXPORT_MTL
,
EXPORT_APPLY_MODIFIERS
,
EXPORT_APPLY_MODIFIERS
,
...
@@ -723,7 +706,6 @@ def save(operator, context, filepath="",
...
@@ -723,7 +706,6 @@ def save(operator, context, filepath="",
use_triangles
=
False
,
use_triangles
=
False
,
use_edges
=
True
,
use_edges
=
True
,
use_normals
=
False
,
use_normals
=
False
,
use_hq_normals
=
False
,
use_uvs
=
True
,
use_uvs
=
True
,
use_materials
=
True
,
use_materials
=
True
,
use_apply_modifiers
=
True
,
use_apply_modifiers
=
True
,
...
@@ -743,7 +725,6 @@ def save(operator, context, filepath="",
...
@@ -743,7 +725,6 @@ def save(operator, context, filepath="",
EXPORT_TRI
=
use_triangles
,
EXPORT_TRI
=
use_triangles
,
EXPORT_EDGES
=
use_edges
,
EXPORT_EDGES
=
use_edges
,
EXPORT_NORMALS
=
use_normals
,
EXPORT_NORMALS
=
use_normals
,
EXPORT_NORMALS_HQ
=
use_hq_normals
,
EXPORT_UV
=
use_uvs
,
EXPORT_UV
=
use_uvs
,
EXPORT_MTL
=
use_materials
,
EXPORT_MTL
=
use_materials
,
EXPORT_APPLY_MODIFIERS
=
use_apply_modifiers
,
EXPORT_APPLY_MODIFIERS
=
use_apply_modifiers
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment