Page 1 of 2

LUA PLUG-INS for Celestia 1.6

Posted: 21.01.2010, 11:31
by Vincent
Hi,

Martin and I are proud to release a set of LUA PLUG-INS FOR CELESTIA 1.6:
> http://gvince.perso.sfr.fr/celestia/lua ... ugins2.zip

This set of plug-ins can be considered as a 'light' version of the Lua Edu Tools.

HOW TO INSTALL THE PLUG-INS ?
1- Unzip and paste the 'lua_plugins' folder in your 'extras' folder.
2- Paste the 'luahookinit.lua' file in your Celestia root folder.
3- Add this line to your celestia.cfg file :

Code: Select all

   Configuration
   {
   LuaHook "luahookinit.lua" # <-- Line to add
   ...


HOW TO USE THE PLUG-INS ?
- The set of plug-ins, the initial state of each plug-in and the key shortcuts
are easily customizable in the 'config.lua' file.
- More information about how to use and customize the plug-ins can be
found in the README.txt file.

COMPASS:
Key shortcut: [Ctrl] + [1]

Image


CELESTIAL COORDINATES:
Key shortcut: [Ctrl] + [2]

Image


KEPLERIAN PARAMETERS:
Key shortcut: [Ctrl] + [3]

Image


PICTURE FRAME:
Key shortcut: [Ctrl] + [4]

Image


HERTZSPRUNG-RUSSELL DIAGRAM:
Key shortcut: [Ctrl] + [5]

Image Image


Enjoy ! :)

Re: LUA PLUG-INS for Celestia 1.6

Posted: 21.01.2010, 12:24
by Fenerit
Thanks! 8)

Re: LUA PLUG-INS for Celestia 1.6

Posted: 21.01.2010, 17:51
by jogad
Hi,

Wonderful :D

the Lua plugings bring new opportunities and are really interesting.
I especially appreciate the Keplerian parameters and the HR diagram. Very well done and reallay new.

The picture frame is very nice compared to the lua-tools with its floating window. Unfortunately it seems limited to square images.

My only problem is that I do not want to abandon my beloved lua edu tools
Would it be possible to make plugins that may be used alone or integrated with lua-tools without writing a new version each time?

Cham, Vincent, bravo :!:
Mais pourquoi ne pas inclure un lisez-moi.txt ? :wink:

Re: LUA PLUG-INS for Celestia 1.6

Posted: 21.01.2010, 21:49
by BobHegwood
Thanks very much for producing a LUA tool kit that I can finally use on my Vista system. :D
Have tested (and very much enjoyed) the plug-ins on my home PC. Very, very nice.

Much appreciated by the Brain-Dead here, so thanks again...

Take care, Brain-Dead

EDIT:
Just curious... Is there a way to cycle through the picture frame objects which are
associated with a single planet or moon? In other words, I can only view one PF at
a time. What am I missing here? Again, many thanks.

Re: LUA PLUG-INS for Celestia 1.6

Posted: 22.01.2010, 02:49
by Cham
BobHegwood wrote:Just curious... Is there a way to cycle through the picture frame objects which are
associated with a single planet or moon? In other words, I can only view one PF at
a time. What am I missing here? Again, many thanks.

Bob, you just need to click on the two hotspots of the window : bottom-left and bottom-right corners. It should work, IF you have several pictures in the images/object folder.

Re: LUA PLUG-INS for Celestia 1.6

Posted: 22.01.2010, 12:14
by BobHegwood
Cham wrote:Bob, you just need to click on the two hotspots of the window : bottom-left and bottom-right corners. It should work, IF you have several pictures in the images/object folder.

Thanks very much Martin... When I click on the corners of the picture pop-ups
it will cycle through the pictures very nicely.

Absolutely beautiful functions and additions to Celestia with these new tools.
Again, many MANY thanks for these new additions to my favorite program.
Appreciate the work it must have taken you guys to add this capability. :wink:

Take care, Brain-Dead

Re: LUA PLUG-INS for Celestia 1.6

Posted: 24.01.2010, 15:43
by BobHegwood
Martin?

Just a quick question for you...
I have managed to add the picture box images for Io, Callisto, Ganymede, etc.
But, I have absolutely NO idea how to add the comets and asteroids (other than Itokawa)
to the picture box displays.

Can you give me a hint as to how to do this?
I would very much like to be able to add the picture box display for other asteroids and comets,
but I have no idea how the numbering scheme works for either.

Any help would be appreciated. :wink:

Thanks, Brain-Dead

Re: LUA PLUG-INS for Celestia 1.6

Posted: 24.01.2010, 15:52
by Cham
BobHegwood wrote:Just a quick question for you...
I have managed to add the picture box images for Io, Callisto, Ganymede, etc.
But, I have absolutely NO idea how to add the comets and asteroids (other than Itokawa)
to the picture box displays.

