New "plug-in" for Celestia

Post requests, images, descriptions and reports about work in progress here.
Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #41by Fenerit » 01.01.2010, 01:22

Vincent wrote:.
.
What do you mean by "shatter itself" ?
After resizing the main Celestia window, the Keplerian parameters window should simply get back
to its initial position... If this is not the case, you may want to define your iwidth, iheight values
as local. That's what I did in the final version of KeplerParamBox.lua :

For best explaing I've decided to post here the phases plug-in. Whether you can try it with the keplerian, check the behaviour. Also this plugin has the iwidth, iheight values. Look at code, the screen position is within the settings.lua file, the Box isn't controlled by any screen feature, just by user's customization; moreover is only text, the box height/width are zero. This plug-in will rest where the user decide to stick it, for whatever else resolution. Now is configured for be placed as in the previous screendumps. Probably you should find the ' "distruction" of the keplerian box during the switch in full screen; not be afraid, after the return in windowed mode the keplerian will be riassembled.

Note that the illuminated fractions are observer based, so, if you surf around the universe, the value for the Moon phases can differ rispect to that of the actual Moon phase. I've tested this latter here and there throughout the centuries and in eclipse path, and the agreeding is no bad.

http://marauder.webng.com/files/data_lights.zip 14 kb
Never at rest.
Massimo

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New "plug-in" for Celestia

Post #42by Cham » 01.01.2010, 01:26

Fenerit,

the problems you are describing are perfectly "normal" : the plug-ins may interfere if their codes are using the same words. You just need to use other words to prevent this interaction. That's all there is to it ! I already experienced something similar before, and the solution is really simple.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #43by Fenerit » 01.01.2010, 01:30

Cham wrote:Fenerit,

the problems you are describing are perfectly "normal" : the plug-ins may interfere if their codes are using the same words. You just need to use other words to prevent this interaction. That's all there is to it ! I already experienced something similar before, and the solution is really simple.

Cham, all the words are different, the box is called dataBox, the candidate is called target and so on...
Never at rest.
Massimo

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New "plug-in" for Celestia

Post #44by Cham » 01.01.2010, 01:35

Then there's a problem with your code. There shouldn't be any interaction, if the words (names) are different.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #45by Fenerit » 01.01.2010, 01:39

Moreover these plug-ins have more problems. Its folders must be called with a initial letter not beyond the "L" of lua_edu_tools, or these latters take the precedence. Another problem is that they does activate ALL the location features (the checkboxes in the locations windows are all checked after their load).
Never at rest.
Massimo

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #46by Fenerit » 01.01.2010, 01:48

Cham wrote:Then there's a problem with your code. There shouldn't be any interaction, if the words (names) are different.

It's not a problem of my code, is that for moving the box as the kleperian, need an hardware input by the screen dimension which take the control. The floating boxes must "know" where move itself, "knowledge" drew up from the screen-width scren-height hardware relate by the screenBox routine compiled into lua5.1.dll (Win system). If you wish to stick a floating box in one point of the screen you must write the setting in one file in automatic mode.(io.open, io.write functions).
Never at rest.
Massimo

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New "plug-in" for Celestia

Post #47by Cham » 01.01.2010, 01:51

Sorry, I don't know what you're talking about. I'm not experiencing any problems with my plug-ins.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #48by Fenerit » 01.01.2010, 02:12

Cham wrote:Sorry, I don't know what you're talking about. I'm not experiencing any problems with my plug-ins.

Your plugin work PERFECTLY even on my system, but him alone. What I try to say is that a floating plugin prevent the creation of statics ones; because the statics ones "destroy" that floatings during the screen refreshing between windowed and full screen mode. You can try, I posted my plugin just for this. Try to check it alone and you should see how it work fine. Then add it to the plug-ins "list" together the keplerian and switch the screen mode (windowed/full). The question is that either all plug-ins will be floating (in which the stickness will be due to read-write operation), or all plug-in will be statics. The two-way fold seem unrunning.
Never at rest.
Massimo

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New "plug-in" for Celestia

Post #49by Cham » 01.01.2010, 02:31

Fenerit, there's surely something you're doing wrong with your code. I'm adding more windows in the plug-in, and there isn't any problem.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #50by Fenerit » 01.01.2010, 12:55

Cham wrote:Fenerit, there's surely something you're doing wrong with your code. I'm adding more windows in the plug-in, and there isn't any problem.

The way in which you are adding the new boxes follow this rule, right?:

Code: Select all

KeplerParamFrame:attach(screenBox, width-KeplerParamFrameWidth - 2, (height-KeplerParamFrameHeight)/2, 2, (height-KeplerParamFrameHeight)/2)


