Modified SHRig to use indices provided by SHRigAsset instead of auto generated indices
This commit is contained in:
parent
bce7237e20
commit
af3e4a3cfd
|
@ -33,7 +33,6 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do a recursive depth first traversal to populate the rig
|
// Do a recursive depth first traversal to populate the rig
|
||||||
nodeCount = 0;
|
|
||||||
rootNode = recurseCreateNode(asset, asset.root);
|
rootNode = recurseCreateNode(asset, asset.root);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ namespace SHADE
|
||||||
|
|
||||||
int SHRig::GetNodeCount() const noexcept
|
int SHRig::GetNodeCount() const noexcept
|
||||||
{
|
{
|
||||||
return nodeCount;
|
return static_cast<int>(nodes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
int SHRig::GetNodeIndex(Handle<Node> node) const noexcept
|
int SHRig::GetNodeIndex(Handle<Node> node) const noexcept
|
||||||
|
@ -80,7 +79,6 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
// Construct the node
|
// Construct the node
|
||||||
auto newNode = nodeStore.Create();
|
auto newNode = nodeStore.Create();
|
||||||
++nodeCount;
|
|
||||||
|
|
||||||
// Fill the node with data
|
// Fill the node with data
|
||||||
const auto& NODE_DATA = asset.nodeDataCollection.at(sourceNode->idRef);
|
const auto& NODE_DATA = asset.nodeDataCollection.at(sourceNode->idRef);
|
||||||
|
@ -91,9 +89,9 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
nodeNames.emplace(newNode, NODE_DATA.name);
|
nodeNames.emplace(newNode, NODE_DATA.name);
|
||||||
nodesByName.emplace(NODE_DATA.name, newNode);
|
nodesByName.emplace(NODE_DATA.name, newNode);
|
||||||
nodeIndexMap.emplace(newNode, nodes.size());
|
|
||||||
nodes.emplace_back(newNode);
|
|
||||||
}
|
}
|
||||||
|
nodeIndexMap.emplace(newNode, sourceNode->idRef);
|
||||||
|
nodes.emplace_back(newNode);
|
||||||
|
|
||||||
// Fill child nodes
|
// Fill child nodes
|
||||||
for (const auto& child : sourceNode->children)
|
for (const auto& child : sourceNode->children)
|
||||||
|
|
|
@ -94,7 +94,6 @@ namespace SHADE
|
||||||
std::unordered_map<std::string, Handle<Node>> nodesByName;
|
std::unordered_map<std::string, Handle<Node>> nodesByName;
|
||||||
std::vector<Handle<Node>> nodes;
|
std::vector<Handle<Node>> nodes;
|
||||||
std::unordered_map<Handle<Node>, int> nodeIndexMap;
|
std::unordered_map<Handle<Node>, int> nodeIndexMap;
|
||||||
int nodeCount = 0;
|
|
||||||
SHResourceLibrary<Node> nodeStore;
|
SHResourceLibrary<Node> nodeStore;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in New Issue