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
481a8384
Commit
481a8384
authored
14 years ago
by
Ken Nign
Browse files
Options
Downloads
Patches
Plain Diff
fixed issues caused by last two commits
parent
9656588e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_import_scene_lwo.py
+12
-8
12 additions, 8 deletions
io_import_scene_lwo.py
with
12 additions
and
8 deletions
io_import_scene_lwo.py
+
12
−
8
View file @
481a8384
...
@@ -114,6 +114,7 @@ class _obj_surf(object):
...
@@ -114,6 +114,7 @@ class _obj_surf(object):
__slots__
=
(
__slots__
=
(
"
bl_mat
"
,
"
bl_mat
"
,
"
name
"
,
"
name
"
,
"
source_name
"
,
"
colr
"
,
"
colr
"
,
"
diff
"
,
"
diff
"
,
"
lumi
"
,
"
lumi
"
,
...
@@ -366,7 +367,9 @@ def read_layr(layr_bytes, object_layers, load_hidden):
...
@@ -366,7 +367,9 @@ def read_layr(layr_bytes, object_layers, load_hidden):
print
(
"
Reading Object Layer
"
)
print
(
"
Reading Object Layer
"
)
offset
=
4
offset
=
4
new_layr
.
pivot
=
struct
.
unpack
(
"
>fff
"
,
layr_bytes
[
offset
:
offset
+
12
])
pivot
=
struct
.
unpack
(
"
>fff
"
,
layr_bytes
[
offset
:
offset
+
12
])
# Swap Y and Z to match Blender's pitch.
new_layr
.
pivot
=
[
pivot
[
0
],
pivot
[
2
],
pivot
[
1
]]
offset
+=
12
offset
+=
12
layr_name
,
name_len
=
read_lwostring
(
layr_bytes
[
offset
:])
layr_name
,
name_len
=
read_lwostring
(
layr_bytes
[
offset
:])
offset
+=
name_len
offset
+=
name_len
...
@@ -411,10 +414,11 @@ def read_pnts(pnt_bytes, object_layers):
...
@@ -411,10 +414,11 @@ def read_pnts(pnt_bytes, object_layers):
while
offset
<
chunk_len
:
while
offset
<
chunk_len
:
pnts
=
struct
.
unpack
(
"
>fff
"
,
pnt_bytes
[
offset
:
offset
+
12
])
pnts
=
struct
.
unpack
(
"
>fff
"
,
pnt_bytes
[
offset
:
offset
+
12
])
offset
+=
12
offset
+=
12
# Re-order the points so that the mesh has the right pitch.
# Re-order the points so that the mesh has the right pitch,
# the pivot already has the correct order.
pnts
=
[
pnts
[
0
]
-
object_layers
[
-
1
].
pivot
[
0
],
\
pnts
=
[
pnts
[
0
]
-
object_layers
[
-
1
].
pivot
[
0
],
\
pnts
[
2
]
-
object_layers
[
-
1
].
pivot
[
2
],
\
pnts
[
2
]
-
object_layers
[
-
1
].
pivot
[
1
],
\
pnts
[
1
]
-
object_layers
[
-
1
].
pivot
[
1
]]
pnts
[
1
]
-
object_layers
[
-
1
].
pivot
[
2
]]
object_layers
[
-
1
].
pnts
.
append
(
pnts
)
object_layers
[
-
1
].
pnts
.
append
(
pnts
)
...
@@ -1022,11 +1026,11 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
...
@@ -1022,11 +1026,11 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
# me.vertices[vi].co= layer_data.pnts[vi]
# me.vertices[vi].co= layer_data.pnts[vi]
# faster, would be faster again to use an array
# faster, would be faster again to use an array
me
.
vertices
.
foreach_set
(
"
co
"
,
[
axis
co
for
co
in
layer_data
.
pnts
for
axis
in
co
])
me
.
vertices
.
foreach_set
(
"
co
"
,
[
axis
for
co
in
layer_data
.
pnts
for
axis
in
co
])
ngons
=
{}
# To keep the FaceIdx consistant, handle NGons later.
ngons
=
{}
# To keep the FaceIdx consistant, handle NGons later.
edges
=
[]
# Holds the FaceIdx of the 2-point polys.
edges
=
[]
# Holds the FaceIdx of the 2-point polys.
for
fi
,
fpol
in
enumerate
(
len
(
layer_data
.
pols
)
)
:
for
fi
,
fpol
in
enumerate
(
layer_data
.
pols
):
fpol
.
reverse
()
# Reversing gives correct normal directions
fpol
.
reverse
()
# Reversing gives correct normal directions
# PointID 0 in the last element causes Blender to think it's un-used.
# PointID 0 in the last element causes Blender to think it's un-used.
if
fpol
[
-
1
]
==
0
:
if
fpol
[
-
1
]
==
0
:
...
@@ -1157,8 +1161,8 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
...
@@ -1157,8 +1161,8 @@ def build_objects(object_layers, object_surfs, object_tags, object_name, add_sub
# Apply the Edge Weighting.
# Apply the Edge Weighting.
if
len
(
layer_data
.
edge_weights
)
>
0
:
if
len
(
layer_data
.
edge_weights
)
>
0
:
for
edge
in
me
.
edges
:
for
edge
in
me
.
edges
:
edge_sa
=
"
{0} {1}
"
.
format
(
edge
.
vertices
[
0
]
)
,
edge
.
vertices
[
1
])
edge_sa
=
"
{0} {1}
"
.
format
(
edge
.
vertices
[
0
],
edge
.
vertices
[
1
])
edge_sb
=
"
{0} {1}
"
.
format
(
edge
.
vertices
[
1
]
)
,
edge
.
vertices
[
0
])
edge_sb
=
"
{0} {1}
"
.
format
(
edge
.
vertices
[
1
],
edge
.
vertices
[
0
])
if
edge_sa
in
layer_data
.
edge_weights
:
if
edge_sa
in
layer_data
.
edge_weights
:
edge
.
crease
=
layer_data
.
edge_weights
[
edge_sa
]
edge
.
crease
=
layer_data
.
edge_weights
[
edge_sa
]
elif
edge_sb
in
layer_data
.
edge_weights
:
elif
edge_sb
in
layer_data
.
edge_weights
:
...
...
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