[Closed] set map to environment
Hiya,
I can’t seem to set <textureMap.coordinates>.mappingtype to environment (1) via maxscript somehow. Any ideas how to fix that?
thnx
Obi
Works here. Can you show a piece of code that you used?
For example:
mat = meditmaterials[1] --get first slot of material editor
map = bitmaptexture() --create a bitmap
mat.diffusemap = map --assign the bitmap to diffuse channel
map.coords.mappingtype = 1 --set the mapping type to environment
map.coordinates.mapping = 3 --set the mapping to Screen
MatEditor.Open() --open editor to check it out
Hiya Bobo,
here’s the code. I am extending the gradient map and on creation I am trying to set this map to environment…
plugin textureMap T_2M_Reflection
name:"2M Reflection"
classID:#(0x4824c115, 0x2224035) --GenclassID()
extends:Gradient
replaceUI:false
(
parameters main rollout:params
(
Rcolor type:#color default:white ui:Rcolor -- Reflection color
)
rollout params "Reflection map parameters"
(
colorpicker Rcolor -- Reflection color
"Reflection Color"
type:#color
default:white
align:#right
)--end rollout
on create do
( -- start create
delegate.coords.mappingType = 1 -- 0 - Texture 1 - Environment
delegate.coords.mapping = 0 -- 0 - Spherical 1 - Cylindrical 2 - Shrink-Wrap 3 - Screen
) -- end create
) -- end plugin
You forgot to mention you are extending a plugin
Looks like a limitation of the Material Editor. If you try to assign via MAXScript, it works.
meditmaterials[1].diffusemap = T_2M_Reflection()
If you look now, the coords will be set to Environment.
Doing the same through the UI does not work. Looks like the coords are overwritten when the map is assigned to the diffuse map channel.
This is because the UI level of Material and Map handling has some built-in defaults.
For example, if you assign your bitmap to the environment map slot of the Environment dialog via the UI, then drag it to the Medit, the coords will be set to Env>Screen automatically.
If you assign to a diffuse map channel, the env. is automatically set to Explicit Map Channel.
If you assign to a reflection map slot, the map will be automatically set to Environment>Spherical and so on.
This is code from Max 1.0 times (pre-scripting) and I don’t think you can do much about it…
Ahhhh…
thought it would be something like that. Thanx for explaining that Bobo!
Obi