bLT_utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:bLandscapeTools 作者: paxetgloria 项目源码 文件源码
def exportSurfaceMask(overwriteSource):
    terrainSplatMaskPath = bpy.data.scenes["Default_Location"].ImportTerrainSplatMaskPath
    if bpy.context.scene.SurfaceMaskFormatValid:
        print('\nbLT_Info: Surface map export started ', time.ctime())
        from cv2 import imread as cv2imread, imwrite as cv2imwrite, IMREAD_COLOR as cv2IMREAD_COLOR
        ProjFolderPath = bpy.data.scenes["Default_Location"].ProjFolderPath
        locationName = bpy.context.scene.name
        sourceSurfaceMask = cv2imread(bpy.data.scenes["Default_Location"].ImportTerrainSplatMaskPath, cv2IMREAD_COLOR)
        locationSurfaceMask = cv2imread(r'{}ProjectData\Textures\TerrainMask_{}.png'.format(ProjFolderPath,locationName), cv2IMREAD_COLOR)
        terrainObject = bpy.data.objects.get('Terrain_{}'.format(locationName))
        sourceSurfaceMask[terrainObject['MergeTopLeftY']:terrainObject["MergeBottomRightY"],terrainObject["MergeTopLeftX"]:terrainObject["MergeBottomRightX"]] = locationSurfaceMask
        if overwriteSource:
            outputPath = terrainSplatMaskPath
        else:
            outputPath = '{}\\Output\\surfaceMask.png'.format(ProjFolderPath)
        cv2imwrite(outputPath, sourceSurfaceMask)
        print('bLT_Info: Surface map export finished ', time.ctime())
    else:
        print('\nbLT_Info:No surface map data exported!!! Source surface mask path not defined in Data Sources panel.')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号