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
a1dbf26e
Commit
a1dbf26e
authored
5 years ago
by
Julien Duroure
Browse files
Options
Downloads
Patches
Plain Diff
glTF importer: check that primitive exists (some invalid glTF files don't have any)
parent
cb4e5b24
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_gltf2/__init__.py
+1
-1
1 addition, 1 deletion
io_scene_gltf2/__init__.py
io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
+22
-20
22 additions, 20 deletions
io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
with
23 additions
and
21 deletions
io_scene_gltf2/__init__.py
+
1
−
1
View file @
a1dbf26e
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
bl_info
=
{
bl_info
=
{
'
name
'
:
'
glTF 2.0 format
'
,
'
name
'
:
'
glTF 2.0 format
'
,
'
author
'
:
'
Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors
'
,
'
author
'
:
'
Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors
'
,
"
version
"
:
(
1
,
0
,
1
),
"
version
"
:
(
1
,
0
,
2
),
'
blender
'
:
(
2
,
81
,
6
),
'
blender
'
:
(
2
,
81
,
6
),
'
location
'
:
'
File > Import-Export
'
,
'
location
'
:
'
File > Import-Export
'
,
'
description
'
:
'
Import-Export as glTF 2.0
'
,
'
description
'
:
'
Import-Export as glTF 2.0
'
,
...
...
This diff is collapsed.
Click to expand it.
io_scene_gltf2/blender/imp/gltf2_blender_gltf.py
+
22
−
20
View file @
a1dbf26e
...
@@ -282,27 +282,29 @@ class BlenderGlTF():
...
@@ -282,27 +282,29 @@ class BlenderGlTF():
mesh
.
shapekey_names
=
[]
mesh
.
shapekey_names
=
[]
used_names
=
set
()
used_names
=
set
()
for
sk
,
target
in
enumerate
(
mesh
.
primitives
[
0
].
targets
or
[]):
# Some invalid glTF files has empty primitive tab
if
'
POSITION
'
not
in
target
:
if
len
(
mesh
.
primitives
)
>
0
:
mesh
.
shapekey_names
.
append
(
None
)
for
sk
,
target
in
enumerate
(
mesh
.
primitives
[
0
].
targets
or
[]):
continue
if
'
POSITION
'
not
in
target
:
mesh
.
shapekey_names
.
append
(
None
)
continue
# Check if glTF file has some extras with targetNames. Otherwise
# Check if glTF file has some extras with targetNames. Otherwise
# use the name of the POSITION accessor on the first primitive.
# use the name of the POSITION accessor on the first primitive.
shapekey_name
=
None
shapekey_name
=
None
if
mesh
.
extras
is
not
None
:
if
mesh
.
extras
is
not
None
:
if
'
targetNames
'
in
mesh
.
extras
and
sk
<
len
(
mesh
.
extras
[
'
targetNames
'
]):
if
'
targetNames
'
in
mesh
.
extras
and
sk
<
len
(
mesh
.
extras
[
'
targetNames
'
]):
shapekey_name
=
mesh
.
extras
[
'
targetNames
'
][
sk
]
shapekey_name
=
mesh
.
extras
[
'
targetNames
'
][
sk
]
if
shapekey_name
is
None
:
if
shapekey_name
is
None
:
if
gltf
.
data
.
accessors
[
target
[
'
POSITION
'
]].
name
is
not
None
:
if
gltf
.
data
.
accessors
[
target
[
'
POSITION
'
]].
name
is
not
None
:
shapekey_name
=
gltf
.
data
.
accessors
[
target
[
'
POSITION
'
]].
name
shapekey_name
=
gltf
.
data
.
accessors
[
target
[
'
POSITION
'
]].
name
if
shapekey_name
is
None
:
if
shapekey_name
is
None
:
shapekey_name
=
"
target_
"
+
str
(
sk
)
shapekey_name
=
"
target_
"
+
str
(
sk
)
shapekey_name
=
BlenderGlTF
.
find_unused_name
(
used_names
,
shapekey_name
)
shapekey_name
=
BlenderGlTF
.
find_unused_name
(
used_names
,
shapekey_name
)
used_names
.
add
(
shapekey_name
)
used_names
.
add
(
shapekey_name
)
mesh
.
shapekey_names
.
append
(
shapekey_name
)
mesh
.
shapekey_names
.
append
(
shapekey_name
)
@staticmethod
@staticmethod
def
find_unused_name
(
haystack
,
desired_name
):
def
find_unused_name
(
haystack
,
desired_name
):
...
...
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