Creating Plugin to Overide Autorotation (PTP 2.2)  

Share your tips and tricks here or get help with any Panotour 2.0+ problem!
No bug reports (of any kind) in this forum!
no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Tue Oct 07, 2014 8:32 pm

I'm am creating a "Guided Tour" plugin that guides the user through a series locations (h,v,fov) on each pano. I would like to over-ride the functions that support autorotation (play/pause buttons and integration with Auto Tour). I'm thinking maybe I can replace the XXXautorotation actions in the generated NAME_core.xml file, but I suspect there are other considerations to doing this. At this point in time I'm planning on the list of locations for each pano to be stored in an external XML file. Initially I will plan on building this file manually, but eventually I want to enable editing of these settings in the PTP UI. If anyone could give me some guidance on how to override autorotation, or really any feedback on the approach I would be very grateful. I would also be interested in any ideas about how to embed an editor of these settings in the Tour - Pano Properties page.

Thanks
Mike

User avatar
klausesser
Member
 
Posts: 8836
Likes: 5 posts
Liked in: 64 posts
Joined: Mon May 22, 2006 12:18 am
Location: Duesseldorf, Germany
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by klausesser » Tue Oct 07, 2014 10:07 pm

FlatBallFlyer wrote:I'm am creating a "Guided Tour" plugin that guides the user through a series locations (h,v,fov) on each pano. I would like to over-ride the functions that support autorotation (play/pause buttons and integration with Auto Tour). I'm thinking maybe I can replace the XXXautorotation actions in the generated NAME_core.xml file, but I suspect there are other considerations to doing this. At this point in time I'm planning on the list of locations for each pano to be stored in an external XML file. Initially I will plan on building this file manually, but eventually I want to enable editing of these settings in the PTP UI. If anyone could give me some guidance on how to override autorotation, or really any feedback on the approach I would be very grateful. I would also be interested in any ideas about how to embed an editor of these settings in the Tour - Pano Properties page.

Thanks
Mike



Hi Mike!

You can set autorotation and/or autotour - and almost all other parameters - in each scene´s xml code seperately.
So you can design the behavior of each pano in a tour seperately.

Klaus

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Tue Oct 07, 2014 10:37 pm

Thank you Claus, I'm not sure if you know about the _core.xml code, but what I really need help with is over-riding the Auto Rotation features with my own actions. Here are a few more specific questions:
    Is there documentation on the <scene> xml?
    Can I add "lookto" actions in the <scene> xml somewhere?
I suspect that I will need to make changes to the _core.xml code, and not just the <scene> xml. If so,
    Can I replace the startautorotation, stopautorotation, pauseautorotation, resumeautorotation actions in the _core.xml file with my own actions?
    Can you tell me the difference between tour_autorotateenabled and autorotate.enabled?
    What does the variable forceplugin indicate? (it appears to support a stacked resume/pause, I just don't understand why)
    What do the event handlers for onstartautorotation, onstopautorotation, pauseautorotation, resumeautorotation do?
    What are the other the autorotation_events (beyond onnewpano)?
    Are there other Auto Rotation actions to modify or replace?
    Are there other Auto Tour events I need to handle?

Any help or pointers are greatly appreciated.

Mike

User avatar
klausesser
Member
 
Posts: 8836
Likes: 5 posts
Liked in: 64 posts
Joined: Mon May 22, 2006 12:18 am
Location: Duesseldorf, Germany
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by klausesser » Tue Oct 07, 2014 10:44 pm

FlatBallFlyer wrote:Thank you Claus, I'm not sure if you know about the _core.xml code, but what I really need help with is over-riding the Auto Rotation features with my own actions. Here are a few more specific questions:
    Can I replace the startautorotation, stopautorotation, pauseautorotation, resumeautorotation actions in the _core.xml file with my own actions?
    Can you tell me the difference between tour_autorotateenabled and autorotate.enabled?
    What does the variable forceplugin indicate? (it appears to support a stacked resume/pause, I just don't understand why)
    What do the event handlers for onstartautorotation, onstopautorotation, pauseautorotation, resumeautorotation do?
    What are the other the autorotation_events (beyond onnewpano)?
    Are there other Auto Rotation actions to modify or replace?
    Are there other Auto Tour events I need to handle?

Any help or pointers are greatly appreciated.

Mike


the _core.xml works globally, the _tour.xml can be set individually for each pano.

But i´m not very familiar with PTP2.x

Klaus

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Tue Oct 07, 2014 10:59 pm

So, if I add code the code
Code: Select all
  <action name="startautorotation">
    set(guided, true);
    callToMyCode();
    events.dispatch(onstartautorotation);
  </action>

to my tour.xml will that code be executed instead of the same action in the _tour.xml or in addition to?

Thanks

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Wed Oct 08, 2014 9:30 am

To overwrite an action the code must be added after the first one.
Elsewhere added code will not work.

But with Panotour the core.xml is injected after the skin.xml used by plugins so the latest code called is the core one.
So it seems difficult to overwrite these actions with a plugin.
Benjamin

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Wed Oct 08, 2014 10:10 am

You can also use an events tag to load your own actions on onstartautorotation / onstopautorotation / onpauseautorotation / onresumeautorotation.

When start or resume is called, call this action set(autorotate.enabled, false); into your code to stop Panotour rotation and after that begin your own.


Code: Select all
<events name="myOwnRotation" onstartautorotation="myStartRotationAction" onstopautorotation="myStopRotationAction" onpauseautorotation="myPauseRotationAction" onresumeautorotation="myResumeRotationAction" keep="true />

<action name="myStartRotationAction">
set(autorotate.enabled, false);
...
</action>

<action name="myStopRotationAction">
...
</action>

<action name="myPauseRotationAction">
...
</action>

<action name="myResumeRotationAction">
set(autorotate.enabled, false);
...
</action>
Benjamin

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Tue Oct 21, 2014 1:49 am

Many thanks to benj33 - I've made considerable progress, but I'm having some problems with the lookto action in nonblocking mode. More specifically the following command works (of course the nextstop() action is never called because it's non-blocking):
Code: Select all
    lookto(get(data[get(stopname)].toH),
        get(data[get(stopname)].toV),
        get(data[get(stopname)].fov),
        tween(get(data[get(stopname)].tween),get(data[get(stopname)].time)),
        false,
        false,
        delayedcall(get(data[get(stopname)].pause), nextstop()  );

and when I turn the nonblocking option on the command does nothing. (Here is code that does not work:)
Code: Select all
    lookto(get(data[get(stopname)].toH),
        get(data[get(stopname)].toV),
        get(data[get(stopname)].fov),
        tween(get(data[get(stopname)].tween),get(data[get(stopname)].time)),
        false,
        true,
        delayedcall(get(data[get(stopname)].pause), nextstop()  );

Maybe I'm missing something? Any help would be greatly appreciated!

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Tue Oct 21, 2014 8:53 am

Have your tried the WAIT parameter into the donecall : http://krpano.com/docu/actions/#tween ?
Benjamin

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Wed Oct 22, 2014 2:12 am

I've made some progress, but I can't seem to get the donecall to work, and I'm starting to wonder if I understand the requirements for the autorotation event handlers. Is there any documentation on when the onstartautorotation onstopautorotation onpauseautorotation onresumeautorotation are called? In further testing the onstart action appears to be called frequently, without calls to onstop or onpause actions. I was assuming that I could call the lookto command from onstart and onresume actions in non-blocking mode, and stoplookto in the onstop and onpause actions. I was hoping that this would allow me to override the auto rotation without requiring tween step event handlers. I am also not seeing how I should indicate to the AutoTour that the autorotation has completed and it's time to load the next pano.
Last edited by FlatBallFlyer on Wed Oct 22, 2014 4:32 am, edited 1 time in total.

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Wed Oct 22, 2014 4:00 am

Ok, I think I've found all my typo's and syntax errors now, and things appear to be working as I want with 1 exception. The following command works just fine.
Code: Select all
lookto(0.1,0.2,0.12,tween("easeOutQuint",4));
but the following command uses a time of 0
Code: Select all
<krpano foo="4"/>
....
lookto(0.1,0.2,0.12,tween("easeOutQuint",get(foo)));

any idea of what's going on here? Is there a "val" type function to convert string to number or something?

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Thu Oct 23, 2014 9:18 am

Yep I've asked for this problem.
Benjamin

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Thu Oct 23, 2014 3:18 pm

Thank you Ben, can you tell me what action I should call to tell the Auto Tour function that the Auto Rotate has completed it's rotation and the tour should proceed to the next pano?

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Thu Oct 23, 2014 3:24 pm

The loadNextScene(); action.

For your get(foo) problem it's a krpano viewer problem. The get() is not exposed into the tween. So it's not possible to do like that until a krpano script update.
Benjamin

no avatar
Alexpopov
Member
 
Posts: 92
Likes: 21 posts
Liked in: 28 posts
Joined: Mon Mar 24, 2014 8:18 pm
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by Alexpopov » Fri Oct 24, 2014 6:16 am

but the following command uses a time of 0
You can try this:
Add action instance somwhere, but not inside any action etc.
Code: Select all
<action name="mylookto"></action>

Then the second action
Code: Select all
<action name="mylooktocall">
txtadd(action[mylookto].content, 'lookto(0.1,0.2,0.12,tween("easeOutQuint",',get(foo),'));');
mylookto();</action>

Then you can call mylooktocall(); action instead your lookto code... I did not try this, just idea.

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Fri Oct 24, 2014 2:26 pm

Thanks for the work around - Genius! I've tested and it works great.
I'm still hoping they fix the problem, but I've got a working solution for now.
:)

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Fri Oct 24, 2014 10:37 pm

Just an update, I have a beta version of the "Guided Tour" feature that I was looking for up and running. If you'd like to see it go to http://www.ssgpp.com/forcorners/ - For now you have to pause the tour to be able to use pan/zoom controls, so I'm still trying to figure out the "non-blocking" part of the lookto action. Any advice on how to make that work is greatly appreciated.

no avatar
mediavets
Moderator
 
Posts: 16415
Likes: 2 posts
Liked in: 130 posts
Joined: Wed Nov 14, 2007 2:12 pm
Location: Isleham, Cambridgeshire, UK.
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by mediavets » Sun Oct 26, 2014 6:43 pm

FlatBallFlyer wrote:Just an update, I have a beta version of the "Guided Tour" feature that I was looking for up and running. If you'd like to see it go to http://www.ssgpp.com/forcorners/ - For now you have to pause the tour to be able to use pan/zoom controls, so I'm still trying to figure out the "non-blocking" part of the lookto action. Any advice on how to make that work is greatly appreciated.
Congratulations you have the basics of a feature I've been requesting for years.

I'd like to see everything configurable via a GUI and more control over the transitons between views, and a synched audio 'track' or tracks, manual overide and auto-resumption of guided tour amongst other things.

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Sun Oct 26, 2014 9:34 pm

I'm not sure if you looked at the code, but under the covers it is just a series of "Guide Stops", each with it's own target (h/v/fov), a tween type and time for the transition, and a delay before the next transition, so you have a good bit of control on transitions. I did have to make "intermediate" stops to achieve some of the transitions I wanted, still learning how the various tween types work, but most of them only seem to control the pan/zoom speed, so arch transitions are impossible. I imagine you could create more sophisticated use of tween logic to control an arched path, but I'm not going to write a new lookto function. Maybe a future enhancement in krpano script will support more transition controls. I am planning on open-sourcing the code in hopes that the functionality will be incorporated into a future release. Ideally I would like to see an editor similar to the "Starting Point" editor, that allowed me to add/update entries in the guide stop table. Since the plug-in's only let you work on the Style page, and not the Pano page I doubt I'll spend much time trying to make it a real plug-in. When the code is a bit more stable I'll make a blog post with instructions on how to use the code. At this point in time I have a pano_guided.xml that include in the base pano.xml. I use an excel spreadsheet that creates the XML that describes the stops. The code currently doesn't support multi-pano tours, but I should have that added soon. I'm still trying to figure out the "non blocking" part, as nothing I do seems to make the lookto action non-blocking.

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Mon Oct 27, 2014 11:06 am

Look after the oninterrupt action for user interaction during animation.
http://krpano.com/docu/actions/#oninterrupt
Benjamin

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Sun Nov 02, 2014 1:53 am

Thanks Ben, but I'm still stuck on the non-blocking use of lookto. I execute lookto with both shortestway and nonblocking set to true but user action appears to be blocked. I've added an oninterupt call to stoplookto before the lookto command, but the call still blocks user interaction. I am able to click on the "change move mode" button, but navigation appears to stack and execute between calls to lookto. I'll upload code just in case someone has time to look at it, there's not much to it really. The "gotostop" action is slightly convoluted to deal with the tween speed workaround. As always any is help appreciated!
Attachments
fourcorners_guided.xml
this is included into fourcorners.xml to drive the guided tour.
(4.25 KiB) Downloaded 84 times

no avatar
benji33
Kolor Team
 
Posts: 5848
Likes: 92 posts
Liked in: 199 posts
Joined: Tue Apr 09, 2013 10:59 am
Location: France
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by benji33 » Mon Nov 03, 2014 9:38 am

Seems that there are errors in your code as the simple "=" into nextstop action.

With an old project I was dealing with a code like this one with user action to take control on the panorama :
Code: Select all
oninterrupt(action(hiddenAllInfos));
action(hideMenus);   
oninterrupt(action(hiddenAllInfos));
lookat(-82,2.07,15);       
oninterrupt(action(hiddenAllInfos));
action(hideSpecificInfos);
lookto(-95.77,-3.25,0.5,smooth(25,25,25));
action(showSpecificInfos);
wait(4.00);
action(hideSpecificInfos);
oninterrupt(action(hiddenAllInfos));
action(hideSpecificInfos2);
lookto(-95.69,0.67,3.09,smooth(25,25,25));
action(showSpecificInfos2);
wait(4.00);
action(hideSpecificInfos2);
...
Benjamin

no avatar
FlatBallFlyer
Member
 
Topic author
Posts: 65
Likes: 1 post
Liked in: 0 post
Joined: Thu Mar 01, 2012 10:11 pm
Location: Asheville NC
Info

Re: Creating Plugin to Overide Autorotation (PTP 2.2)

by FlatBallFlyer » Mon Nov 03, 2014 3:04 pm

Thanks Ben, I've corrected the error in nextstop (now ==) and changed my oninterupt statement to use the action() function. Here is the updated code for gotostop, it's still not working. User interactions to move/zoom are still blocked. Some user interactions are not blocked (Play/Pause and DoubleClick work). The Play/Pause buttons for Autotour and Autorotation seem to work correctly, and if I pause the autorotation I have control, but during the lookto execution user interaction is still blocked.

Code: Select all
       txtadd(stopname,"guide_",get(guide_stop));
        txtadd(action[mylookto].content,
        'lookto(',
            get(data[get(stopname)].toH),',',
            get(data[get(stopname)].toV),',',
            get(data[get(stopname)].fov),',',
            'tween(',get(data[get(stopname)].tween),',',
                     get(data[get(stopname)].time),'),true, true,',
                     'delayedcall(',get(data[get(stopname)].pause),',nextstop()));');

        oninterrupt(action(guideStopRotationAction));
        mylookto();


Who is online

Users browsing this forum: Majestic-12 [Bot] and 10 guests