Whatever happened to doctorjoe's GOTO patch?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Whatever happened to doctorjoe's GOTO patch?

Post #1by BlindedByTheLight » 28.05.2007, 01:56

Remember a while back that great patch doctorjoe wrote? Shift-G on an item - say the Mir - and it would send you to the location in space AND time. I thought that had percolated into CVS...but it doesn't work on my system. Anyone else know anything about this?
Steven Binder, Mac OS X 10.4.10

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

Post #2by Cham » 28.05.2007, 03:06

Steve,

I'm using a modified start.celx script which includes that usefull function. I've edited the config file so it recognize the celx script to start Celestia. In the celx file, I placed all the usual standard CEL script. Here it is (stripped of all my usual start script).

I agree that this function should be included in the standard Celestia.

Code: Select all

-- start.celx


function fastgoto()
    sel = celestia:getselection()
    obs = celestia:getobserver()
    if sel and obs then
        obs:goto(sel, 0.001)
    end
end


keyhandlers =
{
   G = fastgoto,
}


function handlekey(k)
    handler = keyhandlers[k.char]
    if (handler ~= nil) then
        handler()
        return true
    else
        return false
    end
end


celestia:registereventhandler("key", handlekey)


function CEL(source)
   local script = celestia:createcelscript(source)
   while script:tick() do
      wait(0)
   end
end


CEL([[
{

# ... Beginning of script

# PASTE ALL YOUR STANDARD START SCRIPT HERE

# End of standard script...
}


]])


-- end

"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!"

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #3by BlindedByTheLight » 28.05.2007, 03:13

cool! I'm unfamiliar with celx...but it looks like you can use it to override the keyboard commands and replace them with your own functions?
Steven Binder, Mac OS X 10.4.10

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

Post #4by Cham » 28.05.2007, 03:20

I don't think it overwrites the keyboard. It's just adding a specific function with a keyboard shortcut. Vincent is the specialist on that subject. There is certainly much more things we can do with this trick. Mine underexploit the possibilities.
"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!"

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

Post #5by Vincent » 28.05.2007, 09:07

Cham wrote:I don't think it overwrites the keyboard. It's just adding a specific function with a keyboard shortcut. Vincent is the specialist on that subject. There is certainly much more things we can do with this trick. Mine underexploit the possibilities.

Actually, you can choose whether the key-mapped function totally replaces the standard function or is simply added on top of it by making the handlekey function return 'true' or 'false'.

I've added a modified version of DoctorJoe's patch to Celestia 1.4.1 patch a while ago. Then, following Cham's idea that is far more flexible and that works with Celestia 1.5pre1 or later, here's a script that maps the gotoStartDate function to [shift]+[G]:

Code: Select all

-- Map the gotoStartDate function to [shift]+[G]:
-- (Go to the current selection and replace time with the selection's Start Lifespan).

function gotoStartDate()
   local sel = celestia:getselection()
   local startTime = sel:getinfo().lifespanStart;
   if startTime and startTime > -1e50 then
      celestia:settime(startTime);
   end
   obs = celestia:getobserver();
   obs:follow(sel);
   obs:goto(sel, 5);
end


keyhandlers =
{
   G = gotoStartDate,
}


function handlekey(k)
    handler = keyhandlers[k.char]
    if (handler ~= nil) then
        handler()
        return true
    else
        return false
    end
end


celestia:registereventhandler("key", handlekey)


function CEL(source)
   local script = celestia:createcelscript(source)
   while script:tick() do
      wait(0)
   end
end


CEL([[
{

# ... Beginning of script

# PASTE ALL YOUR STANDARD START SCRIPT HERE

# End of standard script...
}


]])


-- end
Last edited by Vincent on 28.05.2007, 13:08, edited 1 time in total.
@+
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

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #6by ElChristou » 28.05.2007, 11:42

Vincent wrote:...I've added a modified version of DoctorJoe's patch...


Vincent, could it be possible to add a follow to selection? (after Go, a Follow would be welcome because sometimes, the time some textures load the model can be far from the initial position...)

I agree this script is a must and should be part of the distribution or better, be hard coded...
Image

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

Post #7by Vincent » 28.05.2007, 13:21

ElChristou wrote:Vincent, could it be possible to add a follow to selection? (after Go, a Follow would be welcome because sometimes, the time some textures load the model can be far from the initial position...)

Yes, you're right Chris, the standard goto command is also associated to a follow process. I've edited the script.

Then, to illustrate what I wrote about replacing/keeping the standard command, we could have simply removed the goto/follow process from the gotoStartDate function, and make the handlekey function return 'false' to keep the standard Goto function enabled. But since some other key-mapped function may need a 'return true' call, this might make things a little bit too confusing... :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
dirkpitt
Developer
Posts: 674
Joined: 24.10.2004
With us: 20 years

Post #8by dirkpitt » 29.05.2007, 03:33

Can keys be (re)mapped with a Lua script while Celestia is running, and not just via start.celx?
Even better, could key commands be remapped using Lua commands fired by UI elements?

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

Post #9by chris » 29.05.2007, 06:54

dirkpitt wrote:Can keys be (re)mapped with a Lua script while Celestia is running, and not just via start.celx?
Even better, could key commands be remapped using Lua commands fired by UI elements?


The answer to both questions is yes.

--Chris

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #10by BlindedByTheLight » 29.05.2007, 19:54

Vincent,

Is this still the most current patch?

"Here's the new Celestia_1.4.1_patch3 final release"

Can I patch that to what is on CVS now?

Thanks,
Steve
Steven Binder, Mac OS X 10.4.10

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

Post #11by Vincent » 30.05.2007, 13:36

BlindedByTheLight wrote:Vincent,

Is this still the most current patch?

"Here's the new Celestia_1.4.1_patch3 final release"

Can I patch that to what is on CVS now?

Thanks,
Steve

Steve,

I don't think that applying the whole patch to the CVS code will work, since quite a lot of changes were made since 1.4.1... However, I might be able to provide a patch against the current CVS for one or two specific features. Just tell me which ones you're interested in...
@+
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
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #12by BlindedByTheLight » 31.05.2007, 03:36

Well, for me...I'm happy. I was just thinking about any other Mac OS X users out there. So ya'all...whaddya you guys want?

S
Steven Binder, Mac OS X 10.4.10

ElChristou
Developer
Posts: 3776
Joined: 04.02.2005
With us: 19 years 9 months

Post #13by ElChristou » 31.05.2007, 10:56

To me the GotoDate should be hard code, now as it work perfect via celx this could wait. If I recall Dr Joe has done a work on orbits, but they are now fixed. What else did he wrote?
Image

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #14by BlindedByTheLight » 29.06.2007, 07:00

"To me the GotoDate should be hard code"

I like where you're going with that. Anyone else? Bueller?

:)
Steven Binder, Mac OS X 10.4.10

Topic author
BlindedByTheLight
Posts: 485
Joined: 19.03.2005
With us: 19 years 8 months
Location: Los Angeles, CA

Post #15by BlindedByTheLight » 20.01.2008, 21:00

I can't seem to find the thread - maybe it was a PM I erased - but I seem to recall one of the developers saying this GOTO functionality had ALREADY been hard-coded. If so, it's not working for me. Can anyone else confirm or deny its existence, working or otherwise?
Steven Binder, Mac OS X 10.4.10


Return to “Development”