Import Image Sequence Script Solved

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
DK
Posts: 2896
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Import Image Sequence Script Solved

Post by DK »

Hi.
I was using the Import Image Sequence script today and found that when you import an image sequence, the script renames your images to create it's own image sequence nameset. That's fine except when you want to adust one of the images slightly in an image editor then the problem is you cannot refresh any of the image as they have been renamed. You have to completely delete all images and re-import them...in my case I lost all my tweaked cycle keyframes and had to start from scratch. Just wondering,if it iwere possible anyone on the list could take a look at it?

Cheers
D.K
Last edited by DK on Tue Oct 07, 2008 8:24 am, edited 1 time in total.
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Hey DK,
it is not a problem of the script. Forget the names it gives to the imported layers. The correct path to the file is there, inside the layer properties. The problem is that AS doesn't have a "refresh" images sources button. As you know, for fast render, images are stored in memory so you cannot update the touched original image file(s) until you don't close AS open it again and load the anme file that has the image sequence imported.
;)

-G
User avatar
DK
Posts: 2896
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Genete.

Thanks for that. ....now I remember this problem giving me headaches before and having to save changed images in a sequence to new filenames just to get them to import as this was faster than closing and re-opening the file constantly.

Thanks for the explanation Genete ;)

Cheers
D.K
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Let me give you a present:

Code: Select all

-- **************************************************
-- Provide Moho with the name of this script object
-- **************************************************

ScriptName = "GE_reload_image"

-- **************************************************
-- General information about this script
-- **************************************************

GE_reload_image = {}
function GE_reload_image:Name()
	return "Reload Image"
end



function GE_reload_image:Version()
	return "1.0"
end

function GE_reload_image:Description()
	return "Reload image form disk"
end

function GE_reload_image:Creator()
	return "Carlos López (Genete)"
end

function GE_reload_image:UILabel()
	return "Reload Image Source"
end


-- **************************************************
-- The guts of this script
-- **************************************************

function GE_reload_image:IsEnabled(moho)

	if (moho.layer:LayerType() == MOHO.LT_IMAGE) then

		return true

	end

	return false

end

function GE_reload_image:Run(moho)

	local l=moho.layer
	if(l:LayerType()~=MOHO.LT_IMAGE) then
		return
	else
--		print("reloading...")
		l=moho:LayerAsImage(l)
		local fname = l:SourceImage()
		l:SetSourceImage(fname)
		return
	end
end 
save the script, name it ge_reload_image.lua and save in the menu>scripts>layer folder
Usage: select the image layer that you have modified and run the script.

Enjoy
-G
Last edited by Genete on Tue Oct 07, 2008 11:15 am, edited 2 times in total.
User avatar
DK
Posts: 2896
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Genete
Wow....thank you for doing that.
I am getting an error though and can't run the script to test it.


Image

Cheers
D.K
User avatar
DK
Posts: 2896
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

Hi Genete.

I fixed it by removing the two top lines with the "*******"s ...there must be a typo in there somewhere. Seeing this is your script I will wait for you to fix it properly and re-upload it and then I will replace my hacked one.

YAAAY!!!! This is a BRILLANT script....It works like a dream!!!!
Thank you so much Genete!!!! :)

D.K
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Yeah! It was my mistake during the copy/paste sequence. I think it is fixed now.

You're welcome :)

(Didn't anyone do this script before???? ... sure?. If only LM would add a right button context menu on the Image layer to do this... )

-G
User avatar
DK
Posts: 2896
Joined: Mon Aug 09, 2004 6:06 am
Location: Australia

Post by DK »

I placed it in the same menu as the "Import Image Sequence" script so I'll always know it's there. I will use this script a LOT.
Many thanks again Genete.

Cheers
D.K
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

If you want to make a short cut or a button just copy it to the tool folder and add a line to the desired section of _tool_list.txt file:

Code: Select all

button ge_reload_image    +
You should reload the script from the post above. I've modified it to make it available only if a image layer is selected.

Of course copy the script to the script/tool folder and provide a cool icon :).

I've found that the '+' key is not assigned to any task. I think that LM didn't assign them for different keyboards compatibilities. But I believe that you can assign any "typeable" character from the keyboard.

Enjoy!!!! :D
-G
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Yes, I think there was an earlier script that did this. It was done a long time ago, back in the "Moho days"... before I even bought Moho I think. I have no idea who did it or where it is... and I'm too lazy and tired to look for it. ;)

-vern
Post Reply