Menu

Scene_preview

Javier Taibo

When previewing the scene in Maya, the script will try to use the camera in the selected Maya viewport as home view. If this camera is exported, osgviewer will be launched with the -c option indicating the camera/viewer configuration.

The problem here is that this camera is set, but after that, the initial position is reset by the camera manipulator that establishes a different "home view".

A quick workaround for this problem is to set the camera position as the home position of the manipulator. We can change osgviewer.cpp code to do that just before setting the camera manipulator.

        if ( arguments.read("--noautohomeview") ) {
            osg::Vec3 eye, center, up;
            viewer.getCamera()->getViewMatrixAsLookAt( eye, center, up );
            keyswitchManipulator->setHomePosition( eye, center, up );
        }
        viewer.setCameraManipulator( keyswitchManipulator.get(), true );

To keep the default behaviour of osgviewer, this code was set under the option

--noautohomeview

. The modified osgviewer.cpp file is included in the

misc

directory. Just compile this modified osgviewer and put it in the PATH and modify the script

maya2osg_preview.mel

to add the

--noautohomeview

option at the end of the osgviewer command line.


Related

Wiki: Maya2OSG_User_Manual

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.