Can now save/load resources
This commit is contained in:
parent
9913eb6c8e
commit
b5877ff3ca
13 changed files with 59 additions and 0 deletions
|
|
@ -545,6 +545,10 @@ void DrawingProgram::save_file(cereal::PortableBinaryOutputArchive& a) const {
|
|||
layerMan.save_file(a);
|
||||
}
|
||||
|
||||
void DrawingProgram::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) {
|
||||
layerMan.get_used_resources(resourceSet);
|
||||
}
|
||||
|
||||
void DrawingProgram::draw(SkCanvas* canvas, const DrawData& drawData) {
|
||||
if(drawData.dontUseDrawProgCache)
|
||||
layerMan.draw(canvas, drawData);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ class DrawingProgram {
|
|||
void init_client_callbacks();
|
||||
void add_file_to_canvas_by_path(const std::filesystem::path& filePath, Vector2f dropPos, bool addInSameThread);
|
||||
void add_file_to_canvas_by_data(const std::string& fileName, std::string_view fileBuffer, Vector2f dropPos);
|
||||
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet);
|
||||
|
||||
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version);
|
||||
void save_file(cereal::PortableBinaryOutputArchive& a) const;
|
||||
|
|
|
|||
|
|
@ -70,3 +70,8 @@ void DrawingProgramLayer::save_file(cereal::PortableBinaryOutputArchive& a) cons
|
|||
for(auto& comp : *components)
|
||||
comp.obj->save_file(a);
|
||||
}
|
||||
|
||||
void DrawingProgramLayer::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const {
|
||||
for(auto& comp : *components)
|
||||
comp.obj->get_comp().get_used_resources(resourceSet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ class DrawingProgramLayer {
|
|||
|
||||
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version, DrawingProgramLayerManager& layerMan);
|
||||
void save_file(cereal::PortableBinaryOutputArchive& a) const;
|
||||
|
||||
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const;
|
||||
private:
|
||||
std::function<void(const CanvasComponentContainer::ObjInfoIterator& c)> eraseCallback;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,3 +69,8 @@ void DrawingProgramLayerFolder::save_file(cereal::PortableBinaryOutputArchive& a
|
|||
for(auto& listItem : *folderList)
|
||||
listItem.obj->save_file(a);
|
||||
}
|
||||
|
||||
void DrawingProgramLayerFolder::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const {
|
||||
for(auto& listItem : *folderList)
|
||||
listItem.obj->get_used_resources(resourceSet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,4 +21,6 @@ class DrawingProgramLayerFolder {
|
|||
|
||||
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version, DrawingProgramLayerManager& layerMan);
|
||||
void save_file(cereal::PortableBinaryOutputArchive& a) const;
|
||||
|
||||
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -121,6 +121,13 @@ void DrawingProgramLayerListItem::save_file(cereal::PortableBinaryOutputArchive&
|
|||
layerData->save_file(a);
|
||||
}
|
||||
|
||||
void DrawingProgramLayerListItem::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const {
|
||||
if(folderData)
|
||||
folderData->get_used_resources(resourceSet);
|
||||
else
|
||||
layerData->get_used_resources(resourceSet);
|
||||
}
|
||||
|
||||
void DrawingProgramLayerListItem::draw(SkCanvas* canvas, const DrawData& drawData) const {
|
||||
if(displayData->visible) {
|
||||
SkPaint layerPaint;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <Helpers/NetworkingObjects/NetObjManager.hpp>
|
||||
#include <Helpers/NetworkingObjects/NetObjOrderedList.hpp>
|
||||
#include <Helpers/NetworkingObjects/DelayUpdateSerializedClassManager.hpp>
|
||||
#include <unordered_set>
|
||||
#include "DrawingProgramLayerFolder.hpp"
|
||||
#include "DrawingProgramLayer.hpp"
|
||||
#include "SerializedBlendMode.hpp"
|
||||
|
|
@ -29,6 +30,7 @@ class DrawingProgramLayerListItem {
|
|||
void get_flattened_component_list(std::vector<CanvasComponentContainer::ObjInfo*>& objList) const;
|
||||
void get_flattened_layer_list(std::vector<DrawingProgramLayerListItem*>& objList);
|
||||
void scale_up(const WorldScalar& scaleUpAmount);
|
||||
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) const;
|
||||
|
||||
void set_alpha(DrawingProgramLayerManager& layerMan, float newAlpha) const;
|
||||
float get_alpha() const;
|
||||
|
|
|
|||
|
|
@ -120,3 +120,7 @@ void DrawingProgramLayerManager::load_file(cereal::PortableBinaryInputArchive& a
|
|||
void DrawingProgramLayerManager::save_file(cereal::PortableBinaryOutputArchive& a) const {
|
||||
layerTreeRoot->save_file(a);
|
||||
}
|
||||
|
||||
void DrawingProgramLayerManager::get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet) {
|
||||
layerTreeRoot->get_used_resources(resourceSet);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ class DrawingProgramLayerManager {
|
|||
|
||||
void load_file(cereal::PortableBinaryInputArchive& a, VersionNumber version);
|
||||
void save_file(cereal::PortableBinaryOutputArchive& a) const;
|
||||
void get_used_resources(std::unordered_set<NetworkingObjects::NetObjID>& resourceSet);
|
||||
|
||||
bool layer_tree_root_exists();
|
||||
const DrawingProgramLayerListItem& get_layer_root();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue