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
56c818af
Commit
56c818af
authored
14 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
fix [#27691] PLY importer does not support float based vertex colors
parent
76c3df01
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_mesh_ply/import_ply.py
+13
-3
13 additions, 3 deletions
io_mesh_ply/import_ply.py
with
13 additions
and
3 deletions
io_mesh_ply/import_ply.py
+
13
−
3
View file @
56c818af
...
...
@@ -199,6 +199,8 @@ def read(filepath):
obj
=
obj_spec
.
load
(
format_specs
[
format
],
file
)
file
.
close
()
return
obj_spec
,
obj
...
...
@@ -217,19 +219,24 @@ def load_ply(filepath):
return
uvindices
=
colindices
=
None
colmultiply
=
None
# noindices = None # Ignore normals
for
el
in
obj_spec
.
specs
:
if
el
.
name
==
b
'
vertex
'
:
vindices
=
vindices_x
,
vindices_y
,
vindices_z
=
(
el
.
index
(
b
'
x
'
),
el
.
index
(
b
'
y
'
),
el
.
index
(
b
'
z
'
)
)
vindices
=
vindices_x
,
vindices_y
,
vindices_z
=
el
.
index
(
b
'
x
'
),
el
.
index
(
b
'
y
'
),
el
.
index
(
b
'
z
'
)
# noindices = (el.index('nx'), el.index('ny'), el.index('nz'))
# if -1 in noindices: noindices = None
uvindices
=
(
el
.
index
(
b
'
s
'
),
el
.
index
(
b
'
t
'
))
if
-
1
in
uvindices
:
uvindices
=
None
colindices
=
(
el
.
index
(
b
'
red
'
),
el
.
index
(
b
'
green
'
),
el
.
index
(
b
'
blue
'
)
)
colindices
=
el
.
index
(
b
'
red
'
),
el
.
index
(
b
'
green
'
),
el
.
index
(
b
'
blue
'
)
if
-
1
in
colindices
:
colindices
=
None
else
:
# if not a float assume uchar
colmultiply
=
[
1.0
if
el
.
properties
[
i
].
numeric_type
in
(
'
f
'
,
'
d
'
)
else
(
1.0
/
256.0
)
for
i
in
colindices
]
elif
el
.
name
==
b
'
face
'
:
findex
=
el
.
index
(
b
'
vertex_indices
'
)
...
...
@@ -242,7 +249,10 @@ def load_ply(filepath):
if
uvindices
:
mesh_uvs
.
append
([(
vertices
[
index
][
uvindices
[
0
]],
1.0
-
vertices
[
index
][
uvindices
[
1
]])
for
index
in
indices
])
if
colindices
:
mesh_colors
.
append
([(
vertices
[
index
][
colindices
[
0
]]
/
255.0
,
vertices
[
index
][
colindices
[
1
]]
/
255.0
,
vertices
[
index
][
colindices
[
2
]]
/
255.0
)
for
index
in
indices
])
mesh_colors
.
append
([(
vertices
[
index
][
colindices
[
0
]]
*
colmultiply
[
0
],
vertices
[
index
][
colindices
[
1
]]
*
colmultiply
[
1
],
vertices
[
index
][
colindices
[
2
]]
*
colmultiply
[
2
],
)
for
index
in
indices
])
if
uvindices
or
colindices
:
# If we have Cols or UVs then we need to check the face order.
...
...
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