add ppbr info data

This commit is contained in:
2019-09-19 10:14:31 +02:00
parent 814fd76292
commit 4d788bb174
7 changed files with 45 additions and 12 deletions

View File

@@ -684,7 +684,7 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr<Brush> brush)
m_notification->SetVisibility(m_container->m_children.size() == 0);
}
bool NodePanelBrushPreset::export_ppbr(const std::string& path, const Image& header_image)
bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo& info_data)
{
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)");
std::smatch m;
@@ -724,8 +724,12 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const Image& hea
info.class_id = "ppbr_info";
info.name = L"info header";
bool has_header_image = header_image.m_data != nullptr;
bool has_header_image = info_data.header_image.m_data != nullptr;
info.props["author"] = std::make_shared<Serializer::String>(info_data.author);
info.props["email"] = std::make_shared<Serializer::String>(info_data.email);
info.props["url"] = std::make_shared<Serializer::String>(info_data.url);
info.props["descr"] = std::make_shared<Serializer::String>(info_data.descr);
info.props["has_header_image"] = std::make_shared<Serializer::Boolean>(has_header_image);
info.props["num_brush_tips"] = std::make_shared<Serializer::Integer>(img_brushes.size());
info.props["num_brush_patt"] = std::make_shared<Serializer::Integer>(img_patterns.size());
@@ -739,8 +743,8 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const Image& hea
// header image
if (has_header_image)
{
sw << header_image;
header_image.save_jpg(out_path + "/header.jpg", 75);
sw << info_data.header_image;
info_data.header_image.save_jpg(out_path + "/header.jpg", 75);
}
pb->increment();