Xpresso, Python, Mouse over object in Viewport


Hi There,
I am exploring possibilities of interaction between mouse/keyboard and xpresso and or python.
The interaction tag is very powerful and gives a huge amount of possibilities.
I also was able to get keyboard hits in python.

What I am looking for right now is a possibility to check if an Object is being hovered over by the mouse in viewport.
Like code that senses if the mouse is over a certain object in the viewport. no matter if it is selected or not.

any Ideas?
Thanks a lot


def onHighlight():

There is the example in the interaction tag.


Hi Kaptain,

thanks for your reply.

with on Highlight I just get a result if I select it. for me this seems to be the “on selected”. Did I miss something?

I would like to get information if a cursor is over the object in the viewport. No matter if I touch or select it and no matter what state it is in.


Yeah - I think you might have missed something. :slight_smile: When you position the curse over an object using the interaction tag this will work. No need to click or select it.

PS - I don’t know python


I am using c4d for such a long time and now I feel silly.
I don’t get Highliting but I can not remember, that I swiched it off?
I tried it with R18, R19 and R20.
I tried most of the buttons in the Tag, different modes with tweaking swiched on and off.

I a quite shure, that there must be a simple answer to it, that mot probably will not let me look good :slight_smile:


Here is a screenshot - hopefully we’re talking about the same thing. You can see it printing to the console.


Thanks for your patience,

we are talking about exactly the same. I just do not get any highlight without klicking. and If I click on the object it unhighlights immediately afterwards. :frowning:

sorry that is the german version of the Program. The dropdown means “always adjust”


btw. I have the component highlight swiched on in the viewport settings, but It doesnt do it :frowning: