On 8/27/06, Jon Phillips <jon@...235...> wrote:
However, the issue with doing this is that there are too many signals emitted and thus too many updates to redraw. Generally, this makes node editing visually laggy. This is especially noticeable while dragging node(s) quickly on the canvas.
That's exactly the reason why this was never done before. Updating clones is done when the original repr is updated, and updating repr is very costly because it involves a lot of callbacks being fired.
Besides, you seem to be doing it in a wrong place. Knot is a too low level object to take care of this anyway. Currently the decision when to update or not update the repr is taken by the nodepath, and that's where you need to work if you want to change this. In particular, at line 999 in nodepath.cpp you see:
// do not update repr here so that node dragging is acceptably fast update_object(nodepath);
This means the display is updated while you drag the node but the repr is only updated when you release it. Same call is used in other analogous places (node sculpting, handle drag, etc.) So, all you need is to replace this update_object with sp_nodepath_update_repr_keyed, giving it the same key within one drag so that the entire drag is undone as a single operation.
Of course you can't do it simply like that, as you're noticing it becomes intolerably slow. I'm not sure of your idea to update repr only sometimes (i.e. not on each move event); you can experiment with it and see if it's workable.