Page 1 of 1
"Reordering" point/shape internal order for switch
Posted: Wed Dec 06, 2006 7:32 pm
by heyvern
I have noticed something fascinating and a bit frustrating about switch layers and how AS does stuff to vector layers when you copy and paste.
Every so often I "break" a switch layer. Even though the points are identical they go all over the place. With trial and error I can fix this if the layer is not overly complex.
I copy each "closed vector shape" and paste into new layers making sure I copy and paste in THE SAME ORDER for each layer. Bingo! Fixed!
However with complex layers this can be troublesome. I assume that there is some kind of point or vector shape ordering with in AS that is "invisible" to the me the user.
What I am wonder is if it would be possible to do some kind of "global" reordering of these shapes or points or whatever?
The order of points is irrelevant to the order of styled shapes. The stacking order of shapes has no effect. Somehow when pasting closed vector shapes into a switch layer the points can discombobulated.
Just wondering if there would be a way to "logically" reorder the points on two identical layers with LUA so the switches work "again"? Some kind of "stacking order" for each closed vector shape. Similar to the number system for filled shape styles.
-vern
Posted: Wed Dec 06, 2006 9:30 pm
by Rasheed
I was thinking on these lines as well. For example, you have a square with points 0, 1, 2, 3. If you add a point between points 0 and 1, it becomes point 5. You would expect the points in the layer to be renumbered, but they are not. This means if you accidentally add two point in one order in one vector layer, and in the other order in another vector layer, the interpolation doesn't "compute" anymore (at least not for the user of Moho).

layer 1

layer 2 (wrong order of points)

resulting switch layer
Is this what you meant, Vern? I tried pasting the same shape in several layers within a switch, but those did just good. It is when the order in which you paste (or add points) differs that the interpolation goes amuck.
However, it is not as simple as you think. You cannot simply say, order the points per curve, because curves can get very complex and interconnected. How then would you number the points? One way could just simply be by (x, y) coordinate. However, what if some points have the same coordinate? It is very hard to disambiguate the point numbering in a given configuration of the mesh.
I'm afraid if this is the problem, you simply have to be more careful how you modify your layers. I can't see a solution that always works. I'm sure if there were, Lost Marble would have used this in the program.
I guess in other programs, points that occupy the same position get merged. Not so in Moho, and that has both advantages and disadvantages. You would think that the solution might be to merge points with the same coordinates, but this will not help you, because then the point count would change, because in other layers within the switch, were no points occupy the same position, these points would not be merged.
Posted: Wed Dec 06, 2006 9:42 pm
by heyvern
So far I have always been able to fix the problem. I even just did it now for the head turn switches on Larry. It was a pain but it really didn't take that long.
I had 3 layers that were "messed up". I just carefully copied each "shape" from each to a new layer one shape at a time in order from "bottom" up (bottom is relative. I went by visual "bottom"). Problem solved.
As far as adding points in the "wrong" order... I am very careful about that. If I add points I make sure to find the exact spot on the other switch layers and put it in the same spot. For me the trouble has always been pasting in shapes.
I guess I keep thinking there is some kind of order in AS for closed shapes. I know from what I'm doing already that there must be something like that if I am able to copy out switch layer "shapes" and "fix" them by hand. It leads me to believe there could be something in LUA to "automate" this somehow.
Thanks for looking into it though. I will just be more careful from now on.
This is one of the reasons I started using that technique of using key frames on one layer to do my switches... unfortunately I didn't do it with the head turn on Larry.
-vern
Posted: Wed Dec 06, 2006 11:31 pm
by Rasheed
All the more reason for me to develop this animation pose toolbox. I think a lot of "vector point pushers" would appreciate such a set of tools and scripts, because it would make them so much more productive as an animator.
If I can pull it off, and once I know how Moho's mesh works internally, I can perhaps whip up a Py-thon program to create an external modeler, which would have much more power than an internal Lua script. However, it's a lot of ifs before that will happen. First things first.
Posted: Wed Dec 06, 2006 11:37 pm
by bupaje
Not sure if it would be possible but if someone could come up with a script to toggle "show point ID's" that might be useful from what you are saying.
Posted: Wed Dec 06, 2006 11:51 pm
by heyvern
I think that might help Bupaje.
I had a situation where the whole switch was working but one shape was swapping point positions (pointy hairs would "flip" pointy bits) and one lone point at the bottom was switching places with another point way off at the top.
I knew that all I had to do was figure out how to swap those points using copy paste... but I ended up using my tried and true technique of repasting into new layers.
One thing I am happy about, I never have to "lose" a switch layer when the points get mixed up. I know how to fix it.
-vern
Posted: Thu Dec 07, 2006 12:15 am
by Rasheed
That would be a nice workaround, show the ID of the point closest to the mouse cursor in a field of the main window. It would involve modifying the points tools.