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
![Embarassed :oops:](./images/smilies/icon_redface.gif)
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.
![Very Happy :D](./images/smilies/icon_biggrin.gif)
But that does not solve all problems.
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.
![Mr. Green :mrgreen:](./images/smilies/icon_mrgreen.gif)