MCPcopy Create free account
hub / github.com/MyGUI/mygui / fillRegionData

Method fillRegionData

Tools/SkinEditor/SkinExportSerializer.cpp:346–417  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344 }
345
346 void SkinExportSerializer::fillRegionData(DataPtr _data, pugi::xml_node _node)
347 {
348 pugi::xpath_node_set regions = _node.select_nodes(R"(BasisSkin[@type="SubSkin"or@type="TileRect"])");
349 for (auto region : regions)
350 {
351 DataPtr regionData = nullptr;
352
353 MyGUI::Align align = MyGUI::Align::parse(region.node().attribute("align").value());
354
355 if (align.isLeft() && align.isTop())
356 regionData = getChildData(_data, "Region", "Left Top");
357 else if (align.isLeft() && align.isVStretch())
358 regionData = getChildData(_data, "Region", "Left");
359 else if (align.isLeft() && align.isBottom())
360 regionData = getChildData(_data, "Region", "Left Bottom");
361
362 else if (align.isHStretch() && align.isTop())
363 regionData = getChildData(_data, "Region", "Top");
364 else if (align.isHStretch() && align.isVStretch())
365 regionData = getChildData(_data, "Region", "Center");
366 else if (align.isHStretch() && align.isBottom())
367 regionData = getChildData(_data, "Region", "Bottom");
368
369 else if (align.isRight() && align.isTop())
370 regionData = getChildData(_data, "Region", "Right Top");
371 else if (align.isRight() && align.isVStretch())
372 regionData = getChildData(_data, "Region", "Right");
373 else if (align.isRight() && align.isBottom())
374 regionData = getChildData(_data, "Region", "Right Bottom");
375
376 if (regionData == nullptr)
377 continue;
378
379 regionData->setPropertyValue("Visible", "True");
380
381 std::string_view type = region.node().attribute("type").value();
382 if (type == "TileRect")
383 {
384 bool vert = MyGUI::utility::parseValue<bool>(
385 region.node().select_single_node("State/Property[@key=\"TileV\"]/@value").attribute().value());
386 bool horz = MyGUI::utility::parseValue<bool>(
387 region.node().select_single_node("State/Property[@key=\"TileH\"]/@value").attribute().value());
388
389 if (vert && !horz)
390 type = "TileRect Vert";
391 else if (!vert && horz)
392 type = "TileRect Horz";
393 }
394
395 regionData->setPropertyValue("Type", type);
396 }
397
398 pugi::xpath_node regionText = _node.select_single_node(R"(BasisSkin[@type="SimpleText"or@type="EditText"])");
399 if (!regionText.node().empty())
400 {
401 DataPtr regionData = getChildData(_data, "RegionText", "Text");
402
403 if (regionData != nullptr)

Callers

nothing calls this directly

Calls 8

parseFunction · 0.50
select_nodesMethod · 0.45
valueMethod · 0.45
attributeMethod · 0.45
nodeMethod · 0.45
setPropertyValueMethod · 0.45
select_single_nodeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected