QTVR Pan OpenCard

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
hamlynart
Posts: 101
Joined: Wed Mar 19, 2008 7:10 pm
Location: Glasgow
Contact:

QTVR Pan OpenCard

Post by hamlynart » Sun Aug 31, 2008 12:25 pm

Hi Folks,

I have a QTVR which I'd like to open at a different pan angle. I'm using the following script but unfortunately this happens after the QTVR is displayed making it jump. I've tried "on PreOpenCard" but this doesn't work - I guess because the QTVR isn't loaded yet. Any thoughts???

on OpenCard

set the pan of player "myQTVR" to 190

end OpenCard


Thanks

Jim

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Location: London, UK
Contact:

Post by Mark Smith » Sun Aug 31, 2008 2:04 pm

This seems to work ok here, on OS X - what version of Rev are you using, and which OS? (I think there have been issues with quicktime on Windows).

best,

Mark

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4027
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Sun Aug 31, 2008 3:25 pm

Hi Jim,

I dont quite understand what you want

If you want to go to a card which has a QTVR already loaded and when opening the card you want it in a certain angle and you dont want the change of angle to be visible then the only way I found was to reload the QTVR on opening the card.
like in:

on OpenCard
lock screen
set the filename of player 1 to field 1
set the pan of player 1 to random(360)
end OpenCard

on preOpenCard
set the filename of player 1 to ""
end preOpenCard

you will not see the change of pan but it takes a bit longer and depending on the size of your QTVR you see a little delay until the QTVR is shown.

for this scenario you could also try

on opencard
lock screen
set the pan of player 1 to random(360)
set the loc of player 1 to the cpPlayerLoc of this stack
set the alwaysbuffer of player 1 to false
end opencard

on preopencard
set the alwaysbuffer of player 1 to true
set the cpPlayerLoc of this stack to the loc of player 1
set the loc of player 1 to "-32000,-32000"
end preopencard

only works if the alwaysbuffer is true, but with alwaysbuffer true you can not manually navigate in the QTVR, therefore the alwaysbuffer in the script. Might be a little faster the reloading the QTVR

I your problem is that you want to load a new QTVR into the player at a given pan then you might try

lock screen
set the filename of player "valid path to file"
set the pan of player 1 to 90
unlock screen

regards


Bernd

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4027
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Sun Aug 31, 2008 7:52 pm

Hi Jim,

playing around with this I found the second solution to not work anymore. Why???

So here is what works pretty consistently for me opening a card with a QTVR on this card to a non default pan without going visibly from pan 0 to x

Code: Select all

on preopencard
    set the alwaysbuffer of player 1 to true
    set  the cpPlayerLoc of this stack to the loc of player 1
    set the loc of player 1 to "-32000,-32000"
end preopencard

on opencard
    set the loc of player 1 to the cpPlayerLoc of this stack
    set the pan of player 1 to random(360)
    set the alwaysbuffer of player 1 to false
end opencard
I just wonder, why it works.

Oh well, maybe someone in the know finds a smarter way to do this.

greetings

Bernd

hamlynart
Posts: 101
Joined: Wed Mar 19, 2008 7:10 pm
Location: Glasgow
Contact:

Post by hamlynart » Sun Aug 31, 2008 11:23 pm

Wow that's great it works!

However, what's "cpPlayerLoc"? I can't find it in the documentation dictionary.

Trying your script out I find it works just as well if I do this:

on preopencard
    set the alwaysbuffer of player 1 to true
end preopencard

on opencard
    set the pan of player 1 to random(360)
    set the alwaysbuffer of player 1 to false
end opencard

Many Thanks

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4027
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Post by bn » Sun Aug 31, 2008 11:56 pm

Jim,

glad it works for you.

cpPlayerLoc is a custom property that you create in Rev when you set it. It is persistent because it is saved with the stack. It is a way to store a variable and share it from different handlers, even when they are not in the same script. You can look at these properties in the inspector --> custom properties.

I tried your variation of the script and for me it does not work, I still see angle 0 and then angle x.

I thought I was smart in setting the player to an offscreen location then change the pan and set it back to the old location, turns out it is not really that since it only works if I set the location back to the old location and then set the pan. So it may have to do with timing with the graphic engine, Rev is busy with the commands and skips on refresh or something. I really dont get it why it works.

anyhow it is not nice but if it works....

looked at your site and the conceptual art there. Liked it very much.

regards

bernd

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”