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
477d73fd
Commit
477d73fd
authored
12 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
patch [#34591] 3DS importer: material transparency value short/float fix
from Andreas Atteneder (atti)
parent
2c236d3c
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_scene_3ds/import_3ds.py
+16
-4
16 additions, 4 deletions
io_scene_3ds/import_3ds.py
with
16 additions
and
4 deletions
io_scene_3ds/import_3ds.py
+
16
−
4
View file @
477d73fd
...
...
@@ -19,7 +19,7 @@
# <pep8 compliant>
# Script copyright (C) Bob Holcomb
# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Campbell Barton, Mario Lapin, Dominique Lorre
# Contributors: Bob Holcomb, Richard L?rk?ng, Damien McGinnes, Campbell Barton, Mario Lapin, Dominique Lorre
, Andreas Atteneder
import
os
import
time
...
...
@@ -44,6 +44,10 @@ OBJECTINFO = 0x3D3D # This gives the version of the mesh and is found right bef
VERSION
=
0x0002
# This gives the version of the .3ds file
EDITKEYFRAME
=
0xB000
# This is the header for all of the key frame info
#------ Data Chunks, used for various attributes
PERCENTAGE_SHORT
=
0x30
PERCENTAGE_FLOAT
=
0x31
#------ sub defines of OBJECTINFO
MATERIAL
=
0xAFFF
# This stored the texture info
OBJECT
=
0x4000
# This stores the faces, vertices, etc...
...
...
@@ -574,10 +578,18 @@ def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
elif
new_chunk
.
ID
==
MAT_TRANSPARENCY
:
#print 'elif new_chunk.ID == MAT_TRANSPARENCY:'
read_chunk
(
file
,
temp_chunk
)
temp_data
=
file
.
read
(
STRUCT_SIZE_UNSIGNED_SHORT
)
temp_chunk
.
bytes_read
+=
2
contextMaterial
.
alpha
=
1
-
(
float
(
struct
.
unpack
(
'
<H
'
,
temp_data
)[
0
])
/
100
)
if
temp_chunk
.
ID
==
PERCENTAGE_SHORT
:
temp_data
=
file
.
read
(
STRUCT_SIZE_UNSIGNED_SHORT
)
temp_chunk
.
bytes_read
+=
STRUCT_SIZE_UNSIGNED_SHORT
contextMaterial
.
alpha
=
1
-
(
float
(
struct
.
unpack
(
'
<H
'
,
temp_data
)[
0
])
/
100
)
elif
temp_chunk
.
ID
==
PERCENTAGE_FLOAT
:
temp_data
=
file
.
read
(
STRUCT_SIZE_FLOAT
)
temp_chunk
.
bytes_read
+=
STRUCT_SIZE_FLOAT
contextMaterial
.
alpha
=
1
-
float
(
struct
.
unpack
(
'
f
'
,
temp_data
)[
0
])
else
:
print
(
"
Cannot read material transparency
"
)
new_chunk
.
bytes_read
+=
temp_chunk
.
bytes_read
elif
new_chunk
.
ID
==
OBJECT_LAMP
:
# Basic lamp support.
...
...
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