No announcement yet.

Problem with custom seek code

  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with custom seek code

    We recently moved to OIV 8.0 and are having difficulties with our custom code which is implemented as an extension of SoWinExaminerViewer::computeSeekFinalOrientation. Our custom code simply locks the seek behavior to be constrained as "Always Up". This is to say that the camera's direction (*EDIT* camera's UpVector (direction cross orientation) *END EDIT*) is (0,y,z). In other words, the camera is constrained on a plane rather than just straight up.

    Our problem arises in that the computeSeekFinalOrientation was located in SoWinExaminerViewer and has since been moved. This being the case, our function which extended SoWinExaminerViewer and thus subsequently overrode computeSeekFinalOrientation is no longer called. The seek now does not maintain our "Always Up" integrity.

    The seek instructions are now housed in SoGuiViewer, but I am unsure how to implement this custom seek behavior now. Making a class which extends SoGuiViewer is a lot of work for such a simple problem. I have looked through the manual trying to find something in the SoGuiViewer which will mimic our previous code, but have had no luck. Any suggestions?
    Last edited by INOVxDev; May 26th, 2009, 11:58 PM.

  • #2
    This is definitely a bug. It will be fixed for the release of OpenInventor 8.0 .


    • #3
      Is this true? Can a moderator verify this?

      I have found some ideas with a callBack via addStartCallback. This is fired every time the viewer receives a mouse click. I have used:

      m_computeSeekVariables = false;

      in order to shut off OIV's calculation of the orientation, and instead use my custom seek code. I remain with the problem that OIV will not reset the central point of the camera (the point the camera rotates around). I have tried resetting this by setting the seek point to the camera's centralPosition, but this is not correct. How should I manually go about this?


      • #4
        Yes it's true, I'm part of the development team .
        Anyway may be you can do something like that (computation of the new camera orientation is up to you ):
        SoCamera* camera = getCamera();
        camera->orientation = SbRotation::slerp( oldCameraOrientation, newCameraOrientation, cos_t );

        Hope this helps.


        • #5
          Seek code is back in SoWinViewer

          Originally posted by INOVxDev View Post
          Is this true?
          Yes. To be more precise:
          - The viewer code was re-architected in OIV 7.0 because we had 4 different flavors (Xt, Win, Qt and Wx) with (almost) exactly the same code. Now all the platform independent "behavior" code is in the SoGui classes. For maintenance and consistency this is definitely an improvement. But the seek animation could no longer be customized by simply subclassing from xxxViewer.
          - In OIV 8.0 (final) this issue is fixed. The default xxxViewer methods call the SoGui methods, but the xxxViewer methods can be (usefully) overridden again. So your existing code should work.



          • #6
            I have installed the full version of OIV 8.0 and have investigated the matter once more.

            The overridden ComputeSeekFinalVariables is once again overwritten correctly, and the custom code for our seeks is achieved. A problem I am experiencing is that our one of our custom seek desires is to align to the normal of objects which are clicked on. This is done by holding the 'ctrl' key while clicking a seek point. The problem arises in that the callback fires ComputeSeekVariables on what I would believe is any mouse or keyboard press during a seek. This means that if the user releases 'ctrl' during the seek animation, the custom code is called once more, and realizes that seek is not pressed, and modifies the newCamPosition and newCamOrientation variables for the new case (in this case 'ctrl' not pressed). I would like to be able to start the seek, and then deafen the callback to any new ComputeSeekFinalVariables calls... in my custom code and also in the other viewers which also are called. The only other solution I can think of is to use some sort of flag when the seek is begun, and then a callback to reset this flag when the seek is completed. This way, my custom code ignores subsequent calls (probably from keypresses or mouseclicks after the initial seek), and I can just force the newCamOrientation and newCamPosition to remain consistent until the flag is set back to allow new variables (once the seek is complete). I hope I have been verbose enough in describing this problem.

            Many thanks