8
$\begingroup$

I would like to amend functionality of an existing operator with a condition check and then "proceed" with the original operator (if condition check allows it).
It is essentially what is done in answer to this question, however I would like to avoid writing the operator's code from scratch (as that answer does in main() ).

I know I can write a new operator and call the original from there but I don't want to add another operator, I want to replace (override) the original one.

So, is there a way to get to the "base" operator's methods from the override operator?

(In that example I managed to get the "OK?" prompt by adding invoke() and calling context.window_manager.popup_menu(). So that sort of solves my initial need, however, some operators are too complex to be rewritten from scratch and the need for calling the "base" operator still stands.)

$\endgroup$
  • $\begingroup$ Writing new operators code from scratch looks like it would work, then call the proceed to another operator in execute. Why don't you want to write a new operator from scratch? Can you do a OOP way and inherit the class from the parent (the operator you want to modify) and then modify/ register your child class from that ? $\endgroup$ – 4nof Jun 25 at 0:16
  • $\begingroup$ Well, as I wrote in the question 4 years ago, some operators are too complex to be rewritten from scratch. Besides it has been so many projects ago that I honestly do not remember the details any more. Thanks for the down-wote, @4nof. $\endgroup$ – spacer Jun 25 at 9:18

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.