dalboris / vpaint

Experimental vector graphics and 2D animation editor

Home Page:http://www.vpaint.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invisible vertices after deleting motion paste

hollunder opened this issue · comments

commented

I played around with interpolation and motion pasting to discover its limitations.
By deleting stuff I arrived at a weird state where seemingly empty keyframes were left, which turned out to be due to invisible vertices.
See attached file.
bug_invisible_vertices.vec.zip

Thx again, I'll look at that this weekend.

Oops... my deepest apologies for not having looked at this when I said ("this weekend", more than two years ago).

You are actually raising a very interesting question / bug, and I should have taken the time to answer earlier.

Indeed, I can see that there are some isolated vertices in the file attached, where an "isolated vertex" is defined as a vertex which isn't in the boundary of any edge or any face.

The thing is, VPaint never renders vertices (isolated or not). Vertices are only meant to be building blocks to represent connections between edges, and are not meant to be independent visible entities (although this would be possible, but we'd have to implement more tools to allow users to specify how they'd like to render them).

Therefore, by design, VPaint doesn't have tool to directly create isolated vertices. Also, VPaint tries to automatically delete a vertex if some operation would leave it isolated. For example, if you draw an edge, it automatically creates two vertices at its ends. If you select the edge and delete it, VPaint would not only delete the edge, but also delete the two vertices at its ends.

However, as you have noticed, VPaint isn't smart enough in some cases. For example, if you draw an edge at time t1, motion-paste it at time t2, and delete the copied edge at time t2, then its end vertices are not deleted. Why? because VPaint detects that the vertices are still "connected" to something: they are not connected to any edges, but they are still connected in time to the vertices at time t1, via inbetween vertices. Therefore, VPaint chooses to be conservative and not delete them. In this case though, VPaint is "wrong": it would really be a better choice to delete them, because the only thing they are connected to are themselves isolated (inbetween) vertices. However, in the general case, there could have been, say, a face shrinking to this vertex, in which case we wouldn't want to delete the vertex, even though it looks isolated at this specific frame.

To summarize, VPaint generally tries to get rid of isolated vertices whenever deleting them would not affect any visible elements. Unfortunately, the algorithm that takes the decision isn't always smart enough to actually know whether or not it would affect any visible elements, and prefers to be conservative when in doubt.

I will mark this as a bug, since I do think that the algorithm should do a better job, because not doing so can really leave you in a confusing state, with surprising behavior. However, I don't think I will take the time to fix it for VPaint, which is only meant to be a prototype. I will definitely improve this algorithm for VGC, and leave this open as a reminder.