Align objects on same layer, too.

Discuss ideas for new features with other users. To submit feature requests to Smith Micro, please visit support.smithmicro.com

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
Reindeer
Posts: 216
Joined: Sat Oct 17, 2015 8:13 am

Align objects on same layer, too.

Post by Reindeer »

As far as I know one can only align (top, bottom, centre, etc) objects residing on different layers. Very useful. But I feel we should also be able to align objects residing on a single layer. Also, we should be able to align to the stage. I know there are workarounds to accomplish that, but the need to align is quite frequent, so I think it should be a click away.
Poptoogi
Posts: 287
Joined: Mon Sep 06, 2010 5:03 pm

Re: Align objects on same layer, too.

Post by Poptoogi »

Agreed! I even say go farther than that and have point aligning as well. It's a very useful tool in illustrator.
Practice random acts of kindness and senseless acts of beauty! Pause, consider, do! I dare you!
Shelde
Posts: 15
Joined: Tue Nov 28, 2017 12:36 pm

Re: Align objects on same layer, too.

Post by Shelde »

PLS PLS PLS!

An alignment & distribution tool such as in Inkscape would be top! I'd even go ahead an pay someone to make this happen!
Image
In Inkscape there's the possibility to align objects to each other, to the page, etc
User avatar
DigitalDesignDude
Posts: 14
Joined: Tue Nov 14, 2023 6:02 pm

Re: Align objects on same layer, too.

Post by DigitalDesignDude »

I agree with this as well. :)

The ability to snap and align vector art precisely is important for ensuring that character body parts are aligned perfectly with their circle joints so that outlined body parts can rotate seamlessly.

For added clarification, see the below video which demonstrates how snapping helps align body parts with each other when designing a basic cutout animation character.

https://youtu.be/ULoZaWRnGMQ

I used Toon Boom Harmony for this demonstration since Moho doesn't have any equivalent alignment features other than grid snapping, and I hope that changes someday since even Flash/Animate has more snapping and alignment tools than MOHO.

Also, during production should any of my character's body parts become misaligned with each other by mistake, snapping can come in handy when needing to make quick alignment fixes.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

For character art and character animation, I rarely need that kind of precision in Moho, but when I do need precise alignment in Moho, I find this tool helpful...

https://mohoscripts.com/script/mr_guides

First, I'll make a grid shape using Hayasidist's shape tool and squash/stretch it to get the spacing I need, and then use Guides to make guides on top. Before Eugene made this, I just used a vector layer as a guide, but this is so much easier and more flexible.

No snapping, unfortunately, but I haven't found that problematic. TBH, creating motion graphics is a lot easier in AE, so I when I need more guide and snapping features, I just do that stuff there. (All my Moho character animations eventually wind up in Ae anyway.)

I think some of the old Mynd tools for Moho had alignment tools. It's been a while since I had those installed, but the tools were great for setting up and animating motion graphics in Moho.

Moho does have alignment options for shapes between layers (Transform Layers Tool> Align Layers), but, yeah, not the same thing. I think alignment within a single vector layer is limited to point snapping because Moho doesn't really see curves inside a single layer as individual objects.

Update: I may be wrong about that. When you create multiple shapes in a layer, they clearly have individual bounding boxes, so I guess it's possible. If so, yes, I'd like to see this too! :D
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Almost forgot this option...

https://mohoscripts.com/script/ss_multi ... orm_points

This tool doesn't align shapes, but it does have options to align selections of points, in a single layer or across multiple layers. If you're careful about how you make your selections, you can perform shape alignments in stages. I've used this method a few times before, and it can be helpful in a pinch.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Shoot! I almost have another method, and this one does what's described...sort of.

First, you need to install AEseeva's Reset Layer Transform from here: https://mohoscripts.com/script/ae_reset_layer_transform

Here are the steps to align shapes from a single layer...well, up to the point where I got stuck anyway...

1. Select the layer containing the shapes you wish to align.
2. Run the menu command Scripts>Layer Effects>RT Break Apart Shapes. This places each shape into its own layer.
3. Select Transform Layers and use the desired alignment option (Left, Right, Center Horizontal, Top, etc.) This performs layer transforms that will align the layers based on each shape's bounding box. This is not what we want, but it's a step in the process.
4. Run Reset Layer Transform on each layer. This resets the layer transforms while preserving the relative transform for the shape. (In other words, it moves the transform to the shape itself.)
5. Select the layers and merge them to a single vector layer.

Step 5 is where we run into a problem. As far as I know, there are 4 ways to do this, but the three automatic methods seem broken for Moho 14.1. Here are the methods...

1. Copy and paste the shape from each layer to one layer. Ugh...tedious and time-consuming.
2. Use RT Break Apart Shapes to merge the shapes to a single layer.
3. Use Synthsin75's Merge Vector Layers script from here: viewtopic.php?p=201672#p201672
4. Use Ramon's Merge Vector Layers script from here: viewtopic.php?p=142274#p142274

