ianwaters
Using this is fine for batch rendering (it works)...

 

if (MGlobal::mayaState() == MGlobal::kBatch )

        {

            //do things

        }


However, I want to know if the user is rendering in the viewport (inside Maya). I thought I could use this...

 

if (MRenderUtil::MRenderState() != MRenderUtil::kNotRendering )

        {

            //do things      

        }

 


However MRenderUtil::MRenderState() returns 0 (kNotRendering) whatever state Maya is in...

Am I using it wrong? 
Ian

 

Reply 0 0
pshipkov
Do you think you can use MRenderCallback ?
You can register callbacks that get invoked during software rendering. You can use that to raise flags indicating rendering state or directly run specific parts of your code.
Reply 0 0
ianwaters

Cheers Peter,
I didn't know about that class, it looks like it might do the trick.

I'll give it a go.

Effectively I want a render time multiplier for the number of objects in a MASH network (to keep work light in the viewport).

Thanks again,
Ian

Reply 0 0
ianwaters
Sadly it appears MRenderCallback can only be called after a render, whereas ideally I'd like to call it before a render.
Actually an MSceneMessage might be my friend here... So many ways to do things!

Reply 0 0
Reply