Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResourceListener - managed usage? #32

Open
jethac opened this issue Apr 6, 2016 · 4 comments
Open

ResourceListener - managed usage? #32

jethac opened this issue Apr 6, 2016 · 4 comments

Comments

@jethac
Copy link

jethac commented Apr 6, 2016

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.

@jethac
Copy link
Author

jethac commented Apr 7, 2016

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!

@jethac jethac closed this as completed Apr 7, 2016
@jethac jethac reopened this Apr 7, 2016
@jethac
Copy link
Author

jethac commented Apr 7, 2016

...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!

@abeckus
Copy link
Contributor

abeckus commented Apr 7, 2016

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.

@jethac
Copy link
Author

jethac commented Apr 11, 2016

Cheers Alan - that does look like what I'm after in terms of the lifecycle. Will take a stab at it now! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants