| 185 | } |
| 186 | |
| 187 | bool AnimGraph::Load(ReadStream* stream, bool loadMeta) |
| 188 | { |
| 189 | Version++; |
| 190 | _bucketsCounter = 0; |
| 191 | _bucketInitializerList.Clear(); |
| 192 | _customNodes.Clear(); |
| 193 | |
| 194 | // Base |
| 195 | if (AnimGraphBase::Load(stream, loadMeta)) |
| 196 | return true; |
| 197 | |
| 198 | if (!_isFunction) |
| 199 | { |
| 200 | // Check if has a proper parameters setup |
| 201 | if (Parameters.IsEmpty()) |
| 202 | { |
| 203 | LOG(Warning, "Missing Animation Graph parameters."); |
| 204 | return true; |
| 205 | } |
| 206 | if (_rootNode == nullptr) |
| 207 | { |
| 208 | LOG(Warning, "Missing Animation Graph output node."); |
| 209 | return true; |
| 210 | } |
| 211 | if (BaseModel == nullptr) |
| 212 | { |
| 213 | LOG(Warning, "Missing Base Model asset for the Animation Graph. Animation won't be played."); |
| 214 | } |
| 215 | } |
| 216 | |
| 217 | // Register for scripts reloading events (only if using any custom nodes) |
| 218 | // Handle load event always because anim graph asset may be loaded before game scripts |
| 219 | if (_customNodes.HasItems() && !_isRegisteredForScriptingEvents) |
| 220 | { |
| 221 | _isRegisteredForScriptingEvents = true; |
| 222 | #if USE_EDITOR |
| 223 | Scripting::ScriptsReloading.Bind<AnimGraph, &AnimGraph::OnScriptsReloading>(this); |
| 224 | Scripting::ScriptsReloaded.Bind<AnimGraph, &AnimGraph::OnScriptsReloaded>(this); |
| 225 | #endif |
| 226 | Scripting::ScriptsLoaded.Bind<AnimGraph, &AnimGraph::OnScriptsLoaded>(this); |
| 227 | } |
| 228 | |
| 229 | return false; |
| 230 | } |
| 231 | |
| 232 | AnimGraph::~AnimGraph() |
| 233 | { |