Now, try to add this rule:

Code: Select all

KeplerParamFrame:attach(screenBox, TopLeft, height-KeplerParamFrameHeight, width-KeplerParamFrameWidth, TopBottom)


in which to TopLeft, TopBottom be assigned value in pixels: e.a 256, 320. Then try to switch amongst scren mode.
The (height-KeplerParamFrameHeight)/2 and (height-KeplerParamFrameHeight)/2 are mastered by hardware, because does iterate with the hardware screen resolution, so the refreshing behave diversely. the screen height/width control the Box by dividing it by two, and in doing this, is the screen that operate, not the user.
Never at rest.
Massimo

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #51by Fenerit » 01.01.2010, 14:58

Well, I try the last tentative to figure out the concept hidden behind my bad english grammar.
Cham, my code is rudimental but not wrong; is in your that the code lack of the place in which must be the topleft, topbottom (or lefttop or bottomup...) settings so that io.write/io.open function can be adopted to stick the floating box both at plugin/Celestia shutdown and at Celestia/plugin load.
Never at rest.
Massimo

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Re: New "plug-in" for Celestia

Post #52by Vincent » 01.01.2010, 18:18

Massimo,

The Location Flags issue is definitely not related to the Lua Plug-ins.
Location Flags are simply not saved in the registry, yet. I have a patch
ready for this, though. So this should be fixed in 1.6.1.

As to the window position on screen, you can of course save it into, e.g.,
a prefs.lua file. Here's how to achieve this :
- Download and place the attached saveTableToFile.lua file into your celxx/ dir
- Add the following code to your KeplerParamBox.lua file:

Set initial values section:

Code: Select all

local iwidth, iheight = celestia:getscreendimension();
width, height = celestia:getscreendimension();
KeplerParamFrameWidth, KeplerParamFrameHeight = 230, 330;

-- Load window position from 'prefs.lua' file.
require "saveTableToFile";
pref = table.load("prefs.lua");
if not pref then pref = {} end
if pref.KeplerParamLb and  pref.KeplerParamBb then
    KeplerParamLb = pref.KeplerParamLb;
    KeplerParamBb = pref.KeplerParamBb;
    KeplerParamRb = width - KeplerParamLb - KeplerParamFrameWidth;
    KeplerParamTb = height - KeplerParamBb - KeplerParamFrameHeight;
else
    KeplerParamLb = width-KeplerParamFrameWidth - 2;
    KeplerParamBb = (height-KeplerParamFrameHeight)/2
    KeplerParamRb = 2;
    KeplerParamTb = (height-KeplerParamFrameHeight)/2;
end


KeplerParamFrame initial definition:

Code: Select all

KeplerParamFrame = CXBox:new()
        -- ...
        :attach(screenBox, KeplerParamLb, KeplerParamBb, KeplerParamRb, KeplerParamTb)


End of KeplerParamFrame.Customdraw function:

Code: Select all

        KeplerParamNewLb, KeplerParamNewBb = KeplerParamFrame:origin()
        if KeplerParamNewLb ~= KeplerParamLb or KeplerParamNewBb ~= KeplerParamBb then
            KeplerParamLb = KeplerParamNewLb;
            KeplerParamBb = KeplerParamNewBb
            -- Save window position to 'prefs.lua' file.
            pref.KeplerParamLb = KeplerParamLb;
            pref.KeplerParamBb = KeplerParamBb;
            table.save(pref, "prefs.lua")
        end


That should do it...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #53by Fenerit » 01.01.2010, 22:21

Thanks Vincent. Now I set also my plug-in with this system; if both works seamless, then a good step toward an "unified" method to manage the boxes' behavior is done. Who wish a float box stands, do set it once for all and then leave in there as it is.
Never at rest.
Massimo

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Re: New "plug-in" for Celestia

Post #54by Vincent » 02.01.2010, 10:15

Fenerit wrote:Thanks Vincent. Now I set also my plug-in with this system; if both works seamless, then a good step toward an "unified" method to manage the boxes' behavior is done. Who wish a float box stands, do set it once for all and then leave in there as it is.
Massimo,

You're welcome.
With the above code, the window position is saved anytime the window is moved.
But it might be handier to write a separate function to save the window position,
using, e.g., a "save" button or a key shortcut... This way, you'll be able to move it
anywhere during a session, and then, get it back to its initial position when a new
session starts...
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Vincent
Developer
Posts: 1356
Joined: 07.01.2005
With us: 19 years 10 months
Location: Nancy, France

Re: New "plug-in" for Celestia

Post #55by Vincent » 02.01.2010, 10:28

