Is it possible to set the new shape defaults to w/o outline?

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
takumi
Posts: 3
Joined: Mon Mar 10, 2008 9:10 pm

Is it possible to set the new shape defaults to w/o outline?

Post by takumi »

Sorry about the weird English, but the character limit wouldn't let me put in any more characters. Usually when setting the defaults for new shapes, you can't set the outline to <i>not</i> be enabled. Is there a reason for this? If not, is there a way to set the default drawing style to not have an outline? I'm just asking because the character I'm drawing has these swirling stripe patterns and it would be more convenient not to have to un-check the box for each shape I draw, especially if I have to animate a head turn or something...
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

This is the easiest solution I've seen in the forum. It's the one I use, anyway. I just make a new style that has the fill color I want. I copy that color's number (ctrl-c) from the color picker, and paste it (ctrl-v) into the line's color picker. I set the line width as low as I can (entering zero will do this). You want to have everything enabled for this style. Now if you select <none> as your style and this new one as an 'applied style', every shape you make will have matching fill and outline.

Hope that helps.
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

I'm afraid you will need to modify your create shape tool. Luckily, for you, I already have done this and put the files on my .Mac homepage.

Download this zip archive. If you unzip it, it creates a tool folder. The two included files in this folder should be copied into the tool folder of the scripts folder of your Anime Studio Pro folder (see screenshot).

The two files are called "lm_create_shape_noline.lua" and "lm_create_shape_noline.png" (without the quotes).

Image

Mind you, this doesn't work in Moho (predecessor of Anime Studio Pro). It is written for Anime Studio Pro.

The new tool will appear in the others category of the Toolbar (window with the title Tools).
User avatar
synthsin75
Posts: 9973
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Post by synthsin75 »

Nice tool Rasheed. Thanks alot.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

BRILLAINT!

YEEEEHAAAAA!

-vern
User avatar
Víctor Paredes
Site Admin
Posts: 5662
Joined: Wed Jan 26, 2005 12:18 am
Location: Barcelona/Chile
Contact:

Post by Víctor Paredes »

I have been looking for this so much time ago!

thanks, rasheed.
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

I already did publish this tool some time ago, but, nevertheless, I'm glad I could help you.

Except for the name of the tool (create_shape_noline), I have just added 4 lines of code in the HandleMessage function:

Code: Select all

function LM_CreateShape_noline:HandleMessage(moho, view, msg)
	local mesh = moho:Mesh()
	if (mesh == nil) then
		return
	end

	if (msg == self.CREATE) then
		if (moho:CountSelectedEdges() > 0) then
			moho.document:PrepUndo(moho.layer)
			moho.document:SetDirty()
			local shapeID = moho:CreateShape(true) -- filled shape
			if (shapeID < 0) then
				shapeID = moho:CreateShape(false) -- just an outline
				if (shapeID >= 0) then
					mesh:SelectNone()
					mesh:Shape(shapeID).fFillAllowed = false
				end
			end
			if (shapeID >= 0) then
				local shape = mesh:Shape(shapeID)           -- added Rasheed
				if (shape.fHasFill) then                    -- added Rasheed
				    mesh:Shape(shapeID).fHasOutline = false -- added Rasheed
				end                                         -- added Rasheed
				mesh:SelectNone()
				mesh:Shape(shapeID).fSelected = true
				moho:NewKeyframe(CHANNEL_FILL)
				moho:NewKeyframe(CHANNEL_LINE)
				moho:UpdateSelectedChannels()
			end
			view:DrawMe()
		end
	elseif (msg == self.LASSO) then
		LM_SelectPoints.lassoMode = self.lassoCheck:Value()
	elseif (msg >= self.SELECTITEM) then
		mesh:SelectNone()
		local i = msg - self.SELECTITEM
		local name = mesh:Group(i):Name()
		mesh:SelectGroup(name)
		moho:UpdateUI()
	end
end
if msg == self.CREATE then means: "If there a request to create a shape, then do the following."

local shapeID = moho:CreateShape(true) means: "Create a variable called shapeID that stores the result of the CreateShape function." If the CreateShape function is called with a true value, it returns the number of the filled shape (0, 1, 2, 3, etc.) that has been created. If no fill could be created, the function returns a -1 value. The return value is stored in ShapeID.

This means that if ShapeID is larger than or equal to zero, there was a filled shape created, and the only thing left is to clean up. Before it does that, I added some code that tests if the shape has an outline, which is removed.

So, it is only a small hack. However, it has a big consequence for users. I'm sure that more experienced Lua coders could easily rewrite the create_shape tool to include a check box to fill without an outline.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I thought this tool sounded familar. how long ago did you post it? It might have been in the old days when I didn't have a clue... or it might have been one of those things I was going to "download someday" and forgot about it. :oops:

-vern
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

The old file has December 16, 2006 as a time stamp, so the thread must be from around that date.

Ah, using the search function I found the thread. You were in it as well, Vern. I guess you didn't follow up after you'd replied.
viewtopic.php?t=7159
User avatar
takumi
Posts: 3
Joined: Mon Mar 10, 2008 9:10 pm

Post by takumi »

That was exactly what I was looking for; thank you! So, does "mesh" in a .lua/.anme file refer to the outline of a shape?
User avatar
Rasheed
Posts: 2008
Joined: Tue May 17, 2005 8:30 am
Location: The Netherlands

Post by Rasheed »

takumi wrote:That was exactly what I was looking for; thank you! So, does "mesh" in a .lua/.anme file refer to the outline of a shape?
Good question.

It is like this. In a vector layer, points are described with two coordinates, x and y. Points can be connected to each other, to form a segment. Each segment can have a subsegment (a branch), that consists of yet other points. This is your mesh. Segments can be closed or open. Open segments consist of at least two points, while closed segments need at least three points.

You can use this mesh to create shapes. Shapes can have fills and outlines. For fills, a selected segment must be closed and without branches. Outlines can be assigned to any segment.

BTW Although, there are no tools for this in the standard toolbox, it is possible to have non-connected points (single points). These are also part of the mesh, although you cannot use them to create shapes.

To answer your question, it is possible to have a mesh of segments without outlines, but if there is no mesh, you cannot create outlines.

I hope this is clear enough.
Post Reply