First pass on tracking changed properties/assets since initialization

This commit is contained in:
GPayne
2020-03-22 20:59:15 -06:00
parent 4753d562f1
commit 6253a5cf2e
7 changed files with 34 additions and 0 deletions
@@ -76,6 +76,7 @@ public:
const glm::mat4& projectionMatrix);
void drawOverlays();
void postDraw();
void resetPropertyChangeFlags();
void keyboardCallback(Key key, KeyModifier mod, KeyAction action);
void charCallback(unsigned int codepoint, KeyModifier modifier);
void mouseButtonCallback(MouseButton button, MouseAction action, KeyModifier mods);
+8
View File
@@ -495,6 +495,11 @@ public:
*/
virtual std::string generateAdditionalJsonDescription() const;
/**
* Reset the valChanged flag to an unchanged state, as if value has not been changed.
*/
void resetToUnchanged();
protected:
static const char* IdentifierKey;
static const char* NameKey;
@@ -531,6 +536,9 @@ protected:
/// The callback function sthat will be invoked whenever the value changes
std::vector<std::pair<OnDeleteHandle, std::function<void()>>> _onDeleteCallbacks;
/// Flag indicating that this property value has been changed after initialization
bool valChanged = false;
private:
void notifyDeleteListeners();
@@ -176,6 +176,7 @@ void openspace::properties::TemplateProperty<T>::setValue(T val) {
if (val != _value) {
_value = std::move(val);
notifyChangeListeners();
valChanged = true;
}
}
@@ -196,6 +197,7 @@ void TemplateProperty<T>::set(std::any value) {
if (v != _value) {
_value = std::move(v);
notifyChangeListeners();
valChanged = true;
}
}
+3
View File
@@ -226,6 +226,9 @@ private:
std::unordered_map<Asset*, std::map<Asset*, std::vector<int>>>
_onDependencyDeinitializationFunctionRefs;
int _assetsTableRef;
std::vector<std::string> profileAssetsAdded;
std::vector<std::string> profileAssetsRemoved;
};
} // namespace openspace