While creating a custom pop-up (via invoke_props_dialog) with two integer values (in this case representing a start frame and stop frame) I find that the "execute()" method (upon clicking the "ok" button) is when values within my class (derived from Operator) actually get a chance to be used. Intermediate changes to those integers (prior to clicking "ok") cannot be accessed.

I am wondering, if I wanted changes to my start frame integer and stop frame integer to always enforce that start frame is less than or equal to stop frame is there a way to do this prior to clicking "ok"? I am wondering by what method I can take an edit to start frame or stop frame which breaks this condition and force the other to a valid state.

Example, someone increasing start frame integer, as it exceeds stop frame, would force stop frame to increase so as to never break requirements...and to be visible prior to clicking the "ok" button. Is there an ability for invoke_props_dialog to name a callback to run upon any change?


1 Answer 1


The props_dialog shows Properties, so you can define set/get functions for them like for any other Property to control changes: https://docs.blender.org/api/2.79/bpy.props.html#get-set-example

Example for your case:

class SomeOperator(Operator):
    bl_idname = "test.some_operator"
    bl_label = "Example"

    def set_start(self, value):
        if value > self["stop_frame"]:
            print("start frame has to be smaller or equal to stop frame")
            self["start_frame"] = self["stop_frame"]
            print("setting start frame")
            self["start_frame"] = value

    def get_start(self):
        return self["start_frame"]

    start_frame = bpy.props.IntProperty(set=set_start, get=get_start)
    stop_frame = bpy.props.IntProperty()


  • You have to define both a setter and a getter (you can't define only a setter, the property will return always 0 if you set no getter).
  • In the setter/getter you should call the operator's properties with self["property_name"], not self.property_name. This way you can get/set the value without calling your own setter/getter functions (which would lead to infinite recursion).
  • $\begingroup$ This looks like what I need. Is there some master API reference which might have told me about set= and get=? I'm looking at link (sorry, not sure how to make that a link, hope this works), and the "parameters" information completely lacks this. I'd like to be able to look up this sort of thing and have not figured out how to do so other than asking other people. $\endgroup$
    – D. Stimits
    Commented Aug 5, 2018 at 20:49
  • $\begingroup$ Properties are used a lot, they are not specific to this dialog. Look at the main page of the Blender API docs and read the "Quickstart", "API Overview" etc. articles: docs.blender.org/api/2.79/contents.html. Details about Properties are described in the article I linked in the answer. $\endgroup$
    – B.Y.O.B.
    Commented Aug 5, 2018 at 22:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .