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
ad28aaf2
Commit
ad28aaf2
authored
13 years ago
by
Kalle-Samuli Riihikoski
Browse files
Options
Downloads
Patches
Plain Diff
Creates material indexs correctly when there is no material in object.
parent
2f45a4c9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
io_coat3D/tex.py
+15
-15
15 additions, 15 deletions
io_coat3D/tex.py
with
15 additions
and
15 deletions
io_coat3D/tex.py
+
15
−
15
View file @
ad28aaf2
...
@@ -2,13 +2,11 @@ import bpy
...
@@ -2,13 +2,11 @@ import bpy
import
os
import
os
import
filecmp
import
filecmp
def
objname
(
path
):
def
objname
(
path
):
path2
=
os
.
path
.
dirname
(
path
)
+
os
.
sep
path2
=
os
.
path
.
dirname
(
path
)
+
os
.
sep
pituus
=
len
(
path2
)
pituus
=
len
(
path2
)
nimi
=
path
[
pituus
:]
nimi
=
path
[
pituus
:]
return
nimi
return
nimi
def
justname
(
name
):
def
justname
(
name
):
...
@@ -30,8 +28,6 @@ def find_index(objekti):
...
@@ -30,8 +28,6 @@ def find_index(objekti):
if
(
not
(
hasattr
(
tex
,
'
texture
'
))):
if
(
not
(
hasattr
(
tex
,
'
texture
'
))):
break
break
luku
=
luku
+
1
luku
=
luku
+
1
return
luku
return
luku
def
gettex
(
mat_list
,
objekti
,
scene
,
export
):
def
gettex
(
mat_list
,
objekti
,
scene
,
export
):
...
@@ -44,8 +40,6 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -44,8 +40,6 @@ def gettex(mat_list, objekti, scene,export):
else
:
else
:
vray
=
False
vray
=
False
take_color
=
0
;
take_color
=
0
;
take_spec
=
0
;
take_spec
=
0
;
take_normal
=
0
;
take_normal
=
0
;
...
@@ -71,7 +65,7 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -71,7 +65,7 @@ def gettex(mat_list, objekti, scene,export):
for
tex_slot
in
mate
.
material
.
texture_slots
:
for
tex_slot
in
mate
.
material
.
texture_slots
:
if
(
hasattr
(
tex_slot
,
'
texture
'
)):
if
(
hasattr
(
tex_slot
,
'
texture
'
)):
if
(
tex_slot
.
texture
.
type
==
'
IMAGE
'
):
if
(
tex_slot
.
texture
.
type
==
'
IMAGE
'
):
tex_slot
.
texture
.
image
.
reload
()
tex_slot
.
texture
.
image
.
reload
()
else
:
else
:
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
coa
=
bpy
.
context
.
scene
.
objects
.
active
.
coat3D
nimi
=
objname
(
coa
.
objectdir
)
nimi
=
objname
(
coa
.
objectdir
)
...
@@ -83,7 +77,6 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -83,7 +77,6 @@ def gettex(mat_list, objekti, scene,export):
just_nimi
+=
'
_
'
just_nimi
+=
'
_
'
just_nimi_len
=
len
(
just_nimi
)
just_nimi_len
=
len
(
just_nimi
)
if
(
len
(
objekti
.
material_slots
)
!=
0
):
if
(
len
(
objekti
.
material_slots
)
!=
0
):
for
obj_tex
in
objekti
.
active_material
.
texture_slots
:
for
obj_tex
in
objekti
.
active_material
.
texture_slots
:
if
(
hasattr
(
obj_tex
,
'
texture
'
)):
if
(
hasattr
(
obj_tex
,
'
texture
'
)):
...
@@ -114,13 +107,24 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -114,13 +107,24 @@ def gettex(mat_list, objekti, scene,export):
#date = os.path.getmtime(texcoat[tex_name][0])
#date = os.path.getmtime(texcoat[tex_name][0])
if
((
texcoat
[
'
color
'
]
or
texcoat
[
'
nmap
'
]
or
texcoat
[
'
disp
'
]
or
texcoat
[
'
specular
'
])
and
(
len
(
objekti
.
material_slots
))
==
0
):
if
((
texcoat
[
'
color
'
]
or
texcoat
[
'
nmap
'
]
or
texcoat
[
'
disp
'
]
or
texcoat
[
'
specular
'
])
and
(
len
(
objekti
.
material_slots
))
==
0
):
new_mat
=
(
"
%s_Material
"
%
(
objekti
.
name
))
index
=
0
tuli
=
False
lasku
=
False
while
(
lasku
==
False
):
tuli
=
False
new_mat
=
(
"
Material.%03d
"
%
(
index
))
for
i
in
bpy
.
data
.
materials
:
if
(
i
.
name
==
new_mat
):
tuli
=
True
break
if
(
tuli
):
index
+=
1
else
:
lasku
=
True
bpy
.
data
.
materials
.
new
(
new_mat
)
bpy
.
data
.
materials
.
new
(
new_mat
)
ki
=
bpy
.
data
.
materials
[
new_mat
]
ki
=
bpy
.
data
.
materials
[
new_mat
]
objekti
.
data
.
materials
.
append
(
ki
)
objekti
.
data
.
materials
.
append
(
ki
)
if
(
bring_color
==
1
and
texcoat
[
'
color
'
]):
if
(
bring_color
==
1
and
texcoat
[
'
color
'
]):
name_tex
=
'
Color_
'
name_tex
=
'
Color_
'
num
=
[]
num
=
[]
...
@@ -178,8 +182,6 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -178,8 +182,6 @@ def gettex(mat_list, objekti, scene,export):
num
=
[]
num
=
[]
index
=
find_index
(
objekti
)
index
=
find_index
(
objekti
)
tex
=
bpy
.
ops
.
Texture
tex
=
bpy
.
ops
.
Texture
objekti
.
active_material
.
texture_slots
.
create
(
index
)
objekti
.
active_material
.
texture_slots
.
create
(
index
)
total_mat
=
len
(
objekti
.
active_material
.
texture_slots
.
items
())
total_mat
=
len
(
objekti
.
active_material
.
texture_slots
.
items
())
...
@@ -189,8 +191,6 @@ def gettex(mat_list, objekti, scene,export):
...
@@ -189,8 +191,6 @@ def gettex(mat_list, objekti, scene,export):
if
((
seekco
.
name
[:
7
]
==
'
Normal_
'
)
and
(
seekco
.
users_material
==
())):
if
((
seekco
.
name
[:
7
]
==
'
Normal_
'
)
and
(
seekco
.
users_material
==
())):
useold
=
seekco
useold
=
seekco
if
(
useold
==
''
):
if
(
useold
==
''
):
tex_name
=
setgallery
()
tex_name
=
setgallery
()
...
...
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