MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / serializeCurrentToJson

Method serializeCurrentToJson

source/MRViewer/MRColorTheme.cpp:165–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void ColorTheme::serializeCurrentToJson( Json::Value& root )
166{
167 assert( ImGui::GetCurrentContext() );
168 auto& instance = ColorTheme::instance();
169
170 std::vector<Color> sceneColors( SceneColors::Count );
171 for ( int i = 0; i < SceneColors::Count; ++i )
172 sceneColors[i] = SceneColors::get( SceneColors::Type( i ) );
173
174 const auto& vpParams = Viewer::instanceRef().viewport().getParameters();
175 setViewportColor( vpParams.backgroundColor, ViewportColorsType::Background );
176 setViewportColor( vpParams.borderColor, ViewportColorsType::Borders );
177
178 for ( int i = 0; i < SceneColors::Count; ++i )
179 serializeToJson( sceneColors[i], root[SceneColors::getName( SceneColors::Type( i ) )] );
180
181 root["ImGuiPreset"] = getPresetName( instance.themePreset_ );
182
183 auto& ribbonColors = root["Ribbon Colors"];
184 for ( int i = 0; i<int( RibbonColorsType::Count ); ++i )
185 serializeToJson( instance.newUIColors_[i], ribbonColors[getRibbonColorTypeName( RibbonColorsType( i ) )] );
186
187 auto& vieportColors = root["Viewport Colors"];
188 for ( int i = 0; i<int( ViewportColorsType::Count ); ++i )
189 serializeToJson( instance.viewportColors_[i], vieportColors[getViewportColorTypeName( ViewportColorsType( i ) )] );
190}
191
192void ColorTheme::apply_( const std::vector<Color>& sceneColors )
193{

Callers

nothing calls this directly

Calls 6

instanceFunction · 0.85
RibbonColorsTypeEnum · 0.85
ViewportColorsTypeEnum · 0.85
TypeEnum · 0.70
serializeToJsonFunction · 0.70
getFunction · 0.50

Tested by

no test coverage detected