3
$\begingroup$

I want to handle some gui updates myself and use

app.handlers.scene_update_post.append(myFunction)

with this code

def myFunction(context):
  if bpy.context.scene.is_updated:
    if myPropertyChanged():
      print(bpy.context.scene.myProperty)

It works flawless, except that I can't detect when I stop dragging a slider value (= mouseUp). The problem is that Blender returns values while dragging an input. While draggin an input x from 0 to 100, Blender returns multiple values like "1,23,24,38,49,99,100". I just want the value when a) the user stops dragging completely or b) the user stops clicking (mouseUp). I the returned values in between 1 and 100 are from Blender guessing wrong that the user stopped dragging. A hacky way would be to measure time and then decide "oh nothing is changing anymore" but that could conflict with a user inputing value very fast with the keyboard.

I don't want to use a modal operator for this. Is there a way of getting a mouseUp-event without a modal operator?

$\endgroup$
  • $\begingroup$ It actually doesn't have to be a mouse up EVENT, it would be enough if I could just check the state of the left mouse button (PRESSED, NOT PRESSED / RELEASED) myself. $\endgroup$ – eserag0n Jan 21 '15 at 10:24
  • $\begingroup$ I think modal operator is the only way to get events, the event.type will tell you LEFT_MOUSE while the event.value will tell you PRESS RELEASE $\endgroup$ – sambler Jan 21 '15 at 15:01

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.