-
Notifications
You must be signed in to change notification settings - Fork 17
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
Implement a way to update only changed effects. #5
Comments
+1 for this. I guess it gets particularly slow because of the webgl shader recompilation + the avs expression recompilation. I was thinking something along these lines: All preset component definitions can have an 'id'. Webvs.Main will have a |
On second thought. we would need actual tree operations on main wouldnt we?
|
Yeah, that sounds like the cleanest approach to me. With |
Maybe I'm being dense, but how you supposed to get the component id in order to use these functions? |
yes, this is an issue. Firstly, ids can be specified in the JSON. If not, an id will be autogenerated when the effects are created. Secondly, letting the frontend know about the ids and the current webvs internal effect tree structure, could be a bit tricky. i was thinking, if there is some sort of a traversal method like 'traverse(callback)' that gives you this, then something like
will allow us to build the tree in the UI. what do you think? On a side note, this feature messes up the |
Ahh, this does sound like a problem. Hmm... well you can already traverse the internal copy of the preset ( (My brain wasn't switched on when I first read that idea and I ended up writing the below) From my perspective managing the internal copy of the preset ( Say as the preset is built by webvs, each component adds its ID (if it doesn't have one) to its node in I'm not sure if that would be the best way, or what would be. Maybe yours would be. As for clones, it's a nice feature. It doesn't get in the way of any AVS presets or functionality and it can be used to reduce duplicate code, which everyone likes. Would marking them internally as clone of a component not help with tree operations? Perhaps treating the first one as the "real" component (maybe storing the number of clones of it with it) and then marking the rest.
Would doing it like that be viable and less complicated? |
The place where UI could go out of sync is when we load a preset. After loading a preset, UI could use As for the clone, yes this is exactly how i ended up writing the code. It gets a bit complicated when you realize that you can clone Effectlists as well. Moving another component (cloned or otherwise) into or out-of such an effectlist will require us to increase or decrease the number of clones correspondingly and redistribute them among the Effectlist clones. And this has to happen all the way through no matter how many cloned Effectlists there might be along the path. |
I haven't looked at the code in detail, but just from reading this thread, wouldn't it make sense to have the components in the tree only store their multiplicity? By this I mean that you could store any effect's clones just as a number n and then have the rendering loop them n times (with index substitution of course). This way you wouldn't have to maintain duplicated effects anywhere, neither internally nor in the UI. |
@grandchild yes that could work if the superscope code doesnt rely on the state of the previous frame. But effects are a lot more than just a bunch of code followed by rendering. The effect encapsulates the states of the avs variables as well. The values of variables persist, across frames. (for eg: if you do |
I've encountered a couple of typo's while trying to implement the new methods. (patch: http://pastebin.com/raw.php?i=yKUck3ZA - cba to fork just for typos) Anyway, I've found that webvs just stops rendering with no errors thrown when I update a component. Found a bug too while removing things in the Jello cube preset, if you remove the top buffer save:
(I'm also using |
Thanks. Applied patch + fixed some of the problems. That was a lot of silly mistakes 😁 I have tested updates with the editor. I'm sure there are still more, so i've pushed the changes to 1.1dev branch, once we've ironed out the rough edges, i'll patch the changes back to master. The editor is looking awesome btw. i like the textbox popout feature. One thing that i noticed, is that even with these changes there is still quite a bit of lag when updating some of the components, particularly the cloned ones. I guess live updating the components (as opposed to replacing with new instance) has to be done. As you've mentioned, It is a bit important because live-editing is sort of the defining and perhaps most useful feature of AVS. |
Great, thanks for those fixes. I found my
I still have to get the move function sorted out, I think that is the last thing, other than testing. Thank you, I thought it was a nice addition. Yeah, the clones are noticeable slow with the Jello Cube. (But otherwise it's nice and quick :) |
Fixed those problems too. I am trying a slightly different approach based on Grandchild's idea, which would greatly simplify and speed up things, but restricts cloning to only some effects viz. ssc, dm, texer etc. Which is okay IMO because cloning really only makes sense for things that have code in them. |
That sounds promising, and I agree that only coded effects benefit from clones.
Noticed a bug in SuperScope colour rotation. It only uses the first colour once, then loops any additional colours. |
Well I think this is fixed now, and the cloning speed up is very quite noticeable. Unfortunately I've been experiencing some strange behaviour with my editor when the webvs component moving code is enabled, it works fine commented out. So I can't say for certain that there are no bugs. Any remarks before this is closed? |
I have tried moving with the editor and it seems to be working fine. |
Currently to update an effect you have to load the entire preset again, which causes a noticeable pause.
This produces a poor experience when editing a preset using AVS style editor, where you (historically) expect the preset to update on the fly.
There are several ways a preset can change:
An effect being modified, an effect being added or removed and an effect being moved around the tree. (I think that covers all cases)
In the case of an effect being modified, being able to mark the effect as needing a rebuild and calling a function that scans the preset looking for marked effects seems like a good way to handle it.
I'm unsure about the other cases.
Thoughts on this?
The text was updated successfully, but these errors were encountered: