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.')
评论列表
文章目录