Page Menu
Home
Search
Configure Global Search
Log In
Files
F2757
test-mtex-2.py
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Yehoshua Sapir (sapir)
Nov 13 2013, 1:06 PM
Size
2 KB
Subscribers
None
test-mtex-2.py
View Options
import
Blender
from
Blender
import
Material
,
Texture
,
Object
mat
=
Material
.
Get
(
'Material'
)
mtexs
=
mat
.
getTextures
()
mtex
=
mtexs
[
0
]
def
getName
(
d
,
val
):
for
k
in
dir
(
d
):
if
d
[
k
]
==
val
:
return
k
def
output
():
print
'-- Texture Tab --'
print
'tex:'
,
mtex
.
tex
print
'correctNor:'
,
mtex
.
correctNor
print
print
'-- Map Input Tab --'
print
'texco:'
,
getName
(
Texture
.
TexCo
,
mtex
.
texco
)
print
'object:'
,
mtex
.
object
,
'( for if texco =='
,
Texture
.
TexCo
[
'OBJECT'
],
')'
print
'mapping:'
,
getName
(
Texture
.
Mappings
,
mtex
.
mapping
)
print
'x,y,z axises:'
,
mtex
.
xproj
,
mtex
.
yproj
,
mtex
.
zproj
print
'offset:'
,
mtex
.
ofs
print
'size:'
,
mtex
.
size
print
print
'-- Map To Tab --'
print
map
(
None
,
[
'col'
,
'nor'
,
'csp'
,
'cmir'
,
'ref'
,
'spec'
,
'amb'
],
[
mtex
.
mtCol
,
mtex
.
mtNor
,
mtex
.
mtCsp
,
mtex
.
mtCmir
,
mtex
.
mtRef
,
mtex
.
mtSpec
,
mtex
.
mtAmb
]
)
print
map
(
None
,
[
'hard'
,
'raymir'
,
'alpha'
,
'emit'
,
'translu'
,
'disp'
],
[
mtex
.
mtHard
,
mtex
.
mtRayMir
,
mtex
.
mtAlpha
,
mtex
.
mtEmit
,
mtex
.
mtTranslu
,
mtex
.
mtDisp
]
)
print
'old mapto:'
,
mtex
.
mapto
print
'stencil:'
,
mtex
.
stencil
print
'neg:'
,
mtex
.
neg
print
'noRGB:'
,
mtex
.
noRGB
print
'blendmode:'
,
getName
(
Texture
.
BlendModes
,
mtex
.
blendmode
)
print
'color:'
,
mtex
.
col
print
'colfac:'
,
mtex
.
colfac
print
'norfac:'
,
mtex
.
norfac
print
'varfac:'
,
mtex
.
varfac
print
'dispfac:'
,
mtex
.
dispfac
print
'dvar:'
,
mtex
.
dvar
print
'mtWarp:'
,
mtex
.
mtWarp
print
'warpfac:'
,
mtex
.
warpfac
def
setStuff
():
# Edit things to see how they throw exceptions.
mtex
.
blendmode
=
Texture
.
BlendModes
[
'ADD'
]
mtex
.
col
=
(
0.5
,
0.5
,
0.5
)
mtex
.
colfac
=
0.05
mtex
.
correctNor
=
False
mtex
.
dispfac
=
0.1
mtex
.
dvar
=
0.15
mtex
.
mapping
=
Texture
.
Mappings
[
'SPHERE'
]
# Next line is pointless
mtex
.
mapto
=
1353
mtex
.
mtAlpha
=
-
1
mtex
.
mtAmb
=
1
mtex
.
mtCmir
=
0
mtex
.
mtCol
=
1
mtex
.
mtCsp
=
1
mtex
.
mtDisp
=
-
1
mtex
.
mtEmit
=
1
mtex
.
mtHard
=
0
mtex
.
mtNor
=
0
mtex
.
mtRayMir
=
1
mtex
.
mtRef
=
-
1
mtex
.
mtSpec
=
-
1
mtex
.
mtTranslu
=
1
mtex
.
mtWarp
=
0
mtex
.
neg
=
True
mtex
.
norfac
=
0.2
mtex
.
noRGB
=
True
mtex
.
object
=
Object
.
Get
(
'Cube'
)
mtex
.
ofs
=
(
5
,
-
1
,
2
)
mtex
.
size
=
(
-
1.9
,
-
8.6
,
3.27
)
mtex
.
stencil
=
True
mtex
.
tex
=
Texture
.
New
()
mtex
.
texco
=
Texture
.
TexCo
[
'REFL'
]
mtex
.
varfac
=
0.25
mtex
.
warpfac
=
0.3
mtex
.
xproj
=
Texture
.
Proj
[
'Y'
]
mtex
.
yproj
=
Texture
.
Proj
[
'NONE'
]
mtex
.
zproj
=
Texture
.
Proj
[
'X'
]
Blender
.
Window
.
Redraw
()
print
"Before setting"
output
()
print
"setting now"
setStuff
()
print
"After setting"
output
()
File Metadata
Details
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a1/f7/6a71860016da05b73afa917be545
Event Timeline
Log In to Comment