MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / onNodeLoaded

Method onNodeLoaded

Source/Engine/Animations/Graph/AnimGraph.Base.cpp:139–390  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137 _graph->_bucketInitializerList.Add(initializer)
138
139bool AnimGraphBase::onNodeLoaded(Node* n)
140{
141 ((AnimGraphNode*)n)->Graph = _graph;
142 switch (n->GroupID)
143 {
144 // Tools
145 case 7:
146 switch (n->TypeID)
147 {
148 // Time
149 case 5:
150 ADD_BUCKET(AnimationBucketInit);
151 break;
152 }
153 break;
154 // Animation
155 case 9:
156 switch (n->TypeID)
157 {
158 // Output
159 case 1:
160 _rootNode = n;
161 if (_rootNode->Values.Count() < 1)
162 {
163 _rootNode->Values.Resize(1);
164 _rootNode->Values[0] = (int32)RootMotionExtraction::NoExtraction;
165 }
166 break;
167 // Animation
168 case 2:
169 ADD_BUCKET(AnimationBucketInit);
170 n->Assets.Resize(1);
171 n->Assets[0] = (Asset*)Content::LoadAsync<Animation>((Guid)n->Values[0]);
172 break;
173 // Blend with Mask
174 case 11:
175 n->Assets.Resize(1);
176 n->Assets[0] = (Asset*)Content::LoadAsync<SkeletonMask>((Guid)n->Values[1]);
177 break;
178 // Multi Blend 1D
179 case 12:
180 ADD_BUCKET(MultiBlendBucketInit);
181 n->Data.MultiBlend1D.Count = (ANIM_GRAPH_MULTI_BLEND_INDEX)((n->Values.Count() - 4) / 2); // 4 node values + 2 per blend point
182 n->Data.MultiBlend1D.Length = -1;
183 n->Data.MultiBlend1D.IndicesSorted = (ANIM_GRAPH_MULTI_BLEND_INDEX*)Allocator::Allocate(sizeof(ANIM_GRAPH_MULTI_BLEND_INDEX) * n->Data.MultiBlend1D.Count);
184 n->Assets.Resize(n->Data.MultiBlend1D.Count);
185 for (int32 i = 0; i < n->Data.MultiBlend1D.Count; i++)
186 {
187 n->Assets[i] = Content::LoadAsync<Animation>((Guid)n->Values[i * 2 + 5]);
188 n->Data.MultiBlend1D.IndicesSorted[i] = (ANIM_GRAPH_MULTI_BLEND_INDEX)(n->Assets[i] ? i : ANIM_GRAPH_MULTI_BLEND_INVALID);
189 }
190 Sorting::SortArray(n->Data.MultiBlend1D.IndicesSorted, n->Data.MultiBlend1D.Count, &SortMultiBlend1D, n);
191 break;
192 // Multi Blend 2D
193 case 13:
194 {
195 ADD_BUCKET(MultiBlendBucketInit);
196 n->Data.MultiBlend1D.Count = (ANIM_GRAPH_MULTI_BLEND_INDEX)((n->Values.Count() - 4) / 2); // 4 node values + 2 per blend point

Callers

nothing calls this directly

Calls 14

SortArrayFunction · 0.85
Float2Class · 0.85
TriangulateFunction · 0.85
AsFloat4Method · 0.80
WaitForLoadedMethod · 0.80
InitCustomNodeMethod · 0.80
TriangleFunction · 0.50
CountMethod · 0.45
ResizeMethod · 0.45
AddMethod · 0.45
LoadSurfaceMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected