*NEW* Stacked shape tools

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

User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

*NEW* Stacked shape tools

Post by synthsin75 » Mon Sep 10, 2018 10:46 am

https://sites.google.com/site/synthsin/ ... ects=0&d=1

Create shape tool:
  • This mod allows you to create stacked shapes on the exact same vector points.
    • Warning: Stacking too many shapes can cause aliased edges when rendered.
      The select shape tool will help you avoid that.
  • Update 7/4/19: This now displays selected end points as fat markers.

Select shape tool features:
  • A shape stack indicator: Shape ID: 0 [1] 2
    • When you select a shape, this shows all the IDs for the shapes below the cursor.
    • It indicates which shape in the stack is selected with "[ ]". So you can see either your selection change, using Ctrl+Up/Down, or the shape order change (IDs move), just using Up/Down.
    • Left to right is top to bottom in the stack.
  • No more Ctrl+Up/Down overrun...where you keep hitting the arrow and nothing happens.
  • You can also make contiguous shape selections in the stack using Ctrl+Shift+Up/Down. All selected shapes in the stack are indicated by "[ ]" and can be moved as a group.

:D :!: :!: :!:
Last edited by synthsin75 on Fri Jul 05, 2019 3:21 am, edited 1 time in total.
- Wes
ImageImageImage
ulrik
Posts: 1069
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Re: *NEW* Stacked shape tools

Post by ulrik » Tue Sep 11, 2018 6:13 am

That is indeed a very useful tool, thank you for sharing this! :)
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Tue Sep 11, 2018 5:12 pm

Updated the above link to correct a minor issue.
- Wes
ImageImageImage
onurbeiren
Posts: 3
Joined: Sun Dec 07, 2014 11:22 pm
Location: Brazil
Contact:

Re: *NEW* Stacked shape tools

Post by onurbeiren » Thu Sep 13, 2018 9:56 pm

it will help a lot!
A.Evseeva
Posts: 33
Joined: Wed Apr 08, 2015 8:43 am
Contact:

Re: *NEW* Stacked shape tools

Post by A.Evseeva » Thu Oct 11, 2018 4:31 am

Oh, thank You very very much, it is very helpful!
I even wanted to write such a tool, but could not imagine how shoud an interface look like. Your idea is simple and perfect!

Sometimes the tool can not see some shapes.
Image
(two shapes selected but only no 11 shown)
Here is the file.

Also I have a tool mod wich can show an outline of selected shape. Maybe You want to implement it into Your tool?
It looks like this:
Image
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Thu Oct 11, 2018 4:55 am

A.Evseeva wrote:Oh, thank You very very much, it is very helpful!
I even wanted to write such a tool, but could not imagine how shoud an interface look like. Your idea is simple and perfect!
Yeah, I kicked myself for not thinking of it earlier.
Sometimes the tool can not see some shapes.
Image
(two shapes selected but only no 11 shown)
Here is the file.
It doesn't show all selected shape IDs. It only shows all selected and unselected IDs under where you last clicked.
In your picture, the hair line is shape 11 (selected) and the hair fill is shape 9 (unselected). The ear is shape 17, so you probably selected that and then shift-selected the hair line (shape 11).
Also I have a tool mod wich can show an outline of selected shape. Maybe You want to implement it into Your tool?
It looks like this:
Image
Interesting. Since there's already a checkerboard pattern, maybe I could use that to highlight the whole stack.
Is that mod in one of your existing tools?
- Wes
ImageImageImage
A.Evseeva
Posts: 33
Joined: Wed Apr 08, 2015 8:43 am
Contact:

Re: *NEW* Stacked shape tools

Post by A.Evseeva » Thu Oct 11, 2018 7:04 am

Oh, thank You! Now I understand how does it work. I missed that I have to click to see numbers under cursor.

Here is my function for tracing shapes

Code: Select all

