mirror of
https://github.com/4sval/FModel.git
synced 2026-04-25 07:21:54 -05:00
Fix StateRootNodeIndex mapping: use (Count - 1 - index) for reverse ChildProperties order
Co-authored-by: LoogLong <86428208+LoogLong@users.noreply.github.com>
This commit is contained in:
parent
e3030cb0a0
commit
c2ea844f0c
|
|
@ -653,6 +653,8 @@ public class AnimGraphViewModel
|
||||||
metadata.StateNames.Add(stateName);
|
metadata.StateNames.Add(stateName);
|
||||||
|
|
||||||
// Mark root node via StateRootNodeIndex
|
// Mark root node via StateRootNodeIndex
|
||||||
|
// UE stores node indices in reverse order relative to ChildProperties,
|
||||||
|
// so the actual index into animNodeProps is (Count - 1 - stateRootIndex).
|
||||||
if (!stateStruct.TryGetValue(out int stateRootIndex, "StateRootNodeIndex") ||
|
if (!stateStruct.TryGetValue(out int stateRootIndex, "StateRootNodeIndex") ||
|
||||||
stateRootIndex < 0 || stateRootIndex >= animNodeProps.Count)
|
stateRootIndex < 0 || stateRootIndex >= animNodeProps.Count)
|
||||||
{
|
{
|
||||||
|
|
@ -660,7 +662,8 @@ public class AnimGraphViewModel
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var rootPropName = animNodeProps[stateRootIndex].name;
|
var mappedIndex = animNodeProps.Count - 1 - stateRootIndex;
|
||||||
|
var rootPropName = animNodeProps[mappedIndex].name;
|
||||||
metadata.StateRootPropNames.Add(rootPropName);
|
metadata.StateRootPropNames.Add(rootPropName);
|
||||||
if (nodeByName.TryGetValue(rootPropName, out var rootNode))
|
if (nodeByName.TryGetValue(rootPropName, out var rootNode))
|
||||||
rootNode.AdditionalProperties["BelongsToStateMachine"] = machineName;
|
rootNode.AdditionalProperties["BelongsToStateMachine"] = machineName;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user