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
synthsin75
Posts: 9978
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Align objects on same layer, too.

Post by synthsin75 »

I followed your steps in v14.1, using the second version of my script, and it works as expected. At least in destructive mode, like you're using it.

My guess is that something is being done too fast after creating the new layer. The second version merges to the last selected layer, so no new layer is created.
EDIT: ^That's not the problem. The first version of my script doesn't select the curves for you, so if nothing's selected, it doesn't copy anything. I think I'll remove that version.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Thanks, Wes! I confess I lost track of which version I have installed right now. Let me try again, making sure I have the second version installed. BRB.
Last edited by Greenlaw on Wed Dec 27, 2023 10:29 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 worked for me theres to things different of mine in the merge script i changed the destructive to false and after using the break apart i took all the layers out of the group the script made then did the same as in the video
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

That did it! I replaced the Merge Vector script with 1.1 (I must've regressed to 1.0 last night for some reason.) I didn't have to extract layers from the group, it just worked this time. Tested in Moho 13.5, not 14.1.

Testing in 14.1 now.
Last edited by Greenlaw on Wed Dec 27, 2023 9:48 pm, edited 1 time in total.
User avatar
synthsin75
Posts: 9978
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Align objects on same layer, too.

Post by synthsin75 »

If the workflow works, I assume AEseeva's Reset Layer Transform could be made to work over a table of the layers produced by Break Apart and combined with the relevant parts of RT:Break Apart and Merge Vectors. I have too much on my scripting plate at ATM, or I'd volunteer.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Yay! After replacing the Merge Vector script with 1.1, the workflow is fine in Moho 14.1 too. No need to modify the script or move layers from the group...it just works now!

Here's a video of the process in Moho 14.1 with the successful result...



Test: Align Shapes Workflow, Success!

Thanks everyone for helping me figure this out. That was fun and I'm glad we solved it. I'm not sure how often I'd use this technique, but I know it will come in handy sooner or later.

I think I'll make a macro for this sequence later today. It's mainly the repetitive Reset Layer Transform part that needs automation. Quick question: I'm pretty sure I've asked this before, and I think the answer is no, but is there a way to assign a hotkey to a menu script from within Moho? I guess I can turn the script into a button, which would be a little better than selecting from the nested menu. Just a thought.
Last edited by Greenlaw on Wed Dec 27, 2023 9:45 pm, edited 5 times in total.
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

synthsin75 wrote: Wed Dec 27, 2023 9:16 pm If the workflow works, I assume AEseeva's Reset Layer Transform could be made to work over a table of the layers produced by Break Apart and combined with the relevant parts of RT:Break Apart and Merge Vectors. I have too much on my scripting plate at ATM, or I'd volunteer.
I thought I might take a stab at that myself. It should be a good learning exercise for me. Sigh! I'm kinda busy with stuff today (not Moho-related,) but maybe later this week.
User avatar
synthsin75
Posts: 9978
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 9:39 pm
synthsin75 wrote: Wed Dec 27, 2023 9:16 pm If the workflow works, I assume AEseeva's Reset Layer Transform could be made to work over a table of the layers produced by Break Apart and combined with the relevant parts of RT:Break Apart and Merge Vectors. I have too much on my scripting plate at ATM, or I'd volunteer.
I thought I might take a stab at that myself. It should be a good learning exercise for me. Sigh! I'm kinda busy with stuff today (not Moho-related,) but maybe later this week.
Making AEseeva's Reset Layer Transform work for all selected layers would be the simplest, and address the most tedious part.

Yeah, sadly, it'd have to be a button to get a shortcut.
User avatar
synthsin75
Posts: 9978
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Align objects on same layer, too.

Post by synthsin75 »

My merge vectors script has what you need to find the selected layers in the document:

Code: Select all

local layers = {}
	local count = 0
	repeat
		local layer = moho.document:LayerByAbsoluteID(count)
		if layer then
			count = count + 1
			if (layer:SecondarySelection() and layer:LayerType() == MOHO.LT_VECTOR) then
				table.insert(layers, moho:LayerAsVector(layer))	--either make a table to loop through, as shown here and used below, or just do what you need here
			end
		end
	until not layer

Code: Select all

-- if looping through the table made above
for i,v in ipairs(layers) do
		if (v:LayerType() == MOHO.LT_VECTOR) then
			--do stuff here 
		end
	end
User avatar
SimplSam
Posts: 1048
Joined: Thu Mar 13, 2014 5:09 pm
Location: London, UK
Contact:

Re: Align objects on same layer, too.

Post by SimplSam »

Here is a version of the AE Reset Layer script that I modded a while ago, which acts recursively. Also with icon for use as a Button. Someone also wanted this on discord about a week ago. https://drive.google.com/file/d/1VUrCPa ... sp=sharing
Moho 14.1 » Win 11 Pro 64GB » NVIDIA GTX 1080ti 11GB
Moho 14.1 » Mac mini 2012 8GB » macOS 10.15 Catalina
Tube: SimplSam


Sam
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Thanks guys! I really appreciate the tips and the modded Aeseeva script!

Can't wait to pick these apart and maybe Frankenstein a new script myself. Since I'm starting to use Moho more regularly again, one of my goals this year is to get more comfortable with Moho scripting. :D
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: Align objects on same layer, too.

Post by mmmaarten »

Greenlaw wrote: Thu Dec 28, 2023 3:41 pm one of my goals this year is to get more comfortable with Moho scripting. :D
Nice! Good luck those two days :wink:
Adults should play more often
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: Align objects on same layer, too.

Post by Greenlaw »

Ha ha! Yeah...I've been off all last week, and I still haven't found time for personal projects because of family time. I have one week left in my vacation though, so maybe there's still time. :wink:
User avatar
mmmaarten
Posts: 271
Joined: Mon Sep 19, 2022 2:19 pm
Location: Utrecht, The Netherlands
Contact:

Re: Align objects on same layer, too.

Post by mmmaarten »

Greenlaw wrote: Sun Dec 31, 2023 3:47 pm Ha ha! Yeah...I've been off all last week, and I still haven't found time for personal projects because of family time. I have one week left in my vacation though, so maybe there's still time. :wink:
So the time difference with the US from Europe is a week? Wow, lucky you! ;)
Best wishes for 2024! May all your wishes come true and you got time to do the scripting thing! :D
Adults should play more often
Post Reply