From 1a8323b8f91bb30d64f8b79d77e43e8a9bc0af1d Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 10 Mar 2023 00:01:06 +0000 Subject: Mutation persists its own members --- assetFactory/faceController.cpp | 2 +- assetFactory/mutation.cpp | 5 +++++ assetFactory/mutation.h | 4 ++++ assetFactory/use.cpp | 3 +-- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/assetFactory/faceController.cpp b/assetFactory/faceController.cpp index b485c80..b6d3d34 100644 --- a/assetFactory/faceController.cpp +++ b/assetFactory/faceController.cpp @@ -86,6 +86,6 @@ bool FaceController::persist(Persistence::PersistenceStore & store) { return STORE_TYPE && STORE_MEMBER(id) && Style::persist(store) && STORE_MEMBER(type) && STORE_MEMBER(smooth) - && STORE_MEMBER(scale) && STORE_MEMBER(position) && STORE_MEMBER(rotation) + && Mutation::persist(store) && STORE_NAME_HELPER("face", faceControllers, Persistence::MapByMember); } diff --git a/assetFactory/mutation.cpp b/assetFactory/mutation.cpp index 9722dc3..9a6a988 100644 --- a/assetFactory/mutation.cpp +++ b/assetFactory/mutation.cpp @@ -27,3 +27,8 @@ Mutation::relativeLevelOfDetail() const { return std::max({scale.x, scale.y, scale.z}); } +bool +Mutation::persist(Persistence::PersistenceStore & store) +{ + return STORE_MEMBER(scale) && STORE_MEMBER(position) && STORE_MEMBER(rotation); +} diff --git a/assetFactory/mutation.h b/assetFactory/mutation.h index e620955..2432174 100644 --- a/assetFactory/mutation.h +++ b/assetFactory/mutation.h @@ -1,5 +1,6 @@ #pragma once +#include "persistence.h" #include #include @@ -15,4 +16,7 @@ struct Mutation { glm::vec3 position {}; glm::vec3 rotation {}; glm::vec3 scale {1}; + +protected: + bool persist(Persistence::PersistenceStore & store); }; diff --git a/assetFactory/use.cpp b/assetFactory/use.cpp index 898b736..5e45c87 100644 --- a/assetFactory/use.cpp +++ b/assetFactory/use.cpp @@ -49,7 +49,6 @@ struct Lookup : public Persistence::SelectionV { bool Use::persist(Persistence::PersistenceStore & store) { - return STORE_TYPE && STORE_HELPER(type, Lookup) && STORE_MEMBER(position) && STORE_MEMBER(scale) - && STORE_MEMBER(rotation) && Style::persist(store) + return STORE_TYPE && STORE_HELPER(type, Lookup) && Mutation::persist(store) && Style::persist(store) && STORE_NAME_HELPER("face", faceControllers, Persistence::MapByMember); } -- cgit v1.2.3