Additive markers [On Hold]

All about writing scripts for Celestia in Lua and the .cel system
Topic author
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 10 months

Additive markers [On Hold]

Post #1by ElChristou » 05.02.2009, 18:08

Guys, something really annoying: I have two scripts; one mark all galaxies with a white marker. Then I have the script from Fridger to mark the local group. I want to:

1- activate the first script
2- activate the second script
3- get as result the additions of both scripts (all galaxies in white + local group marked)

Actually this seems impossible. Can this issue find a fix? (not being able to show datas in "layers" (not the ones by Cham but almost ;-) ) is a real pity, no?)
Last edited by ElChristou on 31.03.2009, 17:05, edited 1 time in total.
Image

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 10 months
Location: Seattle, Washington, USA

Re: Additive markers

Post #2by chris » 05.02.2009, 18:27

Yes, it is annoying. We should allow more than one marker per object in the next version of Celestia.

--Chris

Topic author
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 10 months

Re: Additive markers

Post #3by ElChristou » 05.02.2009, 18:40

Or each new marker delete the previous if there was one...
Image

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

Re: Additive markers

Post #4by Vincent » 05.02.2009, 19:24

ElChristou wrote:Or each new marker delete the previous if there was one...
Christophe,

This can already be done by telling the script to unmark the LG galaxies just before
marking them with the new symbol. The following version of mark-lg.celx does that:

Code: Select all

-- Title: Mark Local Group Galaxies

function mark_LG_galaxies()
--
-- tables with the member galaxies of the Local Group
--
   local LG_big_galaxies = {"Milky Way", "M 31", "M 33"}

   local LG_members = {"LMC","SMC","IC 10","NGC 6822","M 32","M 110","NGC 3109","NGC 185","IC 1613","NGC 147","Sextans A","Sextans B","WLM","Sagittarius dSph","Fornax dSph","Pegasus DIG","And VII","Leo I","Leo A","And II","And I","And VI","Sagittarius DIG","Aquarius Dwarf","Antlia Dwarf","Sculptor dSph","And III","Leo II","Cetus Dwarf","Sextans dSph","Phoenix Dwarf","LGS 3","Tucana Dwarf","Carina Dwarf","And V","UrsaMinor Dwarf","Draco Dwarf"}
   
   for dso in celestia:dsos() do
      for i,v in ipairs(LG_big_galaxies) do
           if dso:name() == v then
               dso:unmark()
              dso:mark( "green", "disk",10, 1 )
         end
      end
      for j,w in ipairs(LG_members) do         
           if dso:name() == w then
               dso:unmark()
               dso:mark( "red", "disk",5, 0.7 )
           end
      end
   end
end

----------
-- main --
----------
--celestia:unmarkall()
celestia:setrenderflags { markers = true }
km2Mpc = 1/3.08568025e19
MW = celestia:find("Milky Way")
celestia:select(MW)

--
-- move observer to a distance of 5 Mpc from Milky Way
--
observer = celestia:getobserver()
observer:gotodistance(MW, 5/km2Mpc,5)
mark_LG_galaxies()
wait(0)
@+
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

Topic author
ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 10 months

Re: Additive markers

Post #5by ElChristou » 05.02.2009, 19:29

Vincent wrote:This can already be done by telling the script to unmark the LG galaxies just before
marking them with the new symbol. The following version of mark-lg.celx does that:...

Tx Vince, for sure this is a valid solution to my present example, but a general solution at code level would be really welcome...
Anyway, waiting for it I'll use your script! :wink:
Image


Return to “Scripting”