File indexing completed on 2025-01-05 04:01:12

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 #pragma once
0007 
0008 #include "ae_project.hpp"
0009 #include "model/document.hpp"
0010 #include "aep_format.hpp"
0011 #include "model/assets/assets.hpp"
0012 
0013 namespace glaxnimate::io::aep {
0014 
0015 class AepLoader
0016 {
0017 public:
0018     AepLoader(model::Document* document, const Project& project, QDir asset_path, ImportExport* io)
0019     : document(document), project(project), asset_path(asset_path), io(io)
0020     {}
0021 
0022     void load_project();
0023 
0024     struct CompData;
0025 private:
0026     struct ColorInfo
0027     {
0028         model::NamedColor* asset;
0029         const Solid* solid;
0030     };
0031 
0032     void load_comp(const Composition& comp);
0033     void load_asset(const FolderItem* item);
0034     void load_layer(const Layer& layer, CompData& data);
0035     void asset_layer(model::Layer* layer, const Layer& ae_layer, CompData& data);
0036     void shape_layer(model::Layer* layer, const Layer& ae_layer, CompData& data);
0037     void text_layer(model::Layer* layer, const Layer& ae_layer, CompData& data);
0038 
0039     void warning(const QString& msg);
0040     void info(const QString& msg);
0041     model::Composition* get_comp(Id id);
0042 
0043     model::Document* document;
0044     const Project& project;
0045     QDir asset_path;
0046     ImportExport* io;
0047     std::unordered_map<Id, ColorInfo> colors;
0048     std::unordered_map<Id, model::Composition*> comps;
0049     std::unordered_map<Id, model::Bitmap*> images;
0050     std::unordered_map<Id, QPointF> asset_size;
0051 };
0052 
0053 } // namespace glaxnimate::io::aep