Page 1 of 1

Image layer: Warp

Posted: Thu Dec 29, 2016 9:55 am
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.)

Re: Image layer: Warp

Posted: Thu Dec 29, 2016 12:08 pm
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.

Re: Image layer: Warp

Posted: Thu Dec 29, 2016 12:32 pm
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.)

Re: Image layer: Warp

Posted: Fri Dec 30, 2016 12:26 am
by slowtiger
Yes, for the old versions I rely on Text Edit too. So there's no solution for v11?

Thx so far.

Re: Image layer: Warp

Posted: Fri Dec 30, 2016 7:42 am
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.

Re: Image layer: Warp

Posted: Fri Dec 30, 2016 7:54 am
by slowtiger
Thank you so much. I'll try that first in January!