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
d326b12f
Commit
d326b12f
authored
14 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
write materials in a alphabetical order
parent
6dbb21f4
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_obj/export_obj.py
+6
-1
6 additions, 1 deletion
io_scene_obj/export_obj.py
with
6 additions
and
1 deletion
io_scene_obj/export_obj.py
+
6
−
1
View file @
d326b12f
...
...
@@ -62,8 +62,13 @@ def write_mtl(scene, filepath, copy_images, mtl_dict):
file
=
open
(
filepath
,
"
w
"
,
encoding
=
"
utf8
"
,
newline
=
"
\n
"
)
file
.
write
(
'
# Blender MTL File: %r
\n
'
%
os
.
path
.
basename
(
bpy
.
data
.
filepath
))
file
.
write
(
'
# Material Count: %i
\n
'
%
len
(
mtl_dict
))
mtl_dict_values
=
list
(
mtl_dict
.
values
())
mtl_dict_values
.
sort
(
key
=
lambda
m
:
m
[
0
])
# Write material/image combinations we have used.
for
key
,
(
mtl_mat_name
,
mat
,
img
)
in
mtl_dict
.
items
():
# Using mtl_dict.values() directly gives un-pradictable order.
for
mtl_mat_name
,
mat
,
img
in
mtl_dict_values
:
# Get the Blender data for the material and the image.
# Having an image named None will make a bug, dont do it :)
...
...
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