API Xray

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 05 May 2009   #1
API Xray

Is there any way to query whether Xray is on or off using API ?
Ive looked in MCamera, M3dView and MDrawRequest...... nothing ;(
The only reference ive found to xray is in M3DModelView, but im pretty sure this isnt what im looking for.
I have created an MPxHardwareShader which renders solid in Xray mode. Im trying to query whether its on or not and if so set the transparent flag in the shader.

Anyone any ideas ?

T
 
Old 05 May 2009   #2
I'm not sure where or how many times you are going to be calling this but you may be able to use:


MCommandResult myCmd;
MGlobal::executeCommand("modelEditor -q -xray modelPanel", myCmd);
myCmd.getResult()


I know making a lot of these calls will slow down the performance of your plug-in but if its only during initialization I don't think it would be too much of a problem.

HTH,
Josh
 
Old 05 May 2009   #3
Yeah unfortunately I think the only way to go about this is to queue up some MUiMessage::add3dViewPreRenderCallback() and query the xray flag via MEL as JoshM said per panel, per draw. The MEL call isn't that expensive, but it's unfortunate that it needs to be executed per frame/per view.
 
Old 05 May 2009   #4
thanks for the pointers

Thanks for the pointers guys - I was trying to keep away from MEL as this check is in the geometry() section of the shader and if true it will alter the transparency value of the output, but I suppose I could add a boolean into the shaderNode and add a callback that changes this value and keep a check on xray...... maybe

it seems a long way round of doing it as I can get almost every other state from MDrawRequest and M3dView....

anyway - thanks for the help !
T
 
Old 05 May 2009   #5
In order to get the transparency to work properly, I believe you also need to modify the hasTransparency() or transparencyOptions() method as well. While the geometry() method is fine to set the transparency for the shader, the object won't be sorted properly if the hasTransparency() method doesn't let Maya know that it is a transparent object. I'm pretty sure transparencyOptions()/hasTransparency() is invoked prior to the geometry() and the bind() call to determine if the object shaded by your shader needs to be binned as a transparent object.
 
Old 05 May 2009   #6
aaah - okay - well that might actually work in my favour - meaning I call the checks elsewhere, change the isTransparent() and then a refresh when the value changes.


actually on thinking about it - could I not set the object as transparent in the init and change the openGL transparency depending on a "xray on" boolean added to the shader - letting openGL do the work ??

Ill post my results

Thanks again

Last edited by Tranimatronic : 05 May 2009 at 09:09 PM. Reason: afterthought
 
Old 05 May 2009   #7
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 03:39 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.