Message 1 of 6
Maxscript Rename textures/materials to filename, change file image extension
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have scenes I need a single script to do the following
Change Texture name to filename on disk example: ClutterGenSmallA_d.dds
Change Material name to Texture file name
Change Image extension from .dds to .tga
I already found a script which changes the material to texture name, I cant seem to find a script which changes texture name to one on disk. If I can remove the path from the texture name
from: textures\SetDressing\ClutterGeneric\ClutterGenSmallA_d.dds
to: ClutterGenSmallA_d.dds
select $*
fn renameMats objs = if objs.count != 0 do
(
local matClasses = #(Arch___Design__mi, Standard)
local selMats = #()
for c in matClasses do
(
for o in objs where o.mat != null do (join selMats (getClassInstances c target:o))
)
if selMats.count != 0 do
(
for m in selMats do
(
case of
(
(isProperty m #diff_color_map): if isKindOf (map = getProperty m #diff_color_map) textureMap do m.name = map.name
(isProperty m #diffuseMap): if isKindOf (map = getProperty m #diffuseMap) textureMap do m.name = map.name
)
)
) ; free selMats
)
renameMats selection