OUPS ! I made a mistake with the published pictures collection ! :oops:

I'm using a personalized version of the pictureBox module which assigns the asteroids/comets folders for all asteroids and comets, respectively. This isn't in the published pictureBox module ! :x Sorry for the troubles...

You just need to put the asteroids/comets pictures for each individual object, in a separate folder. For example, create a folder with the name "Halley" and put the pictures you want in it, with the proper name : "Halley_1.jpg", "Halley_2.jpg", etc. Of course, you'll need to add Halley to the list of objects, in the pictureBox.lua file, or by following the steps given by Vincent.

If you want to use the same pictures for ALL the comets at once (like I did), you'll need to mess around in the code itself ! I don't suggest that you do it by yourself unless you know exactly what you're doing, because it could be very messy !

The simplest solution would be to trash the asteroids/comets folders. :|

Re: LUA PLUG-INS for Celestia 1.6

Posted: 25.01.2010, 00:07
by BobHegwood
Cham wrote:I'm using a personalized version of the pictureBox module which assigns the asteroids/comets folders for all asteroids and comets, respectively. This isn't in the published pictureBox module ! :x Sorry for the troubles...

You just need to put the asteroids/comets pictures for each individual object, in a separate folder. For example, create a folder with the name "Halley" and put the pictures you want in it, with the proper name : "Halley_1.jpg", "Halley_2.jpg", etc. Of course, you'll need to add Halley to the list of objects, in the pictureBox.lua file, or by following the steps given by Vincent.|

Okay, I'll try that. :D
Thanks VERY much for the tips. Much appreciated, and again, Thanks very much for this add-on.
Very nice indeed. :wink:

Take care, Brain-Dead

Re: LUA PLUG-INS for Celestia 1.6

Posted: 26.01.2010, 12:25
by maatkai
Hello,

These plugins are great and very useful, but it's pity that they can't be compatible with the LuaEduTools.

I implement lots of addons in LuaEdu, and the Hertzprung-Russell one interests me particularly. Is there a way to add it to LuaEdu?

Cyril

Re: LUA PLUG-INS for Celestia 1.6

Posted: 27.01.2010, 18:11
by Vincent
maatkai wrote:I implement lots of addons in LuaEdu, and the Hertzprung-Russell one interests me particularly. Is there a way to add it to LuaEdu?
Hi Cyril,

The Hertzprung-Russell Diagram will be part of the next release of the Lua Edu Tools.
Meanwhile, the following steps will help you to add it to the current version :
    1- Unzip the 'HR_diagram.zip' package below to your 'lua_edu_tools/' dir.
    2- Add these two lines to your 'config.lua' file :
    toolset =
    {
    "timeBox",
    ...
    "distanceBox",
    "magnificationBox",
    "HRBox",
    "virtualPadBox",
    "compassBox",
    }
    enable_info = false
    enable_coordinates = false
    enable_magnification = false
    enable_HR = false
    enable_virtual_pad = false
    enable_compass = false
    2- Add the following line to your 'utils/toolBox.lua' file :
    boxheight =
    {
    timeBoxH = 98,
    ...
    distanceBoxH = 20,
    magnificationBoxH = 20,
    HRBoxH = 20,
    virtualPadBoxH = 20,
    compassBoxH = 20,
    }

That should do it :)

Re: LUA PLUG-INS for Celestia 1.6

Posted: 27.01.2010, 21:38
by maatkai
It works like a charm!

Thank you SO much! :D

Re: LUA PLUG-INS for Celestia 1.6

Posted: 24.02.2010, 22:59
by fsgregs
Vincent:

Very nice HR diagram. It will be useful in my class. Thank you.

Frank

Re: LUA PLUG-INS for Celestia 1.6

Posted: 04.03.2010, 20:20
by jogad
Hello,

I noticed a small bug with lua plugins.

This has already been discussed about the addon Ephemeris of Fenerit but I think it is a general problem with the lua plugins.

It is manifested by the inability to move objects in the addon with the mouse or selecting objects with the mouse in Celestia. In some rare cases it can cause Celestia to crash.
This bug (or these bugs) occurs rarely and is difficult to reproduce.

