Slideshow without scripting

Post requests, images, descriptions and reports about work in progress here.
Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Slideshow without scripting

Post #1by jogad » 06.03.2010, 22:20

Hello,

The idea is strongly inspired by the picture box of lua-plugins. But I wanted to display images and text in a free order without being bound to a particular selection in celestia.

And I especially wanted something that anyone without scripting knowledge can use as easily as possible. 8)
All ideas that allow easy usage are welcome.

For now, I am at this point:

Each slide consists of one, two or three of the following
- an image
- a text
- A position in celestia (cel://url)
This last possibility is only available with the next version of Celestia (1.6.1) or a recent SVN versions

Here are some interesting features:
- Images can be moved and resized with the mouse
- It is allowed to have an image of any size an the dimensions of its sides are absolutely free.
- You don't have to rename your image files to use them
- We can move the text with mouse like pictures.
- The text can be left or right justified or centered.
- We can even chose the colour of the text.
- We have a complete control on how text and images are attached on the screen (relative to the borders or to the center horizontal and vertical axes)
- recording these different elements is done easily from within Celestia.
- It is possible to search for a particula slide in stealth mode and we can continue to use Celestia normally when a slide is displayed or between two slides.

There is a description file that defines the slideshow display order of the slides. Manual intervention on this file is limited to type the text to be displayed (and maybe the picture files names if you have linux)
An incorrect syntax do not prevent the program to run.

Together with the other lua plugins we can get cool layouts like this:
Image

I) - Installing the program

This plugin works only with Celestia version 1.6
If you want to enjoy the Cel://Url feature to record your Celestia position in slides, you must have the upcomming version 1.6.1 of Celestia or one of the last SVN version.

Lua Plugins must be installed before the Slideshow plugin. Because the slideshow doesn't work well with the first version of lua plugins, I suggest to take the last modification by Vincent HERE: http://gvince.perso.sfr.fr/celestia/lua/lua_plugins2.zip

1) If you have a customized version of the config.lua file, save it before.

2) download the beta Slideshow plugin from HERE

3) unzip the archive as usual in the celestia/extras directory

4) You can optionnally add a custom key to start the plugin. If you do not, it will be "r"

OK. The program is installed but we still do not have slides to show.

II) Creating a slideshow
By default the directory that contains the slides is 'slides'.
In order to work, it must contain images to be displayed if any and a description file that must necessarily be called "_slidecatalog.txt"

1) Copy some images in this folder.
Images must be in jpg format (or jpeg) png or dds. Images can be of any size. No need for a special relationship between width and height. And of course no need of power-of-two-mania.

For this little introduction, I have already filled the slides folder with some pictures.

2) Creating the catalog file "_slidecatalog.txt".

We'll start by creating a very minimal catalog.

a) pictures definition

If you're running Windows, double click on the file "makeSlideCatalog.bat" located in the slideshow directory. The file_slidecatalog.txt will be created automatically and open with your default editor. You get this.

Code: Select all

- Slide catalog description
- For slideshow in Celestia
 
aristote.png
copernic.jpg
Galilee.jpg
kepler.jpg
newton.jpg
ptolemee.jpg
russell.png
systeme_ptolemee.png

Rearrange a bit to have them in chronological order instead of alphabetical.
If you're not running Windows, type yourself the names of picture files.

This file is basic but perfectly usable as is.
But I promised that text can be displayed with pictures. So we will do that immediately.

In fact, the catalog file does not even need pictures. You might as well write it with only text. Associated with cel://URLs, this would also be a way to make slideshows quickly.

b) definition of text
Voila! I added some text and some comments

Code: Select all

-- Slide catalog description
-- for slideshow in Celestia

--------------------------------------
-- just a test and a demo for slide show
-- Please do not pay attention to the
-- inexactitude of the text.
----------------------------------------

   'Aristote
aristote.png
ARISTOTE
"
Philosophe grec
384 ? 322 av JC

-------------------------------------
-- the following slide has only
-- text to continue the previous one
-------------------------------------

