automate import images into group layers?

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: 6245
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

automate import images into group layers?

Post by slowtiger »

Since this is a task I run into quite often, I'd like to automate it:
I create a group layer, put an image (or whatever) inside it, and animate it. Now I'd like to multiply this item and put a different image into each. Then I offset all in time.

Could this be scripted?

- maybe in the form of

Code: Select all

get list of items in folder <path>
repeat with n = number of items in list
copy (empty) group layer, rename name+n, import image n from folder <path>
second:

Code: Select all

get list of group layers 1 to n
set offset = m frames
repeat with 1 to n
offset layer n = n*m frames
and additionally: would this also work with group layers all referencing the first group, so that any change of animation there would be repeated elsewhere?

Does a script like this already exist? (for v11)
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: 10267
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: automate import images into group layers?

Post by synthsin75 »

There are a few scripts that do some of the things you need, but everything you describe could definitely be scripted.

Would all the images be in their own folder?
Would they all be imported in alphabetical/numerical order, kind of like an image sequence?

If so, that would be a pretty straightforward script.
User avatar
slowtiger
Posts: 6245
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: automate import images into group layers?

Post by slowtiger »

All images in the same folder, numbered in sequence, same size and file format.
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: 10267
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: automate import images into group layers?

Post by synthsin75 »

So if you already have a group layer with the first image inside, a script can reference that group, use that image to find the path to all the rest, and all you'll need to enter is the sequencer frame offset.
I assume an offset of 3 (for example) would put the second group at frame 3, the third at frame 6, etc.?
User avatar
slowtiger
Posts: 6245
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: automate import images into group layers?

Post by slowtiger »

Yes, that would be the idea. (Although I don't code myself for a decade now it's nice to see that my pseudocode still is understandable!)
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: 10267
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: automate import images into group layers?

Post by synthsin75 »

I'll see if I can find time to write this, or maybe some other scripter will chime in. It's not really something that would be of use to general users.
If it's a "must have" and you have a budget for it, you can PM me about getting it done for sure and in a timely manner.
User avatar
slowtiger
Posts: 6245
Joined: Thu Feb 16, 2006 6:53 pm
Location: Berlin, Germany
Contact:

Re: automate import images into group layers?

Post by slowtiger »

Please, don't start any work! I was really just asking about the possibility, should be able to do it myself if it gets that urgent. Thx for all your time!
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: 10267
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: automate import images into group layers?

Post by synthsin75 »

Feel free to pick my brain in this thread.
Post Reply