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
e5af17eb
Commit
e5af17eb
authored
14 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
unique name exporting was broken, needed to export bytes.
parent
79c899da
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_3ds/export_3ds.py
+9
-7
9 additions, 7 deletions
io_scene_3ds/export_3ds.py
with
9 additions
and
7 deletions
io_scene_3ds/export_3ds.py
+
9
−
7
View file @
e5af17eb
...
@@ -89,23 +89,24 @@ import struct
...
@@ -89,23 +89,24 @@ import struct
# So 3ds max can open files, limit names to 12 in length
# So 3ds max can open files, limit names to 12 in length
# this is verry annoying for filenames!
# this is verry annoying for filenames!
name_unique
=
[]
name_unique
=
[]
# stores str, ascii only
name_mapping
=
{}
name_mapping
=
{}
# stores {orig: byte} mapping
def
sane_name
(
name
):
def
sane_name
(
name
):
name_fixed
=
name_mapping
.
get
(
name
)
name_fixed
=
name_mapping
.
get
(
name
)
if
name_fixed
is
not
None
:
if
name_fixed
is
not
None
:
return
name_fixed
return
name_fixed
new_name
=
name
[:
12
]
# strip non ascii chars
new_name_clean
=
new_name
=
name
.
encode
(
"
ASCII
"
,
"
replace
"
).
decode
(
"
ASCII
"
)[:
12
]
i
=
0
i
=
0
while
new_name
in
name_unique
:
while
new_name
in
name_unique
:
new_name
=
new_name
[:
-
4
]
+
'
.%.3d
'
%
i
new_name
=
new_name
_clean
+
"
.%.3d
"
%
i
i
+=
1
i
+=
1
# note, appending the 'str' version.
name_unique
.
append
(
new_name
)
name_unique
.
append
(
new_name
)
name_mapping
[
name
]
=
new_name
name_mapping
[
name
]
=
new_name
=
new_name
.
encode
(
"
ASCII
"
,
"
replace
"
)
return
new_name
return
new_name
def
uv_key
(
uv
):
def
uv_key
(
uv
):
...
@@ -167,7 +168,8 @@ class _3ds_string(object):
...
@@ -167,7 +168,8 @@ class _3ds_string(object):
'''
Class representing a zero-terminated string for a 3ds file.
'''
'''
Class representing a zero-terminated string for a 3ds file.
'''
__slots__
=
(
'
value
'
,
)
__slots__
=
(
'
value
'
,
)
def
__init__
(
self
,
val
):
def
__init__
(
self
,
val
):
self
.
value
=
val
assert
(
type
(
val
)
==
bytes
)
self
.
value
=
val
def
get_size
(
self
):
def
get_size
(
self
):
return
(
len
(
self
.
value
)
+
1
)
return
(
len
(
self
.
value
)
+
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