function LM_SelectShape:TraceSelected(moho, view)
	local mesh = moho:Mesh()
	if mesh == nil then return end	
	local g = view:Graphics()
	local matrix = LM.Matrix:new_local()
	moho.drawingLayer:GetFullTransform(moho.frame, matrix, moho.document)
	g:Push()
	g:ApplyMatrix(matrix)
	
	for s = 0, mesh:CountShapes()-1 do
		local shape = mesh:Shape(s)
		if shape.fSelected then
			for e = 0, shape:CountEdges()-1 do
				local c,p = shape:GetEdge(e)
				local startPercent, endPercent = mesh:Curve(c):GetSegmentRange(p)
				local step = (endPercent-startPercent)/10
				local p1 = mesh:Curve(c):GetPercentLocation(startPercent)
				for i=1,10 do
					local nextPercent = startPercent + step * i
					if nextPercent > endPercent then nextPercent = endPercent end
					local p2 = mesh:Curve(c):GetPercentLocation(nextPercent)
					g:DrawFatLine(3, p1.x, p1.y, p2.x, p2.y)
					p1:Set(p2)
				end
			end
		end
	end
	
	g:Pop()
	
end
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Thu Oct 11, 2018 11:30 pm

Thanks for the tracing function.
- Wes
ImageImageImage
User avatar
Greenlaw
Posts: 4360
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *NEW* Stacked shape tools

Post by Greenlaw » Fri Oct 12, 2018 12:31 am

This looks cool, Wes! Will try it out this evening.
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Fri Jul 05, 2019 3:23 am

Per Victor's request here: http://www.lostmarble.com/forum/viewtop ... 20#p188420

https://sites.google.com/site/synthsin/ ... ects=0&d=1

Create shape tool:
  • Update 7/4/19: This now displays selected end points as fat markers.
- Wes
ImageImageImage
User avatar
Greenlaw
Posts: 4360
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: *NEW* Stacked shape tools

Post by Greenlaw » Fri Jul 05, 2019 5:07 am

This is great! Thanks Wes!
D.R. Greenlaw
Artist/Partner - Little Green Dog | Little Green Dog Channel on Vimeo | Greenlaw's Demo Reel 2017
Lead Digital Animator, Dreamworks Animation

Image
User avatar
alanthebox
Posts: 61
Joined: Sat Feb 03, 2018 5:31 pm
Location: california
Contact:

Re: *NEW* Stacked shape tools

Post by alanthebox » Sat Jul 06, 2019 3:11 am

I installed this script tonight and have been playing around with it, but I'm having trouble understanding the application for it. Would someone fill me as to how you would use this in one of your projects?

Sorry, I'm sure it's super obvious but I feel like I'm missing it!
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Sat Jul 06, 2019 3:38 am

alanthebox wrote:
Sat Jul 06, 2019 3:11 am
I installed this script tonight and have been playing around with it, but I'm having trouble understanding the application for it. Would someone fill me as to how you would use this in one of your projects?

Sorry, I'm sure it's super obvious but I feel like I'm missing it!
The stacked shapes? Here's an example from Denis: https://www.lostmarble.com/forum/viewto ... 63#p184363

Chucky used to have a very nice example of a desk lamp that really showed off the potential of shape stacking, but I'm not finding it.
- Wes
ImageImageImage
User avatar
chucky
Posts: 3914
Joined: Sun Jan 28, 2007 4:24 am
Location: Van Diemen's Land
Contact:

Re: *NEW* Stacked shape tools

Post by chucky » Fri Jul 12, 2019 4:49 pm

Well this is well over ten years old.
Good memory Wes.

Image

Because the shapes are stacked on the same vectors, it's possible to change the entire shape and all the effects move with it.
Sequential offender.
my latest animations
User avatar
synthsin75
Posts: 7091
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: *NEW* Stacked shape tools

Post by synthsin75 » Fri Jul 12, 2019 11:09 pm

That's it, Chucky. It's memorable because it makes an impact.
- Wes
ImageImageImage
Post Reply