def check_for_texture(texname, mapname): ufo_map = ufomap_io.read_ufo_map(mapname) for i in ufo_map: for j in i.brushes: for k in j.faces: if k.texture == texname: #found face with that texture return True return False
def scale_textures(texname, mapname, scalex, scaley): changed = False ufo_map = ufomap_io.read_ufo_map(mapname, True) for i in ufo_map: for j in i.brushes: for k in j.faces: if k.texture == texname: #found face with that texture k.scale[0] *= scalex k.scale[1] *= scaley k.offset[0] /= scalex k.offset[1] /= scaley changed = True if changed: ufomap_io.write_ufo_map(ufo_map, mapname) print "Texture found, map updated"
def add_textures(texnames, mapname): ufo_map = ufomap_io.read_ufo_map(mapname, True) for i in ufo_map: for j in i.brushes: for k in j.faces: texnames[k.texture] = True