View Full Version : API: getting active lead color index
04-27-2006, 11:10 AM
Howdy fellow earthlings,
I would like to know the API equivalent to:
displayColor -q -active lead;
which returns the color index of the leading selected object.
My first guess was M3dView would be a good place to get this,
but i have had no luck so far. I want to use it during my draw method,
so I guess MGlobal::executeCommand would hurt the performance.
Any help appreciated
tia earthling buexe
04-27-2006, 12:42 PM
draw method of what?
MPxLocator::colorRGB() works for everything apart from the last selected object. If it's a locator, then the easiest thing to do is to NOT set a colour, and draw the stuff that you want coloured first. (the current colour should be the one you need).
04-27-2006, 03:41 PM
hi earthling robert,
thanks for your reply. Yes, it is a locator I am drawing.
With the colorRGB I can retrieve some color, but I believe
it is the default locator color (green). When I change the
color for locators in the color preferences window it is still just some green
tone from the index palette. And since it is selected I would expect
white (or whatever the user has set the lead color to) to be returned by
colorRGB ( M3dView::DisplayStatus::kLead). Maybe it is the default color
for the lead object, whetther the user has changed it or not ?
In the docs colorRGB it is described:
This method returns the RGB values of the default draw color for the given display status.
Maybe you have another idea how to get the lead color ?
Thanks anyway and great website you have there!
c ya on the mothership : )
04-27-2006, 03:57 PM
yes, to get the lead colour, DO NOT GET THE LEAD COLOUR!!!
hehe, basically, dont set a colour, just draw something. It will be the colour you desire.... ;)
Therefore, draw the stuff you want in the lead colour first, then draw the other stuff. It will magically work. If you need to draw things the other way around, then use push/pop attrib to reurn you to the previous colour.
04-27-2006, 04:11 PM
Alright, I just thought I`d respect what the user might have set up
in his/her preferences. I`m just getting my feet wet in openGL drawing
( or rather scribbling when you are in my stadium) and if you say so,
I`ll just ignore the user`s desire and follow your philosophy.
cheers and thanks for your help
PS: you don`t mind if I`ll send any beefing user to you, do you? ; )
04-27-2006, 04:20 PM
Ah, I think my little brain slowly understands what you meant.
The reason I want to get/set the color is because I want to use blending
in order to be able to make my locator semi-transparent
glColor4f( colLead.r, colLead.g, colLead.b, alpha );
Is it still a sacrilege to get the lead/active/whatever color?
04-27-2006, 04:51 PM
glColor4f( colour,colour,colour, alpha );
that will respect the users colour preferences.
(oh, and btw, the default colours as returned by colorRGB are the ones set by the user, unfortunately the only colour it doesn't work for is the kLead....)
04-27-2006, 05:07 PM
You are my hero!!! :bowdown:
Thank you very much!
04-27-2006, 05:07 PM
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.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.