6
$\begingroup$

I'm writing an addon to import game models into Blender. But sometimes, there is a mismatch between a bone's name from the animation file and the name from the object file.

So I'd like, when the script encounters an unknown bone, to open a popup with a list of existing bones (plus an option to ignore the bone), that would pause the script until the user has chosen his result, and to get back the chosen option.

I've seen How to call invoke_popup? to create a popup, but I'm stuck on several points :

  • how to call it from my python code

  • how to change its name (label) before calling it (to say for example "bone X not found")

  • how to get the result of the selection

  • how to get the user see and interact with the popup before the end of the script

$\endgroup$
8
$\begingroup$

Yes, Python can make a popup menu.

The options are either...

Both of the links above include examples.


Regarding "How to get the result of the selection", The way Blender works, menu items reference operators. So you would need to define an operator which is referenced from the menu.

| improve this answer | |
$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.