MCPcopy Create free account
hub / github.com/MihailRis/voxelcore / read_node

Function read_node

src/objects/rigging.cpp:132–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132static std::tuple<size_t, std::unique_ptr<Bone>> read_node(
133 const dynamic::Map_sptr& root, size_t index
134) {
135 std::string name;
136 std::string model;
137 root->str("name", name);
138 root->str("model", model);
139
140 glm::vec3 offset(0.0f);
141 dynamic::get_vec(root, "offset", offset);
142
143 std::vector<std::unique_ptr<Bone>> bones;
144 size_t count = 1;
145 if (auto nodesList = root->list("nodes")) {
146 for (size_t i = 0; i < nodesList->size(); i++) {
147 if (const auto& map = nodesList->map(i)) {
148 auto [subcount, subNode] = read_node(map, index+count);
149 count += subcount;
150 bones.push_back(std::move(subNode));
151 }
152 }
153 }
154 return {count, std::make_unique<Bone>(index, name, model, std::move(bones), offset)};
155}
156
157std::unique_ptr<SkeletonConfig> SkeletonConfig::parse(
158 std::string_view src,

Callers 1

parseMethod · 0.85

Calls 5

get_vecFunction · 0.85
strMethod · 0.80
listMethod · 0.80
mapMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected