Well after reading the documentations it appears that writecolorbuffer is 
obsolete and it is advised that rendertarget should be used to obtain the 
information. This is the solution you just need to substitute the path 
variable with your output. 

    def create_viewport_render(self, path):
        """
        Function that calls the OpenMaya Renderer module to screenshot the 
viewport and save it
        """
        renderer = apiOMR.MRenderer
        tgt_mgm = renderer.getRenderTargetManager()
        texture_mgm = renderer.getTextureManager()

        target = tgt_mgm.acquireRenderTargetFromScreen('MTextureTest')

        target_desc = target.targetDescription()
        target_data = target.rawData()
        # Render Target must be released in order to avoid causing buffer 
issues
        tgt_mgm.releaseRenderTarget(target)

        # Setting parameters of the file to be output.
        texture_desc = apiOMR.MTextureDescription()
        texture_desc.fWidth = target_desc.width()
        texture_desc.fHeight = target_desc.height()
        texture_desc.fDepth = 1
        texture_desc.fBytesPerRow = target_data[1]
        texture_desc.fBytesPerSlice = target_data[2]
        texture_desc.fMipmaps = 1
        texture_desc.fArraySlices = target_desc.arraySliceCount()
        texture_desc.fFormat = target_desc.rasterFormat()
        texture_desc.fTextureType = 2
        texture_desc.fEnvMapType = 0

        texture = texture_mgm.acquireTexture('MTextureTest', texture_desc, 
target_data[0])
        texture_mgm.saveTexture(texture, path)
        # Texture must be release to avoid causing buffer issues.
        texture_mgm.releaseTexture(texture)

On Tuesday, January 20, 2015 at 8:31:06 AM UTC-8, tomp_blue wrote:
>
> I m running into this issue with a pose library also. *cmds.ogs*Render 
> <http://help.autodesk.com/cloudhelp/2015/ENU/Maya-Tech-Docs/CommandsPython/ogsRender.html>
>  
> seems to still work. I had tried getting the QWidget from PySide but this 
> always came out garbled.
>
> TomP
>
> twitter.com/blue_zoo <http://www.twitter.com/blue_zoo> | 
> facebook.com/bluezooanimation | vimeo.com/bluezoo 
> <http://vimeo.com/channels/bluezoo>
>
>
> Blue Zoo Animation   |   385 Euston Road, London NW1 3AU   |   t. 020 7434 
> 4111
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/52bbc7a9-68c6-4a78-8b1a-756e6b53c16d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to