有谁知道他们在更新 44 中导出画板时发生了什么变化?我写了一个插件来导出画板,但随着更新,导出的画板是“空的”。我确实看到 PNG 导出到了正确的路径(一切都正确;大小、名称、格式等),但 PNG 是“空的”(见截图)
我用来导出文件的片段是:
doc = context.document
var path // <-- assume this is a valid file URL
var layer // <-- assume this is a valid MSArtboardGroup
if (!layer.isLayerExportable()) {
print([NSString stringWithFormat:"The layer [%@] is not exportable!", layer.name()])
return
}
var requests = NSMutableArray.array()
for (var i = 0; i < layer.exportOptions().exportFormats().length; i++) {
var format = layer.exportOptions().exportFormats()[i]
var request = [MSExportRequest exportRequestFromExportFormat:format layer:layer inRect:layer.absoluteInfluenceRect() useIDForName:true]
request.name = (format.name()) ? format.name() : request.name()
requests.addObject(request)
}
// Loop all requests and export each of them
for(var k = 0; k < requests.length; k++) {
var request = requests[k]
exportName = request.name()
exportPath = [path stringByAppendingPathComponent:exportName]
exportPath = [exportPath stringByAppendingPathExtension:request.format()]
[doc saveArtboardOrSlice:request toFile:exportPath]
var msg = [NSString stringWithFormat:"Saved: %@ to %@", exportName, exportPath]
log(msg)
}
在片段完美运行之前,但现在我确实看到了文件已保存/导出但遇到我之前所说的问题的消息。
有谁知道必须更改什么才能正确导出?