Split rectangles into triangles?

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Fahim, Distinct Sun, Víctor Paredes, erey, Belgarath, slowtiger

Post Reply
User avatar
Víctor Paredes
Posts: 4875
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Split rectangles into triangles?

Post by Víctor Paredes » Wed May 01, 2019 2:29 pm

Hi, I have been using a lot of smart meshes for most of my characters and I normally prefer to create the triangles myself instead of using the "triangulate 2D mesh" option. The process is much longer, but gives me the chance to control exactly how I want the mesh to behave during the animation.
Now, most of the time while I'm creating this meshes, I create squares that then split into two triangles and paint each of them. Do you think there's a way to make that step quicker? I'm thinking about a script that automatically takes every for points connected, divide them into triangles and then paint them.
What do you think?
Thanks
Víctor Paredes
Former Moho Product Manager
Animator in Cartoon Saloon
My Youtube Channel - My webinars
A.Evseeva
Posts: 33
Joined: Wed Apr 08, 2015 8:43 am
Contact:

Re: Split rectangles into triangles?

Post by A.Evseeva » Wed May 01, 2019 3:00 pm

Yes, I have a script, working such way:
make some filled shapes (any shape, not only square. But they have to be bulgy, without self-intersections) and run the script. It will split filled shapes (only filled) into triangles. The benefit is that none of existing edges will be deleted, while built-in command deletes them sometimes.
User avatar
Víctor Paredes
Posts: 4875
Joined: Wed Jan 26, 2005 12:18 am
Location: Ireland/Chile
Contact:

Re: Split rectangles into triangles?

Post by Víctor Paredes » Wed May 01, 2019 3:30 pm

Wow! this is fantastic!
Thank you very much, Alexandra! I will use this script for a project right now!
Víctor Paredes
Former Moho Product Manager
Animator in Cartoon Saloon
My Youtube Channel - My webinars
hayasidist
Posts: 2139
Joined: Wed Feb 16, 2011 8:12 pm
Location: Kent, England

Re: Split rectangles into triangles?

Post by hayasidist » Wed May 01, 2019 5:17 pm

or you might consider my "shape" tool -- viewtopic.php?f=12&t=29621#p170024 -- that gives you a mesh from a click-drag rectangle.
Post Reply