Open jethac opened 8 years ago
Well, I feel dumb. Coming back to it with fresh eyes, IResourceService has a ResourceLoaded event... I'll just let myself out here. Sorry to make you worry!
...sadly, that didn't help very much at all. The triggering order seems to be:
[C#] IResourceService.OnResourceLoaded [C#] IResourceConverter.Convert [C++] ResourceFactory.LoadResource
...and I'm after something that can tell me when LoadResource succeeds. If anything, IResourceService might be better named OnResourceRequested - it implies that the resource is ready at that point, when it's not guaranteed to be in fact.
Any notes re: resource lifecycle would be appreciated!
In C++ side there is an event called when resource is loaded. look at class MyResourceListener : public ResourceListener {} located in LvEdRenderingEngine.cpp. OnResourceLoaded(Resource* r); is called when resource is loaded. The current implementation of OnResourceLoaded invokes InvalidateViewsCallbackType call back. I suggest to rename InvalidateViewsCallbackType to resource loaded call back and do the same in C# side. Also rename C# side too.
Cheers Alan - that does look like what I'm after in terms of the lifecycle. Will take a stab at it now! :+1:
Hello! As per topic - I find myself in need of a resource-loaded listener in managed land, and for the life of me I can't seem to find one. The use case is, loading a game object definition file that contains game object component definitions, and then resolving and instantiating components for those definitions once the file has been loaded.
If the functionality doesn't exist yet I'll take a swing at it, but I figured I'd ask just in case.