--  Aristote la suite
Il reprend l'id?e d'Eudoxe
qui repr?sente assez bien le
mouvement des plan?tes au
moyen de sph?res concentriques.
Pour lui les sph?res sont r?elles
et sont dou?es de mouvement
spontan?.

---------------------------------------------------------
'you have noticed that the previous picture is not erased
'when the next slide has only text and no picture
'if you actually want to erase the previous picture
'the trick is to add "no.jgp" as the picture file name
'(if you have an actual no.jpg file, rename it !)
---------------------------------------------------------

         'petite pause
no.jpg
Aristote n'?tait pas vraiment un astronome
mais sa vision de l'Univers a influenc? la
connaissance scientifique jusqu'au moyen ?ge
"
Une petite pause pour souffler
et nous continuons notre visite.

           --Ptol?m?e
ptolemee.jpg
Ptol?m?e
Astronome et astrologue,
il v?cut ? Alexandrie et son
travail nous est parvenu par son
oeuvre majeure, L'Almageste, qui
est le trait? d'astronomie le plus
complet depuis l'antiquit? et
jusqu'au moyen ?ge.


   'Syst?me de Ptol?m?e
systeme_ptolemee.png
Son syst?me g?ocentrique du cosmos
n'a pas la pr?tention de repr?senter
la r?alit? physique de l'univers, mais
permet de calculer la position des
astres avec une grande pr?cision.


   'Copernic
copernic.jpg
Nicolas Copernic
"
Reprend les travaux des astronomes anciens
mais a l'id?e de mettre le soleil au
centre de son syst?me.
L'ouvrage qui expose son syst?me ne
sera publi? qu'? sa mort.


      'K?pler
kepler.jpg
Johannes Kepler
Calculateur infatiguable, il reprend
les observations de Tycho Brahe et d?couvre
que les plan?tes suivent des orbites
elliptiques avec un mouvement non uniforme
autour du Soleil


       'Galil?e
Galilee.jpg
Galileo Galilei
"
N? ? Pise en Italie, il fait progresser
l'astronomie aussi bien que la physique.
Il construit la premi?re lunette
astronomique qui lui permet de d?couvrir
les quatre principaux satellites de
Jupiter


        'Newton
newton.jpg
Isaac Newton
Savant math?maticien, physicien, alchimiste et astronome.
Il met au point les outils math?matiques qui lui
permettront d'?tablir la th?orie de la gravitation
universelle.


   'Russell
russell.png
Henry Norris Russel
Astronome am?ricain 1877 - 1957
"
Il ?tablit une classification des ?toiles
en fonction de leur luminosit? et de leur
classe spectrale, r?sum? par le diagramme
de Hertzsprung-Russell.
Il analysa aussi syst?matiquement les
?toiles binaires ? ?clipses ainsi que la
variation de leur magnitude.


This is only dummy text for example purpose. Don't ask for a translation. You use this text as is or write something more intelligent before saving it as "_slidecatalog.txt".
This text is already in the "examples" directory. If you want to use it, delete the _slidecatalog.txt then copy the _slidecatlog2.txt to the "slides" directory and rename it into "_slidecatalog.txt". (Because there are French accents in it, it is an UTF-8 text. So do not simply copy the code above, or pay attention to recode it in UTF-8)

It should not be blank lines between the different elements of the same slide. Contrariwise, it is strongly advised to separate the slides by at least one blank line.

Comments start at will with -- or ' as the first non blank char.
The text is written directly or can be preceded by "
This lets a line of empty text not to be interpreted as a separation between two slides.
Do not try to make presentation here. This will be done in Celestia

The comment just before the first element of the slide has a special meaning. This is the title of the slide and will be used for display in the stealth mode of the slideshow.

c) definition of positions in Celestia (cel://Urls)
Far too complicated to be done by hand! This will be done much more easily in Celestia.

III) Visualization in Celestia
You activate the slideshow by pressing the 'r' key.
You see the first slide show and a small remote control. This remote is meant to be as unobtrusive as possible and we can move on the screen with the mouse.

Since we did not include a position for the image and text, pictures are centered and texts are in the bottom left corner of the screen.

We are in the normal display mode. The green arrows on the remote control allow respectively to
    - jump at the first slide
    - come back to the previous slide
    - go to the next slide
    - jump forward 5 slides (this can be customized in the config.lua file)
Text and images can be moved with the mouse.
You'll notice a small square in the upper right images. You can use it to resize images.
In this mode the position and size of text and pictures will not be saved.

The red button on the left lets enter in stealth mode. Images and text are not displayed and the URLs are not enabled in Celestia. Instead, we can see briefly appear on the slide number and title (if you've provided one) in the bottom left of the screen. This allows you to quickly scroll through the slides to find the one you want.
A new click on this button returns to normal mode.

An alternative browser method is to press 'r'. This disables the slideshow.
- Continue to use Celestia
When you press again 'r', you will resume the slideshow at the next slide.

IV) Saving the slides
Make up your slide and when you're ready, press the last button (with orange arrows) on the remote.
The buttons change and you get something like this:
Image
In this mode it is still possible to use Celestia and continue to modify the layout on the screen.

When in saving mode, some keys may have been stolen to Celestia:
'j' cycles between left justified, center, right justified
'k' cycles between available colors. (you can add your own colors)

- The buttons with white triangles correspond to the anchor of text. In the case of the slide above, we can see that the text follows the left edge and the bottom edge. It suits us and we do not touch these buttons.
- The buttons with green triangles correspond to the image.
In our case they indicate that the image is attached to the center of the screen, horizontally and vertically.
I prefer the image is linked to right and top edges of the screen. So I click on the green triangles for this
Image
The following button indicates whether the position will be saved in celestia when I return to normal mode. The red cross indicates that it is not the case. As this would be a shame not to keep my beautiful presentation I click on this button

That's it! :mrgreen:

I click again on the orange arrows to return to normal mode to validate the change and not to risk destroying my presentation.

Have fun presenting other slides, quit Celestia, and see how _slidecatalog.txt file has been modified.

With my presentation, I get this:

Code: Select all

-- Slide catalog description
-- for slideshow in Celestia

--------------------------------------
-- just a test and a demo for slide show
-- do not pay attention to the
-- real meaning of the text.
----------------------------------------

            -- pr?sentation
cel://Follow/Milky%20Way/2010-03-03T20:50:30.24984?x=AAAAAAAAfDgrcxf25v///w&y=AAAAAADA97JCpLbu+v///w&z=AAAAAACAc4x9/JK6+f///w&ow=-0.617474&ox=0.150106&oy=-0.772135&oz=-0.00106112&select=Milky%20Way&fov=7.24318&ts=1&ltd=0&p=0&rf=1890071&lm=4&tsrc=0&ver=3
D?s l'antiquit? et probablement m?me
bien avant, les hommes ont ?t? curieux
et on cherch? ? comprendre l'Univers.
"
Ce diaporama nous montre quelques-uns
des personnages c?l?bres qui ont
contribu? ? l'histoire des sciences
et de l'astronomie en particulier
# 0 1 -183 -513 1 7


                                   'Aristote
aristote.png 210 -45 417 0 0
cel://SyncOrbit/Sol:Earth/2010-03-01T10:34:40.03296?x=ZeD4CkGRSg&y=45r0EC/wOQ&z=zIfSxDpN7P///////////w&ow=-0.589119&ox=-0.0267761&oy=0.743539&oz=0.315233&select=Sol:Earth&fov=33.604&ts=1&ltd=0&p=0&rf=1890071&lm=4&tsrc=0&ver=3
ARISTOTE
384 ? 322 av JC
# 0 0 282 -117 1 2

-------------------------------------
-- the following slide has only
-- text to continue the previous one
-------------------------------------

--  Aristote la suite
Il reprend l'id?e d'Eudoxe
qui repr?sente assez bien le
mouvement des plan?tes au
moyen de sph?res concentriques.
Pour lui les sph?res sont r?elles
et sont dou?es de mouvement
spontan?.
# 0 0 199 -241 1 2

---------------------------------------------------------
'you have noticed that the previous picture is not erased
'when the next slide has only text and no picture
'if you actually want to erase the previous picture
'the trick is to add "no.jgp" as the picture file name
'(if you have an actual no.jpg file, rename it !)
---------------------------------------------------------

'petite pause
no.jpg
cel://Follow/Sol:Earth/2010-03-01T10:39:04.17025?x=fAYUefMBRQ&y=tOve9g5WQw&z=7hdhwz0YCA&ow=0.878284&ox=0.299365&oy=-0.27692&oz=-0.249624&fov=35.2855&ts=1&ltd=0&p=0&rf=1890079&lm=12&tsrc=0&ver=3
Aristote n'?tait pas vraiment un astronome
mais sa vision de l'Univers a influenc? la
connaissance scientifique jusqu'au moyen ?ge
"
Une petite pause pour souffler
et nous continuons notre visite.
# 0 0 -221 -73 1 5


           --Ptol?m?e
ptolemee.jpg 36 -429 368 -1 1
cel://Freeflight/2010-03-01T10:33:31.22263?x=wFez/Con8ynx/////////w&y=JymzYb9Wbw&z=zDRdJ2PrbcD6/////////w&ow=-0.651599&ox=-0.347071&oy=0.673936&oz=0.0277609&select=Sol:Earth&fov=33.604&ts=-10&ltd=0&p=1&rf=1890067&lm=20&tsrc=0&ver=3
Ptol?m?e
Astronome et astrologue,
il v?cut ? Alexandrie et son
travail nous est parvenu par son
oeuvre majeure, L'Almageste, qui
est le trait? d'astronomie le plus
complet depuis l'antiquit? et
jusqu'au moyen ?ge.
# 0 1 -162 -269 0 2


            'Syst?me de Ptol?m?e
systeme_ptolemee.png -365 -421 354 1 1
Son syst?me g?ocentrique du cosmos
n'a pas la pr?tention de repr?senter
la r?alit? physique de l'univers, mais
permet de calculer la position des
astres avec une grande pr?cision.
# 0 1 -186 -231 2 2


            'Copernic
copernic.jpg -158 -501 480 0 1
cel://SyncOrbit/Sol:Earth/2010-03-01T10:38:41.02329?x=iwjkFLZF6LZU&y=1q5YMiZ1h2/M&z=JrjTa5w/clBM&ow=-0.520093&ox=-0.182156&oy=0.568862&oz=0.610506&select=Sol&fov=33.604&ts=1&ltd=0&p=0&rf=1890103&lm=6&tsrc=0&ver=3
Nicolas Copernic
"
Reprend les travaux des astronomes anciens
mais a l'id?e de mettre le soleil au
centre de son syst?me.
L'ouvrage qui expose son syst?me ne
sera publi? qu'? sa mort.
# 0 1 -508 -305 2 7


      'K?pler
kepler.jpg -1122 -179 481 1 0
cel://Follow/Sol/2010-03-01T10:37:50.81961?x=AACWaICd4Y0z&y=AADUMMcTUL1M&z=AADrf9x5vv8K&ow=0.667079&ox=0.369958&oy=-0.594133&oz=-0.25523&select=Sol:Mars&fov=34.8556&ts=1&ltd=0&p=0&rf=1890103&lm=6&tsrc=0&ver=3
Johannes Kepler
Calculateur infatiguable, il reprend
les observations de Tycho Brahe et d?couvre
que les plan?tes suivent des orbites
elliptiques avec un mouvement non uniforme
autour du Soleil
# -1 -1 35 96 0 1


       'Galil?e
Galilee.jpg -468 -548 478 1 1
cel://Follow/Sol:Jupiter/2010-03-01T10:33:25.52900?x=gNqAfy+smAw&y=AGBB/MJzhi8B&z=ALCOANJ/1+H//////////w&ow=-0.518776&ox=-0.527708&oy=0.490501&oz=0.460222&fov=33.604&ts=-1&ltd=0&p=0&rf=1890103&lm=6&tsrc=0&ver=3
Galileo Galilei
"
N? ? Pise en Italie, il s'int?resse
? la physique et ? l'astronomie.
Il construit la premi?re lunette
astronomique qui lui permet de d?couvrir
les quatre principaux satellites de
Jupiter
# -1 -1 50 82 0 1

        'Newton
newton.jpg 66 -174 559 0 0
cel://Follow/Sol:Earth:Moon/2010-03-03T20:51:14.74041?x=6JlsW1eb4A&y=SH3YKYqWvf///////////w&z=kGpKTPubXQE&ow=0.957891&ox=-0.103122&oy=-0.260463&oz=-0.0630126&select=Sol:Earth:Moon&fov=7.386&ts=1&ltd=0&p=0&rf=10278775&lm=16&tsrc=0&ver=3
Isaac Newton
Savant math?maticien, physicien, alchimiste et astronome.
Il met au point les outils math?matiques qui lui
permettront d'?tablir la th?orie de la gravitation
universelle.
# -1 -1 20 96 0 1


   'Russell
russell.png -555 -304 632 0 0
cel://Follow/61%20Cyg/2010-03-03T20:58:44.09323?x=AAAA6pjatp9VJw&y=AAAAmM5TMjVBcQ&z=AAAAtDLPHpU+Qw&ow=0.616005&ox=0.240403&oy=-0.448638&oz=-0.601222&select=Algol&fov=7.386&ts=1&ltd=0&p=0&rf=1890103&lm=16&tsrc=0&ver=3
Henry Norris Russel
Astronome am?ricain 1877 - 1957
"
Il ?tablit une classification des ?toiles
en fonction de leur luminosit? et de leur
classe spectrale, r?sum?e par le diagramme
de Hertzsprung - Russel.
Il analysa aussi syst?matiquement les
?toiles binaires ? ?clipses ainsi que la
variation de leur magnitude.
# 0 0 63 -273 2 3

If you want to see it in Celestia, delete (or rename) your _slidecatalog.txt, then copy the _slidecatalog3.txt to the "slides" directory and rename it into _slidecatalog.txt

Enjoy! :D

This is a beta version. My mind is not fixed on all points.
My intention is to make a tool as easy as possible to use for most people.
All remarks, suggestions, bug reports etc.. are greatly appreciated.
Thank you for your insight and your help. 8)

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

Re: Slideshow without scripting

Post #2by Vincent » 07.03.2010, 10:22

Jo?l,

This Lua plugin looks really impressive, both from the user and the scripter points of view! :D
BRAVO!

I'll test it in deep as soon as possible.
@+
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: Slideshow without scripting

Post #3by Fenerit » 07.03.2010, 14:08

Hi Jo?l, I've just now downloaded your plug-in, now I test it. Just the thought-before: I wonder whether your plug-in could be "viewed" like a "tooltips" features, in which the buttons for showing the images (apart thats more "navigationals") had to be added to the textbox and this latter bordered as a callout. With the aid of cel/URL object's orienting the textbox could be insist upon certain planetary features and thus collecting data... :roll:
Second thought, your control bar look like an audio player, so I wonder whether could be a good idea the devoloping of a plug-in for sound control... :roll: :roll:
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: Slideshow without scripting

Post #4by Fenerit » 07.03.2010, 14:18

Hi, Jo?l, the zip is "an invalid archive" :?:
Never at rest.
Massimo

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #5by jogad » 07.03.2010, 16:19

Fenerit wrote:Hi, Jo?l, the zip is "an invalid archive" :?:
No. I have tested the download again and the file is correct :wink: . Try again ! :?

