1
$\begingroup$

I asked a similar - but slightly different - question already some time ago and I found a solution for a custom operator: How to detect if a modifier key is pressed when the value of a custom property is changed?

But now I would like to get the state of the keys of the keyboard while manipulating a custom property. In other words can I create an Event in a set or update function of a property?

def _get_stampInfoUsed(self):
    val = self.get("stampInfoUsed", True)
    # get Event here in some way...
    if event.ctrl:
        print("Ctrl Pressed")

def _set_stampInfoUsed(self, value):
    self["stampInfoUsed"] = value
        
myProp: BoolProperty(
get = _get_stampInfoUsed,
set = _set_stampInfoUsed,
)

Thank you

$\endgroup$
2
  • $\begingroup$ Btw I would also like to add that I am very likely in a non-modal context. $\endgroup$ – Werwack Jun 24 '20 at 8:51
  • $\begingroup$ I found some more clues in the documentation on the "prop" type: docs.blender.org/api/current/… (look at the arguments event and full-event) And this thread provides some lights too but not all the parts of this puzzle: blender.stackexchange.com/questions/71537/… $\endgroup$ – Werwack Jun 26 '20 at 0:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.