Page 1 of 1

Whatever happened to doctorjoe's GOTO patch?

Posted: 28.05.2007, 01:56
by BlindedByTheLight
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?

Posted: 28.05.2007, 03:06
by Cham
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


Posted: 28.05.2007, 03:13
by BlindedByTheLight
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?

Posted: 28.05.2007, 03:20
by Cham
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.

Posted: 28.05.2007, 09:07
by Vincent
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

Posted: 28.05.2007, 11:42
by ElChristou
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...

Posted: 28.05.2007, 13:21
by Vincent
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:

Posted: 29.05.2007, 03:33
by dirkpitt
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?

Posted: 29.05.2007, 06:54
by chris
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

Posted: 29.05.2007, 19:54
by BlindedByTheLight
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

Posted: 30.05.2007, 13:36
by Vincent
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...

Posted: 31.05.2007, 03:36
by BlindedByTheLight
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

Posted: 31.05.2007, 10:56
by ElChristou
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?

Posted: 29.06.2007, 07:00
by BlindedByTheLight
"To me the GotoDate should be hard code"

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

:)

Posted: 20.01.2008, 21:00
by BlindedByTheLight
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?