Image layer: Warp

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

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
slowtiger
Posts: 6067
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Image layer: Warp

Post by slowtiger »

OK, I've never touched scripting so far, but it seems that I need some now.

Is it possible to script the "warp with bones" property? I've found no mention of this in the online documentation.

What I need is a script which I run after importing a bunch of images which sets all of them to "don't warp" - go through all layers, if image layer, set "warp with bones" to No.

I work with version 11, 9.5 and 8 - does the script need to be version-specific?

(Ideally this should go into the preferences - set warp yes/no for all images imported in the future.)
AS 9.5 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
AS 11 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
Moho 13.5 iMac Quadcore 2,9GHz 16GB OS 10.15

Moho 14.1 Mac Mini Plus OS 13.5
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Image layer: Warp

Post by synthsin75 »

If you worked in 12 this would be easy. Just filter the layers by kind, shift-select all, and change all at once.

How much scripting do you really want to learn? I mean someone could just give you the code, but since you use older versions, maybe you want to learn enough to automate simple tasks like this. Kind of like writing macros.
User avatar
neeters_guy
Posts: 1614
Joined: Mon Sep 14, 2009 7:33 pm
Contact:

Re: Image layer: Warp

Post by neeters_guy »

This is a hack, but since ver. 8 (and 9?) format is text editable, you could do a search for "parent_bone -3" and replace it with "parent_bone -1". (I don't know what the numbers mean. I discovered this by doing a text compare with a simple anme file consisting of one bone and one image.)
User avatar
slowtiger
Posts: 6067
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: Image layer: Warp

Post by slowtiger »

Yes, for the old versions I rely on Text Edit too. So there's no solution for v11?

Thx so far.
AS 9.5 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
AS 11 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
Moho 13.5 iMac Quadcore 2,9GHz 16GB OS 10.15

Moho 14.1 Mac Mini Plus OS 13.5
User avatar
synthsin75
Posts: 9934
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: Image layer: Warp

Post by synthsin75 »

This will work in v11 for all selected layers.

Code: Select all

	local sel = moho.document:CountSelectedLayers()-1
	for i=0, sel do
		local layer = moho.document:GetSelectedLayer(i)
		if (layer:LayerType() == MOHO.LT_IMAGE) then
			layer:SetLayerParentBone(-1)
		end
	end
Should work in any version that allows multiple layer selection.
User avatar
slowtiger
Posts: 6067
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: Image layer: Warp

Post by slowtiger »

Thank you so much. I'll try that first in January!
AS 9.5 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
AS 11 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
Moho 13.5 iMac Quadcore 2,9GHz 16GB OS 10.15

Moho 14.1 Mac Mini Plus OS 13.5
Post Reply