Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a function that enables all the variables in a data model to be m… #289

Merged
merged 2 commits into from
Mar 6, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Include/RmlUi/Core/DataModelHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class RMLUICORE_API DataModelHandle {

bool IsVariableDirty(const String& variable_name);
void DirtyVariable(const String& variable_name);
void MarkAllDirty();
EhWhoAmI marked this conversation as resolved.
Show resolved Hide resolved

explicit operator bool() { return model; }

Expand Down
6 changes: 6 additions & 0 deletions Source/Core/DataModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,12 @@ bool DataModel::IsVariableDirty(const String& variable_name) const
return dirty_variables.count(variable_name) == 1;
}

void DataModel::MarkAllDirty() {
for (auto variable : variables) {
dirty_variables.emplace(variable.first);
}
EhWhoAmI marked this conversation as resolved.
Show resolved Hide resolved
}

bool DataModel::CallTransform(const String& name, Variant& inout_result, const VariantList& arguments) const
{
if (transform_register)
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DataModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ class DataModel : NonCopyMoveable {

void DirtyVariable(const String& variable_name);
bool IsVariableDirty(const String& variable_name) const;
void MarkAllDirty();

bool CallTransform(const String& name, Variant& inout_result, const VariantList& arguments) const;

Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DataModelHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ void DataModelHandle::DirtyVariable(const String& variable_name) {
model->DirtyVariable(variable_name);
}

void DataModelHandle::MarkAllDirty() {
model->MarkAllDirty();
}


DataModelConstructor::DataModelConstructor() : model(nullptr), type_register(nullptr) {}

Expand Down