I come back to this subject :oops: because I am currently developing an addon with the lua plugins and it seems that the problems increase with each new addon. :(

I found a fairly wild method to reproduce the bug and try to locate the problem.
I use lua plugins with celestia SVN version 4936.
The settings of enable_plugin in config.lua do not matter. The bug occurs even if all parameters are set to false.

- Open Celestia in a normal window which does not occupy the whole screen.
Do not touch anything.
The Earth is selected in the middle of the screen
- Grab the right edge of the Celestia window and resize it quickly from right to left and from left to right for about ten seconds.

With my system, if I click on the the sky background, the earth remains selected. Sometimes I can select a star but in this case I can not select the Earth again with the mouse.

I found a way to minimize this effect, which works quite well on my system. I hope it doesn't make things worse on other systems.

As an example here is the change I made in pictureBox.lua

Code: Select all

----------------------------------------------
- Set up and Draw the boxes
----------------------------------------------
PictureBox = CXBox: new ()
    : init (0, 0, 0, 0)
    : clickable (true)
    : movable (false)
    : attach (screenbox, width, height, 0, 0);

pictureBox.Customdraw = function(this)
    width, height = celestia:getscreendimension();
    if newwidth ~= width or newheight ~= height then
        newwidth = width;
        newheight = height;
        pictureFrameLB, pictureFrameBB, pictureFrameRB, pictureFrameTB = getPictureBounds();
        pictureFrame:attach(screenBox, pictureFrameLB, pictureFrameBB, pictureFrameRB, pictureFrameTB)
    else
       local sel = celestia:getselection();
        if not getPictureCandidate(sel) and pictureFrame.Visible then
            pictureFrame.Visible = false;
        end
        if getPictureCandidate(sel) and display_picture and not pictureFrame.Visible then
            pictureFrame.Visible = true;
        end
    end
end

I added a line
: clickable (true)
In the definition of PictureBox
and I moved the code that detects the resizing of the Celestia's window from "pictureFrame.Customdraw" to "pictureBox.Customdraw".

I made similar changes in corodinateBox.lua, KeplerParamBox.lua and HRBox.lua

On my system the improvement is very significant. :D But that does not solve all problems. :twisted:
The problem of selection in celestia is almost solved but the problem of fixed objects persists even if there is an improvement.

I have no better use for CompassBox. So I remove it from my lua plugins.
There seems to be strange things with this plugin.
This is particularly surprising because the version in edu_lua_tools works perfectly.

But I am sure that Vincent will have a solution. :mrgreen:

Re: LUA PLUG-INS for Celestia 1.6

Posted: 04.03.2010, 22:16
by Cham
I confirm the problem, which is occuring ONLY if Celestia isn't in the full screen mode. But I strongly suspect the bug isn't in the LUA Plugins. It's a problem with Celestia itself (and may be related to OS X), since I experienced it with an official version of Celestia installed on OS X Snow Leopard, WITHOUT the LUA plug-ins installed !

Re: LUA PLUG-INS for Celestia 1.6

Posted: 05.03.2010, 08:40
by Vincent
jogad wrote:It is manifested by the inability to move objects in the addon with the mouse or selecting objects with the mouse in Celestia.
Hi Jo?l,

Thanks for reporting this bug. I can indeed reproduce it on my system.
it should be fixed by adding the following single line to the renderoverlay
function in the lua_plugins.lua file (~ line 208):

Code: Select all

        for k,v in ipairs(plugins) do
            if pcall( function() require (v) end ) then
                require(v);
                _G[v]:attach(screenBox, sx, sy, 0, 0);     -- <-- Line to add
            end
        end


Edit:
In KeplerParamBox.lua, paramBox should be also renamed into KeplerParamBox (2 occurences):

Code: Select all

KeplerParamBox = CXBox:new()

...

KeplerParamBox.Customdraw =

Re: LUA PLUG-INS for Celestia 1.6

Posted: 05.03.2010, 16:25
by jogad
Hello Vincent,

Sorry :( This is worse than before
No need of my surper-test "de la mort qui tue". The screen is frozen for the mouse as soon as Celestia is launched.

:idea: But perhaps the version available for downloading is different from your's. On my lua_plugins.lua file, the line is added line #199 instead of #208

Re: LUA PLUG-INS for Celestia 1.6

Posted: 05.03.2010, 17:51
by Vincent
jogad wrote: :idea: But perhaps the version available for downloading is different from your's. On my lua_plugins.lua file, the line is added line #199 instead of #208
Jo?l,

You're right, I've made quite a few changes since last release...

Please, try this revised package:
http://gvince.perso.sfr.fr/celestia/lua ... ugins2.zip

Re: LUA PLUG-INS for Celestia 1.6

Posted: 05.03.2010, 21:40
by jogad
That seem to work very well with the standard plugins :)

But now I have a big problem :(

The plugin that I am curently developping doesn't work anymore :twisted:
Instead I get this error
erreur.png

What happened?

Re: LUA PLUG-INS for Celestia 1.6

Posted: 06.03.2010, 07:44
by jogad
Hello

My problem is solved :D. I had to rename a box (same thing than KeplerParamBox).

The result is much more stable than before your change :D :D :D
Please updade your download link.

Vincent, thank you very much. Your are a magician :blue: