Autodesk_Map to Bitmaptexture

0 votes
Version: 
v0.7
Date Updated: 
11/07/2014

Note - for whatever reason this script is no longer working in current versions of Max. I'll update this page when it's fixed.

Looks for Autodesk_Map textures in Standard materials and converts them to BitmapTexture instead. Autodesk_Map maps often exist in Revit imports.

Version 2014-11-07:
This version now loops through all slots in a Standard material, and keeps most map properties - tiling, offset, etc.

AttachmentSize
adksbitmap_to_bitmap_20141107c.ms1.54 KB

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
hanselmoniz's picture

Still not working

Thanks for the reply but this does not work..

-- Script replaces autodesk maps with regular bitmaps. does not handle things like autodesk noise.
-- Reports missing maps

fn convertMap map matname=
(
inMap = map
outMap = bitmaptexture()
print ("converting" + map.name)

outmap.name = inmap.name

outmap.coords.U_Offset = 0
if inMap.Position_X != 0 then outmap.coords.U_Offset = inMap.Position_X
outmap.coords.V_Offset = 0
if inMap.Position_Y != 0 then outmap.coords.V_Offset = inMap.Position_Y

outmap.coords.realWorldScale = on
outmap.coords.U_Tiling = 1
if inMap.Scale_Width != 0 then outmap.coords.U_Tiling = 1/inMap.Scale_Width
outmap.coords.V_Tiling = 1
if inMap.Scale_Height != 0 then outmap.coords.V_Tiling = 1/inMap.Scale_Height

outmap.coordinates.UVW_Type= 0
outmap.coordinates.U_Mirror = false
outmap.coordinates.V_Mirror = false
outmap.coordinates.U_Tile = true
outmap.coordinates.V_Tile = true
outmap.coords.W_angle = inMap.Position_Rotation
outmap.coordinates.mapChannel = inMap.Advanced_Parameters_Map_Channel

badmap = false
try (outmap.bitmap = inmap.Parameters_Source)
catch
(
print ("Map not found in " + inMap.name as string + " in material " + matname + ". Please convert manually.")
badmap = true
)
if badmap == false then (return outMap)
else (return inMap)

)

for m in sceneMaterials do
(
if classof m == VrayMtl then
(
for b=1 to m.maps.count do
(
bmap = m.maps[b]
if isProperty bmap "Parameters_Source" and classof bmap == Autodesk_Map then (m.maps[b] = (convertmap bmap m.name))
)
)
)

Smallpoly's picture

Found the problem.

Found the problem. What was going on is that when using classof you shouldn't be putting the parentheses after VRayMtl. so it should look more like this:

for m in sceneMaterials do (if classof m == VRayMtl then print "this is a VRayMtl")

Smallpoly's picture

Thanks!

Thanks! Ultimately I want to set it up so it doesn't matter what class of material it is. :)

hanselmoniz's picture

i do not know why the class

i do not know why the class of m = Vraymtl () does not work

hanselmoniz's picture

adksbitmap to bitmap for vray materials

-- Script replaces autodesk maps with regular bitmaps. does not handle things like autodesk noise.
-- Reports missing maps

fn convertMap map matname=
(
inMap = map
outMap = bitmaptexture()
print ("converting" + map.name)

outmap.name = inmap.name

outmap.coords.U_Offset = 0
if inMap.Position_X != 0 then outmap.coords.U_Offset = inMap.Position_X
outmap.coords.V_Offset = 0
if inMap.Position_Y != 0 then outmap.coords.V_Offset = inMap.Position_Y

outmap.coords.realWorldScale = on
outmap.coords.U_Tiling = 1
if inMap.Scale_Width != 0 then outmap.coords.U_Tiling = 1/inMap.Scale_Width
outmap.coords.V_Tiling = 1
if inMap.Scale_Height != 0 then outmap.coords.V_Tiling = 1/inMap.Scale_Height

outmap.coordinates.UVW_Type= 0
outmap.coordinates.U_Mirror = false
outmap.coordinates.V_Mirror = false
outmap.coordinates.U_Tile = true
outmap.coordinates.V_Tile = true
outmap.coords.W_angle = inMap.Position_Rotation
outmap.coordinates.mapChannel = inMap.Advanced_Parameters_Map_Channel

badmap = false
try (outmap.bitmap = inmap.Parameters_Source)
catch
(
print ("Map not found in " + inMap.name as string + " in material " + matname + ". Please convert manually.")
badmap = true
)
if badmap == false then (return outMap)
else (return inMap)

)

for m in sceneMaterials do
(
if classof m == VrayMtl () then
(
for b=1 to m.maps.count do
(
bmap = m.maps[b]
if isProperty bmap "Parameters_Source" and classof bmap == Autodesk_Map then (m.maps[b] = (convertmap bmap m.name))
)
)
)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.