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
f612ac77
Commit
f612ac77
authored
11 years ago
by
Chris Foster
Browse files
Options
Downloads
Patches
Plain Diff
Variable name refactor.
parent
5655aab7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_scene_x/export_x.py
+27
-27
27 additions, 27 deletions
io_scene_x/export_x.py
with
27 additions
and
27 deletions
io_scene_x/export_x.py
+
27
−
27
View file @
f612ac77
...
...
@@ -403,14 +403,14 @@ class MeshExportObject(ExportObject):
def
__init__
(
self
,
Mesh
):
self
.
Mesh
=
Mesh
# self.vertices and self.PolygonVertexInd
ex
es relate to the
# self.vertices and self.PolygonVertexInd
ic
es relate to the
# original mesh in the following way:
# Mesh.vertices[Mesh.polygons[x].vertices[y]] ==
# self.vertices[self.PolygonVertexInd
ex
es[x][y]]
# self.vertices[self.PolygonVertexInd
ic
es[x][y]]
self
.
vertices
=
None
self
.
PolygonVertexInd
ex
es
=
None
self
.
PolygonVertexInd
ic
es
=
None
# Represents the mesh as it is inside Blender
class
_OneToOneMeshEnumerator
(
_MeshEnumerator
):
...
...
@@ -419,7 +419,7 @@ class MeshExportObject(ExportObject):
self
.
vertices
=
Mesh
.
vertices
self
.
PolygonVertexInd
ex
es
=
tuple
(
tuple
(
Polygon
.
vertices
)
self
.
PolygonVertexInd
ic
es
=
tuple
(
tuple
(
Polygon
.
vertices
)
for
Polygon
in
Mesh
.
polygons
)
# Duplicates each vertex for each face
...
...
@@ -432,10 +432,10 @@ class MeshExportObject(ExportObject):
self
.
vertices
+=
tuple
(
Mesh
.
vertices
[
VertexIndex
]
for
VertexIndex
in
Polygon
.
vertices
)
self
.
PolygonVertexInd
ex
es
=
[]
self
.
PolygonVertexInd
ic
es
=
[]
Index
=
0
for
Polygon
in
Mesh
.
polygons
:
self
.
PolygonVertexInd
ex
es
.
append
(
tuple
(
range
(
Index
,
self
.
PolygonVertexInd
ic
es
.
append
(
tuple
(
range
(
Index
,
Index
+
len
(
Polygon
.
vertices
))))
Index
+=
len
(
Polygon
.
vertices
)
...
...
@@ -469,17 +469,17 @@ class MeshExportObject(ExportObject):
self
.
Exporter
.
File
.
Write
(
"
,
\n
"
,
Indent
=
False
)
# Write face definitions
PolygonCount
=
len
(
MeshEnumerator
.
PolygonVertexInd
ex
es
)
PolygonCount
=
len
(
MeshEnumerator
.
PolygonVertexInd
ic
es
)
self
.
Exporter
.
File
.
Write
(
"
{};
\n
"
.
format
(
PolygonCount
))
for
Index
,
PolygonVertexInd
ex
es
in
\
enumerate
(
MeshEnumerator
.
PolygonVertexInd
ex
es
):
for
Index
,
PolygonVertexInd
ic
es
in
\
enumerate
(
MeshEnumerator
.
PolygonVertexInd
ic
es
):
self
.
Exporter
.
File
.
Write
(
"
{};
"
.
format
(
len
(
PolygonVertexInd
ex
es
)))
self
.
Exporter
.
File
.
Write
(
"
{};
"
.
format
(
len
(
PolygonVertexInd
ic
es
)))
for
VertexCountIndex
,
VertexIndex
in
\
enumerate
(
PolygonVertexInd
ex
es
):
enumerate
(
PolygonVertexInd
ic
es
):
if
VertexCountIndex
==
len
(
PolygonVertexInd
ex
es
)
-
1
:
if
VertexCountIndex
==
len
(
PolygonVertexInd
ic
es
)
-
1
:
self
.
Exporter
.
File
.
Write
(
"
{};
"
.
format
(
VertexIndex
),
Indent
=
False
)
else
:
...
...
@@ -538,19 +538,19 @@ class MeshExportObject(ExportObject):
MeshExportObject
.
_MeshEnumerator
(
Mesh
)
self
.
vertices
=
[]
self
.
PolygonVertexInd
ex
es
=
[]
self
.
PolygonVertexInd
ic
es
=
[]
Index
=
0
for
Polygon
in
Mesh
.
polygons
:
if
not
Polygon
.
use_smooth
:
self
.
vertices
.
append
(
Polygon
)
self
.
PolygonVertexInd
ex
es
.
append
(
self
.
PolygonVertexInd
ic
es
.
append
(
tuple
(
len
(
Polygon
.
vertices
)
*
[
Index
]))
Index
+=
1
else
:
for
VertexIndex
in
Polygon
.
vertices
:
self
.
vertices
.
append
(
Mesh
.
vertices
[
VertexIndex
])
self
.
PolygonVertexInd
ex
es
.
append
(
self
.
PolygonVertexInd
ic
es
.
append
(
tuple
(
range
(
Index
,
Index
+
len
(
Polygon
.
vertices
))))
Index
+=
len
(
Polygon
.
vertices
)
...
...
@@ -579,9 +579,9 @@ class MeshExportObject(ExportObject):
self
.
Exporter
.
File
.
Write
(
"
,
\n
"
,
Indent
=
False
)
# Write face definitions.
FaceCount
=
len
(
MeshEnumerator
.
PolygonVertexInd
ex
es
)
FaceCount
=
len
(
MeshEnumerator
.
PolygonVertexInd
ic
es
)
self
.
Exporter
.
File
.
Write
(
"
{};
\n
"
.
format
(
FaceCount
))
for
Index
,
Polygon
in
enumerate
(
MeshEnumerator
.
PolygonVertexInd
ex
es
):
for
Index
,
Polygon
in
enumerate
(
MeshEnumerator
.
PolygonVertexInd
ic
es
):
self
.
Exporter
.
File
.
Write
(
"
{};
"
.
format
(
len
(
Polygon
)))
for
VertexCountIndex
,
VertexIndex
in
enumerate
(
Polygon
):
...
...
@@ -755,7 +755,7 @@ class MeshExportObject(ExportObject):
self
.
Exporter
.
File
.
Indent
()
from
array
import
array
MaterialInd
ex
es
=
array
(
"
I
"
,
[
0
])
*
len
(
Mesh
.
polygons
)
# Fast allocate
MaterialInd
ic
es
=
array
(
"
I
"
,
[
0
])
*
len
(
Mesh
.
polygons
)
# Fast allocate
MaterialIndexMap
=
{}
for
Index
,
Polygon
in
enumerate
(
Mesh
.
polygons
):
...
...
@@ -763,17 +763,17 @@ class MeshExportObject(ExportObject):
Mesh
.
uv_textures
.
active
,
Index
)
if
MaterialKey
in
MaterialIndexMap
:
MaterialInd
ex
es
[
Index
]
=
MaterialIndexMap
[
MaterialKey
]
MaterialInd
ic
es
[
Index
]
=
MaterialIndexMap
[
MaterialKey
]
else
:
MaterialIndex
=
len
(
MaterialIndexMap
)
MaterialIndexMap
[
MaterialKey
]
=
MaterialIndex
MaterialInd
ex
es
[
Index
]
=
MaterialIndex
MaterialInd
ic
es
[
Index
]
=
MaterialIndex
self
.
Exporter
.
File
.
Write
(
"
{};
\n
"
.
format
(
len
(
MaterialIndexMap
)))
self
.
Exporter
.
File
.
Write
(
"
{};
\n
"
.
format
(
len
(
Mesh
.
polygons
)))
for
Index
in
range
(
len
(
Mesh
.
polygons
)):
self
.
Exporter
.
File
.
Write
(
"
{}
"
.
format
(
MaterialInd
ex
es
[
Index
]))
self
.
Exporter
.
File
.
Write
(
"
{}
"
.
format
(
MaterialInd
ic
es
[
Index
]))
if
Index
==
len
(
Mesh
.
polygons
)
-
1
:
self
.
Exporter
.
File
.
Write
(
"
;;
\n
"
,
Indent
=
False
)
else
:
...
...
@@ -822,7 +822,7 @@ class MeshExportObject(ExportObject):
self
.
SafeName
))
def
__WriteMeshSkinWeights
(
self
,
Mesh
,
MeshEnumerator
=
None
):
# This contains vertex ind
ex
es and weights for the vertices that belong
# This contains vertex ind
ic
es and weights for the vertices that belong
# to this bone's group. Also calculates the bone skin matrix.
class
_BoneVertexGroup
:
def
__init__
(
self
,
BlenderObject
,
ArmatureObject
,
BoneName
):
...
...
@@ -830,7 +830,7 @@ class MeshExportObject(ExportObject):
self
.
SafeName
=
Util
.
SafeName
(
ArmatureObject
.
name
)
+
"
_
"
+
\
Util
.
SafeName
(
BoneName
)
self
.
Ind
ex
es
=
[]
self
.
Ind
ic
es
=
[]
self
.
Weights
=
[]
# BoneMatrix transforms mesh vertices into the
...
...
@@ -849,7 +849,7 @@ class MeshExportObject(ExportObject):
self
.
BoneMatrix
*=
BlenderObject
.
matrix_world
def
AddVertex
(
self
,
Index
,
Weight
):
self
.
Ind
ex
es
.
append
(
Index
)
self
.
Ind
ic
es
.
append
(
Index
)
self
.
Weights
.
append
(
Weight
)
# Skin weights work well with vertex reuse per face. Use a
...
...
@@ -926,11 +926,11 @@ class MeshExportObject(ExportObject):
self
.
Exporter
.
File
.
Write
(
"
\"
{}
\"
;
\n
"
.
format
(
BoneVertexGroup
.
SafeName
))
GroupVertexCount
=
len
(
BoneVertexGroup
.
Ind
ex
es
)
GroupVertexCount
=
len
(
BoneVertexGroup
.
Ind
ic
es
)
self
.
Exporter
.
File
.
Write
(
"
{};
\n
"
.
format
(
GroupVertexCount
))
# Write the ind
ex
es of the vertices this bone affects.
for
Index
,
VertexIndex
in
enumerate
(
BoneVertexGroup
.
Ind
ex
es
):
# Write the ind
ic
es of the vertices this bone affects.
for
Index
,
VertexIndex
in
enumerate
(
BoneVertexGroup
.
Ind
ic
es
):
self
.
Exporter
.
File
.
Write
(
"
{}
"
.
format
(
VertexIndex
))
if
Index
==
GroupVertexCount
-
1
:
...
...
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