So there is a ruby plugin I've done (based on TIG's post). It renames all texture files in model with a template.
module VNV
def VNV.rename_textures
UI.messagebox("All texture file names will be changed with a template - mat000")
model = Sketchup.active_model
model.start_operation('Rename texture files', true)
tw = Sketchup.create_texture_writer
temp_path = File.expand_path( ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] )
temp_folder = File.join( temp_path, 'Sketchup_tmp_mtl' )
unless File.exist?( temp_folder )
Dir.mkdir( temp_folder )
end
group = model.active_entities.add_group()
Sketchup.active_model.materials.each_with_index{ |m,i|
if m.texture then
group.material = m
tw.load(group)
path_to_png = File.join(temp_folder, "mat#{'%03d' % i}"+".png")
tw.write(group, path_to_png)
w = m.texture.width
h = m.texture.height
m.texture = path_to_png
m.texture.size = [w, h]
File.delete(path_to_png)
end
}
group.erase!
model.commit_operation
end # def
end # module
if (!file_loaded?(__FILE__))
menu = UI.menu("Plugins")
menu.add_item("Rename texture files") { VNV;;rename_textures }
# Let Ruby know we have loaded this file
file_loaded(__FILE__)
end
RenameTextures.rb