Fenerit wrote:Hi Jo?l, I've just now downloaded your plug-in, now I test it. Just the thought-before: I wonder whether your plug-in could be "viewed" like a "tooltips" features, in which the buttons for showing the images (apart thats more "navigationals") had to be added to the textbox and this latter bordered as a callout. With the aid of cel/URL object's orienting the textbox could be insist upon certain planetary features and thus collecting data... :roll:
I don't understand really what your suggestion. Sorry :oops: All buttons are "navigationals" except in "saving mode". But I fear the answer is no :(
The purpose of this addon is to show pictures that are independent of Celestia.
Gathering informations from the Celestia context is the job of addons like the "info tool" in the lua_edu_tools that shows pictures and text relative to the selected object in Celestia. Both addons can work together and I do not want to make a monster addon :twisted: .

Fenerit wrote:Second thought, your control bar look like an audio player, so I wonder whether could be a good idea the devoloping of a plug-in for sound control... :roll: :roll:

This is not impossible. For the moment a "slide" may containt picture, text and url. No reason why it should not accept also sound. :)
:?: Is a solution using the proAudio dll acceptable?

In any case thank your for your feedback 8)

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

Re: Slideshow without scripting

Post #6by Fenerit » 07.03.2010, 16:35

Ok, the zip is now good. Now I test it.
Never at rest.
Massimo

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #7by jogad » 07.03.2010, 20:59

I try to follow Massimo's suggestion to add sound in slides with the proAudioRT library.

Linking a sound to a slide is easy but when I try to play the sound, sooner or later I get this error:
Error while executin Lua Hook: Timeout: script hasn't returnde control to celestia (forgot to call wait()?)

And calling wait() causes an error too.

Is there a workaround?

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #8by jogad » 07.03.2010, 22:16

I have a solution for the sound
I simply launch the OS command from the plugin. :mrgreen:
I know that is system dependant but a simple line in the configuration file let launch the right command.

I have the command for Windows that is
cmd start /C "extras\slideshow\slides\FILE_TO_PLAY"

Someone to give me the corresponding command for linux?

Thank you :)

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

Re: Slideshow without scripting

Post #9by Fenerit » 07.03.2010, 23:26

jogad wrote:I try to follow Massimo's suggestion to add sound in slides with the proAudioRT library.

Linking a sound to a slide is easy but when I try to play the sound, sooner or later I get this error:
Error while executin Lua Hook: Timeout: script hasn't returnde control to celestia (forgot to call wait()?)

And calling wait() causes an error too.

Is there a workaround?

For what I know, the following strings are critic and must be always declared:
At init of file:

Code: Select all

require("proAudioRt")
if not proAudio.create() then os.exit(1) end

-- destroy previous samples
proAudio.destroy()

-- Close audio device when script is terminated
function celestia_cleanup_callback()
    proAudio.destroy()
end

-- initializes audio playback device and create one single track
proAudio.create(1)


at end of file, after your manipulations:

Code: Select all

proAudio.soundUpdate (1)
    wait(0)

where (1) is the track; so, if you have more tracks (more files to play) it should be 2, 3, 4... and so on (theoretically up to the maximum tracks allowed per channel, on basic audio card 128 right/128 left).

MONO
Never at rest.
Massimo

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #10by jogad » 08.03.2010, 06:40

Hi Massimo

With your soloution the nature of the problem change.
The wait(0) instruction is allowed in celx scripts but forbidden in lua scripts and cause this error
Error while executin Lua Hook: attempt to yield across metamethod/C-call boundary

:idea: Anyway I prefer the solution of launching the default music player with a system command. The sound is much more better and we have a better control on it. Of course we can lauch any player we want. The choice is up to the user.

Massimo, your idea is very good :D .
The plugin is now a sound (but not only) plugin with very little modifications. :mrgreen:

thank you

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

Re: Slideshow without scripting

Post #11by Vincent » 08.03.2010, 09:40

Jo?l,

Another option would be to launch a celx script containing the sound playback
commands using the new celestia:runscript method. It has the advantage of
being OS independant.
@+
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
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #12by jogad » 08.03.2010, 20:55

Vincent,

Thank you for the proposal, but i cannot even figure out how to do that. The main problem is to send the name of the file to play to the celx script.

I am interested to know if there is a way to share variables between lua and celx scripts.
But it is only curiosity of my part.

