Add PPI layer metadata save automation
This commit is contained in:
@@ -667,6 +667,16 @@ pp::foundation::Result<std::vector<std::byte>> create_minimal_ppi_project(PpiMin
|
||||
pp::foundation::Status::out_of_range("PPI layer name exceeds the configured limit"));
|
||||
}
|
||||
|
||||
if (config.layer_metadata.opacity < 0.0F || config.layer_metadata.opacity > 1.0F) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI layer opacity is outside the supported range"));
|
||||
}
|
||||
|
||||
if (config.layer_metadata.blend_mode > 4U) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI layer blend mode is outside the supported range"));
|
||||
}
|
||||
|
||||
if (config.layer_count == 0 || config.layer_count > max_ppi_layer_count) {
|
||||
return pp::foundation::Result<std::vector<std::byte>>::failure(
|
||||
pp::foundation::Status::out_of_range("PPI layer count is outside the configured range"));
|
||||
@@ -769,12 +779,12 @@ pp::foundation::Result<std::vector<std::byte>> create_minimal_ppi_project(PpiMin
|
||||
for (std::uint32_t layer = 0; layer < config.layer_count; ++layer) {
|
||||
const auto name = generated_layer_name(config.layer_name, layer, config.layer_count);
|
||||
append_u32(bytes, layer);
|
||||
append_f32(bytes, 1.0F);
|
||||
append_f32(bytes, config.layer_metadata.opacity);
|
||||
append_u32(bytes, static_cast<std::uint32_t>(name.size()));
|
||||
append_ascii(bytes, name);
|
||||
append_u32(bytes, 0);
|
||||
bytes.push_back(std::byte { 0 });
|
||||
bytes.push_back(std::byte { 1 });
|
||||
append_u32(bytes, config.layer_metadata.blend_mode);
|
||||
bytes.push_back(config.layer_metadata.alpha_locked ? std::byte { 1 } : std::byte { 0 });
|
||||
bytes.push_back(config.layer_metadata.visible ? std::byte { 1 } : std::byte { 0 });
|
||||
append_u32(bytes, config.frame_count);
|
||||
for (std::uint32_t frame = 0; frame < config.frame_count; ++frame) {
|
||||
append_u32(bytes, config.frame_duration_ms);
|
||||
|
||||
Reference in New Issue
Block a user