Bitmap drawing tool test

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

Moderators: Víctor Paredes, Belgarath, slowtiger

mykylr
Posts: 60
Joined: Fri Nov 23, 2007 10:15 pm

Post by mykylr »

Sounds like what I am looking for. Pity not possible for osx though.

Mike
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

mykylr wrote:Sounds like what I am looking for. Pity not possible for osx though.

Mike
Actually, that may no longer be the case with version 8.1! Unfortunately, I don't have a Mac to experiment with.

The first step would be to get the GD lua library working with a standalone version of Lua on your system. I couldn't find a precompiled version for OSX, but you can download the source package from here:
http://sourceforge.net/projects/lua-gd/ ... %205.1%29/

I believe OSX is a posix style OS, so it should be fairly straight forward.

The next test will be to copy the GD binaries to your AS folder and write a quick AS lua script with the line:
require "gd"

If that doesn't give an error, then it would be worth trying out PonySmasher's bitmap drawing script.

If anyone wants to donate to me an old MacBook, I would be happy to give it a try myself :).
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Rudiger wrote:
...... write a quick AS lua script with the line:
require "gd"
.
How would I do that, and where?
Rudiger
Posts: 786
Joined: Sun Dec 18, 2005 2:25 am

Post by Rudiger »

ulrik wrote:
Rudiger wrote:
...... write a quick AS lua script with the line:
require "gd"
.
How would I do that, and where?
Something like this:

Code: Select all

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

ScriptName = "RT_GDTest"

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

RT_GDTest = {}


function RT_GDTest:Name()
	return "GD Test Script"
end

function RT_GDTest:Version()
	return "0.1"
end

function RT_GDTest:Description()
	return "Quick test script for testing GD library"
end

function RT_GDTest:Creator()
	return "Rudiger"
end

function RT_GDTest:UILabel()
	return "RT: GD Test"
end

function RT_GDTest:LoadPrefs(prefs)
	
end

function RT_GDTest:SavePrefs(prefs)

end

function RT_GDTest:ResetPrefs()

end


-- **************************************************
-- Recurring values
-- **************************************************

-- **************************************************
-- The guts of this script
-- **************************************************
require "gd"

function RT_GDTest:Run(moho)

    -- If you are feeling adventurous, you could try out some gd functions here, eg
        		
    local layer = moho.layer
    local layerImage, im
    if layer:LayerType() == MOHO.LT_IMAGE then
         layerImage = moho:LayerAsImage(layer):SourceImage()	
         im = gd.createFromPng(layerImage)
    end
end
User avatar
ulrik
Posts: 1087
Joined: Thu Aug 11, 2005 10:32 pm
Location: Stockholm Sweden
Contact:

Post by ulrik »

Thank you Rudiger!
2dee
Posts: 3
Joined: Fri Mar 02, 2012 12:22 pm

Help Please

Post by 2dee »

Hi Ponysmasher and All

Please could you tell me how to use the script; i have installed the files
into the main Anime Pro 8 folder but when i launch Anime Pro 8 i cannot see anything new or any new icons or toolbar.

I tried to create a new PNG layer from the layers menu but there is no entry in the menu to create one.

I have also loked in the Scripts menu for an entry but ther is nothing new in the menu since installing the files.

Maybe i am missing something here; or i am doing something wrong.

Please can you advise on how to use the tool; and where i can see the tool
in Anime Pro 8.

Many thanks.

2dee.
User avatar
jhaustin1969
Posts: 61
Joined: Thu Feb 16, 2012 9:47 pm
Location: Massachusetts

Post by jhaustin1969 »

There's a pretty comprehensive list of add-ons for Lua here:
http://lua-users.org/wiki/LibrariesAndBindings
I have added this link to the Anime Studio Toolbar & Website.

I'll keep my eye on this script too and may add that in the future.

Great work Ponysmasher!!

Thank you,
Joe
User avatar
dueyftw
Posts: 2174
Joined: Thu Sep 14, 2006 10:32 am
Location: kingston NY
Contact:

Post by dueyftw »

2dee

Everything needs to be in its right place. Placing a tool script in main folder will not work.

Open the 'main' then look for 'scripts' you will see other folders. Tool, menu and utility. Now open the new script that you downloaded. The author will have put it in to a folder named tool, or menu. Drag the new tools into the proper folder.

If the new tool is an replacement with the same as an 'lm_' name, it is wise to make a copy placed out side the scripts folder. Just in case you don't like the new one.

Dale
jonbo
Posts: 896
Joined: Thu Apr 08, 2010 2:53 am

Post by jonbo »

Hey Dale, this script is a little different. The contents of the zip needs to be extracted to the main folder as there are a couple of .dll files that need to be in the main folder. If the script is installed correctly the .lua will be placed into the script>tool folder and you should see a icon in the other section of the tool palette.
User avatar
dueyftw
Posts: 2174
Joined: Thu Sep 14, 2006 10:32 am
Location: kingston NY
Contact:

Post by dueyftw »

Ya, your right. I forgot about all the dll that need to be in the main folder.

Sorry.

Dale
2dee
Posts: 3
Joined: Fri Mar 02, 2012 12:22 pm

Still not showing for me

Post by 2dee »

Hi All

Thanks for the reply, i had installed the lua script and dlls as per instructions but the tool icon still does not show any where?

Shouls i be doing something else for the tool to show on any of the tool bars?

Thanks for your help

2dee.
jonbo
Posts: 896
Joined: Thu Apr 08, 2010 2:53 am

Post by jonbo »

Make sure these two things are installed in the correct place. This image shows where they should be.

Image
2dee
Posts: 3
Joined: Fri Mar 02, 2012 12:22 pm

What Image?

Post by 2dee »

Hi jonbo

Thanks for your reply, i think an image you want me to look at is missing from your post?

"Make sure these two things are installed in the correct place. This image shows where they should be"

Cheers.

2dee
Post Reply