The plugin should be able to determine the running OS by spying the environnement variables. At worst, a line in the configuration file, should do the trick. From a strict point of view of programmation launching an OS command is not a portable solution, but for the user there is no difference.

I think the benefits outweigh the disadvantages.
- First of all, sound if far better with any audio player than with the proAudioRT system. And the user have a full control on the sound in a very usual way.
- Moreover, this method is not limited to sound files. All media files are proceeded in the same way.

Your runscript method gave me also other ideas. :wink:
The structure of the slide catalog is open enough to accept for each slide the name of a script to run.
But I reject strongly this idea. Even if it is easy to do, this plugin must remain what it was designed for and not turn in a scripting tool.

However it would be nice that a celx script could acces a fonction of the pluging to display a slide. for example if I make a global function displaySlide(numSlide) in the lua plugin, how can I access this function from a celx script?

Other ideas? :idea:

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

Re: Slideshow without scripting

Post #13by Fenerit » 09.03.2010, 00:12

Hey Jo?l, your plug-in is very impressive! 8O and I too think that your code is straightforward. I need to dig in it more. :mrgreen: (pause for Vincent: your new HR work good as usual).

The plug-in work perfectly on my system. The last thing is that I need more time to play with the control bar for exploiting its potentiality.

BTW, accordingly with the new format of name-plugin-name-box, I've updated my sunposBox as service pack 2 and now even ephemerides works along.

Image

http://marauder.webng.com/files/ephemerides_sp2.zip
(this files match even for southern version)
Never at rest.
Massimo

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

Re: Slideshow without scripting

Post #14by Vincent » 09.03.2010, 08:14

jogad wrote:However it would be nice that a celx script could acces a fonction of the pluging to display a slide.
for example if I make a global function displaySlide(numSlide) in the lua plugin, how can I access this function from a celx script?
Jo?l,

A celx script can access global values and functions from a lua file using a 'require' call.
The easiest way is to place your celx script in the same folder as your lua file.
Then, add the following lines at the beginning of the celx script:

Code: Select all

package.path = celestia:getscriptpath().."/../?.lua;"
require "myluafile"

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: Slideshow without scripting

Post #15by Fenerit » 10.03.2010, 12:39

Jo?l, there is a way for avoiding the time freezing due to the cel/url setting? I which part of the code it would have set?
Never at rest.
Massimo

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #16by jogad » 10.03.2010, 19:34

Hello,

@Vincent.
Thank you for the tip. My problem is not to find the place of the required file, but rather to send a parameter to a lua script with a celx script and then to use it in a second lua script. The parameter is always accessible between to scripts but never to the three together.

@Massimo.
I noticed indeed a small delay in loading some url. Particularly with the Miky Way. But on my system it is very short (less than 1/2 second). For urls involving planets I don't even notice any delay.

If you really want to put your hands in the dirty code :wink: , it is here (line 289):

Code: Select all

local activateObj = function(j, resizing) -- line j of diaporama
   iObj=j;
   celestia:print("",0)
   while iObj > nbObjects do iObj=iObj-nbObjects end
   while iObj < 1 do iObj = iObj + nbObjects end
   local obj = diaporama[iObj]
   if display_diapo and not resizing then
      if obj.url and allow_urls then celestia:seturl(obj.url) end  --  <== look here
      if obj.sound and sound_available then
         local soundCommand = string.gsub(playSoundCommand,"SOUNDFILE",obj.sound)
         os.execute(soundCommand)
      end
   end
   if obj.IMG.file then
      loadImage()
   end
   initText()
end

This is the small essential functions that activate a slide. (and the one that was the elusive target of my celx script)

If you have a look into, you'll notice that the sound is now available.
I don't plan to further develop this aspect.

Now the plugin is localized. :blue: Not a big challenge (only 6 sentences to translate) but it is important for me. Of course only French is available but the English. To add a language just take the file slideshow_fr.lua in the "locale" directory of slideshow (in the "extras" directory) as an example and rename it with the correct to letters.
To do that I have stolen a piece of code to the edu lua tools of Vincent. I hope he is not hangry because of that. This system lets each pluging to have its own set of translations.

