# what is the default code for the operator.modal method?

So I'm working on an export script and need to implement some extra data... I want to add the extra data when the file browser is open and remove the data when the browser is closed on cancel or export.

The problem is I don't know how the default modal method works, I want to keep the default code, but extend it with the .append and .clear methods for my added data.

So what is the default code for the modal method?

Well I managed to make something work with the ExportHelper.invoke source...
This is coming from not knowing about the invoke method because the example doesn't provide it let alone explain where to look for more info.

what I did to access the data was simply to use the invoke method and integrate and modify the code from ExportHelper into my class rather than inherit from it.

to supply the needed data, all I did was create a dedicated PropertyGroup initialized in the scene context, and when invoke was called, clear and update the CollectionProperty items with their associated index IntProperty items in the group.

there may be a better method than this, but it works for me:

I did the dialog with this at the end of invoke before returning {'RUNNING_MODAL'}:

context.window_manager.invoke_props_dialog( this, width=900 )


Would be nice if blender's api was documented as well as they claim it to be...

• If you have got something working please add some details as to what you did so that if others have the same issue as you in future, they can use your answer to help them. At the minute, you can't learn much from this answer. – Ray Mairlot Oct 12 '17 at 13:40
• give me some time to actually get internet (I've only been on a phone) and I'll really spice up this answer ;) – Tcll Oct 25 '17 at 14:52
• Still waiting for that expanded answer. – Ray Mairlot Dec 2 '17 at 19:01
• I don't have internet yet... I'm in a debt hole and hoping to be out of it sometime around February... I will try to see if I can write something to transfer to my phone and copy over... but my phone is not very good at handling code. – Tcll Dec 2 '17 at 23:08
• so I didn't add a src (too complex), but I did transfer the writing, I actually transferred the link from my phone first... hope it helps – Tcll Dec 2 '17 at 23:38