Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  JavaScript    VMPExtremeShot fails to render newest scene

Moderators: e_phoenix13
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
Hi

I think I have found a bug, and I hope that there is a come-around to it.

I have the following scenario:

s1) MTX File loads into scene
s2) When mts is finished loading, a MTSLoadDone event is fired calling javascript function OnMTSLoadDone.
s3) Inside OnMTSLoadDone, I (1)reset camera, (2)set cameras pivot, (3)set cameras orbitdist and, (4)set scene scale and (5) make a FORCE-render of scene. Finally I (6) Render to local file via VMPExtremeShot.
s4) Pop window shows where to save file, I type in and save. Image is now saved, but without some (if not all) of (1-5).
s5) When image is saved, viewpoint player now does 1-5.


Why is this happining? I am trying to FORCE a render of the scene before Render to file, but still I am not seeing the correct render. WHY?

Thanks in advance.

This message has been edited. Last edited by: gooky,
 
Posts: 47 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Avi
AviScript Extraordinaire
Member
Picture of Avi
Posted Hide Post
I'm guessing you're doing it in an action rather than an animation. If you do it in an animation, you have much more control and the Viewpoint scene will force the 1-4 steps to occur (and you can do it all at once) without needing to force a render.
Depending on whether or not you'd like the scene to animate to the desired location or just jump to the location, you can set the timing of the animation accordingly and then you can use the ActionAnimator call to capture and save the scene when complete. I'd allow one second between capturing and saving the scene. You do not have to wait long after the animation to capture the scene (maybe 0.1 or 0.25 seconds).

So something like this should work:

<MTSInteractor>
<MTSHandle Event="captureit" Action="VETDispatchCall" Function="ShotIt::VMPCapture()" />
<MTSHandle Event="saveit" Action="VETDispatchCall" Function="ShotIt::VMPRemotePersist()" />
</MTSInteractor>

<MTSTimeElem Type="Keyframe" Name="sceneCapture_anim" On="0">
<Target Name="MTSCamera" Property="rot_" Timeline="cam_rot"/>
<Target Name="MTSCamera" Property="orbd" Timeline="cam_zom"/>
<Target Name="MTSCamera" Property="pivt" Timeline="cam_piv"/>
<Target Name="MTSCamera" Property="tra_" Timeline="cam_tra"/>
<Target Name="MTSCamera" Property="scl_" Timeline="cam_scl"/>
<Time>
0 0.001 0.1 1.1
</Time>
<Timeline Name="cam_rot" Type="3D">
[0 36 0] [0 36 0]
</Timeline>
<Timeline Name="cam_zom" Type="1D">
[2.63] [2.63]
</Timeline>
<Timeline Name="cam_piv" Type="3D">
[0 .38 0] [0 .38 0]
</Timeline>
<Timeline Name="cam_tra" Type="3D">
[0 0 0] [0 0 0]
</Timeline>
<Timeline Name="cam_scl" Type="3D">
[1 1 1] [1 1 1]
</Timeline>
<MTSTimeElem Type="ActionAnimator">
<noop/>
<noop/>
<PostMessage Message="captureit" />
<PostMessage Message="saveit" />
</MTSTimeElem>
</MTSTimeElem>
 
Posts: 24 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Hi Avi

Actually I am doing these things from javascript. Isn't this possible?

If so, I guess I need to wait 1/4 sec as well after setting the properties until I actually capture or what?
 
Posts: 47 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
Avi
AviScript Extraordinaire
Member
Picture of Avi
Posted Hide Post
Yes, you would have to set timeouts in javascript. My advice is to put it into an animation instead if possible. I love Javascript, but I realize it's limitations. It does not have a great timeline approach. And if you're setting up multiple calls at once, you will not be able to tell which is run first and worse of all, if you're running on a slow computer or a Mac (I'm not taking a stab at the Mac -- Javascript on a Mac is completely unstable), you run the risk of LOSING calls. This can easily happen. If you run more than 3 SetProperty, TriggerAnim, or PostEvent calls at once, expect it to happen.

So again, my recommendation if at all possible is to place it in an animation and trigger it. The timeline of the animation forces things to perform in order. No other method is as foolproof.

Avi
 
Posts: 24 | Registered: January 24, 2003Reply With QuoteEdit or Delete MessageReport This Post
  Powered by Eve Community  
 

Viewpoint Developer Central    Viewpoint Forums    Viewpoint Forums  Hop To Forum Categories  JavaScript    VMPExtremeShot fails to render newest scene