And for the end, I like the Lua Edu Tools much more than the Lua Plugins. This is my favorite program for Celestia.
Thus I made my plugin compatible with the all new version of it:
planetes.jpg

Now installing in the Lua Plugins or in the Lua Edu Tools is very similar:

For the Lua Plugins find the config.lua file in the "lua_plugings" directory and edit like this:

Code: Select all

plugins =
    {
        "compassBox",
        "coordinateBox",
        "KeplerParamBox",
        "pictureBox",
        "HRBox",
   "slideshow", --  <== line to add
    }


For the Lua tools find the config.lua file in the "lua_edu_tools" directory and edit like this:

Code: Select all

toolset =
    {
        "timeBox",
        "lightBox",
        "magnitudeBox",
        "galaxyLightBox",
        "renderBox",
        "obsModeBox",
        "solarSystemBox",
        "fovBox",
        "addsBox",
        "infoBox",
        "coordinatesBox",
        "distanceBox",
        "magnificationBox",
        "HRBox",
        "KeplerParamBox",
   "slideshow",  --      <== line to add
        --"virtualPadBox",
        "compassBox",
    }

That's it! :mrgreen:

Of course, when running in the Lua Edu Tools, the localization is also present, but Vincent don't be afraid. I did not modify anything in your files.

:idea: There is a lot of customization in the slideshowconfig.lua file in the extras/slideshow folder. Have a look at it.
.

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

Re: Slideshow without scripting

Post #17by Vincent » 11.03.2010, 15:44

Jo?l,

jogad wrote:Thank you for the tip. My problem is not to find the place of the required file, but rather to send a parameter to a lua script with a celx script and then to use it in a second lua script. The parameter is always accessible between to scripts but never to the three together.
Do you mean that the Lua scripts should read variables from the celx script?


jogad wrote:To do that I have stolen a piece of code to the edu lua tools of Vincent. I hope he is not hangry because of that.
Absolutely not. 8)
Except if you're planning to make a lot of money from my wonderful piece of code... :wink:
@+
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
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #18by jogad » 11.03.2010, 20:43

Hello,
Vincent wrote:Do you mean that the Lua scripts should read variables from the celx script?
No. It's rather the slideshow plugin that should be able to read and use a value (the slide number) sent by a celx script. :wink:

As I said, I do not want to add programming capabilities to my plugin. (Maybe it will be easier)
But I would like to export the possibility to export the procedure that displays a slide and make it accessible from a celx script.
A kind of interface as the one that allows a celx script file to execute actions in Celestia.

The problem is that I can't declare <require "slideshow"> in a lua or celx script without causing errors because the windows (boxes) are redefined.
I can try to separate some procedures of the main program, but as it is required to use the boxes defined therein, it only delays the problem. :?

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

Re: Slideshow without scripting

Post #19by Fenerit » 11.03.2010, 22:36

@Massimo.
I noticed indeed a small delay in loading some url. Particularly with the Miky Way. But on my system it is very short (less than 1/2 second). For urls involving planets I don't even notice any delay.

Jo?l, is not that what I intend; my issue concern the timecounter's stop once the cel/url slideshow's setting have been set. When one reload the slideshow after a while, the timecounter is rewind. Perhaps I've forgot something?
Never at rest.
Massimo

Avatar
Topic author
jogad
Posts: 458
Joined: 17.09.2008
With us: 16 years 2 months
Location: Paris France

Re: Slideshow without scripting

Post #20by jogad » 12.03.2010, 16:36

Massimo,

I'm not sure I understand your question. :oops:

There is no timecounter code in the plugin.
But sometimes the time is paused. This is one of the many things that are stored in the URL itself.
In this case simply remove the pause (space bar) and re-register the slide with the new URL.
A very quick way to register the new URL (and the other elements of the slide) is to click twice on the orange arrows.

I do not know if I answered your question. :?

:arrow: I have posted a new version with some bugs fixed and a new behavior when resizing the Celestia windows.


Return to “Add-on development”