def process_dirs_to_atlas():
    for dirname in [ d for d in os.listdir( '.' ) if os.path.isdir( d ) and not d in excluded_dirs ]:
        filenames = glob.glob( os.path.join( dirname, "*.png" ) )
        dest_filename = os.path.join( out_path, dirname + ".tex" )
        xml_filename = os.path.join( out_path, dirname + ".xml" )

        if util.IsAnyFileNewer( filenames, [ dest_filename, xml_filename ] ) or args.force:
            print( "Processing " + dirname )

            working_dir = os.path.join( tempfile.gettempdir(), dirname )
            try:
                if os.path.exists( working_dir ):
                    shutil.rmtree( working_dir )
                os.makedirs( working_dir )

                size = None
                border_size = 0

                if ImageProperties in dirname:
                    width = ImageProperties[dirname].get( "width", None )
                    height = ImageProperties[dirname].get( "height", None )
                    border_size = ImageProperties[dirname].get( "border", 0 )

                    if width != None and height != None:
                        size = ( width, height )

                images = []
                for filename in filenames:
                    im = imgutil.OpenImage( filename, size=size, border_size=border_size )
                    filename, ext = os.path.splitext( os.path.basename( filename ) )
                    im.name = filename + ".tex" 
                    images.append( im )

                atlas_data = atlas.Atlas( images, dirname, minimize_num_textures=True, ignore_exceptions=args.ignoreexceptions, force_square=args.square )
                assert len( atlas_data ) == 1
                page = atlas_data[0]

                mip_filenames = []
                for mip_idx in range( len( page.mips ) ):
                    mip = page.mips[mip_idx]

                    mip_filename = mip.name + "-mip{}.png".format( mip_idx )
                    full_mip_filename = os.path.join( working_dir, mip_filename )
                    mip_filenames.append( full_mip_filename )
                    mip.im.save( full_mip_filename )

                textureconverter.Convert(
                        src_filenames=mip_filenames, dest_filename=dest_filename,
                        platform=args.platform, texture_format=args.textureformat, force=args.force,
                        ignore_exceptions=args.ignoreexceptions)
                        
                tex_filename = os.path.relpath( dest_filename, ROOT ).replace( "\\", "/" )
                xml = atlas.GenerateXMLTree( tex_filename, page.mips[0].im.size, page.bboxes, border_size + 0.5 )
                xml.write( xml_filename )

            finally:
                if os.path.exists( working_dir ):
                    shutil.rmtree( working_dir )
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/cmn/mod_tools/compiler_scripts/image_build.py/process_dirs_to_atlas/swapped operands of `in`