t00fri wrote:What I would find of considerable "educational interest" would be a display of the difference between the "isolated" Keplerian 2-body predictions and those from the REAL orbits (Celestia?).

Fridger,

This would be very interesting, indeed. However, we're still limited by the fact that not all orbital parameters
are accessible from Lua/Celx scripting... As an example, we can't directly get the semi major axis value from the
Celestia data files. It has to be computed as described in Martin's first post... So, no comparison is possible, yet.
@+
Vincent

Celestia Qt4 SVN / Celestia 1.6.1 + Lua Edu Tools v1.2
GeForce 8600 GT 1024MB / AMD Athlon 64 Dual Core / 4Go DDR2 / XP SP3

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #56by Fenerit » 02.01.2010, 10:33

Vincent wrote:
Fenerit wrote:Thanks Vincent. Now I set also my plug-in with this system; if both works seamless, then a good step toward an "unified" method to manage the boxes' behavior is done. Who wish a float box stands, do set it once for all and then leave in there as it is.
Massimo,

You're welcome.
With the above code, the window position is saved anytime the window is moved.
But it might be handier to write a separate function to save the window position,
using, e.g., a "save" button or a key shortcut... This way, you'll be able to move it
anywhere during a session, and then, get it back to its initial position when a new
session starts...

I'm stay to configure your settings just now, and, yes, this latter solution wouldn't bad. That "the window position is saved anytime the window is moved", what mean: can it hung up the movements due to continuos savings? Or just as the usual INI/registry settings done at release of the mouse/quit in a position? Because in this latter case then the situation would be better and the second case would be redundant.
Never at rest.
Massimo

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #57by Fenerit » 02.01.2010, 11:00

VINCEEEEENT!!! I good as it is, is good as it is!!! Merci, vive la France! :wink:
Never at rest.
Massimo

Avatar
Fenerit M
Posts: 1880
Joined: 26.03.2007
Age: 17
With us: 17 years 8 months
Location: Thyrrenian sea

Re: New "plug-in" for Celestia

Post #58by Fenerit » 02.01.2010, 14:04

The sticky settings are good, but the "convivence" between plug-ins is still hard. Below there is the link to my phase plugin built upon the last hints. Inside the folder there are also two deactivated files: the first is the lua_edu_tools.lua with the modified plugins = adds_t and the second is plugins.lua with the list already set for both plugins.

http://marauder.webng.com/files/data_lights.zip

Whether you can try they together, because in windowed mode both are good:

Image

while in full screen, boxes still behaves bad:

Image
Never at rest.
Massimo

Avatar
fsgregs
Posts: 1307
Joined: 07.10.2002
With us: 22 years 1 month
Location: Manassas, VA

Re: New "plug-in" for Celestia

Post #59by fsgregs » 02.01.2010, 16:12

Vincent and Martin:

Very nice plugin. It will indeed improve the teaching of Astronomy. I have two questions:

1. Martin, the plugin's ability to display images on the fly is just great. Will you be releasing that part of the addon soon, or is there some short tutorial that instructs us in how to add images to the plugin now, and designate clickable "hot spots" on the planet?

2. Vincent: On my system, loading Keplerian Parameters in the extras folder automatically replaces Lua Edu tools. :( Please ... is there a way to have both plugins running together? Perhaps the parameters plugin could be an addon in Lua Tools that could be turned on or off via the "set addons visability" menu!!! :)

Thanks for your great work guys

Frank

Avatar
Topic author
Cham M
Posts: 4324
Joined: 14.01.2004
Age: 60
With us: 20 years 10 months
Location: Montreal

Re: New "plug-in" for Celestia

Post #60by Cham » 02.01.2010, 16:21

fsgregs wrote:1. Martin, the plugin's ability to display images on the fly is just great. Will you be releasing that part of the addon soon, or is there some short tutorial that instructs us in how to add images to the plugin now, and designate clickable "hot spots" on the planet?

2. Vincent: On my system, loading Keplerian Parameters in the extras folder automatically replaces Lua Edu tools. :( Please ... is there a way to have both plugins running together? Perhaps the parameters plugin could be an addon in Lua Tools that could be turned on or off via the "set addons visability" menu!!! :)

Frank,

the pictures box hasn't been released yet (and believe me, it's becoming an indispensable tool !). Vincent is the one who publishes the LUA Extensions (compass, coordinates, Kepler box, and now the pictures box all together in a single addon). So I guess he'll release it soon.

However, be aware that the LUA extensions (or "LUA Tools Light") are incompatible with the LUA Edu Tools. You want one or the other, not both at the same time. Vincent may incorporate the Kepler box in his LUA Tools, I don't know yet.
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"


Return to “Add-on development”