Unfortunately, options 2 - 4 are all broken in Moho 14.1. Option 2. Ignores the command entirely. TBH, I'm pretty sure this native merge option in Moho has been broken for several years. Option 3. errors and produces an empty layer, and 4. also errors and doesn't produce anything useful.

That's all the time I have for this now, I wanted to revisit the above to see if I can fix one of the merging options options. Don't hold your breath though, I'm slow and terrible at scripting for Moho. :D

In the meantime, if anyone here has a solution for easily merging the layers, please post it here. Thanks.
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Align objects on same layer, too.

Post by synthsin75 »

Greenlaw wrote: Wed Dec 27, 2023 2:28 am 3. Use Synthsin75's Merge Vector Layers script from here: viewtopic.php?p=201672#p201672

... Option 3. errors and produces an empty layer, and 4. also errors and doesn't produce anything useful.
Seems to work here, v14.1.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Hi Wes!

Thanks for popping in.

I tried both versions of the script, but maybe I'm misusing it. Here's what I did...

1. Saved the code as a text file and loaded as a menu script
2. Selected the split layers.
3. Ran the Merge Vector Layers menu script

The result was either a layer that was empty or containing only one shape. I think the result depended on the order of layers selected or maybe which version I was running. (Sorry, I was tired yesterday and not keeping track of everything I did.)

I'm a little more awake now and going to check again.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Hi Wes,

I just now tried the script with a clean project and multiple vector layers (i.e., not involving the other scripts,) and it worked fine. That's promising!

I'm not sure why the script kept failing last night. I'll try my shape alignment workflow again and let you know how it goes.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Wow, i'm getting weird random behavior with the RT Break Apart script or the Merge Vector Layers in Moho 14.1. The scripts may work, or they may do something completely wrong. I don't think the issue is with the scripts themselves, but maybe Moho 14.1 is losing track of layers and their contents?

Earlier, for example, I had a layer with four squares side-by-side but misaligned vertically. The RT script created one new layer with one square, and that was it. I undid it, and the script worked correctly the second time around and generated four separate layers, one for each square. Then, I ran the Reset Layer Transform script for each layer (need to come up with a faster way to do this,) which seemed to work correctly. Finally ran Merge Vector Layer and got a single layer with all the squares stacked on top of each other and scaled up (at point level, not layer.)

I'm guessing Moho 14.1 is generating and holding some junk data in memory and the scripts are being misinformed about the selected content.

Trying this in Moho 13.5 now. Will report what happens there.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Tested in 13.5, and here's what happened.

Note: For RT Break Apart to work, you must select all the curves before running the script. Otherwise, it will create only one layer, not a new layer for each shape. I'm sure I was doing this inconsistently in both 13.5 and 14.1. I guess it helps to use the tool correctly. :P

Reset Layer Transform appears to run fine in 13.5.

Merge Vectors failed again in this example, stacking all the squares on top of each other and scaling them up. Not sure why it's doing this but suspecting garbage data in RAM, maybe generated by one of the other scripts? I'm got to try closing and reopening Moho later before running this script. Update: this time it created an empty layer.

I also tested Merging the layers using RT Break Apart in 13.5, and it still didn't work...but maybe I'm not using it correctly. I should check the manual for this script if it exists.

I'll post the test project shortly for others to try.
Last edited by Greenlaw on Wed Dec 27, 2023 7:08 pm, edited 1 time in total.
User avatar
teienkawi
Posts: 13
Joined: Sat May 20, 2023 12:15 pm

Re: Align objects on same layer, too.

Post by teienkawi »

it might be the reset layer i dont fully understand how it works but i think in a way its zeroing all the shapes so once they are all moved or copied to a new layer they all are at 0 so if that idea has any ground that coud be why they stack
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Hmm...the layers are zeroed out as they should be, so maybe something 'under the hood' is off then. Stil investigating.

Update: read the user manual entry for RT: Break Apart Shapes. It's not very helpful, but it does sound like it should be able to merge vector layer. Tested in 13.5 and 14.1, the break-apart option works but the merge options do not.
User avatar
Greenlaw
Posts: 9192
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

I recorded a video of what happens. I'm using Moho 13.5 in this recording, but it also fails in 14.1. (Different failures though, see below)...



Test: Align Shapes Workflow, Vector Merge Fails

Slight correction to what I wrote earlier: In Moho 13.5, I end with an empty layer, and in Moho 14,1, I end with a single layer with four perfectly stacked squares, all the same size and enlarged.

Here's the project file if anyone wants to try it. Let me know how it works for you or if you have a solution for the merging issue.

MergeLayersTest.moho

That's all the time I have for this puzzle right now. I will return when I